chenjunkai 6 năm trước cách đây
mục cha
commit
41c7bb264a

+ 18 - 7
Ansjer/test/oss.py

@@ -16,8 +16,9 @@ from oss2.models import *
 import time
 from var_dump import var_dump
 import urllib
+
 ###########
-host = "oss-cn-shenzhen.aliyuncs.com" #just for example
+host = "oss-cn-shenzhen.aliyuncs.com"  # just for example
 accessid = "LTAI5pJxXXklo2ve"
 accesskey = "ngFu11aTJmA0BoYmt8WT7JyyQ2Wmx1"
 bucket_name = "testrtmp"
@@ -25,19 +26,29 @@ channel_name = "test-channel"
 auth = Auth(accessid, accesskey)
 bucket = Bucket(auth, host, bucket_name)
 ######################
-#生成oss签名url
-url = bucket.sign_url('GET', 'test-channel/test.m3u8', 60 * 60,params={'x-oss-process':'hls/sign'})
-url=urllib.parse.unquote(url, encoding='utf-8', errors='replace')
+# 生成oss签名url
+url = bucket.sign_url('GET', 'test-channel/test.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'})
+url = urllib.parse.unquote(url, encoding='utf-8', errors='replace')
 print(url)
 
 exit()
 # 播放m3u8
-m3list = bucket.post_vod_playlist(channel_name=channel_name,playlist_name='test.m3u8',start_time=1537336020119,end_time=1537336029318)
+m3list = bucket.post_vod_playlist(channel_name=channel_name, playlist_name='test.m3u8', start_time=1537336020119,
+                                  end_time=1537336029318)
 
 exit()
 # 获取推流地址
-channel_cfg = LiveChannelInfo(target = LiveChannelInfoTarget())
+channel_cfg = LiveChannelInfo(target=LiveChannelInfoTarget())
 channel = bucket.create_live_channel(channel_name, channel_cfg)
 publish_url = channel.publish_url
 signed_publish_url = bucket.sign_rtmp_url("test-channel", "playlist.m3u8", 3600)
-print(signed_publish_url)
+print(signed_publish_url)
+
+'''
+直播录制转为媒体文件
+https://help.aliyun.com/document_detail/64997.html?spm=a2c4g.11186623.2.11.78274c07rvcHUR
+'''
+
+
+from aliyunsdkcore import client
+# from aliyunsdklive

+ 2 - 2
Controller/DeviceMeal.py

@@ -95,7 +95,7 @@ class DeviceMeal(View):
             if param_flag is True:
                 is_exist = Device_Meal.objects.filter(uid=uid, channel=channel)
                 if is_exist.exists():
-                    return response.json(54)
+                    return response.json(0)
                 else:
                     try:
                         store_meal = Store_Meal.objects.get(id=rank)
@@ -220,7 +220,7 @@ class DeviceMeal(View):
             if own_dev is True:
                 is_exist = Device_Meal.objects.filter(uid=uid, channel=channel)
                 if is_exist.exists():
-                    return response.json(54)
+                    return response.json(0)
                 else:
                     try:
                         store_meal = Store_Meal.objects.get(id=rank)

+ 1 - 1
Controller/EquipmentManager.py

@@ -39,7 +39,7 @@ def addNewUserEquipment(userID, deviceContent, response):
                                                  **deviceData)
                             userDevice.save()
                         else:
-                            return response.json(178)
+                            return response.json(180)
                 else:
                     return response.json(806)
 

+ 2 - 3
Controller/OTAEquipment.py

@@ -220,9 +220,8 @@ def getUpdataFileUrlInterface(request):
     else:
         return response.json(801)
     code = request_dict.get('code', None)
-    http_host = request.META.get('HTTP_HOST', None)
-    if code is not None:
-        # return getUpdataFileUrl(code, http_host, response)
+    # http_host = request.META.get('HTTP_HOST', None)
+    if code:
         equipmentValid = Equipment_Version.objects.filter(code=code, status=1).order_by('-data_joined')
         # 判断是否有版本存在
         if equipmentValid:

+ 1 - 1
Controller/UserController.py

@@ -175,7 +175,7 @@ class registerView(TemplateView):
         if identifyingCode is False:
             identifyingCode = reds.get_data(key=userEmail + '_identifyingCode')
             if identifyingCode is False:
-                return response.json(121)
+                return response.json(120)
             else:
                 username = userEmail
         if authCode != identifyingCode:

+ 40 - 152
Object/ResponseObject.py

@@ -16,42 +16,31 @@ class ResponseObject(object):
             5: 'Please try again one minute later!',
             9: 'User accounts is not exist',
             10: res,
