|
|
@@ -0,0 +1,64 @@
|
|
|
+<?php
|
|
|
+namespace app\api\lists;
|
|
|
+
|
|
|
+use app\adminapi\lists\BaseAdminDataLists;
|
|
|
+use app\common\model\home_service\HomeSpecial;
|
|
|
+use app\common\lists\ListsSearchInterface;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * HomeSpecial列表
|
|
|
+ * Class HomeSpecialLists
|
|
|
+ * @package app\api\listshome_service
|
|
|
+ */
|
|
|
+class HomeSpecialLists extends BaseApiDataLists implements ListsSearchInterface
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 设置搜索条件
|
|
|
+ * @return \string[][]
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/11/18 10:05
|
|
|
+ */
|
|
|
+ public function setSearch(): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ '=' => ['special_type'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 获取列表
|
|
|
+ * @return array
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/11/18 10:05
|
|
|
+ */
|
|
|
+ public function lists(): array
|
|
|
+ {
|
|
|
+ return HomeSpecial::where($this->searchWhere)
|
|
|
+ ->where('status',1)
|
|
|
+ ->field(['id', 'special_type', 'title', 'cover_type', 'cover', 'user_head', 'user_nickname', 'vue_web', 'vue_param', 'view_num', 'tags', 'status'])
|
|
|
+ ->limit($this->limitOffset, $this->limitLength)
|
|
|
+ ->order(['id' => 'desc'])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 获取数量
|
|
|
+ * @return int
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/11/18 10:05
|
|
|
+ */
|
|
|
+ public function count(): int
|
|
|
+ {
|
|
|
+ return HomeSpecial::where($this->searchWhere)->count();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|