```
feat(shopro_huifu): 添加汇付进件管理功能 - 新增汇付进件管理模块,支持新建、编辑进件流程 - 实现用户角色绑定验证功能,确保进件角色的有效性 - 集成Vue.js前端界面,提供完整的表单操作体验 - 支持个人和企业两种账户类型的进件资料录入 - 添加银行支行搜索功能,方便结算账户信息填写 - 完善进件状态管理和审核流程控制 - 增加图片上传组件,支持身份证、营业执照等证件上传 ```
这个提交包含在:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro_huifu\library\onboard;
|
||||
|
||||
use addons\shopro_huifu\model\Onboard;
|
||||
use think\Db;
|
||||
|
||||
class HuifuOnboardAdminService
|
||||
{
|
||||
public function saveDraft($userId, $roleType, $roleRefId, array $formData)
|
||||
{
|
||||
$userId = intval($userId);
|
||||
$roleRefId = intval($roleRefId);
|
||||
if ($userId <= 0) {
|
||||
throw new \InvalidArgumentException('请选择用户');
|
||||
}
|
||||
if (!in_array($roleType, ['promoter', 'regional_agent'], true)) {
|
||||
throw new \InvalidArgumentException('请选择进件角色');
|
||||
}
|
||||
$this->assertRoleBinding($userId, $roleType, $roleRefId);
|
||||
|
||||
$service = new HuifuOnboardService();
|
||||
return $service->saveDraft($userId, $roleType, $roleRefId, $formData);
|
||||
}
|
||||
|
||||
protected function assertRoleBinding($userId, $roleType, $roleRefId)
|
||||
{
|
||||
if ($roleType === 'promoter') {
|
||||
if ($roleRefId !== $userId) {
|
||||
throw new \InvalidArgumentException('分销商角色参数无效');
|
||||
}
|
||||
$agent = Db::name('shopro_commission_agent')->where('user_id', $userId)->find();
|
||||
if (!$agent) {
|
||||
throw new \InvalidArgumentException('该用户不是分销商,无法创建分销商进件');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$agent = Db::name('shopro_regional_agent')
|
||||
->where('id', $roleRefId)
|
||||
->where('user_id', $userId)
|
||||
->find();
|
||||
if (!$agent) {
|
||||
throw new \InvalidArgumentException('区域公司与用户不匹配');
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户