This commit is contained in:
doudou201703
2026-08-06 20:39:45 +08:00
parent 046fac6dc1
commit 3ff0faebb9
38 changed files with 1029 additions and 611 deletions
+10 -10
View File
@@ -58,7 +58,7 @@ class sixmini(ViewSet):
开发者也可使用云函数或微信云托管免鉴权接收消息推送,立即开通 认证
https://mp.weixin.qq.com/wxamp/devprofile/get_profile?token=2052988734&lang=zh_CN
"""
def sendCustomMessage(self, FromUserName: str, post_data_type):
""""""
# 回复消息的请求
@@ -102,7 +102,7 @@ class sixmini(ViewSet):
url=uri, params={"access_token": mini_token},
data=orjson.dumps(post_data_text).decode("utf-8"),
)
def uploadTempMedia(self, request: WSGIRequest | Request, *args, **kwargs):
"""
@@ -120,7 +120,7 @@ class sixmini(ViewSet):
file = {"media": open(file=file_path, mode="rb", )}
result_data = post(url=uri, params={"access_token": wecom_token, "type": "image", }, files=file)
print(result_data.json())
def 消息加密方法(self, msg: str, appid: str, encoding_aes_key: str, token: str, timestamp: str,
nonce: str, ) -> dict:
""""""
@@ -146,7 +146,7 @@ class sixmini(ViewSet):
signature_str = "".join(params)
msg_signature = hashlib.sha1(signature_str.encode("utf-8")).hexdigest()
return {"Encrypt": encrypt, "MsgSignature": msg_signature, "TimeStamp": timestamp, "Nonce": nonce, }
def 消息解密(self, encrypt: str):
"""
知识点: 微信请求发送过来的 encrypt 是 b64encode编码后的数据, 是由 iv + 编码数据 组成的
@@ -175,12 +175,12 @@ class sixmini(ViewSet):
return orjson.loads(xml_content)
except Exception as e:
raise ValueError("Decryption failed: " + str(e))
def 更新物流信息(self, data):
WayBillId = jmespath.search(data=data, expression="WayBillId")
OrderId = jmespath.search(data=data, expression="OrderId")
ems邮政物流工具().更新物流快递数据(order物流公司订单编号=WayBillId, order物流订单号=OrderId)
ems邮政物流工具().更新物流快递数据(order物流公司订单编号=WayBillId, )
def 确认收货(self, data):
print("确认订单请求接口进来了", data)
确认收货的方法 = pydash.get(obj=data, path="confirm_receive_method", default=None)
@@ -204,14 +204,14 @@ class sixmini(ViewSet):
'confirm_receive_time': 1784839114, # 当前用户确认收货的时间
'settlement_time': 1784839115, # 微信官方 确认的 结算时间
}
def web_view_auth(self, request: WSGIRequest | Request, ):
""""""
pass
# get请求的方法读取文件并且返回文件
print("认证web_view的请求进来了没有")
return HttpResponse(content="8cfc2017094adff8d7c66b94e209456e")
def api_get(self, request: Request, *args, **kwargs):
"""
:param request:
@@ -232,7 +232,7 @@ class sixmini(ViewSet):
return HttpResponse(content=echostr, content_type="text/plan")
else:
return Response(data="不对", )
def api_post(self, request: Request, *args, **kwargs):
"""
调用本接口: 就可以向已经订阅消息的用户发送消息,(同时需要注意的是:消息模板需要在小程序的管理后台订阅好)