feat(withdraw): 落地方案B一体化商城余额提现与手续费内扣模式,完善多端打款退款与对账闭环

这个提交包含在:
chen
2026-09-20 14:35:38 +08:00
父节点 bee5288e88
当前提交 2b7c34c7f7
共有 65 个文件被更改,包括 3554 次插入 和 579 次删除

查看文件

@@ -163,15 +163,41 @@ class Pay extends Common
// 微信公众号,小程序支付,必须有 openid
if ($payment == 'wechat') {
if (in_array($platform, ['WechatOfficialAccount', 'WechatMiniProgram'])) {
$targetPlatform = lcfirst(str_replace('Wechat', '', $platform));
if (isset($openid) && $openid) {
// 如果传的有 openid
$order_data['payer']['openid'] = $openid;
// 自愈绑定:若当前用户在 third_oauth 中尚无对应平台的绑定记录,自动补建
if ($platform == 'WechatMiniProgram') {
$oauth = \app\admin\model\shopro\ThirdOauth::where([
'user_id' => $order->user_id,
'provider' => 'wechat',
'platform' => $targetPlatform
])->find();
if (!$oauth) {
$existOauth = \app\admin\model\shopro\ThirdOauth::getByOpenid($openid);
if (!$existOauth) {
\app\admin\model\shopro\ThirdOauth::create([
'user_id' => $order->user_id,
'provider' => 'wechat',
'platform' => $targetPlatform,
'openid' => $openid,
'createtime' => time(),
'updatetime' => time(),
]);
} elseif ($existOauth->user_id == 0) {
$existOauth->user_id = $order->user_id;
$existOauth->save();
}
}
}
} else {
// 没有 openid 默认拿下单人的 openid
$oauth = \app\admin\model\shopro\ThirdOauth::where([
'user_id' => $order->user_id,
'provider' => 'Wechat',
'platform' => lcfirst(str_replace('Wechat', '', $platform))
'user_id' => $order->user_id,
'provider' => 'wechat',
'platform' => $targetPlatform
])->find();
$order_data['payer']['openid'] = $oauth ? $oauth->openid : '';

查看文件

@@ -120,6 +120,13 @@ class Goods extends Common
// 处理商品规格
$skuPrices = $goods['new_sku_prices'];
$content = $goods['content'];
if ($content) {
$cdnurl = cdnurl('', true);
if ($cdnurl) {
$cdnurl = rtrim($cdnurl, '/');
$content = preg_replace('/<img([^>]+)src=["\'](\/uploads\/[^"\']+)["\']/i', '<img$1src="' . $cdnurl . '$2"', $content);
}
}
$goods = $goods->toArray();
$goods['sku_prices'] = $skuPrices;
$goods['content'] = $content;

查看文件

@@ -45,8 +45,10 @@ class Wechat extends Common
if ($result) {
$auth = \app\common\library\Auth::instance();
$oauthInfo = $this->wechat->getOauthInfo();
$this->success('登陆成功', [
'token' => $auth->isLogin() ? $auth->getToken() : ''
'token' => $auth->isLogin() ? $auth->getToken() : '',
'openid' => $oauthInfo ? ($oauthInfo->openid ?? '') : ''
]);
}
$this->error('登陆失败');