xjc hace 4 meses
padre
commit
0ab21295a0
Se han modificado 4 ficheros con 7 adiciones y 3 borrados
  1. 1 1
      src/manage/controls.py
  2. 3 1
      src/utils/plottool.py
  3. 2 1
      src/weixin/control_auth.py
  4. 1 0
      src/weixin/controls.py

+ 1 - 1
src/manage/controls.py

@@ -1408,7 +1408,7 @@ def download_top3_imgs(request):
         imgList = imgInfo["imgList"]
         for i,url in enumerate(imgList):
             tmpFile = "/tmp/%s-%s%s" % (imgName,i+1,os.path.splitext(url)[-1])
-            res = requests.get(url)
+            res = requests.get(url+'?x-oss-process=image/resize,w_800,m_lfit')
             if res.status_code == 200:
                 with open(tmpFile,"wb+") as f:
                     f.write(res.content)

+ 3 - 1
src/utils/plottool.py

@@ -106,6 +106,7 @@ def plot_records(data, col_headers, title, prefix):
     files = []
     start = 0
     step = 120
+    i = 1
     while True:
     	if start==0 and ('百万组' in title or '十万组' in title or '菜鸟组' in title ):
     		step = 10
@@ -114,7 +115,7 @@ def plot_records(data, col_headers, title, prefix):
     		
         part = data[start: start + step]
         part_nrows = len(part)
-        filename = u'/tmp/{}-{}.png'.format(title.split('-')[1], start)
+        filename = u'/tmp/{}{}.png'.format(title.split('-')[1][:3], i)
 
         if start == 0:
             png_bytes = plot_records_as_table_and_convert_to_png(
@@ -135,6 +136,7 @@ def plot_records(data, col_headers, title, prefix):
         #ret.append({'filename': filename, 'image_url': image_url})
 
         start += step
+        i = i+1
         if start >= nrows:
             break
     zpfile = get_zipfile(files)

+ 2 - 1
src/weixin/control_auth.py

@@ -108,10 +108,11 @@ def login_user_v3(request):
     phone = info.get('phone','')
     phcode = info.get('phcode')
     unionid = info.get('unionid','')
+    logintype = info.get("logintype","xcx")
 
     agent = request.META.get("HTTP_USER_AGENT")
     xcxflag = False
-    if agent and ("wechatdevtools" in agent or "MiniProgram" in agent):
+    if agent and ("wechatdevtools" in agent or "MiniProgram" in agent) or logintype == "xcx":
         xcxflag = True
 
     #if not openid and not unionid:

+ 1 - 0
src/weixin/controls.py

@@ -2933,6 +2933,7 @@ def get_article_info(**kwargs):
     _id = kwargs.get("id")
     rst = cm.Article.objects.filter(id=_id).values().first()
     rst["url"] = "https://api.hunanwanzhu.com/topic/share/article.html?id="+str(_id)
+    rst["web"] = "https://test.hunanwanzhu.com/topic/share/articleweb.html?id="+str(_id)
     return rst