12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\admin\controller;
- use app\admin\logic\CommonLogic;
- use app\BaseController;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //公共
- class Common extends BaseController
- {
- //登录
- public function Login()
- {
- $param = $this->request->only(['username', 'password'], 'post');
- $val = Validate::rule(Config::get('validate_rules.login'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return CommonLogic::Logic($param);
- }
- //登出
- public function logout()
- {
- return CommonLogic::logout($this->request->post('token', ''));
- }
- //上传图片
- public function upload()
- {
- $files = $this->request->file('image');
- return CommonLogic::upload($files);
- }
- //获取全部商品单位
- public function unitAll(){
- $keyword = $this->request->post('keyword', '');
- return CommonLogic::unitAll($keyword);
- }
- //获取省市区地址
- public function getAddr(){
- $parent_code = $this->request->post('parent_code', '');
- return CommonLogic::getAddr($parent_code);
- }
- }
|