Explorar o código

增加userIconUrl

chenjunkai %!s(int64=6) %!d(string=hai) anos
pai
achega
a01842101c
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      Controller/DeviceShare.py

+ 7 - 1
Controller/DeviceShare.py

@@ -161,7 +161,8 @@ class DeviceShareView(View):
         if UID is not None:
             # 查询分享获得的用户
             qs = Device_Info.objects.filter(UID=UID, isShare=True, primaryUserID=userID, isExist=1). \
-                values('userID__NickName', 'userID__username', 'userID__userEmail', 'userID__phone', 'id')
+                values('userID__NickName', 'userID__username', 'userID__userEmail', 'userID__phone', 'id',
+                       'userID__userIconPath')
             data = []
             # print(qs)
             for q in qs:
@@ -174,6 +175,11 @@ class DeviceShareView(View):
                     d['user'] = q['userID__userEmail']
                 elif q['userID__phone']:
                     d['user'] = q['userID__phone']
+                userIconPath = q['userID__userIconPath']
+                if userIconPath:
+                    if userIconPath.find('static/') != -1:
+                        userIconPath = userIconPath.replace('static/', '').replace('\\', '/')
+                        d['userIconUrl'] = SERVER_DOMAIN + 'account/getAvatar/' + userIconPath
                 data.append(d)
             return response.json(0, data)
         else: