|
|
@@ -718,9 +718,45 @@ class PurchaseController extends BaseController
|
|
|
util::fail('订单已失效,请重新下单');
|
|
|
}
|
|
|
|
|
|
+ $ghsId = $order->ghsId ?? 0;
|
|
|
+ $ghs = GhsClass::getById($ghsId, true);
|
|
|
+ if (empty($ghs)) {
|
|
|
+ util::fail('没有供货商信息');
|
|
|
+ }
|
|
|
+ $ghsShopId = $ghs->shopId ?? 0;
|
|
|
+ $ghsShop = ShopClass::getById($ghsShopId, true);
|
|
|
+ if (empty($ghsShop)) {
|
|
|
+ util::fail('没有供货商门店信息');
|
|
|
+ }
|
|
|
+ if (isset($ghsShop->lklSjNo) && empty($ghsShop->lklSjNo)) {
|
|
|
+ util::fail('商家支付功能未开通');
|
|
|
+ }
|
|
|
+
|
|
|
//已经唤起过微信支付了,根据拉卡拉的规则,需要生成新的订单号
|
|
|
if ($order->changePrice == 2) {
|
|
|
$oldOrderSn = $orderSn;
|
|
|
+
|
|
|
+ //老单号需要关单,否则有付款成功的风险,老单号关闭成功了,才能生成新单号
|
|
|
+ $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
|
|
|
+ $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
|
|
|
+ $params = [
|
|
|
+ 'appid' => 'OP00002119',
|
|
|
+ 'serial_no' => '018b08cfddbd',
|
|
|
+ 'merchant_no' => $ghsShop->lklSjNo,
|
|
|
+ 'term_no' => $ghsShop->lklScanTermNo,
|
|
|
+ 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
|
|
|
+ 'lklCertificatePath' => $lklCertificatePath,
|
|
|
+ ];
|
|
|
+ $laResource = new Lakala($params);
|
|
|
+ $closeParams = [
|
|
|
+ 'orderSn' => $oldOrderSn,
|
|
|
+ ];
|
|
|
+ $response = $laResource->cashClose($closeParams);
|
|
|
+ if (isset($response['code']) == false || $response['code'] != '000000') {
|
|
|
+ $msg = $response['msg'] ?? '';
|
|
|
+ noticeUtil::push('注意花店买花更换单号没有成功,单号:' . $oldOrderSn . ',关单没有成功(收银台-支付宝),' . $msg, '15280215347');
|
|
|
+ }
|
|
|
+
|
|
|
$newOrderSn = orderSn::getPurchaseSn();
|
|
|
$newGhsOrderSn = orderSn::getGhsOrderSn();
|
|
|
$orderSn = $newOrderSn;
|