backup: Native扫码支付设计前 django 代码快照

保留当前后端工作区已改代码,便于扫码支付开发前回滚对照。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQueandCursor committed 2026-08-08 17:00:53 +08:00
1 parent 8464a86e77
commit aee8a32add
4 files changed
+385 -406

No files matched your search

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
把龙先生(lxs)审核版商品目录复制到小溪(xx)。
+18 -40
View File
@@ -12,21 +12,24 @@ _FALLBACK_DEFAULT_INVITE = {
}
def get_club_default_dashou_invite_raw(club) -> str:
"""只读 config_json 里真正保存的值(后台表单用,不含回落)。"""
if not club:
return ''
cfg = getattr(club, 'config_json', None) or {}
if not isinstance(cfg, dict):
return ''
return (cfg.get(CONFIG_KEY) or '').strip()
def get_club_fallback_dashou_invite(club_id: str) -> str:
"""系统内置回落(仅小程序运行时;后台不应把它当已保存值展示)。"""
def get_club_default_dashou_invite(club_id: str) -> str:
"""
优先读 Club.config_json.default_dashou_invite,
否则回落内置各店默认管事邀请码。
"""
cid = (club_id or '').strip()
if not cid:
return ''
try:
from jituan.models import Club
club = Club.query.filter(club_id=cid).first()
if club:
cfg = club.config_json or {}
code = (cfg.get(CONFIG_KEY) or '').strip()
if code:
return code
except Exception:
logger.exception('read default_dashou_invite failed club=%s', cid)
try:
from jituan.services.club_migrate import CLUB_MIGRATE_DEFAULT_GUANSHI_INVITE
code = (CLUB_MIGRATE_DEFAULT_GUANSHI_INVITE.get(cid) or '').strip()
@@ -37,33 +40,8 @@ def get_club_fallback_dashou_invite(club_id: str) -> str:
return (_FALLBACK_DEFAULT_INVITE.get(cid) or '').strip()
def get_club_default_dashou_invite(club_id: str) -> str:
"""
小程序用:优先 config_json.default_dashou_invite,否则回落内置码。
"""
cid = (club_id or '').strip()
if not cid:
return ''
try:
from jituan.models import Club
club = Club.query.filter(club_id=cid).first()
if club:
code = get_club_default_dashou_invite_raw(club)
if code:
return code
except Exception:
logger.exception('read default_dashou_invite failed club=%s', cid)
return get_club_fallback_dashou_invite(cid)
def set_club_default_dashou_invite(club, invite_code: str) -> None:
"""写入 club.config_json,调用方负责 save。空字符串表示清空已保存值。"""
"""写入 club.config_json,调用方负责 save。"""
cfg = dict(getattr(club, 'config_json', None) or {})
code = (invite_code or '').strip()
if code:
cfg[CONFIG_KEY] = code
else:
# 清空:删掉键,避免再次读到旧固定值
cfg.pop(CONFIG_KEY, None)
# 强制新 dict,避免 JSONField 变更检测失败
club.config_json = dict(cfg)
cfg[CONFIG_KEY] = (invite_code or '').strip()
club.config_json = cfg