Index.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. namespace app\abutment\controller;
  3. use app\abutment\logic\Index as IndexLogic;
  4. use app\BaseController;
  5. use think\exception\ValidateException;
  6. use think\facade\Config;
  7. use think\facade\Db;
  8. use think\facade\Validate;
  9. class Index extends BaseController
  10. {
  11. //获取上线平台列表
  12. public function getPlatformList()
  13. {
  14. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  15. $val = Validate::rule(Config::get('validate_rules.common'));
  16. if (!$val->check($param)) throw new ValidateException($val->getError());
  17. return IndexLogic::getPlatformList($param['keyword'], $param['page'], $param['size']);
  18. }
  19. //获取分类列表
  20. public function getCatList()
  21. {
  22. $param = $this->request->filter('trim')->only(['keyword' => '', 'pid' => 0], 'post');
  23. $val = Validate::rule(Config::get('validate_rules.getCatList'));
  24. if (!$val->check($param)) throw new ValidateException($val->getError());
  25. return IndexLogic::getCatList($param['keyword'], $param['pid']);
  26. }
  27. //获取品牌列表
  28. public function getBrandList()
  29. {
  30. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  31. $val = Validate::rule(Config::get('validate_rules.common'));
  32. if (!$val->check($param)) throw new ValidateException($val->getError());
  33. return IndexLogic::getBrandList($param['keyword'], $param['page'], $param['size']);
  34. }
  35. //获取单位列表
  36. public function getUnitList()
  37. {
  38. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  39. $val = Validate::rule(Config::get('validate_rules.common'));
  40. if (!$val->check($param)) throw new ValidateException($val->getError());
  41. return IndexLogic::getUnitList($param['keyword'], $param['page'], $param['size']);
  42. }
  43. //获取规格标题列表
  44. public function getSpecsTitleList()
  45. {
  46. $param = $this->request->filter('trim')->only(['keyword' => ''], 'post');
  47. $val = Validate::rule(Config::get('validate_rules.keyword'));
  48. if (!$val->check($param)) throw new ValidateException($val->getError());
  49. return IndexLogic::getSpecsTitleList($param['keyword']);
  50. }
  51. //获取规格值列表
  52. public function getSpecsValueByTitleList()
  53. {
  54. $param = $this->request->filter('trim')->only(['spec_id'], 'post');
  55. $val = Validate::rule(Config::get('validate_rules.getSpecsValueByTitleList'));
  56. if (!$val->check($param)) throw new ValidateException($val->getError());
  57. return IndexLogic::getSpecsValueByTitleList($param['spec_id']);
  58. }
  59. //获取省市区列表
  60. public function getAreaList()
  61. {
  62. $param = $this->request->filter('trim')->only(['level' => 1, 'pid_code' => ''], 'post');
  63. $val = Validate::rule(Config::get('validate_rules.getAreaList'));
  64. if (!$val->check($param)) throw new ValidateException($val->getError());
  65. return IndexLogic::getAreaList($param['level'], $param['pid_code']);
  66. }
  67. //获取业务公司编码
  68. public function getCompanyNoList()
  69. {
  70. $param = $this->request->filter('trim')->only(['keyword' => ''], 'post');
  71. $val = Validate::rule(Config::get('validate_rules.keyword'));
  72. if (!$val->check($param)) throw new ValidateException($val->getError());
  73. return IndexLogic::getCompanyNoList($param['keyword']);
  74. }
  75. //专属类型列表
  76. public function getExclusiveList(){
  77. $pid = $this->request->filter('trim')->post('pid/d',0);
  78. $where=[["is_del","=",0],["pid","=",$pid]];
  79. $cat_name=$this->request->filter('trim')->post('cat_name','');
  80. if($cat_name!=="") $where[]=['cat_name',"like","%$cat_name%"];
  81. $data = Db::name("exclusive")
  82. ->where($where)
  83. ->select()
  84. ->toArray();
  85. $vmp = [];
  86. foreach ($data as $sts){
  87. $vmp[]=coco($sts);
  88. }
  89. return json_show(0,"获取成功",$vmp);
  90. }
  91. }