Merge branch 'feature/cart' of git.dev.yoho.cn:web/yohobuy into feature/cart
Showing
12 changed files
with
210 additions
and
75 deletions
@@ -1261,7 +1261,7 @@ | @@ -1261,7 +1261,7 @@ | ||
1261 | chosed: true, | 1261 | chosed: true, |
1262 | name: '黄色', | 1262 | name: '黄色', |
1263 | colorNum:10, | 1263 | colorNum:10, |
1264 | - shortUrl:'', | 1264 | + sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割 |
1265 | 1265 | ||
1266 | }, | 1266 | }, |
1267 | ... | 1267 | ... |
@@ -1271,7 +1271,8 @@ | @@ -1271,7 +1271,8 @@ | ||
1271 | id: 2, | 1271 | id: 2, |
1272 | chosed: true, | 1272 | chosed: true, |
1273 | name: 'X', | 1273 | name: 'X', |
1274 | - sizeNum: 2 | 1274 | + sizeNum: 2, |
1275 | + colorNumStr:'10/20/30' //对应的商品颜色数目用斜杠分割 | ||
1275 | }, | 1276 | }, |
1276 | ... | 1277 | ... |
1277 | ], | 1278 | ], |
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | + lazyLoad = require('yoho.lazyload'), | ||
8 | Hammer = require('yoho.hammer'); | 9 | Hammer = require('yoho.hammer'); |
9 | 10 | ||
10 | var $cartContent = $('.cart-content'); | 11 | var $cartContent = $('.cart-content'); |
@@ -13,6 +14,8 @@ var navHammer; | @@ -13,6 +14,8 @@ var navHammer; | ||
13 | 14 | ||
14 | require('./good'); | 15 | require('./good'); |
15 | 16 | ||
17 | +lazyLoad($('img.lazy')); | ||
18 | + | ||
16 | navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); | 19 | navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); |
17 | navHammer.on('tap', function(e) { | 20 | navHammer.on('tap', function(e) { |
18 | var $this = $(e.target).closest('li'); | 21 | var $this = $(e.target).closest('li'); |
@@ -58,21 +58,51 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -58,21 +58,51 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
58 | }).on('touchstart', '#chose-btn-sure', function() { | 58 | }).on('touchstart', '#chose-btn-sure', function() { |
59 | 59 | ||
60 | //确定 | 60 | //确定 |
61 | -}).on('touchstart', '.block', function() { | 61 | +}).on('touchstart', '.block', function(e) { |
62 | 62 | ||
63 | //尺寸颜色点选 | 63 | //尺寸颜色点选 |
64 | - var $this = $(this); | ||
65 | - | ||
66 | - if ($this.hasClass('.chosed') || $this.hasClass('disable')) { | 64 | + var $this = $(this), |
65 | + $that = $(e.target).closest('.chose-items'), | ||
66 | + numArray, | ||
67 | + index; | ||
68 | + | ||
69 | + if ($this.hasClass('chosed')) { | ||
70 | + $this.parent().find('.block').removeClass('chosed'); | ||
71 | + $that.find('.num .left-num').html(''); | ||
72 | + } else if ($this.hasClass('disable')) { | ||
73 | + $this.css('background-color', '#000'); | ||
67 | return; | 74 | return; |
68 | - } | ||
69 | - | 75 | + } else if (!$this.hasClass('chosed')) { |
70 | $this.siblings('.chosed').removeClass('chosed'); | 76 | $this.siblings('.chosed').removeClass('chosed'); |
71 | $this.addClass('chosed'); | 77 | $this.addClass('chosed'); |
78 | + index = $this.index(); | ||
79 | + | ||
80 | + | ||
81 | + //根据颜色切换图片 | ||
82 | + if ($this.closest('.block-list').hasClass('color-list')) { | ||
83 | + $('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide'); | ||
84 | + } | ||
85 | + | ||
86 | + //剩余的商品数 | ||
87 | + if ($that.find('.color-list ul>li').hasClass('chosed') && $that.find('.size-list ul>li').hasClass('chosed')) { | ||
88 | + numArray = $this.closest('.block-list').siblings(':first').find('.chosed').data('numstr').split('/'); | ||
89 | + $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); | ||
90 | + } else { | ||
91 | + $that.find('.num .left-num').html(''); | ||
92 | + } | ||
93 | + | ||
94 | + //点击切换 | ||
95 | + } | ||
96 | + | ||
72 | }).on('touchstart', '.btn-minus', function() { | 97 | }).on('touchstart', '.btn-minus', function() { |
73 | var num = +$num.val(); | 98 | var num = +$num.val(); |
74 | 99 | ||
75 | - if (num === 1) { | 100 | + //若颜色和尺码没有被同时选中,则不能点击 |
101 | + if ($('.block-list>ul>li.chosed').length < 2) { | ||
102 | + return; | ||
103 | + } | ||
104 | + | ||
105 | + if (num === 0) { | ||
76 | return; | 106 | return; |
77 | } | 107 | } |
78 | 108 | ||
@@ -80,6 +110,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -80,6 +110,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
80 | }).on('touchstart', '.btn-plus', function() { | 110 | }).on('touchstart', '.btn-plus', function() { |
81 | var num = +$num.val(); | 111 | var num = +$num.val(); |
82 | 112 | ||
113 | + //若颜色和尺码没有被同时选中,则不能点击 | ||
114 | + if ($('.block-list>ul>li.chosed').length < 2) { | ||
115 | + return; | ||
116 | + } | ||
117 | + | ||
83 | //TODO:库存数验证 | 118 | //TODO:库存数验证 |
84 | $num.val(num + 1); | 119 | $num.val(num + 1); |
85 | }); | 120 | }); |
@@ -8,78 +8,151 @@ var $ = require('jquery'), | @@ -8,78 +8,151 @@ var $ = require('jquery'), | ||
8 | ellipsis = require('mlellipsis'), | 8 | ellipsis = require('mlellipsis'), |
9 | lazyLoad = require('yoho.lazyload'); | 9 | lazyLoad = require('yoho.lazyload'); |
10 | 10 | ||
11 | -var chosePanel = require('./chose-panel'); | 11 | +var dialog = require('../me/dialog'), |
12 | + tip = require('../plugin/tip'); | ||
12 | 13 | ||
13 | -var $curDelPanel; | 14 | +var $names; |
14 | 15 | ||
15 | -//删除面板显示后任何点击行为都将触发隐藏面板 | ||
16 | -function docTouchEvt() { | ||
17 | - $curDelPanel && $curDelPanel.addClass('hide'); | 16 | +//chosePanel = require('./chose-panel'); |
18 | 17 | ||
19 | - // | ||
20 | - $(document).off('touchstart', docTouchEvt); | ||
21 | -} | 18 | +var cartType = 'ordinary'; |
19 | + | ||
20 | +//var $curDelPanel; | ||
21 | + | ||
22 | +////删除面板显示后任何点击行为都将触发隐藏面板 | ||
23 | +//function docTouchEvt() { | ||
24 | +// $curDelPanel && $curDelPanel.addClass('hide'); | ||
25 | +// | ||
26 | +// // | ||
27 | +// $(document).off('touchstart', docTouchEvt); | ||
28 | +//} | ||
22 | 29 | ||
23 | ellipsis.init(); | 30 | ellipsis.init(); |
24 | 31 | ||
25 | -lazyLoad($('.lazy')); | 32 | +lazyLoad({ |
33 | + try_again_css: 'order-failure' | ||
34 | +}); | ||
26 | 35 | ||
27 | -$('.name')[0].mlellipsis(2); | 36 | +$names = $('.name'); |
37 | +if ($names.length > 0) { | ||
38 | + $names[0].mlellipsis(2); | ||
39 | +} | ||
28 | 40 | ||
29 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods | 41 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods |
30 | $('.cart-goods').on('touchstart', '.checkbox', function() { | 42 | $('.cart-goods').on('touchstart', '.checkbox', function() { |
31 | - var $this = $(this); | 43 | + var $this = $(this), |
44 | + id = $(this).closest('.shopping-cart-good').data('id'); | ||
32 | 45 | ||
46 | + $.ajax({ | ||
47 | + type: 'GET', | ||
48 | + url: '/shoppingCart/select', | ||
49 | + data: { | ||
50 | + id: id | ||
51 | + } | ||
52 | + }).then(function(data) { | ||
53 | + if (data.code === 200) { | ||
33 | if ($this.hasClass('icon-cb-checked')) { | 54 | if ($this.hasClass('icon-cb-checked')) { |
34 | $this.removeClass('icon-cb-checked').addClass('icon-checkbox'); | 55 | $this.removeClass('icon-cb-checked').addClass('icon-checkbox'); |
35 | } else { | 56 | } else { |
36 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); | 57 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); |
37 | } | 58 | } |
38 | -}).on('touchstart', '.icon-edit', function() { | ||
39 | - var id = $(this).closest('.shopping-cart-good').data('id'); | ||
40 | - | 59 | + } |
41 | $.ajax({ | 60 | $.ajax({ |
42 | type: 'GET', | 61 | type: 'GET', |
43 | - url: '/shoppingCart/goodinfo', | 62 | + url: '/shoppingCart/getCartData', |
44 | data: { | 63 | data: { |
45 | id: id | 64 | id: id |
46 | }, | 65 | }, |
47 | success: function(data) { | 66 | success: function(data) { |
48 | - if (data.code === 200) { | ||
49 | - chosePanel.show(data.data); | 67 | + if (data) { |
68 | + $('#good-totalprice').html('¥' + data.commonCart.price); | ||
69 | + $('#good-activityPrice').html('¥' + data.commonCart.activityPrice); | ||
70 | + $('#good-total').html(data.commonCart.count + '件总计:¥' + data.commonCart.sumPrice); | ||
50 | } | 71 | } |
72 | + }, | ||
73 | + error: function() { | ||
74 | + tip.show('网络错误'); | ||
51 | } | 75 | } |
52 | }); | 76 | }); |
53 | -}).on('touchstart', '.icon-del', function(e) { | ||
54 | - e.stopPropagation(); | ||
55 | 77 | ||
56 | - //手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板 | ||
57 | - docTouchEvt(); | ||
58 | - | ||
59 | - $curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide'); | 78 | + }).fail(function() { |
79 | + tip.show('网络错误'); | ||
80 | + }); | ||
81 | +}).on('touchstart', '.icon-edit', function() { | ||
60 | 82 | ||
61 | - $(document).on('touchstart', docTouchEvt); | ||
62 | -}).on('touchstart', '.opt-panel', function() { | ||
63 | - var $this = $(this), | ||
64 | - id = $this.closest('.shopping-cart-good').data('id'), | ||
65 | - url; | 83 | +}).on('touchstart', '.icon-del', function(e) { |
84 | + var $this = $(this); | ||
66 | 85 | ||
67 | - if ($this.closest('.put-in-favorite').length > 0) { | 86 | + e.stopPropagation(); |
68 | 87 | ||
69 | - //移入收藏夹 | ||
70 | - url = '/shoppingCart/col'; | ||
71 | - } else { | 88 | + //手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板 |
89 | + //docTouchEvt(); | ||
90 | + // | ||
91 | + //$curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide'); | ||
92 | + // | ||
93 | + //$(document).on('touchstart', docTouchEvt); | ||
72 | 94 | ||
73 | - //删除 | ||
74 | - url = '/shoppingCart/del'; | 95 | + dialog.showDialog({ |
96 | + dialogText: '您确定要从购物车中删除吗?', | ||
97 | + hasFooter: { | ||
98 | + leftBtnText: '取消', | ||
99 | + rightBtnText: '确定' | ||
75 | } | 100 | } |
101 | + }, function() { | ||
102 | + var id = $this.closest('.shopping-cart-good').data('id'); | ||
76 | 103 | ||
77 | $.ajax({ | 104 | $.ajax({ |
78 | - type: 'POST', | ||
79 | - url: url, | 105 | + method: 'post', |
106 | + url: '/shoppingCart/del', | ||
80 | data: { | 107 | data: { |
81 | id: id | 108 | id: id |
82 | } | 109 | } |
110 | + }).then(function(data) { | ||
111 | + if (data.code === 200) { | ||
112 | + dialog.showDialog({ | ||
113 | + dialogText: '删除成功', | ||
114 | + autoHide: true, | ||
115 | + fast: true | ||
116 | + }); | ||
117 | + history.go(0); | ||
118 | + } | ||
119 | + }).fail(function() { | ||
120 | + dialog.showDialog({ | ||
121 | + autoHide: true, | ||
122 | + dialogText: '网络错误~' | ||
123 | + }); | ||
83 | }); | 124 | }); |
125 | + }); | ||
126 | + | ||
84 | }); | 127 | }); |
85 | 128 | ||
129 | +// .on('touchstart', '.opt-panel', function() { | ||
130 | +// var $this = $(this), | ||
131 | +// id = $this.closest('.shopping-cart-good').data('id'), | ||
132 | +// url; | ||
133 | +// | ||
134 | +// if ($this.closest('.put-in-favorite').length > 0) { | ||
135 | +// | ||
136 | +// //移入收藏夹 | ||
137 | +// url = '/shoppingCart/col'; | ||
138 | +// } else { | ||
139 | +// | ||
140 | +// //删除 | ||
141 | +// url = '/shoppingCart/del'; | ||
142 | +// } | ||
143 | +// | ||
144 | +// $.ajax({ | ||
145 | +// type: 'POST', | ||
146 | +// url: url, | ||
147 | +// data: { | ||
148 | +// id: id | ||
149 | +// } | ||
150 | +// }); | ||
151 | +//}) | ||
152 | + | ||
153 | + | ||
154 | +$('.btn-balance').on('touchend', function() { | ||
155 | + window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; | ||
156 | +}); | ||
157 | + | ||
158 | + |
@@ -79,6 +79,11 @@ | @@ -79,6 +79,11 @@ | ||
79 | left: 0; | 79 | left: 0; |
80 | top: 20rem / $pxConvertRem; | 80 | top: 20rem / $pxConvertRem; |
81 | } | 81 | } |
82 | + >span.left-num{ | ||
83 | + position: absolute; | ||
84 | + left: pxToRem(380px); | ||
85 | + top: 20rem / $pxConvertRem; | ||
86 | + } | ||
82 | } | 87 | } |
83 | 88 | ||
84 | .block { | 89 | .block { |
@@ -99,6 +104,11 @@ | @@ -99,6 +104,11 @@ | ||
99 | background-position: bottom right; | 104 | background-position: bottom right; |
100 | color: #e10; | 105 | color: #e10; |
101 | } | 106 | } |
107 | + | ||
108 | + &.disable { | ||
109 | + color: #e0e0e0; | ||
110 | + border-color: #e0e0e0; | ||
111 | + } | ||
102 | } | 112 | } |
103 | 113 | ||
104 | .num { | 114 | .num { |
@@ -32,26 +32,26 @@ | @@ -32,26 +32,26 @@ | ||
32 | <div class="price-compute"> | 32 | <div class="price-compute"> |
33 | <p class="sum-price"> | 33 | <p class="sum-price"> |
34 | <span class="title">总价</span> | 34 | <span class="title">总价</span> |
35 | - ¥{{price}} | 35 | + <span id="good-totalprice">¥{{price}}</span> |
36 | </p> | 36 | </p> |
37 | <p class="activity-price"> | 37 | <p class="activity-price"> |
38 | <span class="title"> | 38 | <span class="title"> |
39 | 活动价 | 39 | 活动价 |
40 | <i class="minus">-</i> | 40 | <i class="minus">-</i> |
41 | </span> | 41 | </span> |
42 | - ¥{{activityPrice}} | 42 | + <span id="good-activityPrice">¥{{activityPrice}}</span> |
43 | </p> | 43 | </p> |
44 | </div> | 44 | </div> |
45 | 45 | ||
46 | <div class="balance"> | 46 | <div class="balance"> |
47 | <span class="iconfont icon-cb-checked"></span> | 47 | <span class="iconfont icon-cb-checked"></span> |
48 | <p> | 48 | <p> |
49 | - <span> | 49 | + <span id="good-total"> |
50 | {{count}}件总计:¥{{sumPrice}} | 50 | {{count}}件总计:¥{{sumPrice}} |
51 | </span> | 51 | </span> |
52 | <span class="tip">(不含运费)</span> | 52 | <span class="tip">(不含运费)</span> |
53 | </p> | 53 | </p> |
54 | - <button class="btn-balance"> | 54 | + <a class="btn-balance"> |
55 | 结算 | 55 | 结算 |
56 | - </button> | 56 | + </a> |
57 | </div> | 57 | </div> |
@@ -3,7 +3,13 @@ | @@ -3,7 +3,13 @@ | ||
3 | <div class="main"> | 3 | <div class="main"> |
4 | <div class="infos"> | 4 | <div class="infos"> |
5 | <div class="basic-info"> | 5 | <div class="basic-info"> |
6 | - <img class="thumb" src={{thumb}}> | 6 | + {{#thumbs}} |
7 | + {{#if @first}} | ||
8 | + <img class="thumb" src={{img}}> | ||
9 | + {{else}} | ||
10 | + <img class="thumb hide" src={{img}}> | ||
11 | + {{/if}} | ||
12 | + {{/thumbs}} | ||
7 | <div class="text-info"> | 13 | <div class="text-info"> |
8 | <p class="name">{{name}}</p> | 14 | <p class="name">{{name}}</p> |
9 | <p class="price"> | 15 | <p class="price"> |
@@ -15,21 +21,21 @@ | @@ -15,21 +21,21 @@ | ||
15 | </div> | 21 | </div> |
16 | </div> | 22 | </div> |
17 | <div class="chose-items"> | 23 | <div class="chose-items"> |
18 | - <div class="color-list"> | 24 | + <div class="color-list block-list"> |
19 | <span>颜色</span> | 25 | <span>颜色</span> |
20 | <ul class="clearfix" data-type="color"> | 26 | <ul class="clearfix" data-type="color"> |
21 | {{# colors}} | 27 | {{# colors}} |
22 | - <li class="block {{#if chosed}}chosed{{/if}}" data-id={{id}}> | 28 | + <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}disable{{/unless}}" data-id={{id}} data-numstr="{{sizeNumStr}}"> |
23 | {{name}} | 29 | {{name}} |
24 | </li> | 30 | </li> |
25 | {{/ colors}} | 31 | {{/ colors}} |
26 | </ul> | 32 | </ul> |
27 | </div> | 33 | </div> |
28 | - <div class="size-list"> | 34 | + <div class="size-list block-list"> |
29 | <span>尺码</span> | 35 | <span>尺码</span> |
30 | - <ul class="clearfix {{#if @first}}{{^}}hide{{/if}}" data-type="size" > | 36 | + <ul class="clearfix" data-type="size" > |
31 | {{# sizes}} | 37 | {{# sizes}} |
32 | - <li class="block {{#if chosed}}chosed{{/if}}" data-id={{id}}> | 38 | + <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}disable{{/unless}}" data-id={{id}} data-numstr="{{colorNumStr}}"> |
33 | {{name}} | 39 | {{name}} |
34 | </li> | 40 | </li> |
35 | {{/ sizes}} | 41 | {{/ sizes}} |
@@ -46,6 +52,7 @@ | @@ -46,6 +52,7 @@ | ||
46 | <span class="iconfont"></span> | 52 | <span class="iconfont"></span> |
47 | </a> | 53 | </a> |
48 | </div> | 54 | </div> |
55 | + <span class="left-num"></span> | ||
49 | </div> | 56 | </div> |
50 | </div> | 57 | </div> |
51 | </div> | 58 | </div> |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | </p> | 51 | </p> |
52 | </div> | 52 | </div> |
53 | </div> | 53 | </div> |
54 | - <div class="opt-panel hide"> | 54 | + <!--<div class="opt-panel hide"> |
55 | <div class="put-in-favorite"> | 55 | <div class="put-in-favorite"> |
56 | <span class="iconfont"></span> | 56 | <span class="iconfont"></span> |
57 | <span>移入</span> | 57 | <span>移入</span> |
@@ -61,5 +61,5 @@ | @@ -61,5 +61,5 @@ | ||
61 | <span class="iconfont"></span> | 61 | <span class="iconfont"></span> |
62 | 删除 | 62 | 删除 |
63 | </div> | 63 | </div> |
64 | - </div> | 64 | + </div>--> |
65 | </div> | 65 | </div> |
@@ -883,6 +883,7 @@ class HomeController extends AbstractAction | @@ -883,6 +883,7 @@ class HomeController extends AbstractAction | ||
883 | { | 883 | { |
884 | $this->setTitle('YOHO币'); | 884 | $this->setTitle('YOHO币'); |
885 | $this->setNavHeader('YOHO币', true, false); | 885 | $this->setNavHeader('YOHO币', true, false); |
886 | + | ||
886 | $data['money'] = '0'; | 887 | $data['money'] = '0'; |
887 | $page = $this->post('page',1); | 888 | $page = $this->post('page',1); |
888 | $size = $this->post('size', 20); | 889 | $size = $this->post('size', 20); |
@@ -907,7 +908,7 @@ class HomeController extends AbstractAction | @@ -907,7 +908,7 @@ class HomeController extends AbstractAction | ||
907 | $page = $this->post('page',1); | 908 | $page = $this->post('page',1); |
908 | $size = $this->post('size', 20); | 909 | $size = $this->post('size', 20); |
909 | $data = UserModel::getYohoCoinLists($this->_uid,$page,$size); | 910 | $data = UserModel::getYohoCoinLists($this->_uid,$page,$size); |
910 | - // $data = UserModel::getYohoCoinLists(3965746,$page,$size); | 911 | + //$data = UserModel::getYohoCoinLists(3965746,$page,$size); |
911 | $this->_view->display('ajax-currency-detail', array( | 912 | $this->_view->display('ajax-currency-detail', array( |
912 | 'currency' => $data['list'], | 913 | 'currency' => $data['list'], |
913 | 'pageFooter' => true, | 914 | 'pageFooter' => true, |
@@ -383,6 +383,7 @@ class UserModel | @@ -383,6 +383,7 @@ class UserModel | ||
383 | // 调用接口获取YOHO币 | 383 | // 调用接口获取YOHO币 |
384 | $yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post'); | 384 | $yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post'); |
385 | // 处理YOHO币数据 | 385 | // 处理YOHO币数据 |
386 | + if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){ | ||
386 | $coinList = $yohoCoin['data']['coinlist']; | 387 | $coinList = $yohoCoin['data']['coinlist']; |
387 | $data['money'] = $yohoCoin['data']['total']; | 388 | $data['money'] = $yohoCoin['data']['total']; |
388 | foreach($coinList as $key => $val){ | 389 | foreach($coinList as $key => $val){ |
@@ -393,6 +394,7 @@ class UserModel | @@ -393,6 +394,7 @@ class UserModel | ||
393 | } | 394 | } |
394 | $result[$key]['count'] = $val['num']; | 395 | $result[$key]['count'] = $val['num']; |
395 | } | 396 | } |
397 | + } | ||
396 | $data['list'] = $result; | 398 | $data['list'] = $result; |
397 | return $data; | 399 | return $data; |
398 | } | 400 | } |
@@ -56,7 +56,7 @@ class BindController extends AbstractAction | @@ -56,7 +56,7 @@ class BindController extends AbstractAction | ||
56 | $nickname = $this->get('nickname'); | 56 | $nickname = $this->get('nickname'); |
57 | $areaCode = $this->get('areaCode', '86'); | 57 | $areaCode = $this->get('areaCode', '86'); |
58 | $isReg = $this->get('isReg'); | 58 | $isReg = $this->get('isReg'); |
59 | - $mobile=$this->get('mobile'); | 59 | + $phoneNum=$this->get('phoneNum'); |
60 | 60 | ||
61 | $data = array( | 61 | $data = array( |
62 | 'bindIndex'=>true,//js标识 | 62 | 'bindIndex'=>true,//js标识 |
@@ -68,7 +68,7 @@ class BindController extends AbstractAction | @@ -68,7 +68,7 @@ class BindController extends AbstractAction | ||
68 | 'nickname' => $nickname, //昵称 | 68 | 'nickname' => $nickname, //昵称 |
69 | 'isReg' => $isReg, //是否是已注册过的手机号 | 69 | 'isReg' => $isReg, //是否是已注册过的手机号 |
70 | 'areaCode' => $areaCode, //国别码 | 70 | 'areaCode' => $areaCode, //国别码 |
71 | - 'phoneNum'=>$mobile,//手机号码 | 71 | + 'phoneNum'=>$phoneNum,//手机号码 |
72 | ); | 72 | ); |
73 | 73 | ||
74 | // 渲染模板 | 74 | // 渲染模板 |
@@ -114,31 +114,31 @@ class BindController extends AbstractAction | @@ -114,31 +114,31 @@ class BindController extends AbstractAction | ||
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | 116 | ||
117 | - $mobile = $this->post('mobile'); | 117 | + $phoneNum = $this->post('phoneNum'); |
118 | $openId = $this->post('openId'); | 118 | $openId = $this->post('openId'); |
119 | $areaCode = $this->post('areaCode', '86'); | 119 | $areaCode = $this->post('areaCode', '86'); |
120 | $sourceType = $this->post('sourceType'); | 120 | $sourceType = $this->post('sourceType'); |
121 | $nickname = $this->post('nickname'); | 121 | $nickname = $this->post('nickname'); |
122 | 122 | ||
123 | 123 | ||
124 | - if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType) | 124 | + if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) |
125 | { | 125 | { |
126 | break; | 126 | break; |
127 | } | 127 | } |
128 | 128 | ||
129 | - $res = BindData::bindCheck($mobile, $openId, $sourceType); | 129 | + $res = BindData::bindCheck($phoneNum, $openId, $sourceType); |
130 | if (!isset($res['code'])) | 130 | if (!isset($res['code'])) |
131 | { | 131 | { |
132 | break; | 132 | break; |
133 | } | 133 | } |
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, 'phoneNum' => $phoneNum)); |
137 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $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 | { |
141 | - $data = array('code' => 500, 'message' => $res['message'], 'data' => $res['data']); | 141 | + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | while (false); | 144 | while (false); |
@@ -159,15 +159,15 @@ class BindController extends AbstractAction | @@ -159,15 +159,15 @@ class BindController extends AbstractAction | ||
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | 161 | ||
162 | - $mobile = $this->post('mobile'); | 162 | + $phoneNum = $this->post('phoneNum'); |
163 | $areaCode = $this->post('areaCode'); | 163 | $areaCode = $this->post('areaCode'); |
164 | 164 | ||
165 | - if (!is_numeric($mobile)) | 165 | + if (!is_numeric($phoneNum)) |
166 | { | 166 | { |
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | 169 | ||
170 | - $data = BindData::sendBindMsg($areaCode,$mobile); | 170 | + $data = BindData::sendBindMsg($areaCode,$phoneNum); |
171 | if (!isset($data['code'])) | 171 | if (!isset($data['code'])) |
172 | { | 172 | { |
173 | break; | 173 | break; |
@@ -191,16 +191,16 @@ class BindController extends AbstractAction | @@ -191,16 +191,16 @@ class BindController extends AbstractAction | ||
191 | break; | 191 | break; |
192 | } | 192 | } |
193 | 193 | ||
194 | - $mobile = $this->post('mobile'); | 194 | + $phoneNum = $this->post('phoneNum'); |
195 | $msgCode = $this->post('msgCode'); | 195 | $msgCode = $this->post('msgCode'); |
196 | $areaCode = $this->post('areaCode'); | 196 | $areaCode = $this->post('areaCode'); |
197 | 197 | ||
198 | - if (!is_numeric($mobile) || !$msgCode) | 198 | + if (!is_numeric($phoneNum) || !$msgCode) |
199 | { | 199 | { |
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | 202 | ||
203 | - $data = BindData::checkBindCode($areaCode,$mobile, $msgCode); | 203 | + $data = BindData::checkBindCode($areaCode,$phoneNum, $msgCode); |
204 | if (!isset($data['code'])) | 204 | if (!isset($data['code'])) |
205 | { | 205 | { |
206 | break; | 206 | break; |
@@ -224,19 +224,19 @@ class BindController extends AbstractAction | @@ -224,19 +224,19 @@ class BindController extends AbstractAction | ||
224 | break; | 224 | break; |
225 | } | 225 | } |
226 | 226 | ||
227 | - $mobile = $this->post('mobile'); | 227 | + $phoneNum = $this->post('phoneNum'); |
228 | $openId = $this->post('openId'); | 228 | $openId = $this->post('openId'); |
229 | $areaCode = $this->post('areaCode', '86'); | 229 | $areaCode = $this->post('areaCode', '86'); |
230 | $sourceType = $this->post('sourceType'); | 230 | $sourceType = $this->post('sourceType'); |
231 | $nickname = $this->post('nickname'); | 231 | $nickname = $this->post('nickname'); |
232 | $password = $this->post('password'); | 232 | $password = $this->post('password'); |
233 | 233 | ||
234 | - if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode) | 234 | + if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) |
235 | { | 235 | { |
236 | break; | 236 | break; |
237 | } | 237 | } |
238 | 238 | ||
239 | - $res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password); | 239 | + $res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password); |
240 | if (!isset($res['code'])) | 240 | if (!isset($res['code'])) |
241 | { | 241 | { |
242 | break; | 242 | break; |
-
Please register or login to post a comment