Commit 7c9a426b authored by 刘小敏's avatar 刘小敏

更新代理商申请接口地址

parent a9df1ab5
<?php
namespace addons\shopro\controller\user;
use addons\shopro\controller\Common;
class Agent extends Common
{
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
/**
* 申请成为代理商
* POST /addons/shopro/user.agent/agentapply
*/
public function agentapply()
{
if (!$this->request->isPost()) {
$this->error('');
}
$user = auth_user();
$userId = $user->id ?? 0;
custom_log('[agent.apply] 收到代理申请请求, user_id=' . $userId, $userId, 'share');
$params = $this->request->only(['province_id', 'real_name', 'id_card', 'id_card_images']);
custom_log('[agent.apply] 解析参数: ' . json_encode($params, JSON_UNESCAPED_UNICODE), $userId, 'share');
$this->svalidate($params, '\addons\shopro\validate\user\User.agentApply');
custom_log('[agent.apply] 参数校验通过', $userId, 'share');
$service = new \addons\shopro\service\agent\ApplyService($user);
try {
$apply = $service->submit($params);
custom_log('[agent.apply] 代理申请成功, apply_id=' . ($apply->id ?? ''), $userId, 'share');
$this->success('申请已提交,请等待审核', $apply);
} catch (\think\Exception $e) {
custom_log('[agent.apply] 代理申请失败: ' . $e->getMessage(), $userId, 'share', 'warning');
$this->error($e->getMessage());
}
}
}
...@@ -398,36 +398,6 @@ class User extends Common ...@@ -398,36 +398,6 @@ class User extends Common
} }
/** /**
* 申请成为代理商
*/
public function agentapply()
{
if (!$this->request->isPost()) {
$this->error('');
}
$user = auth_user();
$userId = $user->id ?? 0;
custom_log('[agent.apply] 收到代理申请请求, user_id=' . $userId, $userId, 'share');
$params = $this->request->only(['province_id', 'real_name', 'id_card', 'id_card_images']);
custom_log('[agent.apply] 解析参数: ' . json_encode($params, JSON_UNESCAPED_UNICODE), $userId, 'share');
$this->svalidate($params, '.agentApply');
custom_log('[agent.apply] 参数校验通过', $userId, 'share');
$service = new \addons\shopro\service\agent\ApplyService($user);
try {
$apply = $service->submit($params);
custom_log('[agent.apply] 代理申请成功, apply_id=' . ($apply->id ?? ''), $userId, 'share');
$this->success('申请已提交,请等待审核', $apply);
} catch (\think\Exception $e) {
custom_log('[agent.apply] 代理申请失败: ' . $e->getMessage(), $userId, 'share', 'warning');
$this->error($e->getMessage());
}
}
/**
* 用户注销 * 用户注销
* 物理删除用户,且未做业务上的逻辑判断,慎用 * 物理删除用户,且未做业务上的逻辑判断,慎用
*/ */
......
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