six_001
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.viewsets import ViewSet
|
||||
|
||||
from sixGuoDjango import BaseResponse, ResData
|
||||
|
||||
|
||||
class 主页分享页面接口ViewSets(ViewSet):
|
||||
img_主页面分享时的图片 = "https://hudie.sixgou.com/six/aa35a95a5be61ba1bc38f856fabf3978.png"
|
||||
|
||||
@action(detail=False, methods=["post", ], url_path="onShareAppMessage")
|
||||
def 主页群分享接口(self, request: Request):
|
||||
""""""
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
self_mini_unionid = request.data.get("self_mini_unionid", None)
|
||||
page_path = request.data.get("page_path", None)
|
||||
# 如果需要携带参数, 需要在路由的后面 ? 添加 key=value的格式;
|
||||
分享参数 = {
|
||||
"superior_unionid": self_mini_unionid,
|
||||
"shareType": "小程序推荐",
|
||||
}
|
||||
print(分享参数)
|
||||
result = "&".join([f"{key}={value}" for key, value in 分享参数.items()])
|
||||
print("================", result, self_mini_openid, "炎什么值拿不到了呢?")
|
||||
messageData = {
|
||||
"title": "🧧🧧🧧无门槛代金券,快来领!!!",
|
||||
"path": f"{page_path}?{result}",
|
||||
"imageUrl": self.img_主页面分享时的图片,
|
||||
}
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=messageData), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
|
||||
@action(detail=False, methods=["post"], url_path="onShareTimeline")
|
||||
def 主页朋友圈分享的功能接口(self, request: Request):
|
||||
""""""
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
self_mini_unionid = request.data.get("self_mini_unionid", None)
|
||||
|
||||
page_path = request.data.get("page_path", None)
|
||||
# 如果需要携带参数, 需要在路由的后面 ? 添加 key=value的格式
|
||||
messageData = {
|
||||
"title": "🧧🧧🧧无门槛代金券,快来领!!!",
|
||||
"path": f"{page_path}",
|
||||
"imageUrl": self.img_主页面分享时的图片,
|
||||
"query": f"superior_unionid={self_mini_unionid}&shareType=小程序推荐",
|
||||
}
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=messageData), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
@@ -0,0 +1,65 @@
|
||||
import uuid
|
||||
|
||||
import pydash
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.viewsets import ViewSet
|
||||
|
||||
from sixGuoDjango import BaseResponse, ResData
|
||||
from wechat_数据库.洗衣液商品数据库.六果洗衣液商品 import Goods
|
||||
|
||||
|
||||
class 商品详情页面分享接口ViewSets(ViewSet):
|
||||
@action(detail=False, methods=["post"], url_path="goods_detaile")
|
||||
def 商品详情页面分享群好友接口(self, request: Request):
|
||||
""""""
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
self_mini_unionid = request.data.get("self_mini_unionid", None)
|
||||
page_path = request.data.get("page_path", None)
|
||||
idKey = request.data.get("idKey", None)
|
||||
my_uuid = uuid.UUID(idKey)
|
||||
goods = Goods.objects.get(idKey=idKey)
|
||||
print(goods.goods_商品销售规格)
|
||||
主图图片链接 = pydash.get(obj=goods, path="goods_商品销售规格.0.goods_商品详情图片.主图.0")
|
||||
分享参数 = {
|
||||
"superior_unionid": self_mini_unionid,
|
||||
"shareType": "好物推荐",
|
||||
"goodID": idKey,
|
||||
}
|
||||
result = "&".join([f"{key}={value}" for key, value in 分享参数.items()])
|
||||
messageData = {
|
||||
"title": "🧧“洗”出好运,免费带走,📢 刚薅到的羊毛!这瓶洗衣液真的不要钱!!!!!",
|
||||
"path": f"{page_path}?{result}",
|
||||
"imageUrl": 主图图片链接,
|
||||
}
|
||||
print(messageData)
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=messageData), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
|
||||
@action(detail=False, methods=["post"], url_path="timeline_goods_detaile")
|
||||
def 商品详情页面分享朋友圈接口(self, request: Request):
|
||||
""""""
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
self_mini_unionid = request.data.get("self_mini_unionid", None)
|
||||
|
||||
page_path = request.data.get("page_path", None)
|
||||
idKey = request.data.get("idKey", None)
|
||||
goods = Goods.objects.get(idKey=idKey)
|
||||
主图图片链接 = pydash.get(obj=goods, path="goods_商品销售规格.0.goods_商品详情图片.主图.0")
|
||||
print("🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 ", 主图图片链接)
|
||||
分享参数 = {
|
||||
"superior_unionid": self_mini_unionid,
|
||||
"shareType": "好物推荐",
|
||||
"goodID": idKey,
|
||||
}
|
||||
result = pydash.join(array=[f"{key}={value}" for key, value in 分享参数.items()], separator="&")
|
||||
messageData = {
|
||||
"title": "🧧“洗”出好运,免费带走,📢 刚薅到的羊毛!这瓶洗衣液真的不要钱!!!!!",
|
||||
"path": f"{page_path}",
|
||||
"imageUrl": 主图图片链接,
|
||||
"query": result,
|
||||
}
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=messageData), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
@@ -0,0 +1,61 @@
|
||||
import pydash
|
||||
from django.forms import model_to_dict
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.viewsets import ViewSet
|
||||
|
||||
from sixGuoDjango import ResData, BaseResponse
|
||||
from wechat_数据库.洗衣液商品数据库.六果洗衣液商品 import goods商品
|
||||
|
||||
|
||||
class 幸运拼团分享接口ViewSets(ViewSet):
|
||||
@action(detail=False, methods=["post"], url_path="message_lucky")
|
||||
def 幸运拼团群分享接口奖励积分(self, request: Request):
|
||||
""""""
|
||||
self_user_unionid = request.data.get("self_user_unionid", None)
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
# 如果需要携带参数, 需要在路由的后面 ? 添加 key=value的格式;
|
||||
page_path = request.data.get("page_path", None)
|
||||
idKey = request.data.get("idKey", None)
|
||||
print("🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 难道我没有拿到值的吗?", idKey)
|
||||
参团商品对象 = goods商品.objects.get(id_主键_goods商品=idKey)
|
||||
goods数据 = model_to_dict(instance=参团商品对象, fields=None)
|
||||
分享图片链接 = pydash.get(obj=goods数据, path="goods商品数据.商品图片.主图.0")
|
||||
messageData = {
|
||||
"title": "🧧🧧🧧洗衣液,居然还可以这样买!!!!",
|
||||
"path": f"{page_path}?superior_unionid={self_user_unionid}&shareType=幸运拼团",
|
||||
"imageUrl": 分享图片链接,
|
||||
}
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=messageData), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
|
||||
@action(detail=False, methods=["post"], url_path="timeline_lucky")
|
||||
def 幸运拼团朋友圈分享的奖励接口(self, request: Request):
|
||||
""""""
|
||||
self_user_unionid = request.data.get("self_user_unionid", None)
|
||||
self_mini_openid = request.data.get("self_mini_openid", None)
|
||||
page_path = request.data.get("page_path", None)
|
||||
# 如果需要携带参数, 需要在路由的后面 ? 添加 key=value的格式
|
||||
idKey = request.data.get("idKey", None)
|
||||
print("\n🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 \n", idKey)
|
||||
# goods = goods商品.objects.get(idKey=idKey)
|
||||
goods = goods商品.objects.get(id_主键_goods商品=idKey)
|
||||
goods数据 = model_to_dict(instance=goods, fields=None)
|
||||
分享图片链接 = pydash.get(obj=goods数据, path="goods商品数据.商品图片.主图.0")
|
||||
print("🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 ", 分享图片链接)
|
||||
messageData = {
|
||||
"title": "🧧🧧🧧洗衣液,居然还可以这样买!!!!",
|
||||
"path": f"{page_path}",
|
||||
"imageUrl": "https://hudie.xiao.band/icon/Ll8-7G-3PFWEc6e26d282e20a598c05c15161ea19b5e.png",
|
||||
"query": f"superior_unionid={self_user_unionid}"
|
||||
}
|
||||
积分朋友圈数据 = {
|
||||
"title": "🧧🧧🧧洗衣液,居然还可以这样买!!!!",
|
||||
"path": f"{page_path}",
|
||||
"imageUrl": 分享图片链接,
|
||||
"query": f"superior_unionid={self_user_unionid}&shareType=商品详情分享朋友圈"
|
||||
}
|
||||
httpResData = BaseResponse(resData=ResData(listData=[""], dictData=积分朋友圈数据), ).model_dump()
|
||||
return Response(data=httpResData, status=status.HTTP_200_OK)
|
||||
Reference in New Issue
Block a user