添加:代理中心 - 基本配置
This commit is contained in:
parent
339c18afde
commit
4c9ac5189a
|
|
@ -244,8 +244,68 @@ class AgentRepository extends BaseRepository{
|
||||||
'children_list' => $childrenList
|
'children_list' => $childrenList
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取配置
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/31 14:43
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfig(){
|
||||||
|
$config = systemConfig([
|
||||||
|
'delivery_money',
|
||||||
|
'delivery_money_field_staff',
|
||||||
|
'delivery_money_initiator',
|
||||||
|
'delivery_money_operator',
|
||||||
|
'delivery_money_partner',
|
||||||
|
'delivery_money_platform',
|
||||||
|
'delivery_money_province',
|
||||||
|
'delivery_process',
|
||||||
|
'field_staff_money',
|
||||||
|
'field_staff_money_initiator',
|
||||||
|
'field_staff_money_platform',
|
||||||
|
'field_staff_money_province',
|
||||||
|
'field_staff_process',
|
||||||
|
'internal_staff_money',
|
||||||
|
'internal_staff_money_initiator',
|
||||||
|
'internal_staff_money_platform',
|
||||||
|
'internal_staff_money_province',
|
||||||
|
'internal_staff_process',
|
||||||
|
'mer_money',
|
||||||
|
'mer_money_field_staff',
|
||||||
|
'mer_money_initiator',
|
||||||
|
'mer_money_operator',
|
||||||
|
'mer_money_partner',
|
||||||
|
'mer_money_platform',
|
||||||
|
'mer_money_province',
|
||||||
|
'mer_process',
|
||||||
|
'operator_money',
|
||||||
|
'operator_money_field_staff',
|
||||||
|
'operator_money_initiator',
|
||||||
|
'operator_money_platform',
|
||||||
|
'operator_money_province',
|
||||||
|
'operator_process',
|
||||||
|
'partner_money',
|
||||||
|
'partner_money_field_staff',
|
||||||
|
'partner_money_initiator',
|
||||||
|
'partner_money_operator',
|
||||||
|
'partner_money_platform',
|
||||||
|
'partner_money_province',
|
||||||
|
'partner_process',
|
||||||
|
'province_money',
|
||||||
|
'province_money_initiator',
|
||||||
|
'province_money_platform',
|
||||||
|
'province_process',
|
||||||
|
]);
|
||||||
|
$config['delivery_process'] = (int)$config['delivery_process'];
|
||||||
|
$config['field_staff_process'] = (int)$config['field_staff_process'];
|
||||||
|
$config['internal_staff_process'] = (int)$config['internal_staff_process'];
|
||||||
|
$config['mer_process'] = (int)$config['mer_process'];
|
||||||
|
$config['operator_process'] = (int)$config['operator_process'];
|
||||||
|
$config['partner_process'] = (int)$config['partner_process'];
|
||||||
|
$config['province_process'] = (int)$config['province_process'];
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ namespace app\common\repositories\system\config;
|
||||||
|
|
||||||
|
|
||||||
use app\common\dao\system\config\SystemConfigClassifyDao;
|
use app\common\dao\system\config\SystemConfigClassifyDao;
|
||||||
|
use app\common\model\system\config\SystemConfigClassify;
|
||||||
use app\common\repositories\BaseRepository;
|
use app\common\repositories\BaseRepository;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
|
|
@ -104,7 +105,6 @@ class ConfigClassifyRepository extends BaseRepository
|
||||||
|
|
||||||
return $form->setTitle(is_null($id) ? '添加配置分类' : '编辑配置分类')->formData($formData);
|
return $form->setTitle(is_null($id) ? '添加配置分类' : '编辑配置分类')->formData($formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Form
|
* @return Form
|
||||||
* @throws FormBuilderException
|
* @throws FormBuilderException
|
||||||
|
|
@ -115,8 +115,6 @@ class ConfigClassifyRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
return $this->form();
|
return $this->form();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Form
|
* @return Form
|
||||||
|
|
@ -131,4 +129,34 @@ class ConfigClassifyRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
return $this->form($id, $this->dao->get($id)->toArray());
|
return $this->form($id, $this->dao->get($id)->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 获取配置分类ID 不存在则添加
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/31 14:27
|
||||||
|
* @param $key
|
||||||
|
* @param $name
|
||||||
|
* @return int|mixed
|
||||||
|
*/
|
||||||
|
public function getConfigClassifyKeyById($key,$name){
|
||||||
|
$cid = (int)$this->keyById($key);
|
||||||
|
// cid小于等于0 添加信息然后返回
|
||||||
|
if($cid <= 0){
|
||||||
|
$model = new SystemConfigClassify();
|
||||||
|
$model->classify_name = $name;
|
||||||
|
$model->classify_key = $key;
|
||||||
|
$model->save();
|
||||||
|
$cid = $model->config_classify_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ namespace app\controller\admin\marketing;
|
||||||
|
|
||||||
use app\common\repositories\marketing\AgentBrokerageRepository;
|
use app\common\repositories\marketing\AgentBrokerageRepository;
|
||||||
use app\common\repositories\marketing\AgentRepository;
|
use app\common\repositories\marketing\AgentRepository;
|
||||||
|
use app\common\repositories\system\CacheRepository;
|
||||||
|
use app\common\repositories\system\config\ConfigClassifyRepository;
|
||||||
|
use app\common\repositories\system\config\ConfigValueRepository;
|
||||||
use app\common\repositories\system\merchant\MerchantRepository;
|
use app\common\repositories\system\merchant\MerchantRepository;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
|
|
@ -78,7 +81,7 @@ class Agent extends BaseController{
|
||||||
// 判断:根据当前角色判断 数据
|
// 判断:根据当前角色判断 数据
|
||||||
switch((int)$childrenItem['agent_type']){
|
switch((int)$childrenItem['agent_type']){
|
||||||
case 1:
|
case 1:
|
||||||
if((float)$childrenItem['agent_stock'] <= 0) throw new ValidateException('发起人的股份必须大于0!');
|
// if((float)$childrenItem['agent_stock'] <= 0) throw new ValidateException('发起人的股份必须大于0!');
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
|
|
@ -203,6 +206,76 @@ class Agent extends BaseController{
|
||||||
|
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 配置信息 - 修改配置信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/31 14:15
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function setConfig(){
|
||||||
|
$config = $this->request->params([
|
||||||
|
['delivery_money',0],
|
||||||
|
['delivery_money_field_staff',0],
|
||||||
|
['delivery_money_initiator',0],
|
||||||
|
['delivery_money_operator',0],
|
||||||
|
['delivery_money_partner',0],
|
||||||
|
['delivery_money_platform',0],
|
||||||
|
['delivery_money_province',0],
|
||||||
|
['delivery_process',0],
|
||||||
|
['field_staff_money',0],
|
||||||
|
['field_staff_money_initiator',0],
|
||||||
|
['field_staff_money_platform',0],
|
||||||
|
['field_staff_money_province',0],
|
||||||
|
['field_staff_process',0],
|
||||||
|
['internal_staff_money',0],
|
||||||
|
['internal_staff_money_initiator',0],
|
||||||
|
['internal_staff_money_platform',0],
|
||||||
|
['internal_staff_money_province',0],
|
||||||
|
['internal_staff_process',0],
|
||||||
|
['mer_money',0],
|
||||||
|
['mer_money_field_staff',0],
|
||||||
|
['mer_money_initiator',0],
|
||||||
|
['mer_money_operator',0],
|
||||||
|
['mer_money_partner',0],
|
||||||
|
['mer_money_platform',0],
|
||||||
|
['mer_money_province',0],
|
||||||
|
['mer_process',0],
|
||||||
|
['operator_money',0],
|
||||||
|
['operator_money_field_staff',0],
|
||||||
|
['operator_money_initiator',0],
|
||||||
|
['operator_money_platform',0],
|
||||||
|
['operator_money_province',0],
|
||||||
|
['operator_process',0],
|
||||||
|
['partner_money',0],
|
||||||
|
['partner_money_field_staff',0],
|
||||||
|
['partner_money_initiator',0],
|
||||||
|
['partner_money_operator',0],
|
||||||
|
['partner_money_platform',0],
|
||||||
|
['partner_money_province',0],
|
||||||
|
['partner_process',0],
|
||||||
|
['province_money',0],
|
||||||
|
['province_money_initiator',0],
|
||||||
|
['province_money_platform',0],
|
||||||
|
['province_process',0],
|
||||||
|
]);
|
||||||
|
// 保存信息
|
||||||
|
$cid = app()->make(ConfigClassifyRepository::class)->getConfigClassifyKeyById('agent_config', '代理中心配置');
|
||||||
|
if (!$cid) return app('json')->fail('保存失败');
|
||||||
|
app()->make(ConfigValueRepository::class)->setFormData($config,$this->request->merId());
|
||||||
|
return app('json')->success('保存成功');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 配置信息 - 获取配置信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/31 14:32
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfig(){
|
||||||
|
$config = app()->make(AgentRepository::class)->getConfig();
|
||||||
|
|
||||||
|
return app('json')->success($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ Route::group(function () {
|
||||||
]);
|
]);
|
||||||
// 代理中心
|
// 代理中心
|
||||||
Route::group('marketing/agent', function () {
|
Route::group('marketing/agent', function () {
|
||||||
// 代理商相关
|
// 代理管理相关
|
||||||
Route::get('list','/agentList')->name('systemMarketingAgentList')->option([
|
Route::get('list','/agentList')->name('systemMarketingAgentList')->option([
|
||||||
'_alias' => '代理列表',
|
'_alias' => '代理列表',
|
||||||
]);
|
]);
|
||||||
|
|
@ -475,7 +475,14 @@ Route::group(function () {
|
||||||
Route::get('get_edit_info','/getEditInfo')->name('systemMarketingAgentGetEditInfo')->option([
|
Route::get('get_edit_info','/getEditInfo')->name('systemMarketingAgentGetEditInfo')->option([
|
||||||
'_alias' => '获取编辑信息',
|
'_alias' => '获取编辑信息',
|
||||||
]);
|
]);
|
||||||
// 代理商佣金明细
|
// 代理配置相关
|
||||||
|
Route::post('config','/setConfig')->name('systemMarketingAgentSetConfig')->option([
|
||||||
|
'_alias' => '设置配置信息',
|
||||||
|
]);
|
||||||
|
Route::get('config','/getConfig')->name('systemMarketingAgentGetConfig')->option([
|
||||||
|
'_alias' => '获取配置信息',
|
||||||
|
]);
|
||||||
|
// 代理佣金明细
|
||||||
Route::get('commission_list','/commissionList')->name('systemMarketingAgentCommissionList')->option([
|
Route::get('commission_list','/commissionList')->name('systemMarketingAgentCommissionList')->option([
|
||||||
'_alias' => '佣金明细',
|
'_alias' => '佣金明细',
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue