添加:平台抽成设置管理
This commit is contained in:
parent
cab7f97d96
commit
3d1b982e2f
|
|
@ -447,13 +447,19 @@ class Common extends BaseController
|
||||||
/******** 数据库批量处理 ***************************************/
|
/******** 数据库批量处理 ***************************************/
|
||||||
private function sqlInit(){
|
private function sqlInit(){
|
||||||
// 不清除数据的表
|
// 不清除数据的表
|
||||||
$notCleanUp = [];
|
$notCleanUp = [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
// 获取全部数据库列表
|
// 获取全部数据库列表
|
||||||
$tables = $this->getAllTable();
|
$tables = $this->getAllTable();
|
||||||
// 获取存在数据的表
|
// 获取存在数据的表
|
||||||
$hasTable = $this->getHasDataTable($tables,$notCleanUp);
|
// $hasTable = $this->getHasDataTable($tables,$notCleanUp);
|
||||||
|
|
||||||
debug($hasTable);
|
debug($tables);
|
||||||
// 执行清除操作
|
// 执行清除操作
|
||||||
// foreach($tables as $name){
|
// foreach($tables as $name){
|
||||||
// if(!in_array($name,$notCleanUp)){
|
// if(!in_array($name,$notCleanUp)){
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\controller\admin\user;
|
||||||
|
|
||||||
|
use app\common\repositories\system\config\ConfigClassifyRepository;
|
||||||
|
use app\common\repositories\system\config\ConfigValueRepository;
|
||||||
|
use app\validate\admin\platformCommission\ConfigValidate;
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
use think\App;
|
||||||
|
|
||||||
|
class PlatformCommission extends BaseController{
|
||||||
|
protected $repository;
|
||||||
|
|
||||||
|
public function __construct(App $app){
|
||||||
|
parent::__construct($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 获取配置信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/22 11:32
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfig(){
|
||||||
|
$default = [
|
||||||
|
'is_open' => 0,
|
||||||
|
'commission_platform_rate' => 0,
|
||||||
|
'commission_partner_rate' => 0,
|
||||||
|
'commission_partner_cycle' => 0,
|
||||||
|
'commission_merchants_rate' => 0,
|
||||||
|
'commission_promoter_rate' => 0,
|
||||||
|
'commission_integral_release_rate' => 0
|
||||||
|
];
|
||||||
|
$config = systemConfig(array_keys($default));
|
||||||
|
$config = array_filter($config,function($v){
|
||||||
|
return $v !== '';
|
||||||
|
}) + $default;
|
||||||
|
|
||||||
|
|
||||||
|
return app('json')->success($config);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 编辑配置信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/22 13:40
|
||||||
|
* @param ConfigValidate $validate
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function saveConfig(ConfigValidate $validate){
|
||||||
|
$config = $this->request->params([
|
||||||
|
'is_open',
|
||||||
|
'commission_platform_rate',
|
||||||
|
'commission_partner_rate',
|
||||||
|
'commission_partner_cycle',
|
||||||
|
'commission_merchants_rate',
|
||||||
|
'commission_promoter_rate',
|
||||||
|
'commission_integral_release_rate'
|
||||||
|
]);
|
||||||
|
$validate->check($config);
|
||||||
|
$cid = app()->make(ConfigClassifyRepository::class)->keyById('platform_commission');
|
||||||
|
if (!$cid) return app('json')->fail('保存失败!配置项不存在,请联系开发人员!');
|
||||||
|
app()->make(ConfigValueRepository::class)->save($cid, $config, 0);
|
||||||
|
|
||||||
|
return app('json')->success('保存成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\validate\admin\platformCommission;
|
||||||
|
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class ConfigValidate extends Validate
|
||||||
|
{
|
||||||
|
protected $failException = true;
|
||||||
|
|
||||||
|
protected $rule = [
|
||||||
|
'is_open|平台抽成' => 'require|in:0,1|rateIsCorrect',
|
||||||
|
'commission_platform_rate|平台分佣比例' => 'require|float|between:0,100',
|
||||||
|
'commission_partner_rate|合伙人分佣比例' => 'require|float|between:0,100',
|
||||||
|
'commission_partner_cycle|合伙人分佣周期' => 'require|in:0,1,2',
|
||||||
|
'commission_merchants_rate|招商员分佣比例' => 'require|float|between:0,100',
|
||||||
|
'commission_promoter_rate|推广员分佣比例' => 'require|float|between:0,100',
|
||||||
|
'commission_integral_release_rate|积分释放比例' => 'require|float|between:0,100',
|
||||||
|
];
|
||||||
|
|
||||||
|
// 判断:开启时 比例总和是否为100
|
||||||
|
protected function rateIsCorrect($value,$rule,$data = []){
|
||||||
|
if($data['is_open'] == 1){
|
||||||
|
// 开启平台抽成
|
||||||
|
$rateCount = (float)$data['commission_platform_rate'] +
|
||||||
|
(float)$data['commission_partner_rate'] +
|
||||||
|
(float)$data['commission_merchants_rate'] +
|
||||||
|
(float)$data['commission_promoter_rate'] +
|
||||||
|
(float)$data['commission_integral_release_rate'];
|
||||||
|
|
||||||
|
if($rateCount != 100) return '所有抽成分佣比例之和必须为100%';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ use app\common\middleware\AllowOriginMiddleware;
|
||||||
use app\common\middleware\LogMiddleware;
|
use app\common\middleware\LogMiddleware;
|
||||||
|
|
||||||
Route::group(function () {
|
Route::group(function () {
|
||||||
|
|
||||||
//积分
|
//积分
|
||||||
Route::group('user/integral', function () {
|
Route::group('user/integral', function () {
|
||||||
Route::get('config', '.UserIntegral/getConfig')->name('systemUserIntegralConfig')->option([
|
Route::get('config', '.UserIntegral/getConfig')->name('systemUserIntegralConfig')->option([
|
||||||
|
|
@ -23,7 +22,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/integral/config',
|
'_path' => '/marketing/integral/config',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Route::group('user/integral', function () {
|
Route::group('user/integral', function () {
|
||||||
Route::get('title', '.UserIntegral/getTitle')->name('systemUserIntegralTitle')->option([
|
Route::get('title', '.UserIntegral/getTitle')->name('systemUserIntegralTitle')->option([
|
||||||
'_alias' => '积分统计',
|
'_alias' => '积分统计',
|
||||||
|
|
@ -52,7 +50,6 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Route::group('user/integral', function () {
|
Route::group('user/integral', function () {
|
||||||
Route::get('hold_list', '.UserIntegral/holdIntegral')->name('systemUserIntegralHoldList')->option([
|
Route::get('hold_list', '.UserIntegral/holdIntegral')->name('systemUserIntegralHoldList')->option([
|
||||||
'_alias' => '持有积分',
|
'_alias' => '持有积分',
|
||||||
|
|
@ -68,9 +65,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/integral/hold',
|
'_path' => '/marketing/integral/hold',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//预售商品
|
//预售商品
|
||||||
Route::group('store/product/presell', function () {
|
Route::group('store/product/presell', function () {
|
||||||
Route::get('lst', 'StoreProductPresell/lst')->name('systemStoreProductPresellLst')->option([
|
Route::get('lst', 'StoreProductPresell/lst')->name('systemStoreProductPresellLst')->option([
|
||||||
|
|
@ -98,8 +92,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/presell/list',
|
'_path' => '/marketing/presell/list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
//助力商品
|
//助力商品
|
||||||
Route::group('store/product/assist', function () {
|
Route::group('store/product/assist', function () {
|
||||||
Route::get('lst', 'StoreProductAssist/lst')->name('systemStoreProductAssistLst')->option([
|
Route::get('lst', 'StoreProductAssist/lst')->name('systemStoreProductAssistLst')->option([
|
||||||
|
|
@ -127,7 +119,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/assist/goods_list',
|
'_path' => '/marketing/assist/goods_list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//助力活动
|
//助力活动
|
||||||
Route::group('store/product/assist', function () {
|
Route::group('store/product/assist', function () {
|
||||||
|
|
||||||
|
|
@ -141,8 +132,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/assist/list',
|
'_path' => '/marketing/assist/list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
//拼团商品
|
//拼团商品
|
||||||
Route::group('store/product/group', function () {
|
Route::group('store/product/group', function () {
|
||||||
Route::get('lst', 'StoreProductGroup/lst')->name('systemStoreProductGroupLst')->option([
|
Route::get('lst', 'StoreProductGroup/lst')->name('systemStoreProductGroupLst')->option([
|
||||||
|
|
@ -185,7 +174,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/combination/combination_list',
|
'_path' => '/marketing/combination/combination_list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Route::group('config/others', function () {
|
Route::group('config/others', function () {
|
||||||
Route::get('group_buying', '/getGroupBuying')->name('configOthersGroupBuyingDetail')->option([
|
Route::get('group_buying', '/getGroupBuying')->name('configOthersGroupBuyingDetail')->option([
|
||||||
'_alias' => '配置信息',
|
'_alias' => '配置信息',
|
||||||
|
|
@ -199,7 +187,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/combination/combination_set',
|
'_path' => '/marketing/combination/combination_set',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//直播间
|
//直播间
|
||||||
Route::group('broadcast/room', function () {
|
Route::group('broadcast/room', function () {
|
||||||
Route::get('lst', '/lst')->name('systemBroadcastRoomLst')->option([
|
Route::get('lst', '/lst')->name('systemBroadcastRoomLst')->option([
|
||||||
|
|
@ -244,7 +231,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/studio/list',
|
'_path' => '/marketing/studio/list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//直播间商品
|
//直播间商品
|
||||||
Route::group('broadcast/goods', function () {
|
Route::group('broadcast/goods', function () {
|
||||||
Route::get('lst', '/lst')->name('systemBroadcastGoodsLst')->option([
|
Route::get('lst', '/lst')->name('systemBroadcastGoodsLst')->option([
|
||||||
|
|
@ -276,7 +262,6 @@ Route::group(function () {
|
||||||
'_path' => '/marketing/broadcast/list',
|
'_path' => '/marketing/broadcast/list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//秒杀配置管理
|
//秒杀配置管理
|
||||||
Route::group('seckill/config', function () {
|
Route::group('seckill/config', function () {
|
||||||
Route::get('lst', '/lst')->name('systemSeckillConfigLst')->option([
|
Route::get('lst', '/lst')->name('systemSeckillConfigLst')->option([
|
||||||
|
|
@ -326,7 +311,6 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//秒杀商品管理
|
//秒杀商品管理
|
||||||
Route::group('seckill/product', function () {
|
Route::group('seckill/product', function () {
|
||||||
Route::get('mer_select', '/lists')->option([
|
Route::get('mer_select', '/lists')->option([
|
||||||
|
|
@ -364,8 +348,6 @@ Route::group(function () {
|
||||||
]);
|
]);
|
||||||
//商品列表
|
//商品列表
|
||||||
Route::get('marketing/spu/lst', 'admin.store.marketing.StoreAtmosphere/markLst');
|
Route::get('marketing/spu/lst', 'admin.store.marketing.StoreAtmosphere/markLst');
|
||||||
|
|
||||||
|
|
||||||
//活动氛围图 - 详情下边框图
|
//活动氛围图 - 详情下边框图
|
||||||
Route::group('activity/atmosphere/', function () {
|
Route::group('activity/atmosphere/', function () {
|
||||||
Route::post('create', '/create')->name('systemActivityAtmosphereCreate')->option([
|
Route::post('create', '/create')->name('systemActivityAtmosphereCreate')->option([
|
||||||
|
|
@ -404,7 +386,6 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//活动氛围图-列表边框
|
//活动氛围图-列表边框
|
||||||
Route::group('activity/border/', function () {
|
Route::group('activity/border/', function () {
|
||||||
Route::post('create', '/create')->name('systemActivityBorderCreate')->option([
|
Route::post('create', '/create')->name('systemActivityBorderCreate')->option([
|
||||||
|
|
@ -443,8 +424,25 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
// 平台抽成
|
||||||
|
Route::group('user/platformCommission', function () {
|
||||||
|
Route::get('config', '.platformCommission/getConfig')->name('platformCommissionConfig')->option([
|
||||||
|
'_alias' => '设置获取',
|
||||||
|
]);
|
||||||
|
Route::post('config', '.platformCommission/saveConfig')->name('platformCommissionConfigSave')->option([
|
||||||
|
'_alias' => '设置保存',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})->prefix('admin.user')->option([
|
||||||
|
'_path' => '/marketing/platformCommission/index',
|
||||||
|
'_auth' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
})->middleware(AllowOriginMiddleware::class)
|
})->middleware(AllowOriginMiddleware::class)
|
||||||
->middleware(AdminTokenMiddleware::class, true)
|
->middleware(AdminTokenMiddleware::class, true)
|
||||||
->middleware(AdminAuthMiddleware::class)
|
->middleware(AdminAuthMiddleware::class)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue