shish 5 سال پیش
والد
کامیت
4f2fa97c02
2فایلهای تغییر یافته به همراه10 افزوده شده و 8 حذف شده
  1. 5 7
      app-hd/controllers/OrderController.php
  2. 5 1
      app-mall/controllers/OrderController.php

+ 5 - 7
app-hd/controllers/OrderController.php

@@ -94,22 +94,20 @@ class OrderController extends BaseController
                 }
                 $goodsPrice = $unitPrice * $goodsNum;
                 $totalGoodsPrice = stringUtil::calcAdd($totalGoodsPrice, $goodsPrice);
-                $currentCover = isset($goodsInfo['shortImgList']) && !empty($currentGoodsInfo['shortImgList']) ? current($currentGoodsInfo['shortImgList']) : '';
-                if (!empty($goodsStyleId) && isset($goodsStyleList[$goodsStyleId]['picture']) && !empty($goodsStyleList[$goodsStyleId]['picture'])) {
-                    $currentCover = $goodsStyleList[$goodsStyleId]['picture'];
-                }
+
                 $orderGoods[] = [
                     'goodsId' => $currentGoodsId,
                     'userId' => $this->adminId,
                     'sjId' => $this->sjId,
                     'title' => $currentGoodsInfo['goodsName'],
-                    'cover' => $currentCover,
+                    'cover' => isset($goodsInfo['shortImgList']) && !empty($currentGoodsInfo['shortImgList']) ? current($currentGoodsInfo['shortImgList']) : '',
                     'unitPrice' => $unitPrice,
                     'num' => $goodsNum,
                     'goodsStyleName' => isset($currentGoodsInfo['goodsStyleList'][$goodsStyleId]['title']) ? $currentGoodsInfo['goodsStyleList'][$goodsStyleId]['title'] : '',
                     'goodsStyleId' => $goodsStyleId,
                     'createTime' => date("Y-m-d H:i:s"),
                 ];
+
             }
 
             $user = $this->custom;
@@ -161,10 +159,10 @@ class OrderController extends BaseController
             if (empty($product)) {
                 util::fail('请选择花材');
             }
-            $actPrice = $post['packingFee'] ?? 0; //包装费
+            $actPrice = $post['packingFee']??0; //包装费
             $orderProduct = [];
             $productInfo = ProductClass::formatProductInfo($product);
-            $actPrice = bcadd($actPrice, $productInfo['price'], 2);
+            $actPrice = bcadd($actPrice,$productInfo['price'],2);
             foreach ($product as $key => $val) {
                 $productId = $val['productId'];
                 $bigNum = $val['bigNum'];

+ 5 - 1
app-mall/controllers/OrderController.php

@@ -108,13 +108,17 @@ class OrderController extends BaseController
             $order = OrderClass::addOrder($post);
             $orderId = $order['id'];
             $orderSn = $order['orderSn'];
+            $currentCover = isset($goodsInfo['shortImgList']) && !empty($currentGoodsInfo['shortImgList']) ? current($currentGoodsInfo['shortImgList']) : '';
+            if (!empty($goodsStyleId) && isset($goodsStyleList[$goodsStyleId]['picture']) && !empty($goodsStyleList[$goodsStyleId]['picture'])) {
+                $currentCover = $goodsStyleList[$goodsStyleId]['picture'];
+            }
             $data = [
                 'orderId' => $orderId,
                 'goodsId' => $goodsId,
                 'userId' => $this->userId,
                 'sjId' => $this->sjId,
                 'title' => $goodsInfo['goodsName'],
-                'cover' => isset($goodsInfo['shortImgList']) && !empty($goodsInfo['shortImgList']) ? current($goodsInfo['shortImgList']) : '',
+                'cover' => $currentCover,
                 'unitPrice' => $unitPrice,
                 'num' => $goodsNum,
                 'goodsStyleName' => isset($goodsInfo['goodsStyleList'][$goodsStyleId]['title']) ? $goodsInfo['goodsStyleList'][$goodsStyleId]['title'] : '',