This commit is contained in:
aaron 2025-03-27 15:58:45 +08:00
parent 8b3779e144
commit 42c175cb43
2 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,9 @@ from typing import Optional, List
from datetime import datetime, time, timedelta from datetime import datetime, time, timedelta
from app.core.coupon_manager import CouponManager from app.core.coupon_manager import CouponManager
from app.core.wechat import WeChatClient from app.core.wechat import WeChatClient
import random
import string
from app.core.qcloud import qcloud_manager
router = APIRouter() router = APIRouter()
@ -256,8 +259,13 @@ async def get_url_link(
return error_response(code=404, message="活动不存在") return error_response(code=404, message="活动不存在")
# 获取URL链接 # 获取URL链接
client = WeChatClient() wechat_client = WeChatClient()
url = await client.get_url_link("pages/my/promation/activities/index", f"id={activity_id}") image_data = await wechat_client.get_wx_code(path=f"pages/my/promation/activities/index", query=f"id={activity_id}")
random_str = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
key = f"qr_code/{current_user.user_code}_{random_str}.png"
url = await qcloud_manager.upload_file_bytes(image_data, key)
return success_response(data=url) return success_response(data=url)

Binary file not shown.