Authored by yangyang

完善一些代码格式,为添加程序备注,完成随便逛逛url获取

@@ -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);
@@ -87,8 +85,7 @@ class HomeController extends AbstractAction @@ -87,8 +85,7 @@ class HomeController extends AbstractAction
87 /** 85 /**
88 * 用户收藏的商品-删除 86 * 用户收藏的商品-删除
89 */ 87 */
90 - public function favoriteDelAction()  
91 - { 88 + public function favoriteDelAction() {
92 $result = array(); 89 $result = array();
93 90
94 if ($this->isAjax()) { 91 if ($this->isAjax()) {
@@ -108,8 +105,7 @@ class HomeController extends AbstractAction @@ -108,8 +105,7 @@ class HomeController extends AbstractAction
108 /** 105 /**
109 * 用户收藏的品牌 106 * 用户收藏的品牌
110 */ 107 */
111 - public function favoritebrandAction()  
112 - { 108 + public function favoritebrandAction() {
113 $uid = $this->getUid(); 109 $uid = $this->getUid();
114 $gender = Helpers::getGenderByCookie(); 110 $gender = Helpers::getGenderByCookie();
115 111
@@ -121,8 +117,7 @@ class HomeController extends AbstractAction @@ -121,8 +117,7 @@ class HomeController extends AbstractAction
121 /** 117 /**
122 * 个人信息 118 * 个人信息
123 */ 119 */
124 - public function personalDetailsAction()  
125 - { 120 + public function personalDetailsAction() {
126 $this->setTitle('个人信息'); 121 $this->setTitle('个人信息');
127 $this->setNavHeader('个人信息', true, SITE_MAIN); 122 $this->setNavHeader('个人信息', true, SITE_MAIN);
128 123
@@ -136,8 +131,7 @@ class HomeController extends AbstractAction @@ -136,8 +131,7 @@ class HomeController extends AbstractAction
136 /** 131 /**
137 * YOHO币 132 * YOHO币
138 */ 133 */
139 - public function currencyAction()  
140 - { 134 + public function currencyAction() {
141 $this->setTitle('YOHO币'); 135 $this->setTitle('YOHO币');
142 $this->setNavHeader('YOHO币', true, false); 136 $this->setNavHeader('YOHO币', true, false);
143 137
@@ -152,8 +146,7 @@ class HomeController extends AbstractAction @@ -152,8 +146,7 @@ class HomeController extends AbstractAction
152 /** 146 /**
153 * 优惠券 147 * 优惠券
154 */ 148 */
155 - public function couponsAction()  
156 - { 149 + public function couponsAction() {
157 150
158 $this->setTitle('优惠券'); 151 $this->setTitle('优惠券');
159 $this->setNavHeader('优惠券', true, SITE_MAIN); 152 $this->setNavHeader('优惠券', true, SITE_MAIN);
@@ -170,8 +163,7 @@ class HomeController extends AbstractAction @@ -170,8 +163,7 @@ class HomeController extends AbstractAction
170 /** 163 /**
171 * 我的消息 164 * 我的消息
172 */ 165 */
173 - public function messageAction()  
174 - { 166 + public function messageAction() {
175 // $uid = $this->getUid(); 167 // $uid = $this->getUid();
176 $page = $this->get('page', 0); 168 $page = $this->get('page', 0);
177 $size = $this->get('size', 10); 169 $size = $this->get('size', 10);
@@ -185,8 +177,7 @@ class HomeController extends AbstractAction @@ -185,8 +177,7 @@ class HomeController extends AbstractAction
185 /** 177 /**
186 * 地址管理 178 * 地址管理
187 */ 179 */
188 - public function addressAction()  
189 - { 180 + public function addressAction() {
190 // 设置网站标题 181 // 设置网站标题
191 $this->setTitle('地址管理'); 182 $this->setTitle('地址管理');
192 $this->setNavHeader('地址管理', true, SITE_MAIN); 183 $this->setNavHeader('地址管理', true, SITE_MAIN);
@@ -210,8 +201,7 @@ class HomeController extends AbstractAction @@ -210,8 +201,7 @@ class HomeController extends AbstractAction
210 /** 201 /**
211 * 修改地址或者添加新地址 202 * 修改地址或者添加新地址
212 */ 203 */
213 - public function saveAddressAction()  
214 - { 204 + public function saveAddressAction() {
215 $result = array(); 205 $result = array();
216 206
217 if ($this->isAjax()) { 207 if ($this->isAjax()) {
@@ -238,8 +228,7 @@ class HomeController extends AbstractAction @@ -238,8 +228,7 @@ class HomeController extends AbstractAction
238 /** 228 /**
239 * 设置默认地址 229 * 设置默认地址
240 */ 230 */
241 - public function defaultAddressAction()  
242 - { 231 + public function defaultAddressAction() {
243 $result = array(); 232 $result = array();
244 233
245 if ($this->isAjax()) { 234 if ($this->isAjax()) {
@@ -260,8 +249,7 @@ class HomeController extends AbstractAction @@ -260,8 +249,7 @@ class HomeController extends AbstractAction
260 /** 249 /**
261 * 删除地址 250 * 删除地址
262 */ 251 */
263 - public function addressDelAction()  
264 - { 252 + public function addressDelAction() {
265 $result = array(); 253 $result = array();
266 254
267 if ($this->isAjax()) { 255 if ($this->isAjax()) {
@@ -280,8 +268,7 @@ class HomeController extends AbstractAction @@ -280,8 +268,7 @@ class HomeController extends AbstractAction
280 } 268 }
281 269
282 //在线客服 270 //在线客服
283 - public function onlineServiceAction()  
284 - { 271 + public function onlineServiceAction() {
285 // 设置网站标题 272 // 设置网站标题
286 $this->setTitle('在线客服'); 273 $this->setTitle('在线客服');
287 $this->setNavHeader('在线客服', true, SITE_MAIN); 274 $this->setNavHeader('在线客服', true, SITE_MAIN);
@@ -296,8 +283,7 @@ class HomeController extends AbstractAction @@ -296,8 +283,7 @@ class HomeController extends AbstractAction
296 } 283 }
297 284
298 //在线客服-具体详情 285 //在线客服-具体详情
299 - public function onlineServiceDetailAction()  
300 - { 286 + public function onlineServiceDetailAction() {
301 $service = array(); 287 $service = array();
302 $cateId = $this->get('cateId', 0); 288 $cateId = $this->get('cateId', 0);
303 $cateName = $this->get('cateName', ''); 289 $cateName = $this->get('cateName', '');
@@ -312,16 +298,14 @@ class HomeController extends AbstractAction @@ -312,16 +298,14 @@ class HomeController extends AbstractAction
312 /** 298 /**
313 * 我的逛 299 * 我的逛
314 */ 300 */
315 - public function myGuangAction()  
316 - { 301 + public function myGuangAction() {
317 echo 'My Guang'; 302 echo 'My Guang';
318 } 303 }
319 304
320 /** 305 /**
321 * 意见反馈 306 * 意见反馈
322 */ 307 */
323 - public function suggestAction()  
324 - { 308 + public function suggestAction() {
325 // 设置网站标题 309 // 设置网站标题
326 $this->setTitle('意见反馈'); 310 $this->setTitle('意见反馈');
327 $this->setNavHeader('意见反馈', true, SITE_MAIN); 311 $this->setNavHeader('意见反馈', true, SITE_MAIN);
@@ -343,8 +327,7 @@ class HomeController extends AbstractAction @@ -343,8 +327,7 @@ class HomeController extends AbstractAction
343 /** 327 /**
344 * 意见反馈-提交表单页面 328 * 意见反馈-提交表单页面
345 */ 329 */
346 - public function suggestSubAction()  
347 - { 330 + public function suggestSubAction() {
348 331
349 // 设置网站标题 332 // 设置网站标题
350 $this->setTitle('反馈问题'); 333 $this->setTitle('反馈问题');
@@ -372,8 +355,7 @@ class HomeController extends AbstractAction @@ -372,8 +355,7 @@ class HomeController extends AbstractAction
372 /** 355 /**
373 * 异步上传图片 356 * 异步上传图片
374 */ 357 */
375 - public function suggestimgUploadAction()  
376 - { 358 + public function suggestimgUploadAction() {
377 $filename = $this->post('filename', ''); 359 $filename = $this->post('filename', '');
378 $result = \Index\UserModel::saveSuggestImg($filename); 360 $result = \Index\UserModel::saveSuggestImg($filename);
379 361
@@ -383,8 +365,7 @@ class HomeController extends AbstractAction @@ -383,8 +365,7 @@ class HomeController extends AbstractAction
383 /** 365 /**
384 * 异步保存意见反馈数据 366 * 异步保存意见反馈数据
385 */ 367 */
386 - public function savesuggestAction()  
387 - { 368 + public function savesuggestAction() {
388 if ($this->isAjax()) { 369 if ($this->isAjax()) {
389 $uid = $this->getUid(); 370 $uid = $this->getUid();
390 $content = $this->post('content', ''); 371 $content = $this->post('content', '');
@@ -398,8 +379,7 @@ class HomeController extends AbstractAction @@ -398,8 +379,7 @@ class HomeController extends AbstractAction
398 /** 379 /**
399 * 会员等级展示页 380 * 会员等级展示页
400 */ 381 */
401 - public function gradeAction()  
402 - { 382 + public function gradeAction() {
403 //设置网站seo信息 383 //设置网站seo信息
404 $this->setTitle('会员等级'); 384 $this->setTitle('会员等级');
405 //显示网站导航头部信息 385 //显示网站导航头部信息
@@ -418,8 +398,7 @@ class HomeController extends AbstractAction @@ -418,8 +398,7 @@ class HomeController extends AbstractAction
418 * 会员特权查看页 398 * 会员特权查看页
419 */ 399 */
420 400
421 - public function preferentialAction()  
422 - { 401 + public function preferentialAction() {
423 //设置网站seo信息 402 //设置网站seo信息
424 $this->setTitle('会员等级'); 403 $this->setTitle('会员等级');
425 //显示网站导航头部信息 404 //显示网站导航头部信息
@@ -433,12 +412,11 @@ class HomeController extends AbstractAction @@ -433,12 +412,11 @@ class HomeController extends AbstractAction
433 } 412 }
434 413
435 /* 414 /*
436 - * 我的订单页面 415 + * 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
437 */ 416 */
438 417
439 - public function orderAction()  
440 - {  
441 - //获得type值 418 + public function orderAction() {
  419 + //获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
442 $type = $this->get('type', 1); 420 $type = $this->get('type', 1);
443 $this->setTitle('我的订单'); 421 $this->setTitle('我的订单');
444 $this->setNavHeader('我的订单'); 422 $this->setNavHeader('我的订单');
@@ -448,7 +426,7 @@ class HomeController extends AbstractAction @@ -448,7 +426,7 @@ class HomeController extends AbstractAction
448 } else { 426 } else {
449 $this->error(); 427 $this->error();
450 } 428 }
451 - 429 + //渲染模板
452 $this->_view->display('order', array( 430 $this->_view->display('order', array(
453 'order' => $order, 431 'order' => $order,
454 'pageFooter' => true, 432 'pageFooter' => true,
@@ -457,8 +435,7 @@ class HomeController extends AbstractAction @@ -457,8 +435,7 @@ class HomeController extends AbstractAction
457 } 435 }
458 436
459 //ajax请求订单页面 437 //ajax请求订单页面
460 - public function getOrdersAction()  
461 - { 438 + public function getOrdersAction() {
462 //判断是不是ajax请求 439 //判断是不是ajax请求
463 if (!$this->isAjax()) { 440 if (!$this->isAjax()) {
464 $this->error(); 441 $this->error();
@@ -473,15 +450,18 @@ class HomeController extends AbstractAction @@ -473,15 +450,18 @@ class HomeController extends AbstractAction
473 $uid = '10267443'; //测试用 450 $uid = '10267443'; //测试用
474 //调用模型层getOrder方法获得并处理数据 451 //调用模型层getOrder方法获得并处理数据
475 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 452 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
476 - //如果没有订单数据,就给一个随便逛逛链接 453 + /* 如果取不到订单数据时,分两种情况:
  454 + 1、page>1时,echo一个空格字符串到浏览器。
  455 + 2、page=1时,就给一个随便逛逛的链接。
  456 + * */
477 $order = array(); 457 $order = array();
478 if (!empty($data)) { 458 if (!empty($data)) {
479 $order['orders'] = $data; 459 $order['orders'] = $data;
480 } else { 460 } else {
481 if ($page > 1) { 461 if ($page > 1) {
482 echo " "; 462 echo " ";
483 - } else {  
484 - $order['walkwayUrl'] = 'http://www.baidu.com'; 463 + } elseif ($page = 1) {
  464 + $order['walkwayUrl'] = self::strollAction();
485 } 465 }
486 } 466 }
487 //渲染模板 467 //渲染模板
@@ -492,8 +472,7 @@ class HomeController extends AbstractAction @@ -492,8 +472,7 @@ class HomeController extends AbstractAction
492 * 我的订单-取消订单 472 * 我的订单-取消订单
493 */ 473 */
494 474
495 - public function cancelOrderAction()  
496 - { 475 + public function cancelOrderAction() {
497 476
498 //判断是不是ajax请求 477 //判断是不是ajax请求
499 if (!$this->isAjax()) { 478 if (!$this->isAjax()) {
@@ -506,8 +485,9 @@ class HomeController extends AbstractAction @@ -506,8 +485,9 @@ class HomeController extends AbstractAction
506 $gender = Helpers::getGenderByCookie(); 485 $gender = Helpers::getGenderByCookie();
507 $yh_channel = $this->get('yh_channel', 1); 486 $yh_channel = $this->get('yh_channel', 1);
508 $method = 'app.SpaceOrders.close'; 487 $method = 'app.SpaceOrders.close';
  488 + //调用取消订单接口,返回订单取消状态
509 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); 489 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
510 - 490 + //将取消状态返回至浏览器
511 $this->echoJson($data); 491 $this->echoJson($data);
512 } 492 }
513 493
@@ -515,8 +495,7 @@ class HomeController extends AbstractAction @@ -515,8 +495,7 @@ class HomeController extends AbstractAction
515 * 我的订单-删除订单 495 * 我的订单-删除订单
516 */ 496 */
517 497
518 - public function delOrderAction()  
519 - { 498 + public function delOrderAction() {
520 //判断是不是ajax请求 499 //判断是不是ajax请求
521 if (!$this->isAjax()) { 500 if (!$this->isAjax()) {
522 $this->error(); 501 $this->error();
@@ -528,15 +507,39 @@ class HomeController extends AbstractAction @@ -528,15 +507,39 @@ class HomeController extends AbstractAction
528 $gender = Helpers::getGenderByCookie(); 507 $gender = Helpers::getGenderByCookie();
529 $yh_channel = $this->get('yh_channel', 1); 508 $yh_channel = $this->get('yh_channel', 1);
530 $method = 'app.SpaceOrders.delOrderByCode'; 509 $method = 'app.SpaceOrders.delOrderByCode';
  510 + //调用接口删除订单,并返回订单删除状态
531 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); 511 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
  512 + //将订单删除状态返回至浏览器
532 $this->echoJson($data); 513 $this->echoJson($data);
533 } 514 }
534 515
  516 + /*
  517 + * 我的订单-支付链接获取
  518 + */
  519 +
  520 + private function paymentAction() {
  521 + $gender = Helpers::getGenderByCookie();
  522 + $yh_channel = $this->get('yh_channel', 1);
  523 + OrderModel::payment($gender, $yh_channel);
  524 + }
  525 +
  526 + /*
  527 + * 我的订单-随便逛逛链接获取
  528 + */
  529 +
  530 + private function strollAction() {
  531 + //获取性别、频道数据
  532 + $gender = Helpers::getGenderByCookie();
  533 + $yh_channel = $this->get('yh_channel', 1);
  534 + //调用接口获取随便逛逛url地址,并return数据
  535 + $data = OrderModel::stroll($gender, $yh_channel);
  536 + return $data;
  537 + }
  538 +
535 /** 539 /**
536 * 订单详情页 540 * 订单详情页
537 */ 541 */
538 - public function orderDetailAction()  
539 - { 542 + public function orderDetailAction() {
540 $data = array( 543 $data = array(
541 'name' => '毛毛莉Lydia', 544 'name' => '毛毛莉Lydia',
542 'phoneNum' => '18600001133', 545 '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' => '全部',
@@ -174,8 +185,29 @@ class OrderModel @@ -174,8 +185,29 @@ class OrderModel
174 } 185 }
175 return $nav; 186 return $nav;
176 } 187 }
177 - 188 +
178 //获得支付链接 189 //获得支付链接
179 - 190 + static function payment($gender, $yh_channel) {
  191 + $code = self::CODE_PAYMENT;
  192 + $data = OrderData::paymentData($gender, $yh_channel, $code);
  193 + }
  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 }