小程序门店列表

This commit is contained in:
liu 2024-06-01 14:56:45 +08:00
parent feb7242b4f
commit cfeb53e4f0
2 changed files with 88 additions and 0 deletions
app/api
controller/store
lists/store

@ -0,0 +1,17 @@
<?php
namespace app\api\controller\store;
use app\api\lists\store\SystemStoreLists;
use app\api\controller\BaseApiController;
class StoreController extends BaseApiController
{
public function lists()
{
return $this->dataLists(new SystemStoreLists());
}
}

@ -0,0 +1,71 @@
<?php
namespace app\api\lists\store;
use app\admin\lists\BaseAdminDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\system_store\SystemStore;
use app\common\lists\ListsSearchInterface;
/**
* 门店列表列表
* Class SystemStoreLists
* @package app\admin\listssystem_store
*/
class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/05/31 17:45
*/
public function setSearch(): array
{
return [
'=' => ['phone'],
'%like%' => ['name'],
];
}
/**
* @notes 获取门店列表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/05/31 17:45
*/
public function lists(): array
{
$where[]=['is_show','=',YesNoEnum::YES];
return SystemStore::where($this->searchWhere)->where($where)
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show',
'day_time','is_store','latitude','longitude'
])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取门店列表数量
* @return int
* @author admin
* @date 2024/05/31 17:45
*/
public function count(): int
{
$where[]=['is_show','=',YesNoEnum::YES];
return SystemStore::where($this->searchWhere)->where($where)->count();
}
}