fix: 自动提现按俱乐部解析微信openid,修复已登录仍提示微信登录
This commit is contained in:
@@ -253,13 +253,19 @@ def validate_payment_info_for_withdraw(user_main):
|
||||
return True, ''
|
||||
|
||||
|
||||
def get_auto_withdraw_openid(user_main):
|
||||
"""自动提现打款用 openid:兼容 user_wx_openid / User.OpenID / UserName(openid)。"""
|
||||
from jituan.services.club_user import get_wx_openid_for_user
|
||||
club_id = club_id_for_tixian_yonghuid(user_main.UserUID)
|
||||
return (get_wx_openid_for_user(user_main, club_id) or '').strip()
|
||||
|
||||
|
||||
def validate_auto_withdraw_prerequisites(user_main):
|
||||
"""
|
||||
自动提现(zddksh / tixiansq):微信企业付款到用户 OpenID。
|
||||
不要求手机号、收款码、收款账号;须已绑定微信 OpenID。
|
||||
不要求手机号、收款码、收款账号;须能解析到微信 OpenID。
|
||||
"""
|
||||
openid = (getattr(user_main, 'OpenID', None) or '').strip()
|
||||
if not openid:
|
||||
if not get_auto_withdraw_openid(user_main):
|
||||
return False, '请先使用微信登录后再申请自动提现'
|
||||
return True, ''
|
||||
|
||||
|
||||
@@ -201,13 +201,14 @@ def process_audit_collect(request):
|
||||
)
|
||||
|
||||
try:
|
||||
if not user_main.OpenID:
|
||||
return Response({'code': 10, 'msg': '用户未绑定微信,无法收款'})
|
||||
|
||||
from users.tixian_shenhe_services import get_auto_withdraw_openid
|
||||
from jituan.services.club_user import get_user_club_id
|
||||
from jituan.services.wechat_pay import get_wechat_v3_config
|
||||
|
||||
payout_club_id = get_user_club_id(user_main)
|
||||
payout_openid = get_auto_withdraw_openid(user_main)
|
||||
if not payout_openid:
|
||||
return Response({'code': 10, 'msg': '用户未绑定微信,无法收款'})
|
||||
wx_cfg = get_wechat_v3_config(payout_club_id)
|
||||
if not wx_cfg.get('APPID') or not wx_cfg.get('MCHID') or not wx_cfg.get('TRANSFER_SCENE_ID'):
|
||||
logger.error('微信打款配置不完整 club=%s APPID=%s MCHID=%s', payout_club_id, wx_cfg.get('APPID'), wx_cfg.get('MCHID'))
|
||||
@@ -317,7 +318,7 @@ def process_audit_collect(request):
|
||||
audit.save(update_fields=['tixian_auto_id', 'UpdateTime'])
|
||||
|
||||
body = _build_wx_transfer_body(
|
||||
wx_cfg, tixian_id, user_main.OpenID, yonghuid, leixing, shijidaozhang,
|
||||
wx_cfg, tixian_id, payout_openid, yonghuid, leixing, shijidaozhang,
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user