增加:用户共创股东相关接口
This commit is contained in:
parent
dc5d458047
commit
e1780f4512
|
|
@ -76,7 +76,41 @@ class MerchantShareholderIntegralRepository extends BaseRepository{
|
||||||
|
|
||||||
return compact('count','list');
|
return compact('count','list');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取统计信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/06/20 16:44
|
||||||
|
* @param $params
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getStatistics($params){
|
||||||
|
$info = $this->getSearchModel($params)
|
||||||
|
->field([
|
||||||
|
'SUM(integral_total) as sum_integral_total',
|
||||||
|
'SUM(integral_use) as sum_integral_use',
|
||||||
|
'SUM(CASE status WHEN 2 THEN (integral_total - integral_use) ELSE 0 END) as sum_used_overdue',// 已过期可用
|
||||||
|
'SUM(CASE status WHEN 0 THEN integral_total ELSE 0 END) as sum_used_freeze',// 冻结中可用
|
||||||
|
'SUM(CASE status WHEN 1 THEN (integral_total - integral_use) ELSE 0 END) as sum_used_surplus',// 当前可用
|
||||||
|
])
|
||||||
|
->findOrEmpty()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return $info ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户绑定商户列表
|
||||||
|
public function getMerList(array $params,int $page,int $limit){
|
||||||
|
// 获取股东列表
|
||||||
|
$data = app()->make(MerchantShareholderRepository::class)->getList($params,$page,$limit);
|
||||||
|
foreach($data['list'] as &$item){
|
||||||
|
$item->statistics = $this->getStatistics([
|
||||||
|
'uid' => $item->uid,
|
||||||
|
'mer_id' => $item->mer_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
namespace app\controller\api\store\merchant;
|
namespace app\controller\api\store\merchant;
|
||||||
|
|
||||||
use app\common\repositories\system\merchant\MerchantRepository;
|
use app\common\repositories\system\merchant\MerchantRepository;
|
||||||
|
use app\common\repositories\system\merchant\MerchantShareholderIntegralRepository;
|
||||||
use app\common\repositories\system\merchant\MerchantShareholderLevelRepository;
|
use app\common\repositories\system\merchant\MerchantShareholderLevelRepository;
|
||||||
use app\common\repositories\system\merchant\MerchantShareholderRepository;
|
use app\common\repositories\system\merchant\MerchantShareholderRepository;
|
||||||
use think\App;
|
use think\App;
|
||||||
|
|
@ -149,4 +150,58 @@ class Shareholder extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 用户餐费积分记录获取
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/06/20 16:45
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function integralRecord(){
|
||||||
|
// 参数获取
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
$params = $this->request->params([
|
||||||
|
['mer_id',0]
|
||||||
|
]);
|
||||||
|
$params['uid'] = $this->request->uid();
|
||||||
|
// 列表获取
|
||||||
|
$data = app()->make(MerchantShareholderIntegralRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 用户餐费积分统计信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/06/20 16:51
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function integralStatistic(){
|
||||||
|
// 参数获取
|
||||||
|
$params = $this->request->params([
|
||||||
|
['mer_id', '']
|
||||||
|
]);
|
||||||
|
$params['uid'] = $this->request->uid();
|
||||||
|
// 列表获取
|
||||||
|
$statistics = app()->make(MerchantShareholderIntegralRepository::class)->getStatistics((array)$params);
|
||||||
|
|
||||||
|
return app('json')->success($statistics);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取当前共创股东绑定的商户列表
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/06/21 10:22
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function merList(){
|
||||||
|
// 参数获取
|
||||||
|
$params['uid'] = $this->request->uid();
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
// 列表获取
|
||||||
|
$data = app()->make(MerchantShareholderIntegralRepository::class)->getMerList((array)$params,(int)$page,(int)$limit);
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -479,12 +479,18 @@ Route::group('api/', function () {
|
||||||
})->prefix('api.user.WithdrawalAccount/');
|
})->prefix('api.user.WithdrawalAccount/');
|
||||||
// 共创股东相关接口
|
// 共创股东相关接口
|
||||||
Route::group('mer/shareholder', function () {
|
Route::group('mer/shareholder', function () {
|
||||||
|
// 商户相关
|
||||||
Route::get('mer_info/:merId', 'merInfo');
|
Route::get('mer_info/:merId', 'merInfo');
|
||||||
Route::get('level_list', 'levelList');
|
Route::get('level_list', 'levelList');
|
||||||
Route::get('level_info/:id', 'levelInfo');
|
Route::get('level_info/:id', 'levelInfo');
|
||||||
Route::post('apply_join', 'applyJoin');
|
Route::post('apply_join', 'applyJoin');
|
||||||
Route::post('apply_join_info', 'applyJoinInfo');
|
Route::post('apply_join_info', 'applyJoinInfo');
|
||||||
Route::post('list', 'getList');
|
Route::post('list', 'getList');
|
||||||
|
// 用户相关
|
||||||
|
Route::get('integral_record', 'integralRecord');
|
||||||
|
Route::get('integral_statistic', 'integralStatistic');
|
||||||
|
Route::get('mer_list', 'merList');
|
||||||
|
|
||||||
})->prefix('api.store.merchant.Shareholder/');
|
})->prefix('api.store.merchant.Shareholder/');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue