Authored by Rock Zhang

添加地址管理修改,删除等接口

... ... @@ -285,6 +285,24 @@ class UserData
}
/**
* 删除地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array 接口返回的数据
*/
public static function deleteAddress($uid, $id)
{
$param = Yohobuy::param();
$param['id'] = $id;
$param['method'] = 'app.address.del';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 意见反馈数据
*
* @param string $udid 客户端唯一标识
... ...
... ... @@ -122,7 +122,7 @@ class HomeController extends AbstractAction
$this->setNavHeader('YOHO币', true, false);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$currency = \Index\UserModel::getYohoCoinData($uid);
$currency['pageFooter'] = true;
... ... @@ -154,7 +154,7 @@ class HomeController extends AbstractAction
$page = $this->get('page', 0);
$size = $this->get('size', 10);
$uid = 967016;
$uid = 8826435;
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
print_r($messages);
... ... @@ -169,7 +169,7 @@ class HomeController extends AbstractAction
$this->setNavHeader('地址管理', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
... ... @@ -192,7 +192,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
... ... @@ -219,7 +219,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
... ... @@ -232,6 +232,27 @@ class HomeController extends AbstractAction
}
}
/**
* 删除地址
*/
public function addressDelAction() {
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 8826435;
$id = $this->post('id', '');
$result = \Index\UserModel::deleteAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
//在线客服
public function onlineServiceAction() {
// 设置网站标题
... ...
... ... @@ -59,7 +59,11 @@ class UserModel
foreach ($infoNumData['data'] as &$val) {
empty($val) && $val = 0;
}
$result = $infoNumData['data'];
// 默认没有返回用户地址的数据,添加这块儿数据
$result['address_num'] = count(self::getAddressData($uid));
}
return $result;
... ... @@ -384,6 +388,27 @@ class UserModel
}
/**
* 删除地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array|mixed 处理之后的返回数据
*/
public static function deleteAddress($uid, $id)
{
$result = array('code' => 400, 'message' => '错误');
// 调用接口删除地址
$address = UserData::deleteAddress($uid, $id);
// 处理返回结果
if ($address && isset($address['code'])) {
$result = $address;
}
return $result;
}
/**
* 处理意见反馈数据
*
* @param string $udid 客户端唯一标识
... ...