| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\admin\model\store;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- class StoreProductProvider extends BaseModel
- {
- protected $pk = 'id';
- protected $name = 'store_product_provider';
- use ModelTrait;
- /**
- * 获取查询条件
- * @param $where
- * @param string $alert
- * @param null $model
- * @return StoreProductProvider|null
- */
- public static function setWhere($where, $alias='', $model=null)
- {
- $model=$model===null ? new self() : $model;
- if($alias) {
- $model=$model->alias($alias);
- }
- $alias=$alias ? $alias.'.': '';
- //$model = $model->where("{$alias}status",0);
- if(isset($where['keyword']) && $where['keyword']!=='') {
- $model=$model->where("{$alias}name",'LIKE',"%$where[keyword]%");
- }
- return $model;
- }
- public static function getProviderList($where)
- {
- $data=self::setWhere($where)->order('add_time desc')->page((int)$where['page'],(int)$where['limit'])->select();
- $data=count($data) ? $data->toArray() : [];
- $count=self::setWhere($where)->count();
- return compact('data','count');
- }
- }
|