moonsflyer 9 kuukautta sitten
vanhempi
commit
2d4dc0aa1f

+ 69 - 0
app/adminapi/controller/asset/AssetController.php

@@ -0,0 +1,69 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\controller\asset;
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\asset\AssetLists;
+use app\adminapi\logic\notice\NoticeLogic;
+use app\adminapi\validate\notice\NoticeValidate;
+
+/**
+ * 资产控制器
+ * Class NoticeController
+ * @package app\adminapi\controller\notice
+ */
+class AssetController extends BaseAdminController
+{
+    /**
+     * @notes 查看资产列表
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2021/12/29 9:55
+     */
+    public function lists()
+    {
+        return $this->dataLists(new AssetLists());
+    }
+
+    /**
+     * @notes 查看通知设置详情
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2022/3/29 11:18
+     */
+    public function detail()
+    {
+        $params = (new NoticeValidate())->goCheck('detail');
+        $result = NoticeLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+    /**
+     * @notes 通知设置
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2022/3/29 11:18
+     */
+    public function set()
+    {
+        $params = $this->request->post();
+        $result = NoticeLogic::set($params);
+        if ($result) {
+            return $this->success('设置成功');
+        }
+        return $this->fail(NoticeLogic::getError());
+    }
+}

+ 73 - 0
app/adminapi/lists/asset/AssetLists.php

@@ -0,0 +1,73 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\asset;
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\notice\NoticeSetting;
+use app\common\model\asset\AssetInfo;
+/**
+ * 资产管理
+ * Class AssetLists
+ * @package app\adminapi\lists\asset
+ */
+class AssetLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+    /**
+     * @notes 搜索条件
+     * @return \string[][]
+     * @author
+     * @date 2025/04/12 2:21 下午
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['name', 'status']
+        ];
+    }
+
+    /**
+     * @notes 资产信息列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function lists(): array
+    {
+        $lists = (new AssetInfo())->field('id,name,address,images,contacts,mobile,area,content,status,create_time,sort')
+            ->append(['status_desc'])
+            ->where($this->searchWhere)
+            ->limit($this->limitOffset, $this->limitLength)
+            ->Order('sort desc')
+            ->select()
+            ->toArray();
+
+        return $lists;
+    }
+
+    /**
+     * @notes 资产信息数量
+     * @return int
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function count(): int
+    {
+        return (new AssetInfo())->where($this->searchWhere)->count();
+    }
+}

+ 60 - 0
app/common/enum/asset/AssetEnum.php

@@ -0,0 +1,60 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+namespace app\common\enum\asset;
+
+/**
+ * 资产枚举
+ * Class AssetEnum
+ * @package app\common\enum
+ */
+class AssetEnum
+{
+    /**
+     * 状态场景
+     */
+    const STATTUS_SCENE = [
+        self::ENABLE,
+        self::DISABLE,
+
+    ];
+
+    //状态类型
+    const ENABLE = 1;//启用
+    const DISABLE = 0;//禁用
+
+
+    /**
+     * @notes 获取状态描述
+     * @param $sceneId
+     * @param false $flag
+     * @return string|string[]
+     * @author 段誉
+     * @date 2022/3/29 11:33
+     */
+    public static function getStatusDesc($sceneId, $flag = false)
+    {
+        $desc = [
+            self::ENABLE => '启用',
+            self::DISABLE => '禁用',
+        ];
+
+        if ($flag) {
+            return $desc;
+        }
+
+        return $desc[$sceneId] ?? '';
+    }
+
+
+}

+ 37 - 0
app/common/model/asset/AssetInfo.php

@@ -0,0 +1,37 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\asset;
+
+
+use app\common\enum\DefaultEnum;
+use app\common\enum\asset\AssetEnum;
+use app\common\model\BaseModel;
+
+class AssetInfo extends BaseModel
+{
+    /**
+     * @notes 状态类型
+     * @param $value
+     * @param $data
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getStatusDesc($data['status']);
+    }
+
+}