|
|
@@ -72,20 +72,24 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $custom = CustomClass::getByCondition(['shopId' => $this->shopId, 'userId' => $this->userId], true);
|
|
|
- $customId = $custom->id ?? 0;
|
|
|
- if (!empty($custom)) {
|
|
|
- $post['customId'] = $customId;
|
|
|
- $customName = $custom->name ?? '';
|
|
|
- $post['customName'] = $customName;
|
|
|
- $post['customNamePy'] = stringUtil::py($customName);
|
|
|
- $hdId = $custom->hdId ?? 0;
|
|
|
- $hd = HdClass::getById($hdId, true);
|
|
|
- if (!empty($hd)) {
|
|
|
- $post['hdId'] = $hd->id ?? 0;
|
|
|
- $post['hdName'] = $hd->name ?? '';
|
|
|
- }
|
|
|
+ $hdId = $post['hdId'] ?? 0;
|
|
|
+ $hd = HdClass::getById($hdId, true);
|
|
|
+ if (empty($hd)) {
|
|
|
+ util::fail('没有找到花店');
|
|
|
+ }
|
|
|
+ if ($hd->shopId != $this->shopId) {
|
|
|
+ util::fail('不是你的花店');
|
|
|
+ }
|
|
|
+ $post['hdName'] = $hd->name ?? '';
|
|
|
+ $customId = $hd->customId ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ if (empty($custom)) {
|
|
|
+ util::fail('没有找到客户');
|
|
|
}
|
|
|
+ $customName = $custom->name ?? '';
|
|
|
+ $post['customName'] = $customName;
|
|
|
+ $post['customNamePy'] = stringUtil::py($customName);
|
|
|
+
|
|
|
|
|
|
$now = time();
|
|
|
//订单30分钟后过期
|
|
|
@@ -371,35 +375,12 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
|
|
|
|
|
|
- //余额支付 ssh 2019.12.6
|
|
|
+ //余额支付 ssh 20250410
|
|
|
public function actionBalancePay()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
|
|
|
- $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
|
|
|
- $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
|
|
|
-
|
|
|
- //验证优惠券是否还有效
|
|
|
- if (!empty($couponId)) {
|
|
|
- //CouponService::checkBeforeUse($couponId, $order['prePrice'], $order['userId']);
|
|
|
- }
|
|
|
-
|
|
|
- $order = OrderService::getByOrderSn($orderSn);
|
|
|
- $userId = $this->userId;
|
|
|
- $user = UserService::getUserInfo($userId);
|
|
|
- //验证支付密码是否正确
|
|
|
- UserService::validPayPassword($payPassword, $user);
|
|
|
- //支付前验证订单有效性
|
|
|
- OrderService::checkBeforePay($order);
|
|
|
- $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
|
|
|
- $totalFee = $order['prePrice'];
|
|
|
- $sourceType = 0;
|
|
|
- $discountData = OrderService::getDiscountPrice(['price' => $totalFee, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->userId]);
|
|
|
- $actPrice = $discountData['price'];
|
|
|
- $callbackParams = [];
|
|
|
- $respond = xhPayToolService::balancePay($callbackParams, $orderSn, $actPrice, $capitalType, $couponId);
|
|
|
- $balance = isset($respond['balance']) ? $respond['balance'] : 0;
|
|
|
- util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'balance' => $balance]);
|
|
|
+ $orderSn = $post['orderSn'] ?? '';
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//获取商城下单要用的微信支付和小程序支付参数 ssh 2019.21.3
|
|
|
@@ -604,18 +585,16 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
|
|
|
$order = OrderClass::addOrder($post);
|
|
|
- $orderId = $order['id'];
|
|
|
- $orderSn = $order['orderSn'];
|
|
|
- $sjId = $this->sjId;
|
|
|
+ $orderId = $order['id'] ?? 0;
|
|
|
+ $orderSn = $order['orderSn'] ?? '';
|
|
|
if ($payWay == 0) {
|
|
|
- $orderId = $order['id'];
|
|
|
$name = '购买商品';
|
|
|
$totalFee = $actPrice;
|
|
|
$user = UserService::getById($this->userId);
|
|
|
//小程序使用miniOpenId
|
|
|
$openId = $user['miniOpenId'];
|
|
|
if (empty($openId)) {
|
|
|
- $openId = isset($post['miniOpenId']) && !empty($post['miniOpenId']) ? $post['miniOpenId'] : '';
|
|
|
+ $openId = !empty($post['miniOpenId']) ? $post['miniOpenId'] : '';
|
|
|
}
|
|
|
if (empty($openId)) {
|
|
|
util::fail('没有微信信息');
|