1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\App;
- use think\Db;
- class ShopAddress extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\ShopAddress();
- }
- public function add(){
- $model = $this->model;
- $ret=$model->add($this->userId);
- if(!$ret){
- HelpHander::error($model->getError());
- }
- HelpHander::success([],'添加成功');
- }
- public function update(){
- $id=input('id/d',0);
- $model = $this->model;
- $ret=$model->updates($id,$this->userId);
- if(!$ret){
- HelpHander::error($model->getError());
- }
- HelpHander::success([],'修改成功');
- }
- public function lists(){
- $model = $this->model;
- $ret=$model->lists($this->userId);
- HelpHander::success($ret);
- }
- public function detail(){
- $id=input('id/d',0);
- $model = $this->model;
- $ret=$model->detail($id);
- if(!$ret){
- HelpHander::error('数据不存在');
- }
- HelpHander::success($ret);
- }
- public function del(){
- $id=input('id/d',0);
- $model = $this->model;
- $ret=$model->del($id);
- if($ret == 0){
- HelpHander::error('删除失败');
- }
- HelpHander::success([],'删除成功');
- }
- //获取默认地址
- public function addressOne(){
- $model = $this->model;
- $ret = $model->finds($this->userId);
- HelpHander::success($ret);
- }
- }
|