...
|
...
|
@@ -5,8 +5,9 @@ use Hood\Core\Security\AuthCode; |
|
|
use Index\CartModel;
|
|
|
use Index\UserModel;
|
|
|
use Plugin\Helpers;
|
|
|
use Plugin\UnionTrans;
|
|
|
use Home\OrderModel;
|
|
|
use Plugin\UdpLog;
|
|
|
use LibModels\Wap\Home\UserData;
|
|
|
|
|
|
/**
|
|
|
* 购物车相关的控制器
|
...
|
...
|
@@ -301,12 +302,13 @@ class IndexController extends AbstractAction |
|
|
// 返回地址
|
|
|
$returnUrl = Helpers::url('/cart/index/index');
|
|
|
|
|
|
$cartType = $this->get('cartType', '');
|
|
|
$cartType = $this->get('cartType', 'ordinary');
|
|
|
$cookieData = $this->getCookie('order-info', null);
|
|
|
$orderInfo = array();
|
|
|
if (!empty($cookieData)) {
|
|
|
$orderInfo = json_decode($cookieData, true);
|
|
|
$cartType = $orderInfo['cartType'];
|
|
|
//如果为空,获取默认
|
|
|
$cartType = empty($orderInfo['cartType']) ? $cartType : $orderInfo['cartType'];
|
|
|
}
|
|
|
|
|
|
// 如果传递了code, sku,skn,buy_number就代表是限购商品
|
...
|
...
|
@@ -331,13 +333,11 @@ class IndexController extends AbstractAction |
|
|
$this->echoJson($order);
|
|
|
return;
|
|
|
}
|
|
|
$userData = UserData::userData($uid);
|
|
|
$mobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile']; //发票人手机
|
|
|
|
|
|
$data = array(
|
|
|
'orderEnsurePage' => true,
|
|
|
'isOrdinaryCart' => ($cartType !== 'advance'),
|
|
|
'orderEnsure' => $order,
|
|
|
'userMobile' => $mobile
|
|
|
'orderEnsure' => $order
|
|
|
);
|
|
|
|
|
|
$this->setTitle('确认订单');
|
...
|
...
|
@@ -347,108 +347,6 @@ class IndexController extends AbstractAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发票信息
|
|
|
*/
|
|
|
public function invoiceInfoAction()
|
|
|
{
|
|
|
$uid = $this->getUid();
|
|
|
if (!$uid) {
|
|
|
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
|
|
|
}
|
|
|
$cookieData = $this->getCookie('order-info', null); //从缓存中获取电子发票信息
|
|
|
$userData = UserData::userData($uid);
|
|
|
$userMobile = empty($userData['data']) || empty($userData['data']['mobile']) ? '' : $userData['data']['mobile']; //发票人手机
|
|
|
if (!empty($cookieData)) {
|
|
|
$orderInfo = json_decode($cookieData, true);
|
|
|
$invoiceType = $orderInfo['invoiceType']; //发票类型ID
|
|
|
$invoices_type = $orderInfo['invoicesType'] * 1; //发票类型 /**纸质 1 ,电子 2 */
|
|
|
$mobile = isset($orderInfo['receiverMobile']) && !empty($orderInfo['receiverMobile']) ? $orderInfo['receiverMobile'] : $userMobile; //发票人手机
|
|
|
$invoices_title = $orderInfo['invoiceText']; //发票抬头
|
|
|
$invoice_Top = $orderInfo['invoiceTitle'];
|
|
|
}
|
|
|
else {
|
|
|
$userData = UserData::userData($uid);
|
|
|
$mobile = $userMobile; //发票人手机
|
|
|
$invoiceType = '7'; //发票类型ID
|
|
|
$invoices_type = '2'; //发票类型 /**纸质 1 ,电子 2 */
|
|
|
$invoice_Top = '个人';
|
|
|
}
|
|
|
|
|
|
$data = array(
|
|
|
'invoiceInfoPage' => true,
|
|
|
'invoiceNotice' => '发票须知',
|
|
|
'phone' => $mobile ? substr_replace($mobile, '****', 3, 4) : '',
|
|
|
'completeTel' => $mobile,
|
|
|
'isCompany' => $invoice_Top =='单位' ? false : true,
|
|
|
'companyName' => $invoices_title,
|
|
|
'invoicesType' => array(
|
|
|
array(
|
|
|
'id' => '2',
|
|
|
'type' => '电子发票',
|
|
|
'choosed' => empty($invoices_type) || $invoices_type == 2 ? true : false,
|
|
|
),
|
|
|
array(
|
|
|
'id' => '1',
|
|
|
'type' => '纸质发票',
|
|
|
'choosed' => $invoices_type == 1 ? true : false,
|
|
|
)
|
|
|
),
|
|
|
'invoiceTitle' => array(
|
|
|
array(
|
|
|
'type' => '个人',
|
|
|
'choosed' =>$invoice_Top == '个人'? true : false,
|
|
|
),
|
|
|
array(
|
|
|
'type' => '单位',
|
|
|
'choosed' => $invoice_Top == '单位' ? true : false,
|
|
|
)
|
|
|
),
|
|
|
'content' => array(
|
|
|
array(
|
|
|
'choosed' => empty($invoiceType) || $invoiceType == 7 ? true : false,
|
|
|
'id' => 7,
|
|
|
'text' => '服装'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 1 ? true : false,
|
|
|
'id' => 1,
|
|
|
'text' => '图书'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 9 ? true : false,
|
|
|
'id' => 9,
|
|
|
'text' => '配件'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 11 ? true : false,
|
|
|
'id' => 11,
|
|
|
'text' => '日用品'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 3 ? true : false,
|
|
|
'id' => 3,
|
|
|
'text' => '办公用品'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 6 ? true : false,
|
|
|
'id' => 6,
|
|
|
'text' => '体育用品'
|
|
|
),
|
|
|
array(
|
|
|
'choosed' => $invoiceType == 10 ? true : false,
|
|
|
'id' => 10,
|
|
|
'text' => '数码产品'
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
|
|
|
$this->setTitle('发票信息');
|
|
|
$this->setNavHeader('发票信息', true, false); // 不显示右上角home按钮
|
|
|
|
|
|
$this->_view->display('invoice-info', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车选择改变字段,重新运算订单数据
|
|
|
*/
|
|
|
public function orderComputeAction()
|
...
|
...
|
@@ -557,22 +455,14 @@ class IndexController extends AbstractAction |
|
|
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
|
|
|
$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('msg', null);
|
|
|
$couponCode = $this->post('couponCode', null);
|
|
|
$yohoCoin = $this->post('yohoCoin', 1);
|
|
|
$skuList = $this->post('skuList', '');
|
|
|
$cookieData = $this->getCookie('order-info', null); //获取电子发票信息
|
|
|
//电子发票信息数组
|
|
|
$invoices = array();
|
|
|
if (!empty($cookieData)) {
|
|
|
$orderInfo = json_decode($cookieData, true);
|
|
|
$invoices['invoices_type_id'] = $orderInfo['invoiceType']; //发票类型ID
|
|
|
$invoices['invoices_type'] = $orderInfo['invoicesType']; //发票类型 /**纸质 1 ,电子 2 */
|
|
|
$invoices['receiverMobile'] = $orderInfo['receiverMobile']; //发票人手机
|
|
|
$invoices['invoices_title'] = empty($orderInfo['invoiceText']) ? '个人' : $orderInfo['invoiceText']; //发票抬头
|
|
|
}
|
|
|
|
|
|
/* 判断是否是友盟过来的用户 */
|
|
|
$userAgent = null;
|
...
|
...
|
@@ -585,14 +475,16 @@ class IndexController extends AbstractAction |
|
|
/* 模拟APP的User-Agent */
|
|
|
$userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null;
|
|
|
}
|
|
|
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent);
|
|
|
|
|
|
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent);
|
|
|
|
|
|
// 记录下单异常的数据
|
|
|
if (empty($result)) {
|
|
|
$message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime
|
|
|
. ',deliveryWay:' . $deliveryWay . ',yohoCoin:' . $yohoCoin
|
|
|
. ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin
|
|
|
. ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
|
|
|
UdpLog::info('【下单】下单异常数据', 'message:' . $message, '返回:' . json_encode($result));
|
|
|
error_log($message, 3, '/Data/logs/php/h5_error/order.' . date('Ym') . '.log');
|
|
|
UdpLog::info('【下单】下单异常数据','message:'.$message,'返回:'.json_encode($result));
|
|
|
}
|
|
|
// 返回数据
|
|
|
else {
|
...
|
...
|
@@ -601,6 +493,14 @@ class IndexController extends AbstractAction |
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/* if ($uid && !empty($result['data'])) {
|
|
|
try {
|
|
|
UnionTrans::set($uid, $result['data']['order_code'], $result['data']['order_amount']);
|
|
|
} catch (Exception $e) {
|
|
|
// do nothing
|
|
|
}
|
|
|
} */
|
|
|
}
|
|
|
else {
|
|
|
echo ' ';
|
...
|
...
|
|