Commit 22321ebf 22321ebfc1f4c045c4385d8bf3b7219507fcdcc8 by yangsheng

修改

1 parent beadfd91
......@@ -505,6 +505,7 @@ def OnlineSave(request):
return JsonResponse(ResponseFactory(code=200, message="音频合成中,合成后会自动保存", data=data, status='success'))
except Exception as e:
logger.info('提交异常:用户ID:{},参数:{},错误信息:{}'.format(user['id'], request.body,e))
return JsonResponse(ResponseFactory(code=500, message="报错:{}".format(e), data=None, status='fail'))
else:
return JsonResponse(ResponseFactory(code=400, message="不支持的请求方法", data=None, status='fail'))
......
......@@ -218,8 +218,8 @@ class ChangeAudio():
sound.export(self.outPath+self.type+str(step) + '.mp3', format="mp3")
def WeChatApi(code):
appid = "wx0f3844b1458ccfb9"
secret = "f9fa09c6cf3b4db19906d876d9c64755"
appid = "wxe6f4c10fb1ec9c2d"
secret = "5381cf3979fc1ccc408c3ee2a999e25c"
parmas = {
'appid': appid,
'secret': secret,
......@@ -268,23 +268,24 @@ def GetWxToken():
def pushSubscribeMessage(data):
channel = data['channel']
open_ids = data['open_id']
if settings.ENV == 'pro':
url = 'https://hi-sing-admin.hikoon.com/api/provider/wechat/pushSubscribeMessage'
else:
url = 'https://hi-sing-admin-dev.hikoon.com/api/provider/wechat/pushSubscribeMessage'
md5_str = channel + ''.join(open_ids) + 'tb0iwb7TE9TIbkG8iFsxldrHJRFdeP1g'
hl = hashlib.md5()
hl.update(md5_str.encode(encoding='utf8'))
secret = hl.hexdigest()
data = {
'secret': secret,
'channel': channel,
'open_ids': open_ids,
'data': data['data']
}
requests.post(url,json=data).json()
pass
# channel = data['channel']
# open_ids = data['open_id']
# if settings.ENV == 'pro':
# url = 'https://hi-sing-admin.hikoon.com/api/provider/wechat/pushSubscribeMessage'
# else:
# url = 'https://hi-sing-admin-dev.hikoon.com/api/provider/wechat/pushSubscribeMessage'
# md5_str = channel + ''.join(open_ids) + 'tb0iwb7TE9TIbkG8iFsxldrHJRFdeP1g'
# hl = hashlib.md5()
# hl.update(md5_str.encode(encoding='utf8'))
# secret = hl.hexdigest()
# data = {
# 'secret': secret,
# 'channel': channel,
# 'open_ids': open_ids,
# 'data': data['data']
# }
# requests.post(url,json=data).json()
def createMessage(data):
message_list = []
......@@ -409,28 +410,30 @@ class JPush():
return payload
def jpush_v3(self, data):
payload = self.push_params_v3(title=data['title'],content=data['content'],content_type=data['content_type'],receiver_value=data['receiver_value'],extras=data['extras'])
body = json.dumps(payload)
return self.https_request(body, "https://api.jpush.cn/v3/push", 'application/json', version=1)
pass
# payload = self.push_params_v3(title=data['title'],content=data['content'],content_type=data['content_type'],receiver_value=data['receiver_value'],extras=data['extras'])
# body = json.dumps(payload)
# return self.https_request(body, "https://api.jpush.cn/v3/push", 'application/json', version=1)
#
def Msg_Push_Server(data):
secret = settings.YJ_SECRET
p = '{channel}&{data}&{secret}&{time}'.format(channel=data['channel'],data=data['data'],secret=secret,time=data['time']).encode()
p = base64.b64encode(p)
hl = hashlib.md5()
hl.update(p)
sign = hl.hexdigest()
data['sign'] = sign
data['data'] = json.loads(data['data'])
logger.info("推送参数:{}".format(str(data)))
if settings.ENV == 'pro':
url = 'https://hi-sing-admin.hikoon.com/api/provider'
else:
url = 'https://hi-sing-admin-dev.hikoon.com/api/provider'
resp = requests.post(url,json=data).text
logger.info("推送结果:{}".format(str(resp)))
pass
# secret = settings.YJ_SECRET
# p = '{channel}&{data}&{secret}&{time}'.format(channel=data['channel'],data=data['data'],secret=secret,time=data['time']).encode()
# p = base64.b64encode(p)
# hl = hashlib.md5()
# hl.update(p)
# sign = hl.hexdigest()
# data['sign'] = sign
# data['data'] = json.loads(data['data'])
# logger.info("推送参数:{}".format(str(data)))
# if settings.ENV == 'pro':
# url = 'https://hi-sing-admin.hikoon.com/api/provider'
# else:
# url = 'https://hi-sing-admin-dev.hikoon.com/api/provider'
# resp = requests.post(url,json=data).text
# logger.info("推送结果:{}".format(str(resp)))
def remove_alias_device(alias):
try:
......
......@@ -2,13 +2,12 @@ aliyun-python-sdk-core==2.13.35
aliyun-python-sdk-kms==2.15.0
django==3.2.12
django-redis-cache==3.0.1
django-rest-jwt==0.1.46
django-rest-jwt
djangorestframework==3.13.1
djangorestframework-jwt==1.11.0
gevent==21.1.2
gevent
mysql-connector-python==8.0.18
oss2==2.14.0
PyJWT==2.7.0
PyJWT==2.0.0
PyMySQL==0.10.1
redis==3.5.3
requests==2.25.0
......@@ -18,7 +17,7 @@ pydub==0.25.1
pyroomacoustics==0.7.3
eyed3==0.9.6
jieba==0.42.1
twilio==8.2.0
twilio
django_redis
matplotlib
schedule
......