123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\common\model;
- use think\Db;
- use think\Model;
- /**
- * 商家员工
- */
- class CompanyStaff extends Model
- {
- // 表名
- protected $name = 'company_staff';
- public function company()
- {
- return $this->hasOne('Company', 'id', 'company_id',[],'LEFT');
- }
- /**
- * 获取员工列表
- * @param $params
- * @return array|bool|\PDOStatement|string|\think\Collection
- */
- public static function getStaffList($params=[])
- {
- $companyId = isset($params['company_id']) ? $params['company_id'] : 0;
- $type = isset($params['type']) ? $params['type'] : 0;
- $company = [];
- if (!empty($companyId)) {
- $field = 'id,truename,mobile';
- !empty($type) && $where['type'] = $type;
- $where['company_id'] = $companyId;
- $company = self::field($field)->where($where)->select();
- }
- return $company;
- }
- }
|