添加:豆豆分配记录查看明细
This commit is contained in:
parent
5c8dc13c60
commit
ca85d5d751
|
|
@ -5,6 +5,7 @@
|
|||
namespace app\common\model\store\platformCommission;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class LegumesLog extends BaseModel{
|
||||
|
||||
|
|
@ -16,5 +17,14 @@ class LegumesLog extends BaseModel{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 关联用户表
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 14:00
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function user(){
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,38 @@ class LegumesLogRepository extends BaseRepository{
|
|||
$this->dao = $dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 豆豆分配记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 13:58
|
||||
* @param array $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['legumes_id'] > 0,function($query) use ($params){
|
||||
$query->where('legumes_id', (int)$params['legumes_id']);
|
||||
})
|
||||
->with([
|
||||
'user' => function($query){
|
||||
$query->field('uid,nickname,avatar')->bind(['nickname','avatar']);
|
||||
}
|
||||
])
|
||||
->order('create_time DESC')
|
||||
->order('id DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page,$limit)->select();
|
||||
|
||||
return compact('count','list');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,28 @@ class LegumesRepository extends BaseRepository{
|
|||
$info = $this->dao->get($id);
|
||||
return $info ? $info->toArray() : [];
|
||||
}
|
||||
/**
|
||||
* Common: 周期结算记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 13:37
|
||||
* @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){
|
||||
$query = $this->dao->getSearch([])->order('create_time DESC')->order('id 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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class PartnerSettlementCycleRepository extends BaseRepository{
|
|||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getRecordList(int $page,int $limit):array{
|
||||
$query = $this->dao->getSearch([])->order('create_time DESC');
|
||||
$query = $this->dao->getSearch([])->order('create_time DESC')->order('id DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page,$limit)->select();
|
||||
foreach($list as &$item){
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ class PartnerSettlementRepository extends BaseRepository{
|
|||
$query->field('uid,nickname,avatar')->bind(['nickname','avatar']);
|
||||
},
|
||||
])
|
||||
->order('create_time DESC');
|
||||
->order('create_time DESC')
|
||||
->order('id DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page,$limit)->select();
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ class RecordRepository extends BaseRepository{
|
|||
$query->field('order_id,order_sn');
|
||||
}
|
||||
])
|
||||
->order('create_time DESC');
|
||||
->order('create_time DESC')
|
||||
->order('id DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page,$limit)->select();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
namespace app\controller\admin\store\marketing;
|
||||
|
||||
use app\common\model\store\platformCommission\LegumesLog;
|
||||
use app\common\repositories\store\platformCommission\LegumesLogRepository;
|
||||
use app\common\repositories\store\platformCommission\LegumesRepository;
|
||||
use app\common\repositories\store\platformCommission\PartnerSettlementCycleRepository;
|
||||
use app\common\repositories\store\platformCommission\PartnerSettlementRepository;
|
||||
use app\common\repositories\store\platformCommission\RecordRepository;
|
||||
|
|
@ -99,7 +102,7 @@ class PlatformCommission extends BaseController{
|
|||
|
||||
|
||||
/**
|
||||
* Common: 合伙人佣金结算记录 - 周期记录
|
||||
* Common: 合伙人佣金结算记录 - 周期记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/28 16:09
|
||||
* @return mixed
|
||||
|
|
@ -110,7 +113,12 @@ class PlatformCommission extends BaseController{
|
|||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
// 合伙人佣金结算记录 - 明细记录
|
||||
/**
|
||||
* Common: 合伙人佣金结算记录 - 明细记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/28 16:41
|
||||
* @return mixed
|
||||
*/
|
||||
public function partnerList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid', 'cycle_id']);
|
||||
|
|
@ -118,8 +126,55 @@ class PlatformCommission extends BaseController{
|
|||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
/**
|
||||
* Common: 豆豆统计明细
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 14:45
|
||||
* @return mixed
|
||||
*/
|
||||
public function legumesTitle(){
|
||||
$params = $this->request->params(['uid','legumes_id']);
|
||||
$legumesModel = app()->make(LegumesRepository::class)->getSearch([]);
|
||||
$legumesLogModel = (new LegumesLog())
|
||||
->when((int)$params['uid'] > 0,function($query) use ($params){
|
||||
$query->where('uid', (int)$params['uid']);
|
||||
})
|
||||
->whereIn('status', [0,1]);
|
||||
|
||||
return app('json')->success([
|
||||
['className' => 'el-icon-coin','count' => $legumesModel->sum('total_platform_commission_money'),'name' => '基金池总数'],
|
||||
['className' => 'el-icon-coin','count' => $legumesLogModel->sum('get_legumes'),'name' => '已产生豆豆'],
|
||||
['className' => 'el-icon-coin','count' => $legumesLogModel->sum('order_money'),'name' => '订单总金额(积分上限)'],
|
||||
['className' => 'el-icon-coin','count' => $legumesLogModel->sum('get_integral'),'name' => '已产生积分'],
|
||||
['className' => 'el-icon-coin','count' => $legumesLogModel->sum('use_integral'),'name' => '已使用积分'],
|
||||
['className' => 'el-icon-coin','count' => $legumesLogModel->where('status',0)->sum('use_integral'),'name' => '冻结中积分'],
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Common: 豆豆 - 周期结算记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 13:38
|
||||
* @return mixed
|
||||
*/
|
||||
public function legumesCycleList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$data = app()->make(LegumesRepository::class)->getRecordList((int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
/**
|
||||
* Common: 豆豆 - 豆豆分配记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 14:00
|
||||
* @return mixed
|
||||
*/
|
||||
public function legumesList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid','legumes_id']);
|
||||
$data = app()->make(LegumesLogRepository::class)->getRecordList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class SparateLegumesJob implements JobInterface{
|
|||
$getLegumes = sprintf("%.3f",$cycleLegumes['legumes_num'] * $rate / 100);
|
||||
// 信息记录
|
||||
$insertData[] = [
|
||||
'uid' => $orderInfo['uid'],
|
||||
'legumes_id' => $data['legumes_id'],
|
||||
'order_id' => $orderInfo['order_id'],
|
||||
'cycle_total_legumes' => $cycleLegumes['legumes_num'],
|
||||
|
|
|
|||
|
|
@ -454,6 +454,16 @@ Route::group(function () {
|
|||
Route::get('partner_list', '.platformCommission/partnerList')->name('platformCommissionPartnerList')->option([
|
||||
'_alias' => '结算周期明细',
|
||||
]);
|
||||
// 豆豆和积分
|
||||
Route::get('legumes_title', '.platformCommission/legumesTitle')->name('platformCommissionLegumesTitle')->option([
|
||||
'_alias' => '豆豆统计',
|
||||
]);
|
||||
Route::get('legumes_cycle_list', '.platformCommission/legumesCycleList')->name('platformCommissionLegumesCycleList')->option([
|
||||
'_alias' => '豆豆结算周期',
|
||||
]);
|
||||
Route::get('legumes_list', '.platformCommission/legumesList')->name('platformCommissionLegumesList')->option([
|
||||
'_alias' => '豆豆结算周期明细',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue