添加:平台抽成 - 合伙人佣金记录接口
This commit is contained in:
parent
efe5cf83c0
commit
1335295cf9
|
|
@ -3,6 +3,7 @@ namespace app\common\model\store\platformCommission;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
|
||||||
class PartnerSettlement extends BaseModel{
|
class PartnerSettlement extends BaseModel{
|
||||||
public static function tablePk():string{
|
public static function tablePk():string{
|
||||||
|
|
@ -16,7 +17,15 @@ class PartnerSettlement extends BaseModel{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 关联用户表
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/28 16:41
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function user(){
|
||||||
|
return $this->hasOne(User::class, 'uid', 'uid');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,30 @@ class PartnerSettlementCycleRepository extends BaseRepository{
|
||||||
public function __construct(PartnerSettlementCycleDao $dao){
|
public function __construct(PartnerSettlementCycleDao $dao){
|
||||||
$this->dao = $dao;
|
$this->dao = $dao;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 周期记录列表
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/28 16:05
|
||||||
|
* @param int $page
|
||||||
|
* @param int $limit
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function getRecordList(int $page,int $limit):array{
|
||||||
|
$query = $this->dao->getSearch([])->order('create_time DESC');
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->page($page,$limit)->select();
|
||||||
|
foreach($list as &$item){
|
||||||
|
$item['start_time'] = date("Y-m-d H:i:s",$item['start_time']);
|
||||||
|
$item['end_time'] = date("Y-m-d H:i:s",$item['end_time']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common: 合伙人结算 - 开始
|
* Common: 合伙人结算 - 开始
|
||||||
* Author: wu-hui
|
* Author: wu-hui
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,37 @@ class PartnerSettlementRepository extends BaseRepository{
|
||||||
public function __construct(PartnerSettlementDao $dao){
|
public function __construct(PartnerSettlementDao $dao){
|
||||||
$this->dao = $dao;
|
$this->dao = $dao;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取合伙人分佣记录
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/28 16:41
|
||||||
|
* @param int $params
|
||||||
|
* @param int $page
|
||||||
|
* @param int $limit
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function getRecordList(array $params,int $page,int $limit):array{
|
||||||
|
$query = $this->dao->getSearch([])
|
||||||
|
->when((int)$params['uid'] > 0,function($query) use ($params){
|
||||||
|
$query->where('uid', (int)$params['uid']);
|
||||||
|
})
|
||||||
|
->when((int)$params['cycle_id'] > 0,function($query) use ($params){
|
||||||
|
$query->where('cycle_id', (int)$params['cycle_id']);
|
||||||
|
})
|
||||||
|
->with([
|
||||||
|
'user' => function($query){
|
||||||
|
$query->field('uid,nickname,avatar')->bind(['nickname','avatar']);
|
||||||
|
},
|
||||||
|
])
|
||||||
|
->order('create_time DESC');
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->page($page,$limit)->select();
|
||||||
|
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
namespace app\controller\admin\store\marketing;
|
namespace app\controller\admin\store\marketing;
|
||||||
|
|
||||||
|
use app\common\repositories\store\platformCommission\PartnerSettlementCycleRepository;
|
||||||
|
use app\common\repositories\store\platformCommission\PartnerSettlementRepository;
|
||||||
use app\common\repositories\store\platformCommission\RecordRepository;
|
use app\common\repositories\store\platformCommission\RecordRepository;
|
||||||
use app\common\repositories\system\config\ConfigClassifyRepository;
|
use app\common\repositories\system\config\ConfigClassifyRepository;
|
||||||
use app\common\repositories\system\config\ConfigValueRepository;
|
use app\common\repositories\system\config\ConfigValueRepository;
|
||||||
|
|
@ -95,5 +97,28 @@ class PlatformCommission extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 合伙人佣金结算记录 - 周期记录
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2023/12/28 16:09
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function partnerCycleList(){
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
$data = app()->make(PartnerSettlementCycleRepository::class)->getRecordList((int)$page,(int)$limit);
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
|
// 合伙人佣金结算记录 - 明细记录
|
||||||
|
public function partnerList(){
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
$params = $this->request->params(['uid', 'cycle_id']);
|
||||||
|
$data = app()->make(PartnerSettlementRepository::class)->getRecordList((array)$params,(int)$page,(int)$limit);
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,13 @@ Route::group(function () {
|
||||||
Route::get('weight_value_change_record', '.platformCommissionWeightValue/changeRecord')->name('platformCommissionWeightValueChangeRecord')->option([
|
Route::get('weight_value_change_record', '.platformCommissionWeightValue/changeRecord')->name('platformCommissionWeightValueChangeRecord')->option([
|
||||||
'_alias' => '变更记录',
|
'_alias' => '变更记录',
|
||||||
]);
|
]);
|
||||||
|
// 合伙人佣金结算信息
|
||||||
|
Route::get('partner_cycle_list', '.platformCommission/partnerCycleList')->name('platformCommissionPartnerCycleList')->option([
|
||||||
|
'_alias' => '结算周期',
|
||||||
|
]);
|
||||||
|
Route::get('partner_list', '.platformCommission/partnerList')->name('platformCommissionPartnerList')->option([
|
||||||
|
'_alias' => '结算周期明细',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue