Index.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. namespace app\api\controller;
  3. use app\BaseController;
  4. use app\model\CommonModel;
  5. use think\exception\ValidateException;
  6. use think\facade\Config;
  7. use think\facade\Db;
  8. use think\facade\Validate;
  9. use app\api\logic\IndexLogic;
  10. class Index extends BaseController
  11. {
  12. //刷新密钥
  13. public function refreshSecret()
  14. {
  15. $param = $this->request->only(['supplierName', 'legaler', 'registercode', 'contactor', 'mobile'], 'post');
  16. $val = Validate::rule(Config::get('validate_rules.refreshSecret'));
  17. if (!$val->check($param)) throw new ValidateException($val->getError());
  18. return IndexLogic::refreshSecret($param);
  19. }
  20. //修改开发信息中的推送地址
  21. public function updatePushUrl(){
  22. $param = $this->request->only(['push_url'=>[]], 'post');
  23. $val = Validate::rule(Config::get('validate_rules.updatePushUrl'));
  24. if (!$val->check($param)) throw new ValidateException($val->getError());
  25. return IndexLogic::updatePushUrl($param);
  26. }
  27. //获取推送记录
  28. public function getPushLog(){
  29. $param = $this->request->only(['page'=>1,'size'=>10,'push_url'=>'','type'=>0,'start'=>'','end'=>''], 'post');
  30. $val = Validate::rule(Config::get('validate_rules.getPushLog'));
  31. if (!$val->check($param)) throw new ValidateException($val->getError());
  32. return IndexLogic::getPushLog($param);
  33. }
  34. //获取上线平台列表
  35. // public function getPlatformList()
  36. // {
  37. //
  38. // $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  39. //
  40. // $val = Validate::rule(Config::get('validate_rules.common'));
  41. //
  42. // if (!$val->check($param)) throw new ValidateException($val->getError());
  43. //
  44. // return IndexLogic::getPlatformList($param['keyword'], $param['page'], $param['size']);
  45. //
  46. // }
  47. //获取分类列表
  48. public function getCatList()
  49. {
  50. $param = $this->request->only(['keyword' => '', 'pid' => 0], 'post');
  51. $val = Validate::rule(Config::get('validate_rules.getCatList'));
  52. if (!$val->check($param)) throw new ValidateException($val->getError());
  53. return IndexLogic::getCatList($param['keyword'], $param['pid']);
  54. }
  55. //获取品牌列表
  56. public function getBrandList()
  57. {
  58. $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 10], 'post');
  59. $val = Validate::rule(Config::get('validate_rules.common'));
  60. if (!$val->check($param)) throw new ValidateException($val->getError());
  61. return IndexLogic::getBrandList($param['keyword'], $param['page'], $param['size']);
  62. }
  63. //获取单位列表
  64. public function getUnitList()
  65. {
  66. $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
  67. $val = Validate::rule(Config::get('validate_rules.common'));
  68. if (!$val->check($param)) throw new ValidateException($val->getError());
  69. return IndexLogic::getUnitList($param['keyword'], $param['page'], $param['size']);
  70. }
  71. //获取规格标题列表
  72. public function getSpecsTitleList()
  73. {
  74. $param = $this->request->only(['keyword' => ''], 'post');
  75. $val = Validate::rule(Config::get('validate_rules.keyword'));
  76. if (!$val->check($param)) throw new ValidateException($val->getError());
  77. return IndexLogic::getSpecsTitleList($param['keyword']);
  78. }
  79. //获取规格值列表
  80. public function getSpecsValueByTitleList()
  81. {
  82. $param = $this->request->only(['spec_id'], 'post');
  83. $val = Validate::rule(Config::get('validate_rules.getSpecsValueByTitleList'));
  84. if (!$val->check($param)) throw new ValidateException($val->getError());
  85. return IndexLogic::getSpecsValueByTitleList($param['spec_id']);
  86. }
  87. //获取省市区列表
  88. public function getAreaList()
  89. {
  90. $param = $this->request->only(['level' => 1, 'pid_code' => '', 'keyword' => ''], 'post');
  91. $val = Validate::rule(Config::get('validate_rules.getAreaList'));
  92. if (!$val->check($param)) throw new ValidateException($val->getError());
  93. return IndexLogic::getAreaList($param['level'], $param['pid_code'], $param['keyword']);
  94. }
  95. //获取业务公司编码
  96. public function getCompanyNoList()
  97. {
  98. $param = $this->request->only(['keyword' => ''], 'post');
  99. $val = Validate::rule(Config::get('validate_rules.keyword'));
  100. if (!$val->check($param)) throw new ValidateException($val->getError());
  101. return IndexLogic::getCompanyNoList($param['keyword']);
  102. }
  103. //专属类型列表
  104. public function getExclusiveList()
  105. {
  106. $param = $this->request->only(['pid' => 0, 'keyword' => ''], 'post');
  107. $val = Validate::rule(Config::get('validate_rules.getExclusiveList'));
  108. if (!$val->check($param)) throw new ValidateException($val->getError());
  109. return IndexLogic::getExclusiveList($param['pid'], $param['keyword']);
  110. }
  111. //创建规格值
  112. public function createSpec()
  113. {
  114. $param = $this->request->only(['spec_id', 'spec_value'], 'post');
  115. $val = Validate::rule(Config::get('validate_rules.createSpec'));
  116. if (!$val->check($param)) throw new ValidateException($val->getError());
  117. return IndexLogic::createSpec($param);
  118. }
  119. //上传图片
  120. public function uploadImg()
  121. {
  122. $files = $this->request->file('image');
  123. $list = "";
  124. if ($files != "") $list = upload_img($files);
  125. if (is_array($list) && !empty($list)) return json_show(0, "上传成功!", $list);
  126. else return json_show(1005, "上传失败!" . $list);
  127. }
  128. }