|  | @@ -21,7 +21,7 @@ from django.views import View
 | 
	
		
			
				|  |  |  from Service.CommonService import CommonService
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -class AppAccoutView(View):
 | 
	
		
			
				|  |  | +class SuperPasswordView(View):
 | 
	
		
			
				|  |  |      def get(self, request, *args, **kwargs):
 | 
	
		
			
				|  |  |          request.encoding = 'utf-8'
 | 
	
		
			
				|  |  |          operation = kwargs.get('operation')
 | 
	
	
		
			
				|  | @@ -39,11 +39,11 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |          lang = request_dict.get('lang', token.lang)
 | 
	
		
			
				|  |  |          response = ResponseObject(lang)
 | 
	
		
			
				|  |  |          userID = token.userID
 | 
	
		
			
				|  |  | -        if operation == 'getAuthorizationCode':  # 获取用户请求/生成授权码
 | 
	
		
			
				|  |  | +        if operation == 'getAuthorizationCode':  # 用户提交请求
 | 
	
		
			
				|  |  |              return self.getAuthorizationCode(request_dict, response, userID)
 | 
	
		
			
				|  |  | -        if operation == 'customerServiceManagement':  # 编辑超级密码请求表
 | 
	
		
			
				|  |  | +        if operation == 'customerServiceManagement':  # 审核用户请求/生成超级密码
 | 
	
		
			
				|  |  |              return self.customerServiceManagement(request_dict, response)
 | 
	
		
			
				|  |  | -        if operation == 'getDeviceSuperPassword':  # 查询超级密码请求表
 | 
	
		
			
				|  |  | +        if operation == 'getDeviceSuperPassword':  # 查询用户请求表
 | 
	
		
			
				|  |  |              return self.getDeviceSuperPassword(request_dict, response)
 | 
	
		
			
				|  |  |          if operation == 'verifyTheVerificationCode':  # 检验验证码
 | 
	
		
			
				|  |  |              return self.verifyTheVerificationCode(request_dict, response, userID)
 | 
	
	
		
			
				|  | @@ -54,6 +54,7 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def getAuthorizationCode(self, request_dict, response, userID):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | +        用户提交请求
 | 
	
		
			
				|  |  |          @param uid:设备id
 | 
	
		
			
				|  |  |          @param request_dict:请求参数
 | 
	
		
			
				|  |  |          @param response:响应对象
 | 
	
	
		
			
				|  | @@ -83,11 +84,6 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |              DeviceSuperPassword.objects.create(uid=uid, orderID=orderID, describe=describe,
 | 
	
		
			
				|  |  |                                                 purchase_channel=purchase_channel, addTime=addTime, userID_id=userID,
 | 
	
		
			
				|  |  |                                                 buyTime=buyTime, status=0, lang=lang)
 | 
	
		
			
				|  |  | -            # 验证码生成
 | 
	
		
			
				|  |  | -            super_code = RandomStr(6, True)
 | 
	
		
			
				|  |  | -            super_password_id = "super_password_%s" % userID
 | 
	
		
			
				|  |  | -            redisObj = RedisObject()
 | 
	
		
			
				|  |  | -            redisObj.set_data(key=super_password_id, val=super_code, expire=86400)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              return response.json(0)
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
	
		
			
				|  | @@ -96,6 +92,7 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def customerServiceManagement(self, request_dict, response):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | +        审核用户请求/生成超级密码
 | 
	
		
			
				|  |  |          @param request_dict:请求参数
 | 
	
		
			
				|  |  |          @param response:响应对象
 | 
	
		
			
				|  |  |          @param hint:提示内容
 | 
	
	
		
			
				|  | @@ -117,27 +114,24 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |                  status = int(status)
 | 
	
		
			
				|  |  |                  authcode = ''
 | 
	
		
			
				|  |  |                  if status == 1:
 | 
	
		
			
				|  |  | -                    device_super_password_qs.update(status=status)
 | 
	
		
			
				|  |  | -                    super_password_id = 'super_password_' + userID
 | 
	
		
			
				|  |  | +                    # 验证码生成
 | 
	
		
			
				|  |  | +                    super_code = RandomStr(6, True)
 | 
	
		
			
				|  |  | +                    super_password_id = "super_password_%s" % userID
 | 
	
		
			
				|  |  |                      redisObj = RedisObject()
 | 
	
		
			
				|  |  | -                    # redis里面的验证码
 | 
	
		
			
				|  |  | -                    redis_super_code = redisObj.get_data(key=super_password_id)
 | 
	
		
			
				|  |  | -                    # 验证用户输入的验证码和redis中的验证码
 | 
	
		
			
				|  |  | -                    if redis_super_code is False:
 | 
	
		
			
				|  |  | -                        return response.json(120)
 | 
	
		
			
				|  |  | -                    authcode = CommonService.encode_data(redis_super_code)
 | 
	
		
			
				|  |  | -                if status == 0 and len(hint) > 1:
 | 
	
		
			
				|  |  | -                    device_super_password_qs.update(status=status, hint=hint)
 | 
	
		
			
				|  |  | -                    msg = hint
 | 
	
		
			
				|  |  | +                    redis = redisObj.set_data(key=super_password_id, val=super_code, expire=86400)
 | 
	
		
			
				|  |  | +                    if redis is False:
 | 
	
		
			
				|  |  | +                        return response.json(121)
 | 
	
		
			
				|  |  | +                    device_super_password_qs.update(status=status)
 | 
	
		
			
				|  |  | +                    if lang == 'en':
 | 
	
		
			
				|  |  | +                        msg = "Your authorization code is " + super_code + ",valid within 24 hours"
 | 
	
		
			
				|  |  | +                    else:
 | 
	
		
			
				|  |  | +                        msg = "您的授权代码:" + super_code + ",24小时内有效"
 | 
	
		
			
				|  |  |                      SysMsgModel.objects.create(userID_id=userID, msg=msg, addTime=now, updTime=now, uid=uid,
 | 
	
		
			
				|  |  |                                                 eventType=2)
 | 
	
		
			
				|  |  |                      return response.json(0)
 | 
	
		
			
				|  |  | -                authcode = CommonService.decode_data(authcode)
 | 
	
		
			
				|  |  | -                if status == 1:
 | 
	
		
			
				|  |  | -                    if lang == 'en':
 | 
	
		
			
				|  |  | -                        msg = "Your authorization code is " + authcode + ",valid within 24 hours"
 | 
	
		
			
				|  |  | -                    else:
 | 
	
		
			
				|  |  | -                        msg = "您的授权代码:" + authcode + ",24小时内有效"
 | 
	
		
			
				|  |  | +                if status == 0 and len(hint) > 1:
 | 
	
		
			
				|  |  | +                    device_super_password_qs.update(status=status, hint=hint)
 | 
	
		
			
				|  |  | +                    msg = hint
 | 
	
		
			
				|  |  |                      SysMsgModel.objects.create(userID_id=userID, msg=msg, addTime=now, updTime=now, uid=uid,
 | 
	
		
			
				|  |  |                                                 eventType=2)
 | 
	
		
			
				|  |  |                      return response.json(0)
 | 
	
	
		
			
				|  | @@ -148,6 +142,7 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def getDeviceSuperPassword(self, request_dict, response):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | +        查询用户请求表
 | 
	
		
			
				|  |  |          @param request_dict:请求参数
 | 
	
		
			
				|  |  |          @param response:响应对象
 | 
	
		
			
				|  |  |          @return:
 | 
	
	
		
			
				|  | @@ -192,6 +187,7 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def verifyTheVerificationCode(self, request_dict, response, userID):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | +        检验验证码
 | 
	
		
			
				|  |  |          @param request_dict:请求参数
 | 
	
		
			
				|  |  |          @param response:响应对象
 | 
	
		
			
				|  |  |          @param userID:用户ID
 | 
	
	
		
			
				|  | @@ -215,6 +211,7 @@ class AppAccoutView(View):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def deleteInformation(self, request_dict, response):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | +        删除信息
 | 
	
		
			
				|  |  |          @param request_dict:请求参数
 | 
	
		
			
				|  |  |          @param response:响应对象
 | 
	
		
			
				|  |  |          @param id:主键
 |