0 && $data['in_stock'] > 0) { $data['add_time'] = time(); $data['store_id'] = $store_id; self::create($data); return true; } return false; } /** *获取列表 */ public static function lst($where) { $model = new self; $model = $model->alias("a")->join("store_product b","a.product_id=b.id","right"); if(isset($where['store_id']) && $where['store_id']>0) $model = $model->where('a.store_id',$where['store_id']); if(isset($where['status']) && $where['status']>-2) $model = $model->where('a.status',$where['status']); if(isset($where['key']) && $where['key']) $model = $model->wherelike('b.store_name',"%".$where['key']."%"); if(isset($where['product_id']) && $where['product_id']) $model = $model->wherelike('a.product_id',$where['product_id']); $model = $model->where('a.id','>',0); $model = $model->field('a.*,b.image,b.is_show,b.is_del,b.store_name'); $count = $model->count(); $data = $model->page($where['page'],$where['limit'])->order("product_id desc")->select()->toarray(); foreach ($data as &$v) { $v['store'] = SystemStore::where('id',$v['store_id'])->value('name'); } return compact('count','data'); } }