Browse Source

no message

libushang 2 days ago
parent
commit
4e40113102
1 changed files with 28 additions and 13 deletions
  1. 28 13
      routers/api/qrcode/__init__.py

+ 28 - 13
routers/api/qrcode/__init__.py

@@ -120,28 +120,42 @@ async def get_qrcode2(
     errcode = int(result['errcode'])
     if errcode == 0:
         data = result['data']
-        depts = data['depts']
-        dept_name = ''
-        if len(depts) > 0:
 
-            phone = ''    
-            try:
-                # 敏感数据加密算法(DES 对称加密)
-                phone = YzyApi.desDecryptValue(settings.YZY_CORPSECRET, data['mobile'])
-            except:
-                traceback.print_exc()
+        dept_list = []
 
-            dept_name = depts[0]['deptname']
-            duties = depts[0]['position']
+        for unit in data['units']:
+            unitid = unit['unitid']
+
+            new_dept = {
+                "dept": unit['unitname'],
+                "position": ""
+            }
+            for dept in data['depts']:
+                unitidpath = dept['unitidpath']
+                if unitidpath.find(unitid) != -1:
+                    new_dept['position'] = dept['position']
+
+            dept_list.append(new_dept)
+
+        phone = ''    
+        try:
+            # 敏感数据加密算法(DES 对称加密)
+            phone = YzyApi.desDecryptValue(settings.YZY_CORPSECRET, data['mobile'])
+        except:
+            traceback.print_exc()
+
+        dept_name = dept_list[0]['dept'] if len(dept_list) > 0 else ''
+        duties = dept_list[0]['position'] if len(dept_list) > 0 else ''
 
         redis_val = {
             "event_id": event_id,
             "user_id": data['userid'],
             "nick_name": data['username'],
-            "dept_name": dept_name,
             "phone": phone,
+            "dept_name": dept_name,
             "duties": duties,
-            "sign_time": ''
+            "sign_time": '',
+            "dept_list": dept_list
         }
     redis_set_json(f"yzy_user_{uuid_str}", redis_val, 60)
     redirect_url = f"/yjxp/#/signPage?event_id={event_id}&uuid={uuid_str}" # 业务页面
@@ -158,6 +172,7 @@ async def yzy_user_info(
 ):
     redis_val = redis_get_json(f"yzy_user_{uuid}")
     if redis_val is not None:
+        logger.info(redis_val)
         return {
             "code": 0,
             "msg": "",