WIN-2308041133\Administrator 5 月之前
父节点
当前提交
68124fe4e8

+ 54 - 0
app/common/dao/user/AwardLakeLogDao.php

@@ -0,0 +1,54 @@
+<?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\common\dao\user;
+
+
+use app\common\dao\BaseDao;
+use app\common\model\BaseModel;
+use app\common\model\user\AwardIntegralPrice;
+use app\common\model\user\AwardLake;
+use app\common\model\user\AwardLakeLog;
+
+/**
+ * Class AwardLakLogDao
+ * @package app\common\dao\user
+ * @author xaboy
+ * @day 2020-05-07
+ */
+class AwardLakeLogDao extends BaseDao
+{
+
+    /**
+     * @return BaseModel
+     * @author xaboy
+     * @day 2020-03-30
+     */
+    protected function getModel(): string
+    {
+        return AwardLakeLog::class;
+    }
+
+    public function search($where)
+    {
+//        return $this->getModel()::getDB()->where($where);
+        $query = $this->getModel()::getDB()
+            ->when(isset($where['type']) && $where['type'] !== '',function($query) use($where){
+                $query->where('type',$where['type']);
+            })->when(isset($where['pm']) && $where['pm'] !== '',function($query) use($where){
+                $query->where('pm',$where['pm']);
+            });
+        return $query;
+    }
+
+}

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

@@ -18,6 +18,7 @@ use app\common\dao\user\AwardIntegralPriceDao;
 use app\common\dao\user\AwardLakeDao;
 use app\common\model\store\order\StoreOrder;
 use app\common\model\user\AwardIntegralPrice;
+use app\common\model\user\AwardLakeLog;
 use app\common\model\user\UserExtract;
 use app\common\repositories\BaseRepository;
 
@@ -139,6 +140,30 @@ class AwardIntegralPriceRepository extends BaseRepository
         // 统计满足条件的数据总数
         $count = $query->count();
 
+        // 查询满足条件的数据列表,带有 'label' 关联数据,按 'label_rule_id' 倒序排列
+        // 分页查询,返回当前页码的 $limit 条数据,并将结果转换为数组形式
+        $list = $query->page($page, $limit)->select()->toArray();
+        // 返回包含数据总数和数据列表的数组
+        return compact('count', 'list');
+    }
+    /**
+     * 根据条件获取列表数据
+     *
+     *  每日奖池列表
+     * @param array $where 查询条件数组,用于指定数据库查询的条件。
+     * @param int $page 当前页码,用于指定要返回的页码。
+     * @param int $limit 每页的数据数量,用于指定每页返回的数据条数。
+     * @return array 返回包含 'count' 和 'list' 两个元素的数组,'count' 为数据总数,'list' 为数据列表。
+     */
+    public function getLakeLogList(array $where, $page, $limit)
+    {
+        // 根据条件查询数据,$where 为查询条件数组
+        $mark = app()->make(AwardLakeLogDao::class);
+        $query = $mark->search($where);
+
+        // 统计满足条件的数据总数
+        $count = $query->count();
+
         // 查询满足条件的数据列表,带有 'label' 关联数据,按 'label_rule_id' 倒序排列
         // 分页查询,返回当前页码的 $limit 条数据,并将结果转换为数组形式
         $list = $query->page($page, $limit)->select()->toArray();

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

@@ -68,6 +68,18 @@ class Award extends BaseController
         $where = $this->request->params(['type']);
         return app('json')->success($this->repository->getLakeList($where, $page, $limit));
     }
+    /**
+     * 奖池变动记录列表
+     * @return \think\response\Json
+     * @author Qinii
+     * @day 2023/9/24
+     */
+    public function lake_log_lst()
+    {
+        [$page, $limit] = $this->getPage();
+        $where = $this->request->params(['type','pm']);
+        return app('json')->success($this->repository->getLakeList($where, $page, $limit));
+    }
     /**
      *  列表
      * @return \think\response\Json