Commit 0780700f authored by 刘小敏's avatar 刘小敏

fix(agent): 防止重复申请代理商

parent 7cb64f71
......@@ -25,6 +25,14 @@ class Agent extends Common
$userId = $user->id ?? 0;
custom_log('[agent.apply] 收到代理申请请求, user_id=' . $userId, $userId, 'share');
// 校验是否已有代理商记录
$existAgent = AgentModel::where('user_id', $userId)->find();
if ($existAgent) {
$statusText = (new AgentModel)->statusList()[$existAgent->status] ?? $existAgent->status;
custom_log('[agent.apply] 已存在代理商记录, agent_id=' . $existAgent->id . ', status=' . $existAgent->status, $userId, 'share', 'warning');
$this->error("您已是代理商,当前状态:{$statusText}");
}
// 校验消费累计条件
$commissionConfig = new \addons\shopro\service\commission\Config();
$becomeAgentEvent = $commissionConfig->getBecomeAgentEvent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment