117 lines
2.7 KiB
PHP
Executable File
117 lines
2.7 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Api\Controller;
|
|
|
|
use Service\UserService;
|
|
|
|
/**
|
|
* 用户地址
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 0.0.1
|
|
* @datetime 2017-03-02T22:48:35+0800
|
|
*/
|
|
class UserAddressController extends CommonController
|
|
{
|
|
/**
|
|
* [_initialize 前置操作-继承公共前置方法]
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 0.0.1
|
|
* @datetime 2017-03-02T22:48:35+0800
|
|
*/
|
|
public function _initialize()
|
|
{
|
|
// 调用父类前置方法
|
|
parent::_initialize();
|
|
|
|
// 是否ajax请求
|
|
if(!IS_AJAX)
|
|
{
|
|
$this->error(L('common_unauthorized_access'));
|
|
}
|
|
|
|
// 登录校验
|
|
$this->Is_Login();
|
|
}
|
|
|
|
/**
|
|
* 获取用户地址详情
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-07-18
|
|
* @desc description
|
|
*/
|
|
public function Detail()
|
|
{
|
|
$params = $this->data_post;
|
|
$params['user'] = $this->user;
|
|
$ret = UserService::UserAddressRow($params);
|
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
|
}
|
|
|
|
/**
|
|
* 获取用户地址列表
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-07-18
|
|
* @desc description
|
|
*/
|
|
public function Index()
|
|
{
|
|
$data = UserService::UserAddressList(['user'=>$this->user]);
|
|
$this->ajaxReturn(L('common_operation_success'), 0, $data['data']);
|
|
}
|
|
|
|
/**
|
|
* 用户地址保存
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-07-18
|
|
* @desc description
|
|
*/
|
|
public function Save()
|
|
{
|
|
$params = $this->data_post;
|
|
$params['user'] = $this->user;
|
|
$ret = UserService::UserAddressSave($params);
|
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
|
}
|
|
|
|
/**
|
|
* 删除地址
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-07-18
|
|
* @desc description
|
|
*/
|
|
public function Delete()
|
|
{
|
|
$params = $this->data_post;
|
|
$params['user'] = $this->user;
|
|
$ret = UserService::UserAddressDelete($params);
|
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
|
}
|
|
|
|
/**
|
|
* 默认地址设置
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-07-18
|
|
* @desc description
|
|
*/
|
|
public function SetDefault()
|
|
{
|
|
$params = $this->data_post;
|
|
$params['user'] = $this->user;
|
|
$ret = UserService::UserAddressDefault($params);
|
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
|
}
|
|
|
|
}
|
|
?>
|