1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\models\merchant;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- class Merchant extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'merchant';
- use ModelTrait;
- public static function getList($where = null)
- {
- $data = ($data = self::setWhere($where)->select()) && count($data) ? $data->toArray() : [];
- $count = self::setWhere($where)->count();
- return ['count' => $count, 'list' => $data];
- }
- public static function setWhere($where)
- {
- $model = (new self);
- if ($where['name']) {
- $model = $model->where('name', 'like', '%' . $where['name'] . '%');
- }
- return $model;
- }
- }
|