小程序门店列表
This commit is contained in:
parent
feb7242b4f
commit
cfeb53e4f0
app/api
17
app/api/controller/store/StoreController.php
Normal file
17
app/api/controller/store/StoreController.php
Normal file
@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
71
app/api/lists/store/SystemStoreLists.php
Normal file
71
app/api/lists/store/SystemStoreLists.php
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user