支持自动提现多商户轮换:配置入库、打款单强制记 mch_id、收款失败自动换号。
- 新增 wechat_pay_mch_config 表,迁移时从 settings 种子默认商户 - TixianAutoRecord 增加 mch_id;查单/回调解密后按记录对齐 - 后台接口 wxmchlb/wxmchbj/wxmchscwj(权限 8080a)与证书上传 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
peizhi/management/commands/seed_wechat_mch_from_settings.py
Normal file
29
peizhi/management/commands/seed_wechat_mch_from_settings.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
将 settings.WECHAT_PAY_V3_CONFIG 迁移进 wechat_pay_mch_config 表。
|
||||
用法:
|
||||
python manage.py seed_wechat_mch_from_settings
|
||||
python manage.py seed_wechat_mch_from_settings --force
|
||||
"""
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from utils.wechat_mch_service import seed_from_settings
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Seed WechatPayMchConfig from settings.WECHAT_PAY_V3_CONFIG'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--force',
|
||||
action='store_true',
|
||||
help='覆盖同商户号已有记录',
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
cfg = seed_from_settings(force=bool(options.get('force')))
|
||||
if not cfg:
|
||||
self.stderr.write(self.style.ERROR('settings.WECHAT_PAY_V3_CONFIG 不完整,未写入'))
|
||||
return
|
||||
self.stdout.write(self.style.SUCCESS(
|
||||
f"OK mch_id={cfg.get('MCHID')} source={cfg.get('_source')} path={cfg.get('PRIVATE_KEY_PATH')}"
|
||||
))
|
||||
Reference in New Issue
Block a user