six_002
This commit is contained in:
@@ -93,6 +93,7 @@ class sixwecom(ViewSet):
|
||||
wecom_token = sixToken.get_wecom_token()
|
||||
uri = f"https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token={wecom_token}&external_userid={ExternalUserID}"
|
||||
data = requests.get(url=uri).json()
|
||||
print("调用了单独添加新用的数据方法调用了单独添加新用的数据方法调用了单独添加新用的数据方法调用了单独添加新用的数据方法", data)
|
||||
# 创建数据库数据表
|
||||
unionid = pydash.get(obj=data, path="external_contact.unionid") # 外部联系人在微信开放平台的唯一身份标识(微信unionid)
|
||||
name = pydash.get(obj=data, path="external_contact.name") # 外部联系人的名称[注1]如果是微信用户,则返回其微信昵称。如果是企业微信联系人,则返回其设置对外展示的别名或实名
|
||||
@@ -100,6 +101,7 @@ class sixwecom(ViewSet):
|
||||
avatar = pydash.get(obj=data, path="external_contact.avatar") # 外部联系人头像。第三方应用和代开发应用均不可获取,
|
||||
gender = pydash.get(obj=data, path="external_contact.gender") # 外部联系人性别 0-未知 1-男性 2-女性。
|
||||
follow_user = pydash.get(obj=data, path="follow_user")
|
||||
print("再打印 下结果", follow_user)
|
||||
for wecom in follow_user:
|
||||
userid = pydash.get(obj=wecom, path="userid") # 添加了此外部联系人的企业成员userid (企微员工的userid)
|
||||
userid = pydash.get(obj=wecom, path="userid") # 添加了此外部联系人的企业成员userid (企微员工的userid)
|
||||
@@ -156,28 +158,6 @@ class sixwecom(ViewSet):
|
||||
# 数据更新完成后: 需要调用添加积分的方法, 对新添加企微的用户,添加积分;
|
||||
(miniUser积分(share分享者unionidID=six上级对象.unionid, click点击者unionidID=self自生对象.unionid, bind绑定的企微unionidID=State)
|
||||
.add添加点击者添加企微员工双向红包积分(share积分类型="新人红包", share分享者二维码state=State))
|
||||
# if is是否首次创建:
|
||||
# # 在这里的场景值:当用户直接扫码添加企微二维码的时候就需要在这里进行处理了
|
||||
# # 怎么判断的逻辑为: 当用户是首次添加的时候,则说明,这个用户以前在数据库中是不存在的;并且可以确定为这个用户一定是新添加的
|
||||
# print("\n🍎 🍏 🍊 🍎首次创建首次创建首次创建首次创建 🍏 🍊 🍎 🍏 \n", 上级对象.unionid)
|
||||
# self自生对象.user_头像 = src
|
||||
# self自生对象.user_昵称 = name
|
||||
# self自生对象.codeQrCode = 上级对象.codeQrCode
|
||||
# self自生对象.codeRemark = 上级对象.codeRemark
|
||||
# self自生对象.codeConfigId = 上级对象.codeConfigId
|
||||
# self自生对象.external_userid = external_userid
|
||||
# self自生对象.user_用户当前的等级 = 上级对象.level + 1
|
||||
# self自生对象.parent = 上级对象
|
||||
# self自生对象.user_绑定企微UNIONID = 上级对象.user_绑定企微UNIONID
|
||||
# self自生对象.user_绑定企微usrID账号 = 上级对象.user_绑定企微usrID账号
|
||||
# self自生对象.save()
|
||||
#
|
||||
# else:
|
||||
# self自生对象.user_头像 = src
|
||||
# self自生对象.user_昵称 = name
|
||||
# self自生对象.external_userid = external_userid
|
||||
# self自生对象.save()
|
||||
|
||||
return None
|
||||
|
||||
def 企微主动删除好友事件(self, UserID, ChangeType, State, ExternalUserID):
|
||||
@@ -197,7 +177,6 @@ class sixwecom(ViewSet):
|
||||
)
|
||||
print("到底哪里报错了呀为什么啊")
|
||||
企微用户关系对象, 企微用户是否为首次 = wecom企微用户.objects.get_or_create(wecom企微ID=UserID, wecom好友的ID=ExternalUserID)
|
||||
print(企微用户关系对象, 企微用户是否为首次, "==========到底哪里报错了呀为什么啊到底哪里报错了呀为什么啊==================")
|
||||
if 企微用户是否为首次:
|
||||
pass
|
||||
else:
|
||||
|
||||
+10
-10
@@ -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):
|
||||
"""
|
||||
调用本接口: 就可以向已经订阅消息的用户发送消息,(同时需要注意的是:消息模板需要在小程序的管理后台订阅好)
|
||||
|
||||
Reference in New Issue
Block a user