| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?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\article\Article;
- use app\common\model\notice\NoticeSetting;
- use app\common\model\asset\AssetInfo;
- use app\common\service\FileService;
- /**
- * 资产管理
- * 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();
- }
- /**
- * @notes 添加资产
- * @param array $params
- * @author heshihu
- * @date 2022/2/22 9:57
- */
- public static function add(array $params)
- {
- AssetInfo::create([
- 'name' => $params['name'],
- 'images' => $params['images'] ?? '',
- 'address' => $params['address'] ?? '',
- 'contacts' => $params['contacts']?? '', // 联系人
- 'mobile' => $params['mobile'] ?? '',
- 'area' => $params['area'] ?? '',
- 'content' => $params['content'] ?? '',
- // 'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
- 'status' => $params['status'] ?? 1,
- 'sort' => $params['sort'] ?? 0, // 排序
- ]);
- }
- }
|