-            13: 'This device does not exist !',
-            14: 'This device does not belong to the user',
-            15: 'You have not opened this service',
+            13: 'Device is not exist !',
+            14: 'Device is not belong to you',
+            15: 'Not own service',
             44: 'System error! Can not send email',
             48: 'System object error!',
-            54: 'Data is already exist!',
-            55: 'Data is not exist!',
             60: 'The app info has already exist',
-            89: 'You have already obtained the verification code, please check it or get it again after 5 minutes.',
-            90: 'If you have too many times to log in, please try it in 10 seconds.',
-            99: ' ERROR Incorrect username or password',
-            101: 'The user account of the mobile phone has already existed!',
-            102: 'The user account of the mobile phone does not exist!',
-            103: 'The mailbox user account has already existed!',
-            104: 'The mailbox user account does not exist!',
-            105: 'The input username is empty!',
+            89: 'Already send the code, please check it or get it again after 5m',
+            101: 'Phone already existed!',
+            102: 'Phone doesn\'t exist!',
+            103: 'Mail already existed!',
+            104: 'Mail doesn\'t exist!',
             106: 'Create User Error',
-            107: 'The username format does not conform to the rules!',
-            108: 'The mailbox format does not conform to the rules! ',
-            109: 'The password format does not conform to the rules!',
-            110: 'Because the user is not activated, the user is an invalid user!',
-            111: 'The password you entered is incorrect!',
-            112: 'Unknown error can not update the password!',
+            107: 'The username not conform to the rules!',
+            109: 'The password not conform to the rules!',
+            110: 'user is not activated',
+            111: 'Error password',
+            112: 'update password error!',
             113: 'This userID does not exist!',
             114: 'Delete user failure error',
             115: 'The userID of the user to delete does not exist!',
-            116: 'Update User information failed',
-            117: 'The userID you provide does not exist!',
             118: 'You do not enter the password two times!',
-            120: 'The verification code has expired, please get the verification code again!',
+            120: 'The code has expired',
             121: 'The verification code is wrong!',
-            122: 'Please get the verification code first!',
-            140: 'Unable to Logout',
             150: 'The superID is None or superID is equal to userID',
             160: 'The All Equipment has been shared by the User!',
-            170: 'A part of the equipment has been shared!',
             171: 'Delete Equipment sharing failed',
             172: 'There is no Equipment for this User!',
             173: 'The UID does not exist!',
@@ -60,104 +49,59 @@ class ResponseObject(object):
             176: 'Delete equipment error',
             177: 'Update equipment error',
             178: 'ADD equipment error',
-            179: 'Device name cannot be repeated',
+            179: 'Device nickname cannot be repeated',
             180: 'UID specification error',
             190: 'The rid does not exist!',
             191: 'The roleName does not exist!',
             192: 'Delete role error',
-            193: 'An unknown error causes the role can not be deleted!',
+            193: 'role can not be deleted!',
             194: 'Update role error',
-            195: 'An unknown error causes the role can not be updated!',
-            196: 'The User already has this role!',
-            197: 'The user failed to add a new role',
-            198: 'The user does not have this role!',
-            199: 'The user can not delete this role',
-            200: 'The role assigns new permissions to failure',
-            201: 'Some of the permissions you have provided do not exist!',
-            202: 'Delete user rights failure',
-            203: 'Delete role permissions fail',
-            204: 'Failure to clear all users Rights',
-            205: 'All permissions to clear the role fail',
-            206: 'Some of the permissions you have provided have already existed!',
-            207: 'Some of the permissions you provide have already existed, and some of the permissions do not exist!',
-            300: 'Unable to get Token!',
-            301: 'Add Token to database error!',
-            302: 'Update Token to database error',
-            303: 'There is a problem in the Token format!',
-            305: 'The Token format is wrong and the related parameter is None!',
-            304: 'The token base64 Decode Error',
-            306: 'The signature in the token is invalid!',
-            307: 'The Token has expired!',
-            308: 'The Refresh Token has expired.',
-            309: 'This token is not valid because there is no token in the database!',
-            310: 'The userID in the token is None!',
-            311: 'The token is None!',
-            312: 'tokenID_id is None!',
-            313: 'If the user landed on someone else, if not, please login and modify the password.',
+            195: 'role can not be updated!',
+            302: 'Please ReLogin! Update Token to database error',
+            307: 'Please ReLogin! The Token has expired!',
+            310: 'Please ReLogin! The userID in the token is None!',
+            311: 'Please ReLogin! The token is None!',
             403: 'API ERROR!',
             404: 'You don not have permission to access this!',
             414: 'Client error ! Please confirm the request path!',
             424: 'Database Error !',
