123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?php
- namespace app\api\controller;
- use app\BaseController;
- use app\model\CommonModel;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Db;
- use think\facade\Validate;
- use app\api\logic\IndexLogic;
- class Index extends BaseController
- {
- //刷新密钥
- public function refreshSecret()
- {
- $param = $this->request->only(['supplierName', 'legaler', 'registercode', 'contactor', 'mobile'], 'post');
- $val = Validate::rule(Config::get('validate_rules.refreshSecret'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::refreshSecret($param);
- }
- //修改开发信息中的推送地址
- public function updatePushUrl(){
- $param = $this->request->only(['push_url'=>[]], 'post');
- $val = Validate::rule(Config::get('validate_rules.updatePushUrl'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::updatePushUrl($param);
- }
- //获取推送记录
- public function getPushLog(){
- $param = $this->request->only(['page'=>1,'size'=>10,'push_url'=>'','type'=>0,'start'=>'','end'=>''], 'post');
- $val = Validate::rule(Config::get('validate_rules.getPushLog'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getPushLog($param);
- }
- //获取上线平台列表
- // public function getPlatformList()
- // {
- //
- // $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
- //
- // $val = Validate::rule(Config::get('validate_rules.common'));
- //
- // if (!$val->check($param)) throw new ValidateException($val->getError());
- //
- // return IndexLogic::getPlatformList($param['keyword'], $param['page'], $param['size']);
- //
- // }
- //获取分类列表
- public function getCatList()
- {
- $param = $this->request->only(['keyword' => '', 'pid' => 0], 'post');
- $val = Validate::rule(Config::get('validate_rules.getCatList'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getCatList($param['keyword'], $param['pid']);
- }
- //获取品牌列表
- public function getBrandList()
- {
- $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 10], 'post');
- $val = Validate::rule(Config::get('validate_rules.common'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getBrandList($param['keyword'], $param['page'], $param['size']);
- }
- //获取单位列表
- public function getUnitList()
- {
- $param = $this->request->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
- $val = Validate::rule(Config::get('validate_rules.common'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getUnitList($param['keyword'], $param['page'], $param['size']);
- }
- //获取规格标题列表
- public function getSpecsTitleList()
- {
- $param = $this->request->only(['keyword' => ''], 'post');
- $val = Validate::rule(Config::get('validate_rules.keyword'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getSpecsTitleList($param['keyword']);
- }
- //获取规格值列表
- public function getSpecsValueByTitleList()
- {
- $param = $this->request->only(['spec_id'], 'post');
- $val = Validate::rule(Config::get('validate_rules.getSpecsValueByTitleList'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getSpecsValueByTitleList($param['spec_id']);
- }
- //获取省市区列表
- public function getAreaList()
- {
- $param = $this->request->only(['level' => 1, 'pid_code' => '', 'keyword' => ''], 'post');
- $val = Validate::rule(Config::get('validate_rules.getAreaList'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getAreaList($param['level'], $param['pid_code'], $param['keyword']);
- }
- //获取业务公司编码
- public function getCompanyNoList()
- {
- $param = $this->request->only(['keyword' => ''], 'post');
- $val = Validate::rule(Config::get('validate_rules.keyword'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getCompanyNoList($param['keyword']);
- }
- //专属类型列表
- public function getExclusiveList()
- {
- $param = $this->request->only(['pid' => 0, 'keyword' => ''], 'post');
- $val = Validate::rule(Config::get('validate_rules.getExclusiveList'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::getExclusiveList($param['pid'], $param['keyword']);
- }
- //创建规格值
- public function createSpec()
- {
- $param = $this->request->only(['spec_id', 'spec_value'], 'post');
- $val = Validate::rule(Config::get('validate_rules.createSpec'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return IndexLogic::createSpec($param);
- }
- //上传图片
- public function uploadImg()
- {
- $files = $this->request->file('image');
- $list = "";
- if ($files != "") $list = upload_img($files);
- if (is_array($list) && !empty($list)) return json_show(0, "上传成功!", $list);
- else return json_show(1005, "上传失败!" . $list);
- }
- }
|