fix(fsgx): 周期佣金锁与分销海报小程序码

- StoreOrderCreateServices: lockWrite 改为 lock(true),避免佣金计算整段异常
- QrcodeServices: 移除误加的 imageInfo 清空、补充小程序码失败日志
- UserBill getRoutineCode: 小程序码失败时回退为 H5 分享链接 ?spread=uid

Made-with: Cursor
This commit is contained in:
apple
2026-03-28 12:36:03 +08:00
parent ac696a8559
commit 35b6d76d50
4 changed files with 48 additions and 3 deletions

37
docs/issues-0327-1.md Normal file
View File

@@ -0,0 +1,37 @@
# 核心功能测试结果
- 分销员直推没有获得返现佣金测试数据uid=20升级为创客分销等级后下级用户下报单商品订单支付后uid=20并没有eb_user_brokerage返现佣金记录。
- 分销海报页面, pages/users/user_spread_code/index 获取不到二维码
fetch("https://www.fsgx.cn/api/user/routine_code", {
"headers": {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"authori-zation": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdXRoIjoiMTRlMWI2MDBiMWZkNTc5ZjQ3NDMzYjg4ZThkODUyOTEiLCJpc3MiOiJ3d3cuZnNneC5jbiIsImF1ZCI6Ind3dy5mc2d4LmNuIiwiaWF0IjoxNzc0NjY2NzA1LCJuYmYiOjE3NzQ2NjY3MDUsImV4cCI6MTc3NTI3MTUwNSwianRpIjp7ImlkIjoyMCwidHlwZSI6InJvdXRpbmUifX0.lbxfmmPVMNFpZmx9EXcb_7viz-YeMC_QymX6tiuCkD4",
"cache-control": "no-cache",
"content-type": "application/json",
"form-type": "routine",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"x-source": "370474988fa2275c"
},
"referrer": "https://servicewechat.com/wx998d9e0a925a1a13/devtools/page-frame.html",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "omit"
});
{"status":200,"msg":"ok","data":{"url":false}}
- `pro_v3.5.1/.cursor/plans/fix_issues_0325-1_f8488785.plan.md`对文档中“B7. e2e 测试验收分销员等级配置(测试问题 #7”执行e2e测试
---
# 测试
# 相关文件
1. **相关文件**`docs/PRD_fsgx_V1.0.md` `docs/page-dev-specs-fsgx.md``pro_v3.5.1/.cursor/plans/fix_issues_0325-1_f8488785.plan.md`

View File

@@ -96,6 +96,10 @@ class UserBill
$urlCode = $imageInfo['att_dir']; $urlCode = $imageInfo['att_dir'];
if ($imageInfo['image_type'] == 1) $urlCode = sys_config('site_url') . $urlCode; if ($imageInfo['image_type'] == 1) $urlCode = sys_config('site_url') . $urlCode;
} }
if (!$urlCode) {
$siteUrl = sys_config('site_url', '');
$urlCode = $siteUrl . '?spread=' . $uid;
}
return app('json')->success(['url' => $urlCode]); return app('json')->success(['url' => $urlCode]);
} }

View File

@@ -1007,7 +1007,7 @@ class StoreOrderCreateServices extends BaseServices
// 锁定推荐人行,确保同一推荐人同时只有一个事务在计算位次 // 锁定推荐人行,确保同一推荐人同时只有一个事务在计算位次
\think\facade\Db::name('user') \think\facade\Db::name('user')
->where('uid', $spread_uid) ->where('uid', $spread_uid)
->lockWrite() ->lock(true)
->value('uid'); ->value('uid');
// fsgx B1推荐人自己必须有报单商品订单才能获得推荐返现佣金 // fsgx B1推荐人自己必须有报单商品订单才能获得推荐返现佣金

View File

@@ -23,6 +23,7 @@ use crmeb\services\wechat\MiniProgram;
use crmeb\services\wechat\OfficialAccount; use crmeb\services\wechat\OfficialAccount;
use GuzzleHttp\Psr7\Utils; use GuzzleHttp\Psr7\Utils;
use think\annotation\Inject; use think\annotation\Inject;
use think\facade\Log;
use think\exception\ValidateException; use think\exception\ValidateException;
@@ -282,10 +283,12 @@ class QrcodeServices extends BaseServices
} }
} }
$siteUrl = sys_config('site_url'); $siteUrl = sys_config('site_url');
$imageInfo = '';
if (!$imageInfo) { if (!$imageInfo) {
$res = MiniProgram::appCodeUnlimit($data, $page, 280); $res = MiniProgram::appCodeUnlimit($data, $page, 280);
if (!$res) return false; if (!$res) {
Log::error('[getRoutineQrcodePath] appCodeUnlimit 返回空, scene=' . $data . ', page=' . $page);
return false;
}
$uploadType = (int)sys_config('upload_type', 1); $uploadType = (int)sys_config('upload_type', 1);
$upload = UploadService::init($uploadType); $upload = UploadService::init($uploadType);
$res = (string)Utils::streamFor($res); $res = (string)Utils::streamFor($res);
@@ -317,6 +320,7 @@ class QrcodeServices extends BaseServices
if ($imageInfo['image_type'] == 1) $url = $siteUrl . $url; if ($imageInfo['image_type'] == 1) $url = $siteUrl . $url;
return $url; return $url;
} catch (\Throwable $e) { } catch (\Throwable $e) {
Log::error('[getRoutineQrcodePath] 生成小程序码异常: ' . $e->getMessage());
return false; return false;
} }
} }