添加:客服端 - 豆豆积分明细及统计接口
This commit is contained in:
parent
a94ac58e34
commit
beaae893ff
|
|
@ -101,7 +101,45 @@ class LegumesLogRepository extends BaseRepository{
|
|||
|
||||
return compact('count','list');
|
||||
}
|
||||
/**
|
||||
* Common: 获取统计信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/04 11:28
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getStatistics(array $params){
|
||||
$data = [
|
||||
'integral_upper_limit' => $this->getModel($params)->sum('order_money'),// 积分释放上限
|
||||
'get_legumes' => $this->getModel($params)->sum('get_legumes'),// 总获得豆豆
|
||||
'refund_get_legumes' => $this->getModel($params)->sum('refund_get_legumes'),// 退款减少豆豆
|
||||
'get_integral' => $this->getModel($params)->sum('get_integral'),// 获得积分
|
||||
'freeze_integral' => $this->getModel($params)->where('status',0)->sum('get_integral'),// 冻结中积分
|
||||
'used_integral' => $this->getModel($params)->where('status',1)->sum('get_integral'),// 可用积分
|
||||
'use_integral' => $this->getModel($params)->sum('use_integral'),// 已使用积分
|
||||
];
|
||||
|
||||
// 实际获得豆豆
|
||||
$data['reality_get_legumes'] = (float)sprintf("%.2f",$data['get_legumes'] - $data['refund_get_legumes']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* Common: 查询model(统计查询使用)
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/04 11:46
|
||||
* @return \app\common\model\BaseModel
|
||||
*/
|
||||
public function getModel($params){
|
||||
return $this->dao->getSearch([])
|
||||
->when((int)$params['uid'] > 0,function($query) use ($params){
|
||||
$query->where('uid', (int)$params['uid']);
|
||||
})
|
||||
->when(isset($params['status']) && $params['status'] !== '',function($query) use($params){
|
||||
$query->where('status',$params['status']);
|
||||
})
|
||||
->whereIn('status',[0,1]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
namespace app\controller\api\store\marketing;
|
||||
|
||||
|
||||
use app\common\repositories\store\platformCommission\LegumesLogRepository;
|
||||
use app\common\repositories\store\platformCommission\RecordRepository;
|
||||
use think\App;
|
||||
use crmeb\basic\BaseController;
|
||||
|
||||
class PlatformCommission extends BaseController{
|
||||
|
||||
protected $repository;
|
||||
protected $userInfo;
|
||||
|
||||
public function __construct(App $app, RecordRepository $repository){
|
||||
parent::__construct($app);
|
||||
$this->repository = $repository;
|
||||
$this->userInfo =$this->request->isLogin() ? $this->request->userInfo():null;
|
||||
}
|
||||
/**
|
||||
* Common: 统计信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/04 11:14
|
||||
* @return mixed
|
||||
*/
|
||||
public function recordStatistics(){
|
||||
$params = $this->request->params(['uid', 'status']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
$statistics = app()->make(LegumesLogRepository::class)->getStatistics($params);
|
||||
$statisticsList = [
|
||||
['title' => '已获得豆','value' => $statistics['reality_get_legumes']],
|
||||
['title' => '积分释放上限','value' => $statistics['integral_upper_limit']],
|
||||
['title' => '已释放积分','value' => $statistics['get_integral']],
|
||||
['title' => '可用积分','value' => $statistics['used_integral']],
|
||||
['title' => '已使用积分','value' => $statistics['use_integral']],
|
||||
['title' => '冻结中积分','value' => $statistics['freeze_integral']],
|
||||
];
|
||||
|
||||
return app('json')->success($statisticsList);
|
||||
}
|
||||
/**
|
||||
* Common: 获取列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/04 11:31
|
||||
* @return mixed
|
||||
*/
|
||||
public function recordList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid','legumes_id','status']);
|
||||
$data = app()->make(LegumesLogRepository::class)->getRecordList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -365,8 +365,25 @@ Route::group('api/', function () {
|
|||
Route::post('deleate/:id', 'PointsOrder/del');
|
||||
})->prefix('api.store.order.');
|
||||
|
||||
})->middleware(UserTokenMiddleware::class, true);
|
||||
//平台抽成相关
|
||||
Route::group('platformCommission', function () {
|
||||
// 统计
|
||||
Route::get('statistics', 'PlatformCommission/recordStatistics');
|
||||
// 记录列表
|
||||
Route::get('record_list', 'PlatformCommission/recordList');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})->prefix('api.store.marketing.');
|
||||
|
||||
|
||||
|
||||
|
||||
})->middleware(UserTokenMiddleware::class, true);
|
||||
//非强制登录
|
||||
Route::group(function () {
|
||||
// 付费会员
|
||||
|
|
@ -562,26 +579,21 @@ Route::group('api/', function () {
|
|||
})->prefix('api.Diy');
|
||||
|
||||
})->middleware(UserTokenMiddleware::class, false);
|
||||
|
||||
//微信支付回调
|
||||
Route::any('notice/wechat_pay', 'api.Common/wechatNotify')->name('wechatNotify');
|
||||
//微信支付回调
|
||||
Route::any('notice/wechat_combine_pay/:type', 'api.Common/wechatCombinePayNotify')->name('wechatCombinePayNotify');
|
||||
Route::any('notice/routine_combine_pay/:type', 'api.Common/routineCombinePayNotify')->name('routineCombinePayNotify');
|
||||
|
||||
Route::any('notice/callback', 'api.Common/deliveryNotify');
|
||||
|
||||
//小程序支付回调
|
||||
Route::any('notice/routine_pay', 'api.Common/routineNotify')->name('routineNotify');
|
||||
//支付宝支付回调
|
||||
Route::any('notice/alipay_pay/:type', 'api.Common/alipayNotify')->name('alipayNotify');
|
||||
Route::any('getVersion', 'api.Common/getVersion')->name('getVersion');
|
||||
|
||||
//城市列表
|
||||
Route::get('system/city/lst', 'merchant.store.shipping.City/getlist');
|
||||
Route::get('v2/system/city/lst/:pid', 'merchant.store.shipping.City/lstV2');
|
||||
Route::get('v2/system/city', 'merchant.store.shipping.City/cityList');
|
||||
|
||||
//热门搜索
|
||||
Route::get('common/hot_keyword', 'api.Common/hotKeyword')->append(['type' => 0]);
|
||||
//社区热门搜索
|
||||
|
|
@ -636,12 +648,9 @@ Route::group('api/', function () {
|
|||
Route::get('agreement_lst', 'admin.system.Cache/getKeyLst')->append(['type' => 1]);
|
||||
//获取协议内容
|
||||
Route::get('agreement/:key', 'admin.system.Cache/getAgree');
|
||||
|
||||
Route::get('copyright', 'api.Common/copyright');
|
||||
|
||||
Route::get('script', 'api.Common/script');
|
||||
Route::get('appVersion', 'api.Common/appVersion');
|
||||
|
||||
Route::get('navigation', 'api.Common/getNavigation');
|
||||
Route::get('micro', 'api.Common/micro');
|
||||
Route::get('version', 'admin.Common/version');
|
||||
|
|
@ -649,8 +658,9 @@ Route::group('api/', function () {
|
|||
//滑块验证码
|
||||
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
|
||||
Route::post('ajcheck', 'api.Auth/ajcheck');
|
||||
|
||||
Route::get('open_screen', 'api.Common/open_screen');
|
||||
|
||||
|
||||
})->middleware(AllowOriginMiddleware::class)
|
||||
->middleware(InstallMiddleware::class)
|
||||
->middleware(CheckSiteOpenMiddleware::class)
|
||||
|
|
|
|||
Loading…
Reference in New Issue