WIN-2308041133\Administrator преди 5 месеца
родител
ревизия
d786996828
променени са 4 файла, в които са добавени 182 реда и са изтрити 0 реда
  1. 40 0
      app/common/repositories/user/AwardIntegralPriceRepository.php
  2. 55 0
      app/controller/admin/user/Award.php
  3. 44 0
      app/controller/api/user/Award.php
  4. 43 0
      route/admin/award.php

+ 40 - 0
app/common/repositories/user/AwardIntegralPriceRepository.php

@@ -81,4 +81,44 @@ class AwardIntegralPriceRepository extends BaseRepository
         $add_time = time();
         return $this->dao->create(compact('day', 'price', 'commission', 'achievement', 'num', 'add_time'));
     }
+    /**
+     *  列表搜索
+     * @param int $merId
+     * @param array $where
+     * @param $page
+     * @param $limit
+     * @return array
+     * @author Qinii
+     */
+    public function search(int $merId, array $where, $page, $limit)
+    {
+        $query = $this->dao->search($merId, $where)->order('add_time DESC');
+        $count = $query->count($this->dao->getPk());
+        $list = $query->page($page, $limit)->hidden(['update_time'])->select();
+        return compact('count', 'list');
+    }
+    /**
+     * 根据条件获取列表数据
+     *
+     * 奖池列表
+     * @param array $where 查询条件数组,用于指定数据库查询的条件。
+     * @param int $page 当前页码,用于指定要返回的页码。
+     * @param int $limit 每页的数据数量,用于指定每页返回的数据条数。
+     * @return array 返回包含 'count' 和 'list' 两个元素的数组,'count' 为数据总数,'list' 为数据列表。
+     */
+    public function getList(array $where, $page, $limit)
+    {
+        // 根据条件查询数据,$where 为查询条件数组
+        $query = $this->dao->search($where);
+
+        // 统计满足条件的数据总数
+        $count = $query->count();
+
+        // 查询满足条件的数据列表,带有 'label' 关联数据,按 'label_rule_id' 倒序排列
+        // 分页查询,返回当前页码的 $limit 条数据,并将结果转换为数组形式
+        $list = $query->with(['label'])->order('label_rule_id DESC')->page($page, $limit)->select()->toArray();
+
+        // 返回包含数据总数和数据列表的数组
+        return compact('count', 'list');
+    }
 }

+ 55 - 0
app/controller/admin/user/Award.php

@@ -0,0 +1,55 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+
+namespace app\controller\admin\user;
+
+
+use app\common\repositories\store\ExcelRepository;
+use app\common\repositories\user\AwardIntegralPriceRepository;
+use app\common\repositories\user\UserInfoRepository;
+use crmeb\basic\BaseController;
+use app\common\repositories\user\UserBillRepository;
+use crmeb\services\ExcelService;
+use think\App;
+
+/**
+ * Class Award
+ * app\controller\admin\user
+ * 用户扩展字段设置
+ */
+class Award extends BaseController
+{
+    protected $repository;
+
+    public function __construct(App $app, AwardIntegralPriceRepository $repository)
+    {
+        parent::__construct($app);
+        $this->repository = $repository;
+    }
+
+    /**
+     *  列表
+     * @return \think\response\Json
+     * @author Qinii
+     * @day 2023/9/24
+     */
+    public function lst()
+    {
+        [$page, $limit] = $this->getPage();
+        $where = $this->request->params(['date']);
+        return app('json')->success($this->repository->getList($where, $page, $limit));
+    }
+
+
+
+}

+ 44 - 0
app/controller/api/user/Award.php

@@ -0,0 +1,44 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+
+namespace app\controller\api\user;
+
+use app\common\repositories\user\AwardIntegralPriceRepository;
+use crmeb\basic\BaseController;
+use think\App;
+
+class Award extends BaseController
+{
+    protected $repository;
+
+    public function __construct(App $app, AwardIntegralPriceRepository $repository)
+    {
+        parent::__construct($app);
+        $this->repository = $repository;
+    }
+
+
+    /**
+     * 用户反馈列表
+     * @return mixed
+     * @author xaboy
+     * @day 2020/5/28
+     */
+    public function feedbackList()
+    {
+        [$page, $limit] = $this->getPage();
+        return app('json')->success($this->repository->getList(['uid' => $this->request->uid(),'is_del' => 0], $page, $limit));
+    }
+
+
+}

+ 43 - 0
route/admin/award.php

@@ -0,0 +1,43 @@
+<?php
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+use think\facade\Route;
+use app\common\middleware\AdminAuthMiddleware;
+use app\common\middleware\AdminTokenMiddleware;
+use app\common\middleware\AllowOriginMiddleware;
+use app\common\middleware\LogMiddleware;
+
+Route::group(function () {
+
+    //积分价格
+    Route::group('system/award/price', function () {
+//        Route::get('create/form', '/createForm')->name('systemArticleCategoryCreateForm')->option([
+//            '_alias' => '文章分类添加表单',
+//            '_auth' => false,
+//            '_form' => 'systemArticleCategoryCreate',
+//        ]);
+        Route::get('lst', '/lst')->name('systemAwardPriceLst')->option([
+            '_alias' => '积分价格列表',
+        ]);
+//        Route::get('select', '/select')->option([
+//            '_alias' => '文章分类筛选',
+//            '_auth'  => false,
+//        ]);
+    })->prefix('admin.user.award')->option([
+        '_path' => '/cms/articleCategory',
+        '_auth' => true,
+    ]);
+
+
+})->middleware(AllowOriginMiddleware::class)
+    ->middleware(AdminTokenMiddleware::class, true)
+    ->middleware(AdminAuthMiddleware::class)
+    ->middleware(LogMiddleware::class);