Authored by Rock Zhang

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

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -24,7 +24,7 @@ class OrderData @@ -24,7 +24,7 @@ class OrderData
24 * and open the template in the editor. 24 * and open the template in the editor.
25 */ 25 */
26 26
27 - public function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) { 27 + static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) {
28 //构建必传参数 28 //构建必传参数
29 $param = Yohobuy::param(); 29 $param = Yohobuy::param();
30 $param['gender'] = $gender; 30 $param['gender'] = $gender;
@@ -36,7 +36,7 @@ class OrderData @@ -36,7 +36,7 @@ class OrderData
36 $param['yh_channel'] = $yh_channel; 36 $param['yh_channel'] = $yh_channel;
37 $param['client_secret'] = Sign::getSign($param); 37 $param['client_secret'] = Sign::getSign($param);
38 //调用接口获得数据 38 //调用接口获得数据
39 - return Yohobuy::get(Yohobuy::API_URL2, $param); 39 + return Yohobuy::get(Yohobuy::API_URL, $param);
40 } 40 }
41 41
42 /* 42 /*
@@ -45,7 +45,7 @@ class OrderData @@ -45,7 +45,7 @@ class OrderData
45 * and open the template in the editor. 45 * and open the template in the editor.
46 */ 46 */
47 47
48 - public function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) { 48 + static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
49 $param = Yohobuy::param(); 49 $param = Yohobuy::param();
50 $param['order_code'] = $order_code; 50 $param['order_code'] = $order_code;
51 $param['uid'] = $uid; 51 $param['uid'] = $uid;
@@ -62,7 +62,7 @@ class OrderData @@ -62,7 +62,7 @@ class OrderData
62 * and open the template in the editor. 62 * and open the template in the editor.
63 */ 63 */
64 64
65 - public function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) { 65 + static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
66 $param = Yohobuy::param(); 66 $param = Yohobuy::param();
67 $param['order_code'] = $order_code; 67 $param['order_code'] = $order_code;
68 $param['uid'] = $uid; 68 $param['uid'] = $uid;
@@ -74,4 +74,20 @@ class OrderData @@ -74,4 +74,20 @@ class OrderData
74 return Yohobuy::get(Yohobuy::API_URL, $param); 74 return Yohobuy::get(Yohobuy::API_URL, $param);
75 } 75 }
76 76
  77 + /*
  78 + * 支付订单
  79 + * To change this template file, choose Tools | Templates
  80 + * and open the template in the editor.
  81 + */
  82 +
  83 + static function getPaymentData($contentCode, $gender, $yh_channel) {
  84 + $param = Yohobuy::param();
  85 + $param['content_code'] = $contentCode;
  86 + $param['gender'] = $gender;
  87 + $param['yh_channel'] = $yh_channel;
  88 + $param['client_secret'] = Sign::getSign($param);
  89 + //print_r($param);
  90 + return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
  91 + }
  92 +
