Browse Source

Merge branch 'pzb' of ssh://192.168.136.45:10022/SERVER/AnsjerServer into pzb

chenjunkai 6 năm trước cách đây
mục cha
commit
0b4c3817a3
3 tập tin đã thay đổi với 14 bổ sung3 xóa
  1. 11 2
      Controller/EquipmentInfo.py
  2. 1 0
      Controller/MealManage.py
  3. 2 1
      Object/UrlTokenObject.py

+ 11 - 2
Controller/EquipmentInfo.py

@@ -196,15 +196,18 @@ class EquipmentInfo(View):
         page = int(request_dict.get('page', None))
         line = int(request_dict.get('line', None))
         username = request_dict.get('username', None)
+        uid = request_dict.get('uid', None)
+        devNickName = request_dict.get('devNickName', None)
+        Channel = request_dict.get('Channel', None)
         if not page or not line:
             return response.json(444, 'page,line')
         check_perm = ModelService.check_perm(userID=userID, permID=30)
         if not check_perm:
             return response.json(404)
 
-        if not username:
+        if not username and not uid and not devNickName and not Channel:
             qs = Equipment_Info.objects.all().order_by('-id')
-        else:
+        elif username:
             user = Device_User.objects.filter(username=username)
             users = CommonService.qs_to_dict(user)
             # 从字典类型中找到对应的pk值,即是userID
@@ -216,6 +219,12 @@ class EquipmentInfo(View):
             if not len(uid_list):
                 return response.json(0, {'datas': [], 'count': 0})
             qs = Equipment_Info.objects.filter(userID_id=user_id).order_by('-id')
+        elif uid:
+            qs = Equipment_Info.objects.filter(devUid=uid).order_by('-id')
+        elif devNickName :
+            qs = Equipment_Info.objects.filter(devNickName=devNickName).order_by('-id')
+        elif Channel:
+            qs = Equipment_Info.objects.filter(Channel=Channel).order_by('-id')
         if not qs.exists():
             return response.json(0, {'datas': [], 'count': 0})
         count = qs.count()

+ 1 - 0
Controller/MealManage.py

@@ -110,6 +110,7 @@ class MealManage(View):
                     'update_time': str(store_meal.update_time)})
 
     def query(self, request_dict, response):
+
         page = int(request_dict.get('page', None))
         line = int(request_dict.get('line', None))
         if page is None or line is None:

+ 2 - 1
Object/UrlTokenObject.py

@@ -40,7 +40,8 @@ class UrlTokenObject:
     def generate(self, data={}):
         now_stamp = int(time.time())
         # print (now_stamp)
-        data['exp'] = 300 + now_stamp
+        # 过期时间为两天
+        data['exp'] = 172800 + now_stamp
         token = jwt.encode(data, '12345', algorithm='HS256').decode('utf-8')
         self.token=token
         return token