where('is_del', 0); if ($keyword != '') $db->whereLike('platform_name', '%' . $keyword . '%'); $count = $db->count('id'); $list = $db ->field('id platform_id,platform_code,platform_name,platform_type') ->order('id') ->page($page, $size) ->select() ->toArray(); return json_show(0, '请求成功', ['count' => $count, 'list' => $list]); } //获取分类列表 public static function getCatList(string $keyword = '', int $pid = 0) { $db = Db::name('cat')->where(['is_del' => 0, 'pid' => $pid]); if ($keyword != '') $db->whereLike('cat_name', '%' . $keyword . '%'); $count = $db->count('id'); $list = $db ->field('id cat_id,cat_name,level') ->order('id') ->select() ->toArray(); return json_show(0, '请求成功', ['count' => $count, 'list' => $list]); } //获取品牌列表 public static function getBrandList(string $keyword = '', int $page = 1, int $size = 15) { $db = Db::name('brand')->where('is_del', 0); if ($keyword != '') $db->whereLike('brand_name', '%' . $keyword . '%'); $count = $db->count('id'); $list = $db ->field('id brand_id,brand_name') ->order('id') ->page($page, $size) ->select() ->toArray(); return json_show(0, '请求成功', ['count' => $count, 'list' => $list]); } //获取单位列表 public static function getUnitList(string $keyword = '', int $page = 1, int $size = 15) { $db = Db::name('unit')->where('is_del', 0); if ($keyword != '') $db->whereLike('unit', '%' . $keyword . '%'); $count = $db->count('id'); $list = $db ->field('id unit_id,unit unit_name') ->order('id') ->page($page, $size) ->select() ->toArray(); return json_show(0, '请求成功', ['count' => $count, 'list' => $list]); } //获取规格标题列表 public static function getSpecsTitleList(string $keyword = '') { $db = Db::name('specs')->where('is_del', 0); if ($keyword != '') $db->whereLike('spec_name', '%' . $keyword . '%'); $list = $db ->field('id spec_id,spec_name') ->order('addtime', 'desc') ->select() ->toArray(); return json_show(0, '请求成功', $list); } //获取规格值列表 public static function getSpecsValueByTitleList(int $spec_id = 0) { $db = Db::name('spec_value')->where('is_del', 0); if ($spec_id != '') $db->where('spec_id', $spec_id); $list = $db ->field('id spec_value_id,spec_id ,spec_value') ->order('id') ->select() ->toArray(); return json_show(0, '请求成功', $list); } //获取省市区列表 public static function getAreaList(int $level = 1, string $pid_code = '') { switch ($level) { case 1: $list = Db::name('province') ->field('province_code,name') ->order('id') ->select() ->toArray(); break; case 2: $list = Db::name('city') ->field('city_code,name') ->where('province_code', $pid_code) ->order('id') ->select() ->toArray(); break; case 3: $list = Db::name('area') ->field('area_code,name') ->where('city_code', $pid_code) ->order('id') ->select() ->toArray(); break; } return json_show(0, '获取成功', $list); } //获取业务公司编码 public static function getCompanyNoList(string $keyword = '') { $db = Db::name('business')->where('is_del', 0); if ($keyword != '') $db->whereLike('company|companyNo', '%' . $keyword . '%'); $list = $db ->field('companyNo,company') ->order('id') ->select() ->toArray(); return json_show(0, '请求成功', $list); } }