Authored by cailing

删除订单

... ... @@ -148,4 +148,22 @@ class OrderData
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/*
* 删除订单
*/
public static function deleteOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.delOrderByCode';
$param['client_secret'] = Sign::getSign($param);
//调用接口删除订单
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -98,7 +98,7 @@ class OrdersController extends WebAction
'userThumb' => UserModel::getUserHeadImg($uid),
'homeNav' => $leftNav
);
$packages=false;
$packages = false;
if ($detail) {
$data += array(
'orderNum' => $detail['orderNum'],
... ... @@ -219,7 +219,7 @@ class OrdersController extends WebAction
$this->echoJson($data);
}
/**
* 还原订单
*/
... ... @@ -244,31 +244,40 @@ class OrdersController extends WebAction
$this->echoJson($data);
}
/**
* 删除订单
/*
* 我的订单-删除订单
*/
public function deleteOrderAction()
public function delOrderAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
$result = array('code' => 400, 'message' => '删除失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$uid = $this->auditJumpLogin();
$orderCode = trim($this->post('orderCode', ''));
// $data = OrderData::confirmUserOrder($uid, $orderCode);
$data = array('code' => 400, 'message' => '订单删除成功', 'data' => '');
if (!isset($data['code'])) {
//传入orderCode删除订单
$orderCode = $this->get('id');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid(true);
if (!$orderCode || !$uid) {
$result = array('code' => 400, 'message' => '缺失必填项', 'data' => '');
break;
}
//调用接口删除订单,并返回订单删除状态
$data = OrderData::deleteOrderData($orderCode, $uid, $gender, $channel);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($data);
$this->echoJson($result);
}
}
... ...