Authored by cailing

删除订单

@@ -148,4 +148,22 @@ class OrderData @@ -148,4 +148,22 @@ class OrderData
148 return Yohobuy::post(Yohobuy::API_URL, $param); 148 return Yohobuy::post(Yohobuy::API_URL, $param);
149 } 149 }
150 150
  151 + /*
  152 + * 删除订单
  153 + */
  154 +
  155 + public static function deleteOrderData($orderCode, $uid, $gender, $channel)
  156 + {
  157 + //构建必传参数
  158 + $param = Yohobuy::param();
  159 + $param['order_code'] = $orderCode;
  160 + $param['uid'] = $uid;
  161 + $param['gender'] = $gender;
  162 + $param['yh_channel'] = $channel;
  163 + $param['method'] = 'app.SpaceOrders.delOrderByCode';
  164 + $param['client_secret'] = Sign::getSign($param);
  165 + //调用接口删除订单
  166 + return Yohobuy::get(Yohobuy::API_URL, $param);
  167 + }
  168 +
151 } 169 }
@@ -98,7 +98,7 @@ class OrdersController extends WebAction @@ -98,7 +98,7 @@ class OrdersController extends WebAction
98 'userThumb' => UserModel::getUserHeadImg($uid), 98 'userThumb' => UserModel::getUserHeadImg($uid),
99 'homeNav' => $leftNav 99 'homeNav' => $leftNav
100 ); 100 );
101 - $packages=false; 101 + $packages = false;
102 if ($detail) { 102 if ($detail) {
103 $data += array( 103 $data += array(
104 'orderNum' => $detail['orderNum'], 104 'orderNum' => $detail['orderNum'],
@@ -219,7 +219,7 @@ class OrdersController extends WebAction @@ -219,7 +219,7 @@ class OrdersController extends WebAction
219 219
220 $this->echoJson($data); 220 $this->echoJson($data);
221 } 221 }
222 - 222 +
223 /** 223 /**
224 * 还原订单 224 * 还原订单
225 */ 225 */
@@ -244,31 +244,40 @@ class OrdersController extends WebAction @@ -244,31 +244,40 @@ class OrdersController extends WebAction
244 244
245 $this->echoJson($data); 245 $this->echoJson($data);
246 } 246 }
247 -  
248 - /**  
249 - * 删除订单 247 +
  248 + /*
  249 + * 我的订单-删除订单
250 */ 250 */
251 - public function deleteOrderAction() 251 +
  252 + public function delOrderAction()
252 { 253 {
253 - $data = array('code' => 400, 'message' => '', 'data' => ''); 254 +
  255 + $result = array('code' => 400, 'message' => '删除失败', 'data' => '');
254 256
255 do { 257 do {
256 /* 判断是不是AJAX请求 */ 258 /* 判断是不是AJAX请求 */
257 if (!$this->isAjax()) { 259 if (!$this->isAjax()) {
258 break; 260 break;
259 } 261 }
260 - $uid = $this->auditJumpLogin();  
261 - $orderCode = trim($this->post('orderCode', ''));  
262 -// $data = OrderData::confirmUserOrder($uid, $orderCode);  
263 - $data = array('code' => 400, 'message' => '订单删除成功', 'data' => '');  
264 - if (!isset($data['code'])) { 262 +
  263 + //传入orderCode删除订单
  264 + $orderCode = $this->get('id');
  265 + $gender = Helpers::getGenderByCookie();
  266 + $channel = Helpers::getChannelByCookie();
  267 + $uid = $this->getUid(true);
  268 + if (!$orderCode || !$uid) {
  269 + $result = array('code' => 400, 'message' => '缺失必填项', 'data' => '');
  270 + break;
  271 + }
  272 + //调用接口删除订单,并返回订单删除状态
  273 + $data = OrderData::deleteOrderData($orderCode, $uid, $gender, $channel);
  274 + if (!isset($result['code'])) {
265 break; 275 break;
266 } 276 }
267 } 277 }
268 while (false); 278 while (false);
269 279
270 - $this->echoJson($data); 280 + $this->echoJson($result);
271 } 281 }
272 -  
273 282
274 } 283 }