添加:用户豆豆和积分持有信息
This commit is contained in:
parent
5088c3b5b3
commit
10a0882129
|
|
@ -48,6 +48,60 @@ class LegumesLogRepository extends BaseRepository{
|
|||
|
||||
return compact('count','list');
|
||||
}
|
||||
/**
|
||||
* Common: 豆豆持有信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/02 15:57
|
||||
* @param array $params
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getHoldList(array $params,int $page,int $limit):array{
|
||||
$query = $this->dao->getSearch([])
|
||||
->field([
|
||||
'uid',
|
||||
'sum(order_money) as total_order_money',
|
||||
'sum(get_legumes) as total_get_legumes',
|
||||
'sum(get_integral) as total_get_integral',
|
||||
'sum(use_integral) as total_use_integral',
|
||||
])
|
||||
->when((int)$params['uid'] > 0,function($query) use ($params){
|
||||
$query->where('uid', (int)$params['uid']);
|
||||
})
|
||||
->whereIn('status',[0,1])
|
||||
->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)->group('uid')->select()->toArray();
|
||||
// 获取冻结中积分
|
||||
$ids = array_column($list,'uid');
|
||||
$freeze = $this->dao->getSearch([])
|
||||
->field('uid,sum(get_integral) as total_get_integral')
|
||||
->whereIn('uid',$ids)
|
||||
->where('status',0)
|
||||
->group('uid')
|
||||
->select()
|
||||
->toArray();
|
||||
$freeze = array_column($freeze,'total_get_integral','uid');
|
||||
foreach($list as &$singleInfo){
|
||||
// 总冻结积分
|
||||
$singleInfo['total_freeze_integral'] = $freeze[$singleInfo['uid']];
|
||||
// 可使用积分
|
||||
$reduce = (float)sprintf("%.2f",$singleInfo['total_freeze_integral'] + $singleInfo['total_use_integral']);// 冻结 + 已使用积分
|
||||
$singleInfo['surplus_use_integral'] = (float)sprintf("%.2f",$singleInfo['total_get_integral'] - $reduce);
|
||||
}
|
||||
|
||||
return compact('count','list');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common: 查询需要使用的分配信息 尽可能仅查询需要使用的信息
|
||||
* Author: wu-hui
|
||||
|
|
|
|||
|
|
@ -126,8 +126,10 @@ class PlatformCommission extends BaseController{
|
|||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 豆豆统计明细
|
||||
* Common: 豆豆 - 统计明细
|
||||
* Author: wu-hui
|
||||
* Time: 2023/12/29 14:45
|
||||
* @return mixed
|
||||
|
|
@ -178,6 +180,19 @@ class PlatformCommission extends BaseController{
|
|||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
/**
|
||||
* Common: 豆豆 - 豆豆持有信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/02 15:25
|
||||
* @return mixed
|
||||
*/
|
||||
public function holdList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid']);
|
||||
$data = app()->make(LegumesLogRepository::class)->getHoldList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -464,6 +464,9 @@ Route::group(function () {
|
|||
Route::get('legumes_list', '.platformCommission/legumesList')->name('platformCommissionLegumesList')->option([
|
||||
'_alias' => '豆豆结算周期明细',
|
||||
]);
|
||||
Route::get('legumes_hold_list', '.platformCommission/holdList')->name('platformCommissionHoldList')->option([
|
||||
'_alias' => '豆豆持有信息',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue