Authored by Rock Zhang

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

@@ -212,9 +212,10 @@ class UserData @@ -212,9 +212,10 @@ class UserData
212 * @param int $uid 用户ID 212 * @param int $uid 用户ID
213 * @param int $page 第几页,默认1 213 * @param int $page 第几页,默认1
214 * @param int $limit 限制读取的数目,默认10 214 * @param int $limit 限制读取的数目,默认10
  215 + * @param string $type 请求类型 get,post
215 * @return array YOHO币接口返回的数据 216 * @return array YOHO币接口返回的数据
216 */ 217 */
217 - public static function yohoCoinData($uid, $page = 1, $limit = 10) 218 + public static function yohoCoinData($uid, $page = 1, $limit = 10,$type = 'get')
218 { 219 {
219 $param = Yohobuy::param(); 220 $param = Yohobuy::param();
220 $param['method'] = 'app.yohocoin.lists'; 221 $param['method'] = 'app.yohocoin.lists';
@@ -223,7 +224,7 @@ class UserData @@ -223,7 +224,7 @@ class UserData
223 $param['limit'] = $limit; 224 $param['limit'] = $limit;
224 $param['client_secret'] = Sign::getSign($param); 225 $param['client_secret'] = Sign::getSign($param);
225 226
226 - return Yohobuy::get(Yohobuy::API_URL, $param); 227 + return Yohobuy::$type(Yohobuy::API_URL, $param);
227 } 228 }
228 229
229 /** 230 /**
  1 +var $ = require('jquery');
  2 +var page = 1;
  3 +
  4 +function ajaxCurrencyDetail(page) {
  5 + $.ajax({
  6 + type: 'POST',
  7 + url: '/home/ajaxCurrencyDetail',
  8 + dataType: 'html',
  9 + data: {
  10 + page: page
  11 + },
  12 + success: function(data) {
  13 + $('.coin-detail').append(data);
  14 + window.rePosFooter();
  15 + }
  16 + });
  17 +}
  18 +
  19 +$(window).scroll(function() {
  20 + if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) {
  21 + page++;
  22 + ajaxCurrencyDetail(page);
  23 + return;
  24 + }
  25 +});
  26 +
  27 +ajaxCurrencyDetail(page);
@@ -18,3 +18,4 @@ require('./address-act'); @@ -18,3 +18,4 @@ require('./address-act');
18 require('./logistic'); 18 require('./logistic');
19 require('./pay'); 19 require('./pay');
20 require('./personal-details'); 20 require('./personal-details');
  21 +require('./currency');
@@ -7,11 +7,15 @@ @@ -7,11 +7,15 @@
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 lazyLoad = require('yoho.lazyload'), 8 lazyLoad = require('yoho.lazyload'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
  10 + Handlebars = require('yoho.handlebars'),
  11 + tip = require('../plugin/tip'),
10 orderInfo = require('./order-info').orderInfo; 12 orderInfo = require('./order-info').orderInfo;
11 13
12 var dispatchModeHammer, 14 var dispatchModeHammer,
13 dispatchTimeHammer, 15 dispatchTimeHammer,
14 - $invoice = $('.invoice'); 16 + $invoice = $('.invoice'),
  17 + $price = $('.price-cal'),
  18 + priceTmpl = Handlebars.compile($('#tmpl-price').html());
15 19
16 lazyLoad(); 20 lazyLoad();
17 21
@@ -55,9 +59,66 @@ $('.invoice').on('touchend', '.checkbox', function() { @@ -55,9 +59,66 @@ $('.invoice').on('touchend', '.checkbox', function() {
55 } 59 }
56 }); 60 });
57 61
  62 +function orderCompute() {
  63 + $.ajax({
  64 + method: 'POST',
  65 + url: '/shoppingCart/orderCompute',
  66 + data: {
  67 + cartType: orderInfo('cartType'),
  68 + deliveryId: orderInfo('deliveryId'),
  69 + paymentTypeId: orderInfo('paymentTypeId'),
  70 + couponCode: orderInfo('couponCode'),
  71 + yohoCoin: orderInfo('yohoCoin')
  72 + }
  73 + }).then(function(res) {
  74 + var priceHtml;
  75 +
  76 + if (!res) {
  77 + tip.show('网络出错');
  78 + } else {
  79 + priceHtml = priceTmpl({
  80 + sumPrice: res.order_amount,
  81 + salePrice: res.discount_amount,
  82 + freight: res.promotion_formula_list[1].promotion_amount,
  83 + yohoCoin: res.use_yoho_coin,
  84 + price: res.last_order_amount
  85 + });
  86 +
  87 + $price.html(priceHtml);
  88 + }
  89 + }).fail(function() {
  90 + tip.show('网络出错');
  91 + });
  92 +}
  93 +
  94 +function submitOrder() {
  95 + $.ajax({
  96 + method: 'POST',
  97 + url: '/shoppingCart/orderSub',
  98 + data: {
  99 + addressId: orderInfo('addressId'),
  100 + cartType: orderInfo('cartType'),
  101 + deliveryId: orderInfo('deliveryId'),
  102 + deliveryTimeId: orderInfo('deliveryTimeId'),
  103 + invoiceText: orderInfo('invoiceText'),
  104 + invoiceType: orderInfo('invoiceType'),
  105 + msg: orderInfo('msg'),
  106 + paymentTypeId: orderInfo('paymentTypeId'),
  107 + paymentType: orderInfo('paymentType'), //支付方式
  108 + couponCode: orderInfo('couponCode'),
  109 + yohoCoin: orderInfo('yohoCoin')
  110 + }
  111 + }).then(function(res) {
  112 + console.log(res);
  113 + }).fail(function() {
  114 + tip.show('网络出错');
  115 + });
  116 +}
  117 +
58 // 界面点击,状态存 cookie 118 // 界面点击,状态存 cookie
59 $('.dispatch-mode').on('touchend', 'li', function() { 119 $('.dispatch-mode').on('touchend', 'li', function() {
60 orderInfo('deliveryId', $(this).data('id')); 120 orderInfo('deliveryId', $(this).data('id'));
  121 + orderCompute();
61 }); 122 });
62 123
63 $('.dispatch-time').on('touchend', 'li', function() { 124 $('.dispatch-time').on('touchend', 'li', function() {
@@ -69,9 +130,12 @@ $('.coin').on('touchend', function() { @@ -69,9 +130,12 @@ $('.coin').on('touchend', function() {
69 130
70 if ($this.find('.checkbox').hasClass('icon-cb-checked')) { 131 if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
71 orderInfo('yohoCoin', $this.data('yoho-coin')); 132 orderInfo('yohoCoin', $this.data('yoho-coin'));
  133 + $this.find('.coin-check em').show();
72 } else { 134 } else {
73 orderInfo('yohoCoin', 0); 135 orderInfo('yohoCoin', 0);
  136 + $this.find('.coin-check em').hide();
74 } 137 }
  138 + orderCompute();
75 }); 139 });
76 140
77 $invoice.on('touchend', function() { 141 $invoice.on('touchend', function() {
@@ -92,4 +156,6 @@ $('#msg').find('input').on('blur', function() { @@ -92,4 +156,6 @@ $('#msg').find('input').on('blur', function() {
92 156
93 $('.pay-mode').on('click', 'li', function() { 157 $('.pay-mode').on('click', 'li', function() {
94 orderInfo('paymentTypeId', $(this).data('pay-id')); 158 orderInfo('paymentTypeId', $(this).data('pay-id'));
  159 + orderInfo('paymentType', $(this).data('pay-type'));
  160 + submitOrder();
95 }); 161 });
@@ -9,7 +9,19 @@ var info = window.cookie('order-info'); @@ -9,7 +9,19 @@ var info = window.cookie('order-info');
9 try { 9 try {
10 info = JSON.parse(info); 10 info = JSON.parse(info);
11 } catch (e) { 11 } catch (e) {
12 - info = {}; 12 + info = {
  13 + deliveryId: null,
  14 + deliveryTimeId: null,
  15 + paymentTypeId: null,
  16 + yohoCoin: null,
  17 + addressId: null,
  18 + couponCode: null,
  19 + couponValue: null,
  20 + invoice: null,
  21 + invoiceText: null,
  22 + invoiceType: null,
  23 + msg: null
  24 + };
13 } 25 }
14 26
15 exports.orderInfo = function(key, value) { 27 exports.orderInfo = function(key, value) {
1 $vip: sprite-map("me/vip/*.png", $spacing: 10px); 1 $vip: sprite-map("me/vip/*.png", $spacing: 10px);
2 $fav: sprite-map("me/fav/*.png", $spacing: 5px); 2 $fav: sprite-map("me/fav/*.png", $spacing: 5px);
3 3
4 -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record", "logistic", "pay";  
5 - 4 +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record", "logistic", "pay","yoho-coin-new", "yoho-coin-detail";
  1 +.yoho-coin-detail-page {
  2 + background: #f0f0f0;
  3 + .money{
  4 + width: 100%;
  5 + height: pxToRem(70px);
  6 + background:#fff;
  7 + margin-bottom: pxToRem(20px);
  8 + line-height: pxToRem(70px);
  9 + font-size: pxToRem(30px);
  10 + text-indent: 1em;
  11 + span{
  12 + color: #f00;
  13 + font-weight: bold;
  14 + }
  15 + }
  16 + .coin-detail {
  17 + background: #fff;
  18 + border-top: 1px solid #e0e0e0;
  19 + border-bottom: 1px solid #e0e0e0;
  20 + }
  21 +
  22 + .detail-item {
  23 + position: relative;
  24 + margin-left: pxToRem(30px);
  25 + border-bottom: 1px solid #e0e0e0;
  26 + color: #444;
  27 + padding: pxToRem(15px) 0;
  28 +
  29 + .title {
  30 + width: pxToRem(480px);
  31 + font-size: pxToRem(28px);
  32 + line-height: pxToRem(40px);
  33 + font-weight: bold;
  34 + overflow: hidden;
  35 + text-overflow: ellipsis;
  36 + white-space: nowrap;
  37 + }
  38 +
  39 + .time {
  40 + font-size: pxToRem(20px);
  41 + line-height: pxToRem(30px);
  42 + color: #b0b0b0;
  43 + }
  44 +
  45 + .count {
  46 + position: absolute;
  47 + right: 0;
  48 + top: 0;
  49 + margin-right: pxToRem(30px);
  50 + font-size: pxToRem(28px);
  51 + font-weight: bold;
  52 + line-height: pxToRem(100px);
  53 + }
  54 + }
  55 +
  56 + li:last-child {
  57 + .detail-item {
  58 + border-bottom: none;
  59 + }
  60 + }
  61 +}
  1 +.yoho-coin-new-page {
  2 + padding-top: pxToRem(30px);
  3 + text-align: center;
  4 +
  5 + .coin-num {
  6 + color: #d0021b;
  7 + font-size: pxToRem(66px);
  8 + font-weight: bold;
  9 + line-height: pxToRem(106px);
  10 + letter-spacing: pxToRem(8px);
  11 + }
  12 +
  13 + .info {
  14 + color: #b0b0b0;
  15 + font-size: pxToRem(24px);
  16 + line-height: 1;
  17 +
  18 + .dollar {
  19 + display: inline-block;
  20 + margin-right: pxToRem(6px);
  21 + vertical-align: middle;
  22 + width: pxToRem(24px);
  23 + height: pxToRem(24px);
  24 + background: image-url("me/yoho-coin/dollar.png") center center;
  25 + background-size: 100%;
  26 + }
  27 + }
  28 +
  29 + .more {
  30 + display: inline-block;
  31 + margin: pxToRem(30px) 0;
  32 + color: #444;
  33 + font-size: pxToRem(24px);
  34 + line-height: pxToRem(36px);
  35 + width: pxToRem(152px);
  36 + height: pxToRem(36px);
  37 + text-align: center;
  38 + border: 1px solid #444;
  39 + border-radius: pxToRem(36px);
  40 + }
  41 +
  42 + .coin-tip {
  43 + margin-bottom: pxToRem(30px);
  44 + padding: pxToRem(20px) pxToRem(30px);
  45 + font-size: pxToRem(24px);
  46 + line-height: pxToRem(32px);
  47 + color: #dc6870;
  48 + border-top: 1px solid #e0e0e0;
  49 + border-bottom: 1px solid #e0e0e0;
  50 +
  51 + .icon {
  52 + display: inline-block;
  53 + width: pxToRem(32px);
  54 + height: pxToRem(32px);
  55 + font-weight: bold;
  56 + border: 2px solid #dc6870;
  57 + border-radius: 50%;
  58 + }
  59 + }
  60 +
  61 + .banner {
  62 + margin-bottom: pxToRem(30px);
  63 + }
  64 +}
  1 +{{# currency}}
  2 + <li>
  3 + <div class="detail-item">
  4 + <p class="title">{{title}}</p>
  5 + <p class="time">{{time}}</p>
  6 + <div class="count">
  7 + {{count}}
  8 + </div>
  9 + </div>
  10 + </li>
  11 +{{/ currency}}
  1 +
  2 +{{> layout/header}}
  3 +<div class="yoho-coin-detail-page yoho-page">
  4 + <div class="money">你拥有的有货币:<span>{{ money}}</span></div>
  5 +
  6 + <ul class="coin-detail"></ul>
  7 +</div>
  8 +{{> layout/footer}}
  1 +{{> layout/header}}
  2 +<div class="yoho-coin-new-page yoho-page">
  3 + <div class="coin">
  4 + <p class="coin-num">
  5 + 7876
  6 + </p>
  7 + <p class="info">
  8 + <span class="dollar"></span>
  9 + YOHO
  10 + </p>
  11 + <a href="" class="more">查看明细</a>
  12 + <div class="coin-tip">
  13 + <span class="icon">!</span>
  14 + 您有300个YOHO币即将于20171231日过期,请尽快使用
  15 + </div>
  16 + </div>
  17 + <div class="banner">
  18 + <a href="">
  19 + {{!-- 演示图片 --}}
  20 + <img src="http://temp.im/640x200" alt="">
  21 + </a>
  22 + </div>
  23 +
  24 + {{> home/maybe_like}}
  25 +</div>
  26 +{{> layout/footer}}
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 优惠券 81 优惠券
82 <span class="iconfont num">{{coupon_num}} &#xe604;</span> 82 <span class="iconfont num">{{coupon_num}} &#xe604;</span>
83 </a> 83 </a>
84 - <a class="list-item" href="/home/currency"> 84 + <a class="list-item" href="/home/currencyDetail">
85 <span class="iconfont icon">&#xe635;</span> 85 <span class="iconfont icon">&#xe635;</span>
86 YOHO 86 YOHO
87 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span> 87 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
@@ -102,23 +102,23 @@ @@ -102,23 +102,23 @@
102 </form> 102 </form>
103 </section> 103 </section>
104 104
105 - <section class="block"> 105 + <section class="price-cal block">
106 <ul class="total"> 106 <ul class="total">
107 <li> 107 <li>
108 <span>总价</span> 108 <span>总价</span>
109 - &nbsp;&nbsp;¥ {{sumPrice}} 109 + &nbsp;&nbsp;¥{{sumPrice}}
110 </li> 110 </li>
111 <li> 111 <li>
112 <span>活动价</span> 112 <span>活动价</span>
113 - - ¥ {{salePrice}} 113 + - ¥{{salePrice}}
114 </li> 114 </li>
115 <li> 115 <li>
116 <span>运费</span> 116 <span>运费</span>
117 - + ¥ {{freight}} 117 + + ¥{{freight}}
118 </li> 118 </li>
119 <li> 119 <li>
120 <span>YOHO币</span> 120 <span>YOHO币</span>
121 - - ¥ {{yohoCoin}} 121 + - ¥{{yohoCoin}}
122 </li> 122 </li>
123 <li class="cost"> 123 <li class="cost">
124 应付金额: <em>¥{{price}}</em> 124 应付金额: <em>¥{{price}}</em>
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 128
129 <ul class="pay-mode"> 129 <ul class="pay-mode">
130 {{# paymentWay}} 130 {{# paymentWay}}
131 - <li class="{{#if default}}default{{/if}}" data-pay-id={{id}}> 131 + <li class="{{#if default}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
132 <span class="iconfont"> 132 <span class="iconfont">
133 {{#if default}} 133 {{#if default}}
134 &#xe62f; 134 &#xe62f;
@@ -142,4 +142,27 @@ @@ -142,4 +142,27 @@
142 </ul> 142 </ul>
143 {{/ orderEnsure}} 143 {{/ orderEnsure}}
144 </div> 144 </div>
  145 +<script id="tmpl-price" type="text/tmpl">
  146 + <ul class="total">
  147 + <li>
  148 + <span>总价</span>
  149 + &nbsp;&nbsp;¥\{{sumPrice}}
  150 + </li>
  151 + <li>
  152 + <span>活动价</span>
  153 + - ¥\{{salePrice}}
  154 + </li>
  155 + <li>
  156 + <span>运费</span>
  157 + + \{{freight}}
  158 + </li>
  159 + <li>
  160 + <span>YOHO币</span>
  161 + - ¥\{{yohoCoin}}
  162 + </li>
  163 + <li class="cost">
  164 + 应付金额: <em>¥\{{price}}</em>
  165 + </li>
  166 + </ul>
  167 +</script>
145 {{> layout/footer}} 168 {{> layout/footer}}
@@ -308,3 +308,8 @@ @@ -308,3 +308,8 @@
308 seajs.use('js/me/pay'); 308 seajs.use('js/me/pay');
309 </script> 309 </script>
310 {{/if}} 310 {{/if}}
  311 +{{#if currencyDetail}}
  312 +<script>
  313 + seajs.use('js/me/currency');
  314 +</script>
  315 +{{/if}}
@@ -876,5 +876,44 @@ class HomeController extends AbstractAction @@ -876,5 +876,44 @@ class HomeController extends AbstractAction
876 ); 876 );
877 $this->_view->display('helpDetail', $data); 877 $this->_view->display('helpDetail', $data);
878 } 878 }
  879 + /**
  880 + * YOHO币详情 新版
  881 + */
  882 + public function currencyDetailAction()
  883 + {
  884 + $this->setTitle('YOHO币');
  885 + $this->setNavHeader('YOHO币', true, false);
  886 + $data['money'] = '0';
  887 + $page = $this->post('page',1);
  888 + $size = $this->post('size', 20);
  889 + // $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  890 + $data = UserModel::getYohoCoinLists(3965746,$page,$size);
  891 + $this->_view->display('currency-detail', array(
  892 + 'money' => $data['money'],
  893 + 'pageFooter' => true,
  894 + 'currencyDetail' => true,
  895 + 'currencyDetailPage' => true
  896 + ));
  897 +
  898 + }
  899 +
  900 + /**
  901 + * YOHO币详情 AJAX
  902 + */
  903 + public function ajaxCurrencyDetailAction()
  904 + {
  905 + $data['list'] = array();
  906 + $data['money'] = 0;
  907 + $page = $this->post('page',1);
  908 + $size = $this->post('size', 20);
  909 + $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  910 + // $data = UserModel::getYohoCoinLists(3965746,$page,$size);
  911 + $this->_view->display('ajax-currency-detail', array(
  912 + 'currency' => $data['list'],
  913 + 'pageFooter' => true,
  914 + 'currencyDetailPage' => true
  915 + ));
  916 +
  917 + }
879 918
880 } 919 }
@@ -196,7 +196,6 @@ class ShoppingCartController extends AbstractAction @@ -196,7 +196,6 @@ class ShoppingCartController extends AbstractAction
196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) 196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
197 ); 197 );
198 198
199 -  
200 $this->_view->display('order-ensure', $data); 199 $this->_view->display('order-ensure', $data);
201 } 200 }
202 201
@@ -209,10 +208,10 @@ class ShoppingCartController extends AbstractAction @@ -209,10 +208,10 @@ class ShoppingCartController extends AbstractAction
209 208
210 if ($this->isAjax()) { 209 if ($this->isAjax()) {
211 $cartType = $this->post('cartType', 'ordinary'); 210 $cartType = $this->post('cartType', 'ordinary');
212 - $deliveryWay = $this->post('deliveryWay', 1);  
213 - $paymentType = $this->post('paymentType', 1);  
214 - $couponCode = $this->post('paymentType', null);  
215 - $yohoCoin = $this->post('paymentType', null); 211 + $deliveryWay = $this->post('deliveryId', 1);
  212 + $paymentType = $this->post('paymentTypeId', 1);
  213 + $couponCode = $this->post('couponCode', null);
  214 + $yohoCoin = $this->post('yohoCoin', null);
216 $uid = $this->getUid(true); 215 $uid = $this->getUid(true);
217 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); 216 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
218 } 217 }
@@ -308,13 +307,13 @@ class ShoppingCartController extends AbstractAction @@ -308,13 +307,13 @@ class ShoppingCartController extends AbstractAction
308 $uid = $this->getUid(true); 307 $uid = $this->getUid(true);
309 $addressId = $this->post('addressId', null); 308 $addressId = $this->post('addressId', null);
310 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 309 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
311 - $deliveryTime = $this->post('deliveryTime', 1); // 默认只工作日配送  
312 - $deliveryWay = $this->post('deliveryWay', 1); // 默认普通快递  
313 - $invoiceTitle = $this->post('invoiceTitle', null);  
314 - $invoiceId = $this->post('invoiceId', null);  
315 - $paymentId = $this->post('paymentId', 15); 310 + $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
  311 + $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
  312 + $invoiceTitle = $this->post('invoiceText', null);
  313 + $invoiceId = $this->post('invoiceType', null);
  314 + $paymentId = $this->post('paymentTypeId', 15);
316 $paymentType = $this->post('paymentType', 1); // 默认在线支付 315 $paymentType = $this->post('paymentType', 1); // 默认在线支付
317 - $remark = $this->post('remark', null); // 默认在线支付 316 + $remark = $this->post('msg', null);
318 $yohoCoin = $this->post('yohoCoin', 1); 317 $yohoCoin = $this->post('yohoCoin', 1);
319 $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin); 318 $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
320 } 319 }
@@ -323,7 +322,7 @@ class ShoppingCartController extends AbstractAction @@ -323,7 +322,7 @@ class ShoppingCartController extends AbstractAction
323 echo ' '; 322 echo ' ';
324 } else { 323 } else {
325 // 提交成功清除Cookie 324 // 提交成功清除Cookie
326 - $this->setCookie('orderInfo', null); 325 + $this->setCookie('order-info', null);
327 326
328 $this->echoJson($result); 327 $this->echoJson($result);
329 } 328 }
@@ -369,6 +369,35 @@ class UserModel @@ -369,6 +369,35 @@ class UserModel
369 } 369 }
370 370
371 /** 371 /**
  372 + * 处理YOHO币变化履历数据
  373 + *
  374 + * @param int $uid 用户ID
  375 + * @param int $page 当前页
  376 + * @param int $limit 一页记录数
  377 + * @return array|mixed 处理之后的YOHO币数据
  378 + */
  379 + public static function getYohoCoinLists($uid, $page, $limit)
  380 + {
  381 + $result = array();
  382 +
  383 + // 调用接口获取YOHO币
  384 + $yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
  385 + // 处理YOHO币数据
  386 + $coinList = $yohoCoin['data']['coinlist'];
  387 + $data['money'] = $yohoCoin['data']['total'];
  388 + foreach($coinList as $key => $val){
  389 + $result[$key]['title'] = $val['message'];
  390 + $result[$key]['time'] = $val['date'];
  391 + if($val['num'] > 0){
  392 + $val['num'] = '+'.$val['num'];
  393 + }
  394 + $result[$key]['count'] = $val['num'];
  395 + }
  396 + $data['list'] = $result;
  397 + return $data;
  398 + }
  399 +
  400 + /**
372 * 处理优惠券数据 401 * 处理优惠券数据
373 * 402 *
374 * @param int $uid 用户ID 403 * @param int $uid 用户ID
@@ -134,7 +134,7 @@ class BindController extends AbstractAction @@ -134,7 +134,7 @@ class BindController extends AbstractAction
134 if ($res['code'] == 200) 134 if ($res['code'] == 200)
135 { 135 {
136 $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile)); 136 $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile));
137 - $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next)); 137 + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
138 } 138 }
139 else 139 else
140 { 140 {