diff --git a/app/common/repositories/user/IntegralRepository.php b/app/common/repositories/user/IntegralRepository.php index 2219887..e02d993 100644 --- a/app/common/repositories/user/IntegralRepository.php +++ b/app/common/repositories/user/IntegralRepository.php @@ -132,6 +132,46 @@ class IntegralRepository extends BaseRepository return compact('count','list'); } + /** + * Common: 获取全部持有积分信息 + * Author: wu-hui + * Time: 2023/11/10 17:02 + * @param int $uid + * @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 getAllIntegralList(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['mer_id'] > 0,function($query) use ($params){ + $query->where('mer_id', (int)$params['mer_id']); + }) + ->with([ + 'mer' => function($query){ + $query->field('mer_id,mer_name,mer_avatar')->bind(['mer_name','mer_avatar']); + }, + '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'); + } + + + + + + diff --git a/app/controller/admin/user/UserIntegral.php b/app/controller/admin/user/UserIntegral.php index c2d3de8..a72a014 100644 --- a/app/controller/admin/user/UserIntegral.php +++ b/app/controller/admin/user/UserIntegral.php @@ -17,6 +17,7 @@ use app\common\repositories\store\ExcelRepository; use app\common\repositories\system\CacheRepository; use app\common\repositories\system\config\ConfigClassifyRepository; use app\common\repositories\system\config\ConfigValueRepository; +use app\common\repositories\user\IntegralRepository; use app\common\repositories\user\UserBillRepository; use app\validate\admin\IntegralConfigValidate; use crmeb\basic\BaseController; @@ -88,4 +89,20 @@ class UserIntegral extends BaseController app()->make(ConfigValueRepository::class)->save($cid, $config, 0); return app('json')->success('保存成功'); } + + // 持有积分列表 + public function holdIntegral(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid','mer_id']); + + $data = app()->make(IntegralRepository::class)->getAllIntegralList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + + + + + + } diff --git a/route/admin/marketing.php b/route/admin/marketing.php index 68fe6cd..0d89af4 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -61,6 +61,20 @@ Route::group(function () { ] ]); + Route::group('user/integral', function () { + Route::get('hold_list', '.UserIntegral/holdIntegral')->name('systemUserIntegralHoldList')->option([ + '_alias' => '持有积分', + ]); + + + + })->prefix('admin.user')->option([ + '_path' => '/marketing/integral/hold', + '_auth' => true, + ]); + + + //预售商品 Route::group('store/product/presell', function () { Route::get('lst', 'StoreProductPresell/lst')->name('systemStoreProductPresellLst')->option([