Authored by Lynnic

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

... ... @@ -212,9 +212,10 @@ class UserData
* @param int $uid 用户ID
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @param string $type 请求类型 get,post
* @return array YOHO币接口返回的数据
*/
public static function yohoCoinData($uid, $page = 1, $limit = 10)
public static function yohoCoinData($uid, $page = 1, $limit = 10,$type = 'get')
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.lists';
... ... @@ -223,7 +224,7 @@ class UserData
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
return Yohobuy::$type(Yohobuy::API_URL, $param);
}
/**
... ...
... ... @@ -42,12 +42,13 @@ class BindData
* @param string $mobile 手机号
*
*/
public static function sendBindMsg($mobile)
public static function sendBindMsg($area,$mobile)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.smsbind';
$param['mobile'] = $mobile;
$param['area'] = $area;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -57,13 +58,14 @@ class BindData
* 验证验证码是否正确
*
*/
public static function checkBindCode($mobile, $code)
public static function checkBindCode($area,$mobile, $code)
{
$param = Yohobuy::param();
$param['method'] = 'app.register.validRegCode';
$param['mobile'] = $mobile;
$param['code'] = $code;
$param['area'] = $area;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ...
var $ = require('jquery');
var page = 1;
function ajaxCurrencyDetail(page) {
$.ajax({
type: 'POST',
url: '/home/ajaxCurrencyDetail',
dataType: 'html',
data: {
page: page
},
success: function(data) {
$('.coin-detail').append(data);
window.rePosFooter();
}
});
}
$(window).scroll(function() {
if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) {
page++;
ajaxCurrencyDetail(page);
return;
}
});
ajaxCurrencyDetail(page);
\ No newline at end of file
... ...
... ... @@ -18,3 +18,4 @@ require('./address-act');
require('./logistic');
require('./pay');
require('./personal-details');
require('./currency');
... ...
... ... @@ -7,11 +7,15 @@
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Hammer = require('yoho.hammer'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
orderInfo = require('./order-info').orderInfo;
var dispatchModeHammer,
dispatchTimeHammer,
$invoice = $('.invoice');
$invoice = $('.invoice'),
$price = $('.price-cal'),
priceTmpl = Handlebars.compile($('#tmpl-price').html());
lazyLoad();
... ... @@ -55,9 +59,66 @@ $('.invoice').on('touchend', '.checkbox', function() {
}
});
function orderCompute() {
$.ajax({
method: 'POST',
url: '/shoppingCart/orderCompute',
data: {
cartType: orderInfo('cartType'),
deliveryId: orderInfo('deliveryId'),
paymentTypeId: orderInfo('paymentTypeId'),
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin')
}
}).then(function(res) {
var priceHtml;
if (!res) {
tip.show('网络出错');
} else {
priceHtml = priceTmpl({
sumPrice: res.order_amount,
salePrice: res.discount_amount,
freight: res.promotion_formula_list[1].promotion_amount,
yohoCoin: res.use_yoho_coin,
price: res.last_order_amount
});
$price.html(priceHtml);
}
}).fail(function() {
tip.show('网络出错');
});
}
function submitOrder() {
$.ajax({
method: 'POST',
url: '/shoppingCart/orderSub',
data: {
addressId: orderInfo('addressId'),
cartType: orderInfo('cartType'),
deliveryId: orderInfo('deliveryId'),
deliveryTimeId: orderInfo('deliveryTimeId'),
invoiceText: orderInfo('invoiceText'),
invoiceType: orderInfo('invoiceType'),
msg: orderInfo('msg'),
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), //支付方式
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin')
}
}).then(function(res) {
console.log(res);
}).fail(function() {
tip.show('网络出错');
});
}
// 界面点击,状态存 cookie
$('.dispatch-mode').on('touchend', 'li', function() {
orderInfo('deliveryId', $(this).data('id'));
orderCompute();
});
$('.dispatch-time').on('touchend', 'li', function() {
... ... @@ -69,9 +130,12 @@ $('.coin').on('touchend', function() {
if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
orderInfo('yohoCoin', $this.data('yoho-coin'));
$this.find('.coin-check em').show();
} else {
orderInfo('yohoCoin', 0);
$this.find('.coin-check em').hide();
}
orderCompute();
});
$invoice.on('touchend', function() {
... ... @@ -92,4 +156,6 @@ $('#msg').find('input').on('blur', function() {
$('.pay-mode').on('click', 'li', function() {
orderInfo('paymentTypeId', $(this).data('pay-id'));
orderInfo('paymentType', $(this).data('pay-type'));
submitOrder();
});
... ...
... ... @@ -9,7 +9,19 @@ var info = window.cookie('order-info');
try {
info = JSON.parse(info);
} catch (e) {
info = {};
info = {
deliveryId: null,
deliveryTimeId: null,
paymentTypeId: null,
yohoCoin: null,
addressId: null,
couponCode: null,
couponValue: null,
invoice: null,
invoiceText: null,
invoiceType: null,
msg: null
};
}
exports.orderInfo = function(key, value) {
... ...
$vip: sprite-map("me/vip/*.png", $spacing: 10px);
$fav: sprite-map("me/fav/*.png", $spacing: 5px);
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record", "logistic", "pay";
@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";
... ...
.yoho-coin-detail-page {
background: #f0f0f0;
.money{
width: 100%;
height: pxToRem(70px);
background:#fff;
margin-bottom: pxToRem(20px);
line-height: pxToRem(70px);
font-size: pxToRem(30px);
text-indent: 1em;
span{
color: #f00;
font-weight: bold;
}
}
.coin-detail {
background: #fff;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}
.detail-item {
position: relative;
margin-left: pxToRem(30px);
border-bottom: 1px solid #e0e0e0;
color: #444;
padding: pxToRem(15px) 0;
.title {
width: pxToRem(480px);
font-size: pxToRem(28px);
line-height: pxToRem(40px);
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.time {
font-size: pxToRem(20px);
line-height: pxToRem(30px);
color: #b0b0b0;
}
.count {
position: absolute;
right: 0;
top: 0;
margin-right: pxToRem(30px);
font-size: pxToRem(28px);
font-weight: bold;
line-height: pxToRem(100px);
}
}
li:last-child {
.detail-item {
border-bottom: none;
}
}
}
... ...
.yoho-coin-new-page {
padding-top: pxToRem(30px);
text-align: center;
.coin-num {
color: #d0021b;
font-size: pxToRem(66px);
font-weight: bold;
line-height: pxToRem(106px);
letter-spacing: pxToRem(8px);
}
.info {
color: #b0b0b0;
font-size: pxToRem(24px);
line-height: 1;
.dollar {
display: inline-block;
margin-right: pxToRem(6px);
vertical-align: middle;
width: pxToRem(24px);
height: pxToRem(24px);
background: image-url("me/yoho-coin/dollar.png") center center;
background-size: 100%;
}
}
.more {
display: inline-block;
margin: pxToRem(30px) 0;
color: #444;
font-size: pxToRem(24px);
line-height: pxToRem(36px);
width: pxToRem(152px);
height: pxToRem(36px);
text-align: center;
border: 1px solid #444;
border-radius: pxToRem(36px);
}
.coin-tip {
margin-bottom: pxToRem(30px);
padding: pxToRem(20px) pxToRem(30px);
font-size: pxToRem(24px);
line-height: pxToRem(32px);
color: #dc6870;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
.icon {
display: inline-block;
width: pxToRem(32px);
height: pxToRem(32px);
font-weight: bold;
border: 2px solid #dc6870;
border-radius: 50%;
}
}
.banner {
margin-bottom: pxToRem(30px);
}
}
... ...
{{# currency}}
<li>
<div class="detail-item">
<p class="title">{{title}}</p>
<p class="time">{{time}}</p>
<div class="count">
{{count}}
</div>
</div>
</li>
{{/ currency}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="yoho-coin-detail-page yoho-page">
<div class="money">你拥有的有货币:<span>{{ money}}</span></div>
<ul class="coin-detail"></ul>
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="yoho-coin-new-page yoho-page">
<div class="coin">
<p class="coin-num">
7876
</p>
<p class="info">
<span class="dollar"></span>
YOHO
</p>
<a href="" class="more">查看明细</a>
<div class="coin-tip">
<span class="icon">!</span>
您有300个YOHO币即将于20171231日过期,请尽快使用
</div>
</div>
<div class="banner">
<a href="">
{{!-- 演示图片 --}}
<img src="http://temp.im/640x200" alt="">
</a>
</div>
{{> home/maybe_like}}
</div>
{{> layout/footer}}
... ...
... ... @@ -81,7 +81,7 @@
优惠券
<span class="iconfont num">{{coupon_num}} &#xe604;</span>
</a>
<a class="list-item" href="/home/currency">
<a class="list-item" href="/home/currencyDetail">
<span class="iconfont icon">&#xe635;</span>
YOHO
<span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
... ...
... ... @@ -41,7 +41,7 @@
<section class="block">
<ul class="sale-invoice">
{{# coupon}}
{{#if coupon}}
<li class="coupon">
<a href="/shoppingCart/selectCoupon">
<!-- <a href="{{url}}"> -->
... ... @@ -65,7 +65,7 @@
{{/if}}
</a>
</li>
{{/ coupon}}
{{/if}}
{{# yohoCoin}}
<li class="coin" data-yoho-coin="{{.}}">
... ... @@ -79,16 +79,16 @@
{{/ yohoCoin}}
{{#if invoice}}
<li class="invoice">
<li class="invoice {{#if needInvoice}}focus{{/if}}">
<span class="title">发票</span>
<span class="iconfont checkbox icon-checkbox"></span>
<span class="iconfont checkbox {{#if needInvoice}}icon-cb-checked{{else}}icon-checkbox{{/if}}"></span>
<form id="invoice">
<input type="text" name="invoice-title" value="" placeholder="发票抬头">
<input type="text" name="invoice-title" value="{{invoiceText}}" placeholder="发票抬头">
<label>
发票类型
<select class="invoice-type" name="invoice-type">
{{# invoice}}
<option value="{{id}}">{{name}}</option>
<option value="{{id}}" {{#if isSelected}}selected{{/if}}>{{name}}</option>
{{/ invoice}}
</select>
</label>
... ... @@ -98,27 +98,27 @@
</ul>
<form id="msg" action="" method="post">
<input type="text" name="msg" value="" placeholder="留言">
<input type="text" name="msg" value="{{msg}}" placeholder="留言">
</form>
</section>
<section class="block">
<section class="price-cal block">
<ul class="total">
<li>
<span>总价</span>
&nbsp;&nbsp;¥ {{sumPrice}}
&nbsp;&nbsp;¥{{sumPrice}}
</li>
<li>
<span>活动价</span>
- ¥ {{salePrice}}
- ¥{{salePrice}}
</li>
<li>
<span>运费</span>
+ ¥ {{freight}}
+ ¥{{freight}}
</li>
<li>
<span>YOHO币</span>
- ¥ {{yohoCoin}}
- ¥{{yohoCoin}}
</li>
<li class="cost">
应付金额: <em>¥{{price}}</em>
... ... @@ -128,7 +128,7 @@
<ul class="pay-mode">
{{# paymentWay}}
<li class="{{#if default}}default{{/if}}" data-pay-id={{id}}>
<li class="{{#if default}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
<span class="iconfont">
{{#if default}}
&#xe62f;
... ... @@ -142,4 +142,27 @@
</ul>
{{/ orderEnsure}}
</div>
<script id="tmpl-price" type="text/tmpl">
<ul class="total">
<li>
<span>总价</span>
&nbsp;&nbsp;¥\{{sumPrice}}
</li>
<li>
<span>活动价</span>
- ¥\{{salePrice}}
</li>
<li>
<span>运费</span>
+ \{{freight}}
</li>
<li>
<span>YOHO币</span>
- ¥\{{yohoCoin}}
</li>
<li class="cost">
应付金额: <em>¥\{{price}}</em>
</li>
</ul>
</script>
{{> layout/footer}}
... ...
... ... @@ -308,3 +308,8 @@
seajs.use('js/me/pay');
</script>
{{/if}}
{{#if currencyDetail}}
<script>
seajs.use('js/me/currency');
</script>
{{/if}}
... ...
... ... @@ -876,5 +876,44 @@ class HomeController extends AbstractAction
);
$this->_view->display('helpDetail', $data);
}
/**
* YOHO币详情 新版
*/
public function currencyDetailAction()
{
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
$data['money'] = '0';
$page = $this->post('page',1);
$size = $this->post('size', 20);
// $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
$data = UserModel::getYohoCoinLists(3965746,$page,$size);
$this->_view->display('currency-detail', array(
'money' => $data['money'],
'pageFooter' => true,
'currencyDetail' => true,
'currencyDetailPage' => true
));
}
/**
* YOHO币详情 AJAX
*/
public function ajaxCurrencyDetailAction()
{
$data['list'] = array();
$data['money'] = 0;
$page = $this->post('page',1);
$size = $this->post('size', 20);
$data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
// $data = UserModel::getYohoCoinLists(3965746,$page,$size);
$this->_view->display('ajax-currency-detail', array(
'currency' => $data['list'],
'pageFooter' => true,
'currencyDetailPage' => true
));
}
}
... ...
... ... @@ -156,7 +156,6 @@ class ShoppingCartController extends AbstractAction
'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
);
$this->_view->display('order-ensure', $data);
}
... ... @@ -169,10 +168,10 @@ class ShoppingCartController extends AbstractAction
if ($this->isAjax()) {
$cartType = $this->post('cartType', 'ordinary');
$deliveryWay = $this->post('deliveryWay', 1);
$paymentType = $this->post('paymentType', 1);
$couponCode = $this->post('paymentType', null);
$yohoCoin = $this->post('paymentType', null);
$deliveryWay = $this->post('deliveryId', 1);
$paymentType = $this->post('paymentTypeId', 1);
$couponCode = $this->post('couponCode', null);
$yohoCoin = $this->post('yohoCoin', null);
$uid = $this->getUid(true);
$result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
}
... ... @@ -268,13 +267,13 @@ class ShoppingCartController extends AbstractAction
$uid = $this->getUid(true);
$addressId = $this->post('addressId', null);
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
$deliveryTime = $this->post('deliveryTime', 1); // 默认只工作日配送
$deliveryWay = $this->post('deliveryWay', 1); // 默认普通快递
$invoiceTitle = $this->post('invoiceTitle', null);
$invoiceId = $this->post('invoiceId', null);
$paymentId = $this->post('paymentId', 15);
$deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
$deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
$invoiceTitle = $this->post('invoiceText', null);
$invoiceId = $this->post('invoiceType', null);
$paymentId = $this->post('paymentTypeId', 15);
$paymentType = $this->post('paymentType', 1); // 默认在线支付
$remark = $this->post('remark', null); // 默认在线支付
$remark = $this->post('msg', null);
$yohoCoin = $this->post('yohoCoin', 1);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
}
... ... @@ -283,7 +282,7 @@ class ShoppingCartController extends AbstractAction
echo ' ';
} else {
// 提交成功清除Cookie
$this->setCookie('orderInfo', null);
$this->setCookie('order-info', null);
$this->echoJson($result);
}
... ...
... ... @@ -306,7 +306,7 @@ class CartModel
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
... ... @@ -326,32 +326,50 @@ class CartModel
// 配送方式
if (isset($payReturn['delivery_way'])) {
$idArr = array();
$defaultKey = 0;
$oneDeliv = array();
foreach ($payReturn['delivery_way'] as $val) {
foreach ($payReturn['delivery_way'] as $key => $val) {
$oneDeliv = array();
$oneDeliv['id'] = $val['delivery_way_id'];
$oneDeliv['name'] = $val['delivery_way_name'];
($val['default'] === 'Y') && $defaultKey = $key;
isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true;
$idArr[$key] = $oneDeliv['id'];
!isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y');
$result['dispatchMode'][$key] = $oneDeliv;
}
$result['dispatchMode'][] = $oneDeliv;
if (isset($orderInfo['deliveryId'])) {
$flag = array_search($orderInfo['deliveryId'], $idArr);
$flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
} else {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
}
// 配送时间
if (isset($payReturn['delivery_time'])) {
$idArr = array();
$defaultKey = 0;
$oneDelivTime = array();
foreach ($payReturn['delivery_time'] as $one) {
foreach ($payReturn['delivery_time'] as $key => $one) {
$oneDelivTime = array();
$oneDelivTime['id'] = $one['delivery_time_id'];
$oneDelivTime['name'] = $one['delivery_time_string'];
$oneDelivTime['default'] = ($one['default'] === 'Y');
isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true;
($one['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDelivTime['id'];
$result['dispatchTime'][] = $oneDelivTime;
}
if (isset($orderInfo['deliveryTimeId'])) {
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
} else {
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
}
}
// 订单商品
... ... @@ -407,13 +425,21 @@ class CartModel
$one = array();
$one['id'] = $inv['invoices_type_id'];
$one['name'] = $inv['invoices_type_name'];
$one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true;
$result['invoice'][] = $one;
}
// 发票信息需要记录
$result['needInvoice'] = $orderInfo['invoice'];
$result['invoiceText'] = $orderInfo['invoiceText'];
}
// 留言
$result['msg'] = $orderInfo['msg'];
// 优惠券数据
$coupons = array('notUsed' => true);
$coupons = array();
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
$coupons += self::getCouponList($uid, 0, 1, true);
$result['coupon'] = $coupons;
... ...
... ... @@ -369,6 +369,35 @@ class UserModel
}
/**
* 处理YOHO币变化履历数据
*
* @param int $uid 用户ID
* @param int $page 当前页
* @param int $limit 一页记录数
* @return array|mixed 处理之后的YOHO币数据
*/
public static function getYohoCoinLists($uid, $page, $limit)
{
$result = array();
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
// 处理YOHO币数据
$coinList = $yohoCoin['data']['coinlist'];
$data['money'] = $yohoCoin['data']['total'];
foreach($coinList as $key => $val){
$result[$key]['title'] = $val['message'];
$result[$key]['time'] = $val['date'];
if($val['num'] > 0){
$val['num'] = '+'.$val['num'];
}
$result[$key]['count'] = $val['num'];
}
$data['list'] = $result;
return $data;
}
/**
* 处理优惠券数据
*
* @param int $uid 用户ID
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use LibModels\Wap\Passport\BindData;
use LibModels\Wap\Passport\RegData;
use Plugin\Helpers;
/**
... ... @@ -15,14 +16,28 @@ class BindController extends AbstractAction
*/
public function indexAction()
{
$refer = $this->get('refer');
if (!empty($refer))
{
$this->setCookie('refer', $refer);
}
$this->setTitle('绑定手机号');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$nickname = $this->get('nickname');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'platform'=>$sourceType,
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'areaCode'=>'+86',//默认区号
'countrys'=>RegData::getAreasData(),//国别码
'nickname' => $nickname, //昵称
);
// 渲染模板
... ... @@ -38,16 +53,22 @@ class BindController extends AbstractAction
$this->setTitle('验证手机');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$area = $this->get('areaCode', '86');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$isReg = $this->get('isReg');
$mobile=$this->get('mobile');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'nickname' => $nickname, //昵称
'isReg' => $isReg, //是否是已注册过的手机号
'area' => $area //国别码
'areaCode' => $areaCode, //国别码
'phoneNum'=>$mobile,//手机号码
);
// 渲染模板
... ... @@ -63,13 +84,17 @@ class BindController extends AbstractAction
$this->setTitle('重新设置登录密码');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$area = $this->get('areaCode', '86');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'area' => $area //国别码
'nickname' => $nickname, //昵称
'areaCode' => $areaCode //国别码
);
// 渲染模板
... ... @@ -91,12 +116,12 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$openId = $this->post('openId');
$area = $this->post('areaCode', '86');
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
$nickName = $this->post('nickName');
$nickname = $this->post('nickname');
if (!is_numeric($mobile) || !$openId || !$area || !$sourceType)
if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType)
{
break;
}
... ... @@ -108,8 +133,8 @@ class BindController extends AbstractAction
}
if ($res['code'] == 200)
{
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickName' => $nickName, 'areaCode' => $area, 'mobile' => $mobile));
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next));
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile));
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
}
else
{
... ... @@ -135,13 +160,14 @@ class BindController extends AbstractAction
}
$mobile = $this->post('mobile');
$areaCode = $this->post('areaCode');
if (!is_numeric($mobile))
{
break;
}
$data = BindData::sendBindMsg($mobile);
$data = BindData::sendBindMsg($areaCode,$mobile);
if (!isset($data['code']))
{
break;
... ... @@ -167,13 +193,14 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$msgCode = $this->post('msgCode');
$areaCode = $this->post('areaCode');
if (!is_numeric($mobile) || !$msgCode)
{
break;
}
$data = BindData::checkBindCode($mobile, $msgCode);
$data = BindData::checkBindCode($areaCode,$mobile, $msgCode);
if (!isset($data['code']))
{
break;
... ... @@ -199,17 +226,17 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$openId = $this->post('openId');
$area = $this->post('areaCode', '86');
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
$nickName = $this->post('nickName');
$nickname = $this->post('nickname');
$password = $this->post('password');
if (!is_numeric($mobile) || !$openId || !$sourceType || !$area)
if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode)
{
break;
}
$res = BindData::bindMobile($openId, $nickName, $sourceType, $mobile, $area, $password);
$res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password);
if (!isset($res['code']))
{
break;
... ...