77 } 93 }
@@ -55,16 +55,19 @@ function initInfosEvt($container) { @@ -55,16 +55,19 @@ function initInfosEvt($container) {
55 55
56 cHammer = new Hammer($container[0]); 56 cHammer = new Hammer($container[0]);
57 57
  58 + //点赞或者收藏事件
58 cHammer.on('tap', function(e) { 59 cHammer.on('tap', function(e) {
59 var $this = $(e.target), 60 var $this = $(e.target),
60 opt = 'ok', 61 opt = 'ok',
61 - $likeBtn,  
62 - $collectBtn, 62 + $btn,
63 $info; 63 $info;
64 64
65 - $likeBtn = $this.closest('.like-btn');  
66 - if ($likeBtn.length > 0) {  
67 - if ($likeBtn.hasClass('like')) { 65 + e.preventDefault();
  66 +
  67 + //点赞
  68 + $btn = $this.closest('.like-btn');
  69 + if ($btn.length > 0) {
  70 + if ($btn.hasClass('like')) {
68 opt = 'cancel'; 71 opt = 'cancel';
69 } 72 }
70 73
@@ -80,22 +83,23 @@ function initInfosEvt($container) { @@ -80,22 +83,23 @@ function initInfosEvt($container) {
80 var code = data.code; 83 var code = data.code;
81 84
82 if (code === 200) { 85 if (code === 200) {
83 - $likeBtn.next('.like-count').text(data.data); 86 + $btn.next('.like-count').text(data.data);
84 87
85 //切换点赞状态 88 //切换点赞状态
86 - $likeBtn.toggleClass('like'); 89 + $btn.toggleClass('like');
87 } 90 }
88 }, 91 },
89 error: function() { 92 error: function() {
90 tip.show('网络断开连接了~'); 93 tip.show('网络断开连接了~');
91 } 94 }
92 }); 95 });
  96 + return;
93 } 97 }
94 98
95 - // 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!  
96 - $collectBtn = $this.closest('.collect-btn');  
97 - if ($collectBtn.length > 0) {  
98 - if ($collectBtn.hasClass('collected')) { 99 + //APP收藏
  100 + $btn = $this.closest('.collect-btn');
  101 + if ($btn.length > 0) {
  102 + if ($btn.hasClass('collected')) {
99 opt = 'cancel'; 103 opt = 'cancel';
100 } 104 }
101 105
@@ -111,7 +115,7 @@ function initInfosEvt($container) { @@ -111,7 +115,7 @@ function initInfosEvt($container) {
111 if (data.code && data.code === 200) { 115 if (data.code && data.code === 200) {
112 116
113 //切换收藏状态 117 //切换收藏状态
114 - $collectBtn.toggleClass('collected'); 118 + $btn.toggleClass('collected');
115 } 119 }
116 }, 120 },
117 error: function() { 121 error: function() {
@@ -6,6 +6,22 @@ @@ -6,6 +6,22 @@
6 6
7 var $ = require('jquery'); 7 var $ = require('jquery');
8 8
9 -var info = require('../guang/info'); 9 +var $infoList = $('#info-list');
10 10
11 -info.initInfoEvt($('#info-list'));  
  11 +var winH = $(window).height();
  12 +
  13 +var info = require('../guang/info'),
  14 + loadMore = info.loadMore;
  15 +
  16 +var setting = {
  17 + page: 2,
  18 + end: false
  19 +};
  20 +
  21 +info.initInfoEvt($infoList);
  22 +
  23 +$(window).scroll(function() {
  24 + if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
  25 + loadMore($infoList, setting);
  26 + }
  27 +});
@@ -136,8 +136,8 @@ orderHammer.on('tap', function(e) { @@ -136,8 +136,8 @@ orderHammer.on('tap', function(e) {
136 success: function(data) { 136 success: function(data) {
137 if (data.code === 200) { 137 if (data.code === 200) {
138 138
139 - //取消订单  
140 - alert('order cancel'); 139 + //取消订单页面刷新
  140 + location.href = location.href;
141 } 141 }
142 } 142 }
143 }); 143 });
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="my-guang-page yoho-page"> 2 <div class="my-guang-page yoho-page">
3 - <div class="info-list"> 3 + <div id="info-list" class="info-list">
4 {{# myGuang}} 4 {{# myGuang}}
5 {{> guang/info}} 5 {{> guang/info}}
6 {{/ myGuang}} 6 {{/ myGuang}}
@@ -242,4 +242,9 @@ @@ -242,4 +242,9 @@
242 <script> 242 <script>
243 seajs.use('js/me/address'); 243 seajs.use('js/me/address');
244 </script> 244 </script>
  245 +{{/if}}
  246 +{{#if myGuangPage}}
  247 +<script>
  248 + seajs.use('js/me/my-guang');
  249 +</script>
245 {{/if}} 250 {{/if}}
@@ -355,7 +355,7 @@ class HomeController extends AbstractAction @@ -355,7 +355,7 @@ class HomeController extends AbstractAction
355 $gender = Helpers::getGenderByCookie(); 355 $gender = Helpers::getGenderByCookie();
356 $channel = Helpers::getChannelByCookie(); 356 $channel = Helpers::getChannelByCookie();
357 $uid = $this->getUid(); 357 $uid = $this->getUid();
358 - $uid = '7566245'; //临时测试用 358 + $uid = '10267443'; //临时测试用
359 $data = GradeModel::getGrade($gender, $channel, $uid); 359 $data = GradeModel::getGrade($gender, $channel, $uid);
360 $data['pageFooter'] = true; 360 $data['pageFooter'] = true;
361 $this->_view->display('vip-grade', $data); 361 $this->_view->display('vip-grade', $data);
@@ -414,7 +414,7 @@ class HomeController extends AbstractAction @@ -414,7 +414,7 @@ class HomeController extends AbstractAction
414 $gender = Helpers::getGenderByCookie(); 414 $gender = Helpers::getGenderByCookie();
415 $yh_channel = $this->get('yh_channel', 1); 415 $yh_channel = $this->get('yh_channel', 1);
416 $uid = $this->getUid(); 416 $uid = $this->getUid();
417 - $uid = '7566245'; //测试用 417 + $uid = '10267443'; //测试用
418 //调用模型层getOrder方法获得并处理数据 418 //调用模型层getOrder方法获得并处理数据
419 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 419 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
420 //如果没有订单数据,就给一个随便逛逛链接 420 //如果没有订单数据,就给一个随便逛逛链接
@@ -450,31 +450,27 @@ class HomeController extends AbstractAction @@ -450,31 +450,27 @@ class HomeController extends AbstractAction
450 $yh_channel = $this->get('yh_channel', 1); 450 $yh_channel = $this->get('yh_channel', 1);
451 $method = 'app.SpaceOrders.close'; 451 $method = 'app.SpaceOrders.close';
452 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); 452 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
453 - if ($data['code'] == 200) {  
454 - echo $data['message'];  
455 - } 453 + $this->echoJson($data);
456 } 454 }
457 455
458 /* 456 /*
459 * 我的订单-删除订单 457 * 我的订单-删除订单
460 */ 458 */
461 459
462 - public function deleteOrderAction() { 460 + public function delOrderAction() {
463 //判断是不是ajax请求 461 //判断是不是ajax请求
464 if (!$this->isAjax()) { 462 if (!$this->isAjax()) {
465 $this->error(); 463 $this->error();
466 } 464 }
467 //传入order_code和uid以删除订单 465 //传入order_code和uid以删除订单
468 - $order_code = $this->get('orderCode'); 466 + $order_code = $this->get('id');
469 $uid = $this->getUid(); 467 $uid = $this->getUid();
470 $uid = '10267443'; //测试用 468 $uid = '10267443'; //测试用
471 $gender = Helpers::getGenderByCookie(); 469 $gender = Helpers::getGenderByCookie();
472 $yh_channel = $this->get('yh_channel', 1); 470 $yh_channel = $this->get('yh_channel', 1);
473 $method = 'app.SpaceOrders.delOrderByCode'; 471 $method = 'app.SpaceOrders.delOrderByCode';
474 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); 472 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
475 - if ($data['code'] == 200) {  
476 - echo $data['message'];  
477 - } 473 + $this->echoJson($data);
478 } 474 }
479 475
480 /** 476 /**
@@ -174,5 +174,8 @@ class OrderModel @@ -174,5 +174,8 @@ class OrderModel
174 } 174 }
175 return $nav; 175 return $nav;
176 } 176 }
  177 +
  178 + //获得支付链接
  179 +
177 180
178 } 181 }