Index.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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\Validate;
  8. class Index extends BaseController
  9. {
  10. //获取上线平台列表
  11. public function getPlatformList()
  12. {
  13. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  14. $val = Validate::rule(Config::get('validate_rules.common'));
  15. if (!$val->check($param)) throw new ValidateException($val->getError());
  16. return IndexLogic::getPlatformList($param['keyword'], $param['page'], $param['size']);
  17. }
  18. //获取分类列表
  19. public function getCatList()
  20. {
  21. $param = $this->request->filter('trim')->only(['keyword' => '', 'pid' => 0], 'post');
  22. $val = Validate::rule(Config::get('validate_rules.getCatList'));
  23. if (!$val->check($param)) throw new ValidateException($val->getError());
  24. return IndexLogic::getCatList($param['keyword'], $param['pid']);
  25. }
  26. //获取品牌列表
  27. public function getBrandList()
  28. {
  29. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  30. $val = Validate::rule(Config::get('validate_rules.common'));
  31. if (!$val->check($param)) throw new ValidateException($val->getError());
  32. return IndexLogic::getBrandList($param['keyword'], $param['page'], $param['size']);
  33. }
  34. //获取单位列表
  35. public function getUnitList()
  36. {
  37. $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  38. $val = Validate::rule(Config::get('validate_rules.common'));
  39. if (!$val->check($param)) throw new ValidateException($val->getError());
  40. return IndexLogic::getUnitList($param['keyword'], $param['page'], $param['size']);
  41. }
  42. //获取规格标题列表
  43. public function getSpecsTitleList()
  44. {
  45. $param = $this->request->filter('trim')->only(['keyword' => ''], 'post');
  46. $val = Validate::rule(Config::get('validate_rules.keyword'));
  47. if (!$val->check($param)) throw new ValidateException($val->getError());
  48. return IndexLogic::getSpecsTitleList($param['keyword']);
  49. }
  50. //获取规格值列表
  51. public function getSpecsValueByTitleList()
  52. {
  53. $param = $this->request->filter('trim')->only(['spec_id'], 'post');
  54. $val = Validate::rule(Config::get('validate_rules.getSpecsValueByTitleList'));
  55. if (!$val->check($param)) throw new ValidateException($val->getError());
  56. return IndexLogic::getSpecsValueByTitleList($param['spec_id']);
  57. }
  58. //获取省市区列表
  59. public function getAreaList()
  60. {
  61. $param = $this->request->filter('trim')->only(['level' => 1, 'pid_code' => ''], 'post');
  62. $val = Validate::rule(Config::get('validate_rules.getAreaList'));
  63. if (!$val->check($param)) throw new ValidateException($val->getError());
  64. return IndexLogic::getAreaList($param['level'], $param['pid_code']);
  65. }
  66. //获取业务公司编码
  67. public function getCompanyNoList()
  68. {
  69. $param = $this->request->filter('trim')->only(['keyword' => ''], 'post');
  70. $val = Validate::rule(Config::get('validate_rules.keyword'));
  71. if (!$val->check($param)) throw new ValidateException($val->getError());
  72. return IndexLogic::getCompanyNoList($param['keyword']);
  73. }
  74. }