Commit 22321ebf 22321ebfc1f4c045c4385d8bf3b7219507fcdcc8 by yangsheng

修改

1 parent beadfd91
...@@ -505,6 +505,7 @@ def OnlineSave(request): ...@@ -505,6 +505,7 @@ def OnlineSave(request):
505 return JsonResponse(ResponseFactory(code=200, message="音频合成中,合成后会自动保存", data=data, status='success')) 505 return JsonResponse(ResponseFactory(code=200, message="音频合成中,合成后会自动保存", data=data, status='success'))
506 except Exception as e: 506 except Exception as e:
507 logger.info('提交异常:用户ID:{},参数:{},错误信息:{}'.format(user['id'], request.body,e)) 507 logger.info('提交异常:用户ID:{},参数:{},错误信息:{}'.format(user['id'], request.body,e))
508 return JsonResponse(ResponseFactory(code=500, message="报错:{}".format(e), data=None, status='fail'))
508 else: 509 else:
509 return JsonResponse(ResponseFactory(code=400, message="不支持的请求方法", data=None, status='fail')) 510 return JsonResponse(ResponseFactory(code=400, message="不支持的请求方法", data=None, status='fail'))
510 511
......
...@@ -218,8 +218,8 @@ class ChangeAudio(): ...@@ -218,8 +218,8 @@ class ChangeAudio():
218 sound.export(self.outPath+self.type+str(step) + '.mp3', format="mp3") 218 sound.export(self.outPath+self.type+str(step) + '.mp3', format="mp3")
219 219
220 def WeChatApi(code): 220 def WeChatApi(code):
221 appid = "wx0f3844b1458ccfb9" 221 appid = "wxe6f4c10fb1ec9c2d"
222 secret = "f9fa09c6cf3b4db19906d876d9c64755" 222 secret = "5381cf3979fc1ccc408c3ee2a999e25c"
223 parmas = { 223 parmas = {
224 'appid': appid, 224 'appid': appid,
225 'secret': secret, 225 'secret': secret,
...@@ -268,23 +268,24 @@ def GetWxToken(): ...@@ -268,23 +268,24 @@ def GetWxToken():
268 268
269 269
270 def pushSubscribeMessage(data): 270 def pushSubscribeMessage(data):
271 channel = data['channel'] 271 pass
272 open_ids = data['open_id'] 272 # channel = data['channel']
273 if settings.ENV == 'pro': 273 # open_ids = data['open_id']
274 url = 'https://hi-sing-admin.hikoon.com/api/provider/wechat/pushSubscribeMessage' 274 # if settings.ENV == 'pro':
275 else: 275 # url = 'https://hi-sing-admin.hikoon.com/api/provider/wechat/pushSubscribeMessage'
276 url = 'https://hi-sing-admin-dev.hikoon.com/api/provider/wechat/pushSubscribeMessage' 276 # else:
277 md5_str = channel + ''.join(open_ids) + 'tb0iwb7TE9TIbkG8iFsxldrHJRFdeP1g' 277 # url = 'https://hi-sing-admin-dev.hikoon.com/api/provider/wechat/pushSubscribeMessage'
278 hl = hashlib.md5() 278 # md5_str = channel + ''.join(open_ids) + 'tb0iwb7TE9TIbkG8iFsxldrHJRFdeP1g'
279 hl.update(md5_str.encode(encoding='utf8')) 279 # hl = hashlib.md5()
280 secret = hl.hexdigest() 280 # hl.update(md5_str.encode(encoding='utf8'))
281 data = { 281 # secret = hl.hexdigest()
282 'secret': secret, 282 # data = {
283 'channel': channel, 283 # 'secret': secret,
284 'open_ids': open_ids, 284 # 'channel': channel,
285 'data': data['data'] 285 # 'open_ids': open_ids,
286 } 286 # 'data': data['data']
287 requests.post(url,json=data).json() 287 # }
288 # requests.post(url,json=data).json()
288 289
289 def createMessage(data): 290 def createMessage(data):
290 message_list = [] 291 message_list = []
...@@ -409,28 +410,30 @@ class JPush(): ...@@ -409,28 +410,30 @@ class JPush():
409 return payload 410 return payload
410 411
411 def jpush_v3(self, data): 412 def jpush_v3(self, data):
412 payload = self.push_params_v3(title=data['title'],content=data['content'],content_type=data['content_type'],receiver_value=data['receiver_value'],extras=data['extras']) 413 pass
413 body = json.dumps(payload) 414 # payload = self.push_params_v3(title=data['title'],content=data['content'],content_type=data['content_type'],receiver_value=data['receiver_value'],extras=data['extras'])
414 return self.https_request(body, "https://api.jpush.cn/v3/push", 'application/json', version=1) 415 # body = json.dumps(payload)
415 416 # return self.https_request(body, "https://api.jpush.cn/v3/push", 'application/json', version=1)
417 #
416 418
417 419
418 def Msg_Push_Server(data): 420 def Msg_Push_Server(data):
419 secret = settings.YJ_SECRET 421 pass
420 p = '{channel}&{data}&{secret}&{time}'.format(channel=data['channel'],data=data['data'],secret=secret,time=data['time']).encode() 422 # secret = settings.YJ_SECRET
421 p = base64.b64encode(p) 423 # p = '{channel}&{data}&{secret}&{time}'.format(channel=data['channel'],data=data['data'],secret=secret,time=data['time']).encode()
422 hl = hashlib.md5() 424 # p = base64.b64encode(p)
423 hl.update(p) 425 # hl = hashlib.md5()
424 sign = hl.hexdigest() 426 # hl.update(p)
425 data['sign'] = sign 427 # sign = hl.hexdigest()
426 data['data'] = json.loads(data['data']) 428 # data['sign'] = sign
427 logger.info("推送参数:{}".format(str(data))) 429 # data['data'] = json.loads(data['data'])
428 if settings.ENV == 'pro': 430 # logger.info("推送参数:{}".format(str(data)))
429 url = 'https://hi-sing-admin.hikoon.com/api/provider' 431 # if settings.ENV == 'pro':
430 else: 432 # url = 'https://hi-sing-admin.hikoon.com/api/provider'
431 url = 'https://hi-sing-admin-dev.hikoon.com/api/provider' 433 # else:
432 resp = requests.post(url,json=data).text 434 # url = 'https://hi-sing-admin-dev.hikoon.com/api/provider'
433 logger.info("推送结果:{}".format(str(resp))) 435 # resp = requests.post(url,json=data).text
436 # logger.info("推送结果:{}".format(str(resp)))
434 437
435 def remove_alias_device(alias): 438 def remove_alias_device(alias):
436 try: 439 try:
......
...@@ -2,13 +2,12 @@ aliyun-python-sdk-core==2.13.35 ...@@ -2,13 +2,12 @@ aliyun-python-sdk-core==2.13.35
2 aliyun-python-sdk-kms==2.15.0 2 aliyun-python-sdk-kms==2.15.0
3 django==3.2.12 3 django==3.2.12
4 django-redis-cache==3.0.1 4 django-redis-cache==3.0.1
5 django-rest-jwt==0.1.46 5 django-rest-jwt
6 djangorestframework==3.13.1 6 djangorestframework==3.13.1
7 djangorestframework-jwt==1.11.0 7 gevent
8 gevent==21.1.2
9 mysql-connector-python==8.0.18 8 mysql-connector-python==8.0.18
10 oss2==2.14.0 9 oss2==2.14.0
11 PyJWT==2.7.0 10 PyJWT==2.0.0
12 PyMySQL==0.10.1 11 PyMySQL==0.10.1
13 redis==3.5.3 12 redis==3.5.3
14 requests==2.25.0 13 requests==2.25.0
...@@ -18,7 +17,7 @@ pydub==0.25.1 ...@@ -18,7 +17,7 @@ pydub==0.25.1
18 pyroomacoustics==0.7.3 17 pyroomacoustics==0.7.3
19 eyed3==0.9.6 18 eyed3==0.9.6
20 jieba==0.42.1 19 jieba==0.42.1
21 twilio==8.2.0 20 twilio
22 django_redis 21 django_redis
23 matplotlib 22 matplotlib
24 schedule 23 schedule
......