Authored by 郝肖肖

修复 更改支付方式 锁单bug

... ... @@ -33,7 +33,7 @@
<div class="count">
{{#each list}}
<div class="mode" data-id="{{dataId}}" data-value="{{dataVal}}">
<div id="{{idNum}}"></div>
<div id="{{idNum}}" class="borer-tag"></div>
<img src="{{ico}}" alt="{{name}}" id="{{imgId}}">
</div>
{{/each}}
... ... @@ -44,7 +44,7 @@
<div class="count">
{{# each entry}}
<div class="mode" data-id="{{dataId}}" data-value="{{dataVal}}">
<div id="{{idNum}}"></div>
<div id="{{idNum}}" class="borer-tag"></div>
<img src="{{ico}}" alt="{{name}}" id="{{imgId}}">
</div>
{{/each}}
... ...
... ... @@ -15,7 +15,6 @@ var $ = require('yoho.jquery'),
$payUrl = $('#payUrl').val(),
$modeData,
activeTab,
showDiv,
imgAlt,
imgSrc,
orderCode,
... ... @@ -45,7 +44,6 @@ function choosed() {
$mode.eq(0).addClass('choose-type').show();
$mode.eq(0).find('div').addClass('choosed-tag');
}
$btnty.attr('value', '前往' + $('#' + $chooseMoid).attr('alt'));
$showPayImg.attr('src', $('#' + $chooseMoid).attr('src'));
}
... ... @@ -54,7 +52,6 @@ choosed();
$mode.click(function() {
$modeData = $(this).data();
showDiv = $modeData.id;
$showValue = $modeData.value;
imgAlt = $('#' + $showValue).attr('alt');
imgSrc = $('#' + $showValue).attr('src');
... ... @@ -62,7 +59,7 @@ $mode.click(function() {
$mode.removeClass('choose-type');
$(this).addClass('choose-type');
$choseTag.removeClass('choosed-tag');
$('#' + showDiv).addClass('choosed-tag');
$(this).find('.borer-tag').addClass('choosed-tag');
$btnty.attr('value', '前往' + imgAlt);
$showPayImg.attr('src', imgSrc);
return false;
... ...
... ... @@ -147,16 +147,14 @@ class PayModel
if (isset($bankRecord['data']['bankCode']) && !empty($bankRecord['data']['bankCode'])) {
$payRecord = $bankRecord['data']['bankCode'];
} else {
$payCode = $order['payment'] ?: $defaultPayType;
$payCode = empty($order['payment']) ? $defaultPayType : $order['payment'];
//记录app上的支付方式
$changeCodes = array(
19 => 21,// app上微信支付
22 => 21,// h5微信支付
18 => $defaultPayType// h5支付宝支付
18 => 2// h5支付宝支付
);
$platformCode = isset($changeCodes[$payCode]) && $changeCodes[$payCode] ? $changeCodes[$payCode] : $payCode;
$platformCodeList = array_keys($types);
$payRecord = in_array($platformCode, $platformCodeList) ? $platformCode : $defaultPayType;
$payRecord = empty($changeCodes[$payCode]) ? $defaultPayType : $changeCodes[$payCode];
}
$result['payRecord'] = $payRecord;
... ... @@ -198,16 +196,14 @@ class PayModel
$onePay = array();
foreach ($pays as $code => $pay) {
$onePay = array();
$onePay['dataId'] = $code;
$onePay['dataId'] = $isBank ? 12 : $code;//支付宝支联为12
$onePay['dataVal'] = $isBank ? '12_' . $code : $code . '_platform';
$onePay['idNum'] = $code;
$onePay['ico'] = $pay['ico'];
$onePay['name'] = $pay['name'];
$onePay['imgId'] = $onePay['dataVal'];
$result[] = $onePay;
}
return $result;
}
... ...
... ... @@ -150,16 +150,14 @@ class PaymentModel
if (isset($bankRecord['data']['bankCode']) && !empty($bankRecord['data']['bankCode'])) {
$payRecord = $bankRecord['data']['bankCode'];
} else {
$payCode = $order['payment'] ?: $defaultPayType;
$payCode = empty($order['payment']) ? $defaultPayType : $order['payment'];
//记录app上的支付方式
$changeCodes = array(
19 => 21,// app上微信支付
22 => 21,// h5微信支付
18 => $defaultPayType// h5支付宝支付
18 => 2// h5支付宝支付
);
$platformCode = isset($changeCodes[$payCode]) && $changeCodes[$payCode] ? $changeCodes[$payCode] : $payCode;
$platformCodeList = array_keys($types);
$payRecord = in_array($platformCode, $platformCodeList) ? $platformCode : $defaultPayType;
$payRecord = empty($changeCodes[$payCode]) ? $defaultPayType : $changeCodes[$payCode];
}
$result['payRecord'] = $payRecord;
... ... @@ -202,7 +200,7 @@ class PaymentModel
foreach ($pays as $code => $pay) {
$onePay = array();
$onePay['dataId'] = $code;
$onePay['dataId'] = $isBank ? 12 : $code;//支付宝支联为12
$onePay['dataVal'] = $isBank ? '12_' . $code : $code . '_platform';
$onePay['idNum'] = $code;
$onePay['ico'] = $pay['ico'];
... ...
... ... @@ -26,7 +26,7 @@ class PayController extends WebAction
public function indexAction()
{
/* 判断用户是否登录 */
$uid = $this->getUid(true);
$uid = $this->getUid();
if (!$uid) {
$this->go( Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))) );
}
... ... @@ -88,7 +88,7 @@ class PayController extends WebAction
$result = array('code' => 400, 'message' => '操作失败!');
if ($this->isAjax()) {
do {
$uid = $this->getUid(true);
$uid = $this->getUid();
$orderCode = $this->post('orderCode', 0);
$paymentId = $this->post('paymentId', 0);
if (empty($orderCode) || empty($uid) || empty($paymentId)) {
... ...