-            444: 'Please confirm the correctness of the parameters!',
+            444: 'Wrong parameters!',
             500: 'Query Database Error:',
             501: 'Update database error!',
-            502: 'In the database, the parameter fields do not exist!',
-            600: 'You do not have permission to query all user information!',
-            601: 'You have no permission to delete user!',
-            602: 'You have no permission to modify the user information!',
-            603: 'The User account does not have permission to do this!',
-            604: 'You do not have permission to query all user equipmnet information!',
-            605: 'You have no permission to upload OTA files!',
-            606: 'The user has not assigned the role!',
-            607: 'The user does not have permission to add a new role!',
-            608: 'You have no rights to assign roles to users!',
-            609: 'You have no authority to delete the user\'s role!',
-            610: 'You have no permissions to query the roles of all users!',
-            611: 'You have no permissions to add a new permission!',
-            612: 'You have no permissions to query the perms of all users!',
-            613: 'You have no permissions to query the permissions of all roles!',
-            614: 'You do not have the authority to delete the user\'s rights!',
-            615: 'The superAdmin(userID) account does not exist!',
-            616: 'The User(userID) account does not exist!',
+            502: 'The fields do not exist!',
+            600: 'Query permission denied!',
+            601: 'Delete permission denied!',
+            602: 'Modify permission denied!',
+            603: 'Permission denied!',
+            604: 'Query permission denied!',
+            605: 'Upload permission denied! ',
+            606: 'User has not assigned role!',
+            607: 'Add permission denied!',
+            611: 'Add permission denied!',
+            612: 'Query permission denied!',
+            615: 'SuperAdmin does not exist!',
+            616: 'User does not exist!',
             800: 'Request KEY is None!',
             801: 'Wrong request KEY!',
-            802: 'The content parameter contains an non - modifiable field!',
-            803: 'The content parameter format is wrong',
-            804: 'One of the parameters of content or sharedAll must be provided!',
-            805: 'One of the parameters of content or unsharedAll must be provided!',
+            802: 'Parameter error!',
+            803: 'Wrong parameter',
+            804: 'Share Error! content or sharedAll must be provided!',
+            805: 'Un share Error! content or unsharedAll must be provided!',
             806: 'The content parameter is incomplete!',
             807: 'The role has already existed!',
             808: 'Add a new role to the wrong',
-            815: 'The permissions have already existed!',
             816: 'Add a new permissions error',
             817: 'The permissions do not exist!',
             818: 'The deletion of the permissions failed',
             700: 'Upload file error',
             701: 'The file does not exist!',
-            702: 'Open the file error',
-            704: 'The Execl file contains n tables!',
-            705: 'The Execl file or TXT file contains some error data!',
-            706: 'The file content format is wrong!',
-            707: 'Other unknown errors',
             900: 'There is no information about this version!',
             901: 'Getting URL failure!',
             902: 'The code does not exist!',
             903: 'The name of the file does not meet the conditions!',
-            904: 'The equipment version information has already existed.',
-            905: 'Add equipment version information failed',
             906: 'Cause of file operation error',
             907: 'The download file does not exist!',
-            908: 'CRC32 Error',
             910: 'There are too many downloads. Please wait a moment...',
