shish 4 years ago
parent
commit
9de3049644
1 changed files with 24 additions and 1 deletions
  1. 24 1
      console/controllers/InitController.php

+ 24 - 1
console/controllers/InitController.php

@@ -56,6 +56,7 @@ use bizHd\goods\classes\CategoryClass;
 use bizHd\goods\classes\GoodsCategoryClass;
 use bizHd\goods\classes\GoodsClass;
 use bizHd\goods\classes\GoodsSettingClass;
+use bizHd\order\classes\OrderGoodsClass;
 use bizHd\order\models\Order;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseItemClass;
@@ -85,18 +86,40 @@ class InitController extends Controller
 
         foreach ($query->batch() as $batchOrder) {
             foreach ($batchOrder as $order) {
+                $addTime = $order['addTime'] ?? '';
                 $goodsPrice = $order['goodsPrice'] ?? 0;
+                $goodsPrice = floatval($goodsPrice);
                 $sendCost = $order['sendCost'] ?? 0;
+                $sendCost = floatval($sendCost);
                 $labourCost = $order['labourCost'] ?? 0;
+                $labourCost = floatval($labourCost);
                 $discountAmount = $order['discountAmount'] ?? 0;
+                $discountAmount = floatval($discountAmount);
                 $orderPrice = $order['orderPrice'] ?? 0;
+                $orderPrice = floatval($orderPrice);
                 $total = bcadd($goodsPrice, $sendCost, 2);
                 $total = bcadd($total, $labourCost, 2);
                 $final = bcsub($total, $discountAmount, 2);
+                $final = floatval($final);
                 $actPrice = $order['actPrice'] ?? 0;
                 $orderSn = $order['orderSn'] ?? '';
                 if ($final != $orderPrice) {
-                    echo "订单号:{$orderSn} 金额有问题 商品总金额:{$goodsPrice} 运费:{$sendCost} 人工包装费:{$labourCost} 合计:{$total} 优惠:{$discountAmount} 订单金额:{$orderPrice} 实付金额:{$actPrice}\n";
+                    echo "订单号:{$orderSn} {$addTime} \n";
+                    echo "=====\n";
+                    $itemList = \bizHd\order\classes\OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
+                    if (!empty($itemList)) {
+                        foreach ($itemList as $item) {
+                            echo $item['name'] . " " . $item['num'] . "X" . $item['unitPrice'] . " " . $item['price'] . "\n";
+                        }
+                    }
+                    $goodsList = OrderGoodsClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
+                    if (!empty($goodsList)) {
+                        foreach ($goodsList as $goods) {
+                            echo $goods['name'] . " " . $goods['num'] . "X" . $goods['unitPrice'] . " " . $goods['price'] . "\n";
+                        }
+                    }
+                    echo "=====\n";
+                    echo "商品总和:{$goodsPrice} \n 运费:{$sendCost} \n人工包装费:{$labourCost} \n合计:{$total} \n优惠:{$discountAmount}\n 订单金额:{$orderPrice} \n 实付金额:{$actPrice}\n";
                 }
             }
         }