order('sort DESC, add_time DESC'); $list = $model->page((int)$page, (int)$limit)->field('id,store_name,image,price,cost,ot_price')->select(); $list = count($list) ? $list->toArray() : []; return $list; } public static function getValidProduct($productId, $field = 'add_time,browse,cate_id,code_path,cost,ficti,id,image,is_sub,is_best,is_del,is_hot,is_show,keyword,ot_price,postage,price,sales,slider_image,sort,stock,store_info,store_name,unit_name,vip_price,spec_type,IFNULL(sales,0) + IFNULL(ficti,0) as fsales,video_link,description') { $Product = self::where('is_del', 0)->where('is_show', 1)->where('id', $productId)->field($field)->find(); if ($Product) return $Product->toArray(); else return false; } }