| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\models\system;
- use app\admin\model\system\SystemAdmin;
- use app\models\user\User;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- /**
- * 门店自提 model
- * Class SystemStore
- * @package app\model\system
- */
- class SystemStoreApply extends BaseModel
- {
- use ModelTrait;
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'system_store_apply';
- /**
- * 获取门店列表
- * @param $where
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public static function getList($where)
- {
- $model = new self();
- if (isset($where['name']) && $where['name'] != '') {
- $model = $model->where('id|name|introduction', 'like', '%' . $where['name'] . '%');
- }
- if (isset($where['type']) && $where['type'] != '' && ($data = self::setData($where['type']))) {
- $model = $model->where($data);
- }
- $count = $model->count();
- $data = $model->page((int)$where['page'], (int)$where['limit'])->select();
- foreach ($data as &$v) {
- $v['user'] = User::where('uid', $v['uid'])->value('nickname') . '/' . $v['uid'];
- }
- return compact('count', 'data');
- }
- /**
- * 获取连表查询条件
- * @param $type
- * @return array
- */
- public static function setData($type)
- {
- switch ((int)$type) {
- case 1:
- $data = ['status' => 1];
- break;
- case 2:
- $data = ['status' => 0];
- break;
- case 3:
- $data = ['status' => 2];
- break;
- };
- return isset($data) ? $data : [];
- }
- }
|