diff --git a/app/common/dao/marketing/activity/RecordDao.php b/app/common/dao/marketing/activity/RecordDao.php index 18339cd..04456f4 100644 --- a/app/common/dao/marketing/activity/RecordDao.php +++ b/app/common/dao/marketing/activity/RecordDao.php @@ -22,6 +22,11 @@ class RecordDao extends BaseDao{ ->when(isset($params['id']) && $params['id'] !== '',function($query) use ($params){ $query->where('id', (int)$params['id']); }) + ->with([ + 'user' => function($query){ + $query->field('uid,nickname,avatar'); + } + ]) ->order('create_time DESC,id DESC'); } diff --git a/app/common/dao/user/ExchangeQuotaRecordDao.php b/app/common/dao/user/ExchangeQuotaRecordDao.php index 920d7cd..65cae76 100644 --- a/app/common/dao/user/ExchangeQuotaRecordDao.php +++ b/app/common/dao/user/ExchangeQuotaRecordDao.php @@ -23,7 +23,7 @@ class ExchangeQuotaRecordDao extends BaseDao{ */ public function searchModel(array $params){ $quotaType = $params['quota_type'] ?? 1;// 存在指定类型则使用指定类型,否则使用默认类型(默认酒卡) - $quotaType = in_array((int)$quotaType,[1,2]) ? $quotaType : 1;// 类型非法,使用默认类型 + $quotaType = in_array((int)$quotaType,[1,2,3,4]) ? $quotaType : 1;// 类型非法,使用默认类型 return (new ExchangeQuotaRecord()) ->where('quota_type', $quotaType) diff --git a/app/common/model/marketing/activity/Record.php b/app/common/model/marketing/activity/Record.php index f1980f6..33128ae 100644 --- a/app/common/model/marketing/activity/Record.php +++ b/app/common/model/marketing/activity/Record.php @@ -2,11 +2,10 @@ namespace app\common\model\marketing\activity; use app\common\model\BaseModel; - +use app\common\model\user\User; class Record extends BaseModel{ - public static function tablePk():string{ return 'id'; } @@ -17,6 +16,9 @@ class Record extends BaseModel{ + public function user(){ + return $this->hasOne(User::class, 'uid', 'uid'); + } diff --git a/app/controller/admin/marketing/activity/Record.php b/app/controller/admin/marketing/activity/Record.php new file mode 100644 index 0000000..f66ea45 --- /dev/null +++ b/app/controller/admin/marketing/activity/Record.php @@ -0,0 +1,35 @@ +repository = $repository; + } + /** + * Common: 活动参与记录列表 + * Author: wu-hui + * Time: 2024/03/14 20:36 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function getList(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['title']); + $data = $this->repository->getList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + + +} diff --git a/route/admin/marketing.php b/route/admin/marketing.php index dbcc40e..a4f3e5b 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -512,7 +512,7 @@ Route::group(function () { Route::post('cate/delInfo','.Cate/delInfo')->name('systemMarketingActivityCateDel')->option([ '_alias' => '删除分类', ]); - // 活动列表 + // 活动 Route::get('list','.Activity/getList')->name('systemMarketingActivityList')->option([ '_alias' => '活动列表', ]); @@ -525,7 +525,10 @@ Route::group(function () { Route::post('delInfo','.Activity/delInfo')->name('systemMarketingActivityDel')->option([ '_alias' => '删除活动', ]); - + // 活动参与记录 + Route::get('record/list','.Record/getList')->name('systemMarketingActivityList')->option([ + '_alias' => '活动参加记录列表', + ]);