123456789101112131415161718 |
- <?php
- namespace app\common\model;
- use think\Model;
- // 供应商公司
- class Company extends Model
- {
- public function goodsList(){
- return $this->hasMany('SupplierGoods','company_id')
- ->where('is_deleted',0)->where('release_time','< time',date("Y-m-d H:i:s"))
- ->field('id,supplier_id,name,cover,read_num,create_at');
- }
- // 获取公司名称
- public static function getCompanyName($is_all = 0)
- {
- return self::when($is_all,function ($query)use ($is_all){if(!$is_all)return $query->where('status',1)->where('is_deleted',0);})->column('id,title,is_deleted,status','id');
- }
- }
|