Authored by ccbikai

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -46,6 +46,7 @@ class OrderData @@ -46,6 +46,7 @@ class OrderData
46 */ 46 */
47 47
48 static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) { 48 static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
  49 + //构建必传参数
49 $param = Yohobuy::param(); 50 $param = Yohobuy::param();
50 $param['order_code'] = $order_code; 51 $param['order_code'] = $order_code;
51 $param['uid'] = $uid; 52 $param['uid'] = $uid;
@@ -53,6 +54,7 @@ class OrderData @@ -53,6 +54,7 @@ class OrderData
53 $param['yh_channel'] = $yh_channel; 54 $param['yh_channel'] = $yh_channel;
54 $param['method'] = $method; 55 $param['method'] = $method;
55 $param['client_secret'] = Sign::getSign($param); 56 $param['client_secret'] = Sign::getSign($param);
  57 + //调用接口获得数据
56 return Yohobuy::get(Yohobuy::API_URL, $param); 58 return Yohobuy::get(Yohobuy::API_URL, $param);
57 } 59 }
58 60
@@ -63,6 +65,7 @@ class OrderData @@ -63,6 +65,7 @@ class OrderData
63 */ 65 */
64 66
65 static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) { 67 static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
  68 + //构建必传参数
66 $param = Yohobuy::param(); 69 $param = Yohobuy::param();
67 $param['order_code'] = $order_code; 70 $param['order_code'] = $order_code;
68 $param['uid'] = $uid; 71 $param['uid'] = $uid;
@@ -70,23 +73,56 @@ class OrderData @@ -70,23 +73,56 @@ class OrderData
70 $param['yh_channel'] = $yh_channel; 73 $param['yh_channel'] = $yh_channel;
71 $param['method'] = $method; 74 $param['method'] = $method;
72 $param['client_secret'] = Sign::getSign($param); 75 $param['client_secret'] = Sign::getSign($param);
73 - 76 + //调用接口删除订单
74 return Yohobuy::get(Yohobuy::API_URL, $param); 77 return Yohobuy::get(Yohobuy::API_URL, $param);
75 } 78 }
76 79
77 /* 80 /*
78 - * 支付订单 81 + * 我的订单-查看物流
79 * To change this template file, choose Tools | Templates 82 * To change this template file, choose Tools | Templates
80 * and open the template in the editor. 83 * and open the template in the editor.
81 */ 84 */
82 85
83 - static function getPaymentData($contentCode, $gender, $yh_channel) { 86 + static function LogisticsData() {
  87 + //构建必传参数
  88 + $param = Yohobuy::param();
  89 + $param['method'] = 'app.express.li';
  90 + //$param['gender'] = $gender;
  91 + //$param['yh_channel'] = $yh_channel;
  92 + $param['client_secret'] = Sign::getSign($param);
  93 + //调用接口获得数据
  94 + return Yohobuy::get('http://api.open.yohobuy.com/', $param);
  95 + }
  96 +
  97 + /*
  98 + * 支付url
  99 + * To change this template file, choose Tools | Templates
  100 + */
  101 +
  102 + static function paymentData($gender, $yh_channel, $code) {
  103 + //构建必传参数
84 $param = Yohobuy::param(); 104 $param = Yohobuy::param();
85 - $param['content_code'] = $contentCode; 105 + $param['content_code'] = $code;
86 $param['gender'] = $gender; 106 $param['gender'] = $gender;
87 $param['yh_channel'] = $yh_channel; 107 $param['yh_channel'] = $yh_channel;
88 $param['client_secret'] = Sign::getSign($param); 108 $param['client_secret'] = Sign::getSign($param);
89 - //print_r($param); 109 + //调用接口获得数据
  110 + return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
  111 + }
  112 +
  113 + /*
  114 + * 随便逛逛url
  115 + * To change this template file, choose Tools | Templates
  116 + */
  117 +
  118 + static function strollData($gender, $yh_channel, $code) {
  119 + //构建必传参数
  120 + $param = Yohobuy::param();
  121 + $param['content_code'] = $code;
  122 + $param['gender'] = $gender;
  123 + $param['yh_channel'] = $yh_channel;
  124 + $param['client_secret'] = Sign::getSign($param);
  125 + //调用接口获得数据
90 return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param); 126 return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
91 } 127 }
92 128
@@ -37,8 +37,7 @@ class HomeController extends AbstractAction @@ -37,8 +37,7 @@ class HomeController extends AbstractAction
37 /** 37 /**
38 * 个人中心入口 38 * 个人中心入口
39 */ 39 */
40 - public function indexAction()  
41 - { 40 + public function indexAction() {
42 // 设置网站标题 41 // 设置网站标题
43 $this->setTitle('个人中心'); 42 $this->setTitle('个人中心');
44 $this->setNavHeader('个人中心', true, SITE_MAIN); 43 $this->setNavHeader('个人中心', true, SITE_MAIN);
@@ -62,8 +61,7 @@ class HomeController extends AbstractAction @@ -62,8 +61,7 @@ class HomeController extends AbstractAction
62 /** 61 /**
63 * 用户收藏的商品 62 * 用户收藏的商品
64 */ 63 */
65 - public function favoriteAction()  
66 - { 64 + public function favoriteAction() {
67 // 设置网站标题 65 // 设置网站标题
68 $this->setTitle('我的收藏'); 66 $this->setTitle('我的收藏');
69 $this->setNavHeader('我的收藏', true, SITE_MAIN); 67 $this->setNavHeader('我的收藏', true, SITE_MAIN);
@@ -93,8 +91,7 @@ class HomeController extends AbstractAction @@ -93,8 +91,7 @@ class HomeController extends AbstractAction
93 /** 91 /**
94 * 用户收藏的商品-删除 92 * 用户收藏的商品-删除
95 */ 93 */
96 - public function favoriteDelAction()  
97 - { 94 + public function favoriteDelAction() {
98 $result = array(); 95 $result = array();
99 96
100 if ($this->isAjax()) { 97 if ($this->isAjax()) {
@@ -114,8 +111,7 @@ class HomeController extends AbstractAction @@ -114,8 +111,7 @@ class HomeController extends AbstractAction
114 /** 111 /**
115 * 个人信息 112 * 个人信息
116 */ 113 */
117 - public function personalDetailsAction()  
118 - { 114 + public function personalDetailsAction() {
119 $this->setTitle('个人信息'); 115 $this->setTitle('个人信息');
120 $this->setNavHeader('个人信息', true, SITE_MAIN); 116 $this->setNavHeader('个人信息', true, SITE_MAIN);
121 117
@@ -129,8 +125,7 @@ class HomeController extends AbstractAction @@ -129,8 +125,7 @@ class HomeController extends AbstractAction
129 /** 125 /**
130 * YOHO币 126 * YOHO币
131 */ 127 */
132 - public function currencyAction()  
133 - { 128 + public function currencyAction() {
134 $this->setTitle('YOHO币'); 129 $this->setTitle('YOHO币');
135 $this->setNavHeader('YOHO币', true, false); 130 $this->setNavHeader('YOHO币', true, false);
136 131
@@ -145,8 +140,7 @@ class HomeController extends AbstractAction @@ -145,8 +140,7 @@ class HomeController extends AbstractAction
145 /** 140 /**
146 * 优惠券 141 * 优惠券
147 */ 142 */
148 - public function couponsAction()  
149 - { 143 + public function couponsAction() {
150 144
151 $this->setTitle('优惠券'); 145 $this->setTitle('优惠券');
152 $this->setNavHeader('优惠券', true, SITE_MAIN); 146 $this->setNavHeader('优惠券', true, SITE_MAIN);
@@ -163,8 +157,7 @@ class HomeController extends AbstractAction @@ -163,8 +157,7 @@ class HomeController extends AbstractAction
163 /** 157 /**
164 * 我的消息 158 * 我的消息
165 */ 159 */
166 - public function messageAction()  
167 - { 160 + public function messageAction() {
168 // $uid = $this->getUid(); 161 // $uid = $this->getUid();
169 $page = $this->get('page', 0); 162 $page = $this->get('page', 0);
170 $size = $this->get('size', 10); 163 $size = $this->get('size', 10);
@@ -178,8 +171,7 @@ class HomeController extends AbstractAction @@ -178,8 +171,7 @@ class HomeController extends AbstractAction
178 /** 171 /**
179 * 地址管理 172 * 地址管理
180 */ 173 */
181 - public function addressAction()  
182 - { 174 + public function addressAction() {
183 // 设置网站标题 175 // 设置网站标题
184 $this->setTitle('地址管理'); 176 $this->setTitle('地址管理');
185 $this->setNavHeader('地址管理', true, SITE_MAIN); 177 $this->setNavHeader('地址管理', true, SITE_MAIN);
@@ -203,8 +195,7 @@ class HomeController extends AbstractAction @@ -203,8 +195,7 @@ class HomeController extends AbstractAction
203 /** 195 /**
204 * 修改地址或者添加新地址 196 * 修改地址或者添加新地址
205 */ 197 */
206 - public function saveAddressAction()  
207 - { 198 + public function saveAddressAction() {
208 $result = array(); 199 $result = array();
209 200
210 if ($this->isAjax()) { 201 if ($this->isAjax()) {
@@ -231,8 +222,7 @@ class HomeController extends AbstractAction @@ -231,8 +222,7 @@ class HomeController extends AbstractAction
231 /** 222 /**
232 * 设置默认地址 223 * 设置默认地址
233 */ 224 */
234 - public function defaultAddressAction()  
235 - { 225 + public function defaultAddressAction() {
236 $result = array(); 226 $result = array();
237 227
238 if ($this->isAjax()) { 228 if ($this->isAjax()) {
@@ -253,8 +243,7 @@ class HomeController extends AbstractAction @@ -253,8 +243,7 @@ class HomeController extends AbstractAction
253 /** 243 /**
254 * 删除地址 244 * 删除地址
255 */ 245 */
256 - public function addressDelAction()  
257 - { 246 + public function addressDelAction() {
258 $result = array(); 247 $result = array();
259 248
260 if ($this->isAjax()) { 249 if ($this->isAjax()) {
@@ -273,8 +262,7 @@ class HomeController extends AbstractAction @@ -273,8 +262,7 @@ class HomeController extends AbstractAction
273 } 262 }
274 263
275 //在线客服 264 //在线客服
276 - public function onlineServiceAction()  
277 - { 265 + public function onlineServiceAction() {
278 // 设置网站标题 266 // 设置网站标题
279 $this->setTitle('在线客服'); 267 $this->setTitle('在线客服');
280 $this->setNavHeader('在线客服', true, SITE_MAIN); 268 $this->setNavHeader('在线客服', true, SITE_MAIN);
@@ -289,8 +277,7 @@ class HomeController extends AbstractAction @@ -289,8 +277,7 @@ class HomeController extends AbstractAction
289 } 277 }
290 278
291 //在线客服-具体详情 279 //在线客服-具体详情
292 - public function onlineServiceDetailAction()  
293 - { 280 + public function onlineServiceDetailAction() {
294 $service = array(); 281 $service = array();
295 $cateId = $this->get('cateId', 0); 282 $cateId = $this->get('cateId', 0);
296 $cateName = $this->get('cateName', ''); 283 $cateName = $this->get('cateName', '');
@@ -321,8 +308,7 @@ class HomeController extends AbstractAction @@ -321,8 +308,7 @@ class HomeController extends AbstractAction
321 /** 308 /**
322 * 意见反馈 309 * 意见反馈
323 */ 310 */
324 - public function suggestAction()  
325 - { 311 + public function suggestAction() {
326 // 设置网站标题 312 // 设置网站标题
327 $this->setTitle('意见反馈'); 313 $this->setTitle('意见反馈');
328 $this->setNavHeader('意见反馈', true, SITE_MAIN); 314 $this->setNavHeader('意见反馈', true, SITE_MAIN);
@@ -344,8 +330,7 @@ class HomeController extends AbstractAction @@ -344,8 +330,7 @@ class HomeController extends AbstractAction
344 /** 330 /**
345 * 意见反馈-提交表单页面 331 * 意见反馈-提交表单页面
346 */ 332 */
347 - public function suggestSubAction()  
348 - { 333 + public function suggestSubAction() {
349 334
350 // 设置网站标题 335 // 设置网站标题
351 $this->setTitle('反馈问题'); 336 $this->setTitle('反馈问题');
@@ -373,8 +358,7 @@ class HomeController extends AbstractAction @@ -373,8 +358,7 @@ class HomeController extends AbstractAction
373 /** 358 /**
374 * 异步上传图片 359 * 异步上传图片
375 */ 360 */
376 - public function suggestimgUploadAction()  
377 - { 361 + public function suggestimgUploadAction() {
378 $filename = $this->post('filename', ''); 362 $filename = $this->post('filename', '');
379 $result = \Index\UserModel::saveSuggestImg($filename); 363 $result = \Index\UserModel::saveSuggestImg($filename);
380 364
@@ -384,8 +368,7 @@ class HomeController extends AbstractAction @@ -384,8 +368,7 @@ class HomeController extends AbstractAction
384 /** 368 /**
385 * 异步保存意见反馈数据 369 * 异步保存意见反馈数据
386 */ 370 */
387 - public function savesuggestAction()  
388 - { 371 + public function savesuggestAction() {
389 if ($this->isAjax()) { 372 if ($this->isAjax()) {
390 $uid = $this->getUid(); 373 $uid = $this->getUid();
391 $content = $this->post('content', ''); 374 $content = $this->post('content', '');
@@ -399,8 +382,7 @@ class HomeController extends AbstractAction @@ -399,8 +382,7 @@ class HomeController extends AbstractAction
399 /** 382 /**
400 * 会员等级展示页 383 * 会员等级展示页
401 */ 384 */
402 - public function gradeAction()  
403 - { 385 + public function gradeAction() {
404 //设置网站seo信息 386 //设置网站seo信息
405 $this->setTitle('会员等级'); 387 $this->setTitle('会员等级');
406 //显示网站导航头部信息 388 //显示网站导航头部信息
@@ -419,8 +401,7 @@ class HomeController extends AbstractAction @@ -419,8 +401,7 @@ class HomeController extends AbstractAction
419 * 会员特权查看页 401 * 会员特权查看页
420 */ 402 */
421 403
422 - public function preferentialAction()  
423 - { 404 + public function preferentialAction() {
424 //设置网站seo信息 405 //设置网站seo信息
425 $this->setTitle('会员等级'); 406 $this->setTitle('会员等级');
426 //显示网站导航头部信息 407 //显示网站导航头部信息
@@ -434,12 +415,11 @@ class HomeController extends AbstractAction @@ -434,12 +415,11 @@ class HomeController extends AbstractAction
434 } 415 }
435 416
436 /* 417 /*
437 - * 我的订单页面 418 + * 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
438 */ 419 */
439 420
440 - public function orderAction()  
441 - {  
442 - //获得type值 421 + public function orderAction() {
  422 + //获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
443 $type = $this->get('type', 1); 423 $type = $this->get('type', 1);
444 $this->setTitle('我的订单'); 424 $this->setTitle('我的订单');
445 $this->setNavHeader('我的订单'); 425 $this->setNavHeader('我的订单');
@@ -449,7 +429,7 @@ class HomeController extends AbstractAction @@ -449,7 +429,7 @@ class HomeController extends AbstractAction
449 } else { 429 } else {
450 $this->error(); 430 $this->error();
451 } 431 }
452 - 432 + //渲染模板
453 $this->_view->display('order', array( 433 $this->_view->display('order', array(
454 'order' => $order, 434 'order' => $order,
455 'pageFooter' => true, 435 'pageFooter' => true,
@@ -458,8 +438,7 @@ class HomeController extends AbstractAction @@ -458,8 +438,7 @@ class HomeController extends AbstractAction
458 } 438 }
459 439
460 //ajax请求订单页面 440 //ajax请求订单页面
461 - public function getOrdersAction()  
462 - { 441 + public function getOrdersAction() {
463 //判断是不是ajax请求 442 //判断是不是ajax请求
464 if (!$this->isAjax()) { 443 if (!$this->isAjax()) {
465 $this->error(); 444 $this->error();
@@ -474,15 +453,18 @@ class HomeController extends AbstractAction @@ -474,15 +453,18 @@ class HomeController extends AbstractAction
474 $uid = '10267443'; //测试用 453 $uid = '10267443'; //测试用
475 //调用模型层getOrder方法获得并处理数据 454 //调用模型层getOrder方法获得并处理数据
476 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 455 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
477 - //如果没有订单数据,就给一个随便逛逛链接 456 + /* 如果取不到订单数据时,分两种情况:
  457 + 1、page>1时,echo一个空格字符串到浏览器。
  458 + 2、page=1时,就给一个随便逛逛的链接。
  459 + * */
478 $order = array(); 460 $order = array();
479 if (!empty($data)) { 461 if (!empty($data)) {
480 $order['orders'] = $data; 462 $order['orders'] = $data;
481 } else { 463 } else {
482 if ($page > 1) { 464 if ($page > 1) {
483 echo " "; 465 echo " ";
484 - } else {  
485 - $order['walkwayUrl'] = 'http://www.baidu.com'; 466 + } elseif ($page = 1) {
  467 + $order['walkwayUrl'] = self::strollAction();
486 } 468 }
487 } 469 }
488 //渲染模板 470 //渲染模板
@@ -493,21 +475,22 @@ class HomeController extends AbstractAction @@ -493,21 +475,22 @@ class HomeController extends AbstractAction
493 * 我的订单-取消订单 475 * 我的订单-取消订单
494 */ 476 */
495 477
496 - public function cancelOrderAction()  
497 - { 478 + public function cancelOrderAction() {
498 479
499 //判断是不是ajax请求 480 //判断是不是ajax请求
500 if (!$this->isAjax()) { 481 if (!$this->isAjax()) {
501 $this->error(); 482 $this->error();
502 } 483 }
503 //传入order_code和uid以取消订单 484 //传入order_code和uid以取消订单
504 - $order_code = $this->get('orderCode'); 485 + $order_code = $this->get('id');
505 $uid = $this->getUid(); 486 $uid = $this->getUid();
506 $uid = '10267443'; //测试用 487 $uid = '10267443'; //测试用
507 $gender = Helpers::getGenderByCookie(); 488 $gender = Helpers::getGenderByCookie();
508 $yh_channel = $this->get('yh_channel', 1); 489 $yh_channel = $this->get('yh_channel', 1);
509 $method = 'app.SpaceOrders.close'; 490 $method = 'app.SpaceOrders.close';
  491 + //调用取消订单接口,返回订单取消状态
510 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); 492 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
  493 + //将取消状态返回至浏览器
511 $this->echoJson($data); 494 $this->echoJson($data);
512 } 495 }
513 496
@@ -515,8 +498,7 @@ class HomeController extends AbstractAction @@ -515,8 +498,7 @@ class HomeController extends AbstractAction
515 * 我的订单-删除订单 498 * 我的订单-删除订单
516 */ 499 */
517 500
518 - public function delOrderAction()  
519 - { 501 + public function delOrderAction() {
520 //判断是不是ajax请求 502 //判断是不是ajax请求
521 if (!$this->isAjax()) { 503 if (!$this->isAjax()) {
522 $this->error(); 504 $this->error();
@@ -528,15 +510,39 @@ class HomeController extends AbstractAction @@ -528,15 +510,39 @@ class HomeController extends AbstractAction
528 $gender = Helpers::getGenderByCookie(); 510 $gender = Helpers::getGenderByCookie();
529 $yh_channel = $this->get('yh_channel', 1); 511 $yh_channel = $this->get('yh_channel', 1);
530 $method = 'app.SpaceOrders.delOrderByCode'; 512 $method = 'app.SpaceOrders.delOrderByCode';
  513 + //调用接口删除订单,并返回订单删除状态
531 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); 514 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
  515 + //将订单删除状态返回至浏览器
532 $this->echoJson($data); 516 $this->echoJson($data);
533 } 517 }
534 518
  519 + /*
  520 + * 我的订单-支付链接获取
  521 + */
  522 +
  523 + private function paymentAction() {
  524 + $gender = Helpers::getGenderByCookie();
  525 + $yh_channel = $this->get('yh_channel', 1);
  526 + OrderModel::payment($gender, $yh_channel);
  527 + }
  528 +
  529 + /*
  530 + * 我的订单-随便逛逛链接获取
  531 + */
  532 +
  533 + private function strollAction() {
  534 + //获取性别、频道数据
  535 + $gender = Helpers::getGenderByCookie();
  536 + $yh_channel = $this->get('yh_channel', 1);
  537 + //调用接口获取随便逛逛url地址,并return数据
  538 + $data = OrderModel::stroll($gender, $yh_channel);
  539 + return $data;
  540 + }
  541 +
535 /** 542 /**
536 * 订单详情页 543 * 订单详情页
537 */ 544 */
538 - public function orderDetailAction()  
539 - { 545 + public function orderDetailAction() {
540 $data = array( 546 $data = array(
541 'name' => '毛毛莉Lydia', 547 'name' => '毛毛莉Lydia',
542 'phoneNum' => '18600001133', 548 'phoneNum' => '18600001133',
@@ -18,11 +18,16 @@ use Configs\CacheConfig; @@ -18,11 +18,16 @@ use Configs\CacheConfig;
18 */ 18 */
19 class OrderModel 19 class OrderModel
20 { 20 {
  21 + /* 频道选择页取背景图片的位置码 */
  22 +
  23 + const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
  24 + const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
21 25
22 /** 26 /**
23 * 订单相关数据处理 27 * 订单相关数据处理
24 */ 28 */
25 - public function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) { 29 +
  30 + static function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
26 $result = array(); 31 $result = array();
27 if (USE_CACHE) { 32 if (USE_CACHE) {
28 $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER; 33 $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER;
@@ -37,32 +42,37 @@ class OrderModel @@ -37,32 +42,37 @@ class OrderModel
37 //检查数据返回是否正常,正常则处理数据 42 //检查数据返回是否正常,正常则处理数据
38 if ($data['code'] == 200 && isset($data['data'])) { 43 if ($data['code'] == 200 && isset($data['data'])) {
39 foreach ($data['data']['order_list'] as $key => $vo) { 44 foreach ($data['data']['order_list'] as $key => $vo) {
40 - //订单号,支付状态,订单商品数量,订单总价格 45 + //订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费)
41 $result[$key]['orderNum'] = $vo['order_code']; 46 $result[$key]['orderNum'] = $vo['order_code'];
42 $result[$key]['orderStatus'] = $vo['status_str']; 47 $result[$key]['orderStatus'] = $vo['status_str'];
43 $result[$key]['count'] = count($vo['order_goods']); 48 $result[$key]['count'] = count($vo['order_goods']);
44 $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost']; 49 $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
45 - //订单商品列表数据 50 + //类内调用格式化订单商品数据方法
46 $result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']); 51 $result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']);
47 - //订单status判断订单处于什么状态。 52 + //根据订单status判断订单处于什么状态。
48 do { 53 do {
49 - //订单取消状态 54 + //订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
50 if ($vo['is_cancel'] === 'Y') { 55 if ($vo['is_cancel'] === 'Y') {
51 $result[$key]['canceled'] = true; 56 $result[$key]['canceled'] = true;
52 break; 57 break;
53 } 58 }
54 - //支付方式不是货到付款时,计算订单状态 59 + /* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
  60 + * 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
  61 + */
  62 + //支付方式为非货到付款时,计算订单状态。
55 if ($vo['payment_type'] != 2) { 63 if ($vo['payment_type'] != 2) {
56 switch ($vo['status']) { 64 switch ($vo['status']) {
57 case 0: 65 case 0:
58 $result[$key]['unpaid'] = true; 66 $result[$key]['unpaid'] = true;
59 break; 67 break;
  68 + //未发货&未收货 状态,统一合并到待收货状态。
60 case 1: 69 case 1:
61 case 2: 70 case 2:
62 case 3: 71 case 3:
63 case 4: 72 case 4:
64 case 5: 73 case 5:
65 $result[$key]['unreceived'] = true; 74 $result[$key]['unreceived'] = true;
  75 + //待收货状态,给查看物流url
66 $result[$key]['logisticsUrl'] = "暂无logisticsUrl数据"; 76 $result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
67 break; 77 break;
68 case 6: 78 case 6:
@@ -72,11 +82,11 @@ class OrderModel @@ -72,11 +82,11 @@ class OrderModel
72 break; 82 break;
73 } 83 }
74 } elseif ($vo['payment_type'] == 2) { 84 } elseif ($vo['payment_type'] == 2) {
75 - //订单为货到付款订单时,订单没有未支付状态 85 + //订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
76 switch ($vo['status']) { 86 switch ($vo['status']) {
77 case 0 || 1 || 2 || 3 || 4 || 5: 87 case 0 || 1 || 2 || 3 || 4 || 5:
78 $result[$key]['unreceived'] = true; 88 $result[$key]['unreceived'] = true;
79 - //此处备注,接口没有返回logisticsUrl数据 89 + //待收货状态,给查看物流url
80 $resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据"; 90 $resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据";
81 break; 91 break;
82 case 6: 92 case 6:
@@ -113,6 +123,7 @@ class OrderModel @@ -113,6 +123,7 @@ class OrderModel
113 $arr[$key]['size'] = $vo['size_name']; 123 $arr[$key]['size'] = $vo['size_name'];
114 $arr[$key]['price'] = $vo['goods_price']; 124 $arr[$key]['price'] = $vo['goods_price'];
115 $arr[$key]['count'] = $vo['buy_number']; 125 $arr[$key]['count'] = $vo['buy_number'];
  126 + //gift=>是否赠品,advanceBuy=>是否加价购;
116 if ($vo['goods_type'] == 'gift') { 127 if ($vo['goods_type'] == 'gift') {
117 $arr[$key]['gift'] = true; 128 $arr[$key]['gift'] = true;
118 } elseif ($vo['goods_type'] == 'price_gift') { 129 } elseif ($vo['goods_type'] == 'price_gift') {
@@ -123,7 +134,7 @@ class OrderModel @@ -123,7 +134,7 @@ class OrderModel
123 } 134 }
124 135
125 //根据type值设置nav属性 136 //根据type值设置nav属性
126 - public function getNavs($type) { 137 + static function getNavs($type) {
127 $nav = array( 138 $nav = array(
128 array( 139 array(
129 'name' => '全部', 140 'name' => '全部',
@@ -176,6 +187,27 @@ class OrderModel @@ -176,6 +187,27 @@ class OrderModel
176 } 187 }
177 188
178 //获得支付链接 189 //获得支付链接
  190 + static function payment($gender, $yh_channel) {
  191 + $code = self::CODE_PAYMENT;
  192 + $data = OrderData::paymentData($gender, $yh_channel, $code);
  193 + }
179 194
  195 + //查看物流
  196 +// static function Logistics(){
  197 +// OrderData::LogisticsData();
  198 +// }
  199 + //随便逛逛url获取
  200 + static function stroll($gender, $yh_channel) {
  201 + //获取随便逛逛url资源码
  202 + $code = self::CODE_STROLL;
  203 + //调用接口获得数据
  204 + $data = OrderData::strollData($gender, $yh_channel, $code);
  205 + $stroll = 1;
  206 + //检查数据返回是否正常,正常则处理数据
  207 + if ($data['code'] == 200) {
  208 + $strollUrl = $data['data'][0]['data'][0]['url'];
  209 + }
  210 + return $strollUrl;
  211 + }
180 212
181 } 213 }