55 行
1.4 KiB
PHP
55 行
1.4 KiB
PHP
<?php
|
|
|
|
namespace addons\shopro\controller;
|
|
|
|
use addons\shopro\exception\Exception;
|
|
use addons\shopro\model\Store as ModelStore;
|
|
use addons\shopro\model\User;
|
|
use addons\shopro\model\UserStore;
|
|
|
|
class Store extends Base
|
|
{
|
|
|
|
protected $noNeedLogin = [];
|
|
protected $noNeedRight = ['*'];
|
|
|
|
public function index()
|
|
{
|
|
$this->error('门店管理功能已关闭');
|
|
$user = User::info();
|
|
$userStore = UserStore::where('user_id', $user->id)->select();
|
|
$store_id_arr = array_column($userStore, 'store_id');
|
|
|
|
$stores = [];
|
|
if ($store_id_arr) {
|
|
$stores = ModelStore::show()->where('id', 'in', $store_id_arr)->select();
|
|
}
|
|
|
|
$this->success('获取门店列表', $stores);
|
|
}
|
|
|
|
/**
|
|
* 获取门店列表
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function getStoreList()
|
|
{
|
|
$page = input('param.page/d', 1);
|
|
$result = ModelStore::where(['status' => 1])
|
|
->field('content,status,createtime,updatetime,deletetime', true)
|
|
->paginate(10, false, [
|
|
'page' => $page
|
|
]);
|
|
|
|
$data = [
|
|
'list' => $result->items(),
|
|
'total' => $result->total(),
|
|
'page' => $result->currentPage(),
|
|
'pageSize' => $result->listRows(),
|
|
'totalSize' => $result->lastPage()
|
|
];
|
|
|
|
$this->success('获取门店列表成功', $data);
|
|
}
|
|
}
|