123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <?php
- namespace app\abutment\logic;
- use think\facade\Config;
- use think\facade\Db;
- class Index
- {
- //获取上线平台列表
- public static function getPlatformList(string $keyword = '', int $page = 1, int $size = 15)
- {
- $db = Db::name('platform')->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);
- }
- }
|