-            1000: 'Sorry, the link has expired!',
-            1001: 'The link is wrong!',
-            1002: 'Send mail Fail!',
-            1003: 'The link content format does not conform to the rules!',
-            1004: 'You have applied for reset password operation, please confirm it by mail.',
-            1021: 'Sending SMS verification code error',
-            1022: 'Network error occurs when the authentication code is sent',
-            1023: 'Send phone voice verification code error',
-            10002: 'The user landed else where before, if not, please modify the user account and password!',
         }
         data_cn = {
             0: '成功',
@@ -170,20 +114,14 @@ class ResponseObject(object):
             15: '您尚未打开此服务',
             44: '系统错误!无法发送电子邮件',
             48: '系统对象错误',
-            54: '数据已存在!',
-            55: '数据不存在!',
             60: 'APP信息已经存在',
             89: '您已经获得了验证码,请在5分钟后检查或再次确认。',
-            90: '登录次数过多,请在10秒内尝试。',
-            99: '用户名或密码错误',
             101: '手机的用户账号已经存在!',
             102: '手机的用户账号不存在!',
             103: '邮箱用户帐户已经存在!',
             104: '邮箱用户帐户不存在!',
-            105: '输入用户名为空!',
             106: '创建用户错误',
             107: '用户名格式不符合规则!',
-            108: '邮箱格式不符合规则!',
             109: '密码格式不符合规则!',
             110: '因为用户未激活,用户是无效用户!',
             111: '您输入的密码不正确!',
@@ -191,16 +129,11 @@ class ResponseObject(object):
             113: '此用户标识不存在!',
             114: '删除用户失败错误',
             115: '删除用户的用户名不存在!',
-            116: '更新用户信息失败',
-            117: '您提供的用户标识不存在!',
             118: '你不输入密码两次!',
-            120: '验证码已经过期,请再次获得验证码!',
+            120: '验证码过期',
             121: '验证码错了!',
-            122: '请先拿到验证码!',
-            140: '无法注销',
             150: '超级用户不存在或者用户id错误',
             160: '所有设备已被用户共享!',
-            170: '部分设备已经共享!',
             171: '删除设备共享失败',
             172: '这个用户没有设备!',
             173: '设备UID不存在!',
@@ -217,32 +150,10 @@ class ResponseObject(object):
             193: '未知的错误导致角色不能被删除!',
             194: '更新角色错误',
             195: '未知的错误导致角色无法更新!',
-            196: '该用户已经拥有这个角色!',
-            197: '该用户未能添加新角色。',
-            198: '该用户没有这个角色!',
-            199: '该用户不能删除此角色',
-            200: '为角色分配新权限失败。',
-            201: '您提供的某些权限不存在!',
-            202: '删除用户权限失败',
-            203: '删除角色权限失败',
-            204: '未能清除所有用户权限',
-            205: '清除角色所有的权限失败',
-            206: '您提供的某些权限已经存在!',
-            207: '您提供的某些权限已经存在,并且某些权限不存在!',
-            300: '无法获取令牌!',
-            301: '添加令牌到数据库错误!',
             302: '更新令牌到数据库错误',
-            303: '令牌格式有问题!',
-            305: '令牌格式是错误的,相关参数是不存在的!',
-            304: '令牌Base64解码错误',
-            306: '令牌中的签名无效!',
             307: '令牌已经过期!',
-            308: '刷新令牌已过期。',
-            309: '此令牌无效,因为数据库中没有标记!',
             310: '令牌中的用户名不存在!',
             311: '令牌为空!',
-            312: '令牌id为空!',
-            313: '账号在其它地方进行过登录,如果不是本人操作,请登录并修改密码。',
             403: 'API错误!',
             404: '您没有访问的权限!',
             414: '客户端错误!请确认请求路径!',
@@ -259,13 +170,8 @@ class ResponseObject(object):
             605: '你没有上传OTA文件的权限!',
             606: '用户没有分配角色!',
             607: '用户没有添加新角色的权限!',
-            608: '您无权分配角色给用户!',
-            609: '您没有权限删除用户的角色!',
-            610: '您没有权限查询所有用户的角色!',
             611: '您没有添加新权限的权限!',
             612: '您没有查询所有用户的权限的权限!',
-            613: '您没有权限查询所有角色的权限!',
-            614: '您没有权限删除用户的权限!',
             615: '超级管理员(USEID)帐户不存在!',
             616: '用户(USERID)帐户不存在!',
             800: '请求参数不存在!',
@@ -277,36 +183,18 @@ class ResponseObject(object):
             806: 'content参数不完整!',
             807: '角色已经存在!',
             808: '添加新角色错误',
-            815: '权限已经存在!',
             816: '新增权限错误',
             817: '权限不存在',
             818: '删除权限错误',
             700: '上传文件错误',
             701: '文件不存在',
-            702: '打开文件错误',
-            704: 'Excel文件包含n个表!',
-            705: 'Excel文件或TXT文件包含一些错误数据!',
-            706: '文件内容格式错误!',
-            707: '其他未知错误',
             900: '版本信息不存在',
             901: '获取链接失败',
             902: 'code不存在!',
             903: '文件名不符合条件!',
-            904: '设备版本信息已经存在。',
-            905: '添加设备版本信息失败',
             906: '文件操作错误',
             907: '下载文件不存在!',
-            908: 'CRC32 错误',
             910: '下载太多了。请稍等…',
-            1000: '对不起,链接已经过期!',
-            1001: '链接错误!',
-            1002: '发送邮件失败!',
-            1003: '链接内容格式不符合规则!',
-            1004: '您已申请重置密码操作,请通过邮件确认。',
-            1021: '发送短信验证码错误',
-            1022: '当发送验证码时发生网络错误',
-            1023: '发送电话语音验证码错误',
-            10002: '用户登陆之前的其他地方,如果没有,请修改用户帐号和密码!',
         }
         if self.lang == 'cn':
             msg = data_cn