Przeglądaj źródła

订单转单时比对系统售价

wufeng 2 lat temu
rodzic
commit
17bb689324
1 zmienionych plików z 13 dodań i 5 usunięć
  1. 13 5
      app/command/handleYzOrderData.php

+ 13 - 5
app/command/handleYzOrderData.php

@@ -35,6 +35,14 @@ class handleYzOrderData extends Command
             Db::startTrans();
             try {
 
+                //判断价格是否符合系统售价
+                $sale_price = Db::name('platform_youzan')
+                    ->where(['skuCode' => $c_data['skuCode'], 'is_del' => 0])
+                    ->value('sale_price', 0);
+
+                if ($c_data['discount_price'] < $sale_price && $c_data['is_approved'] == '0') throw new Exception('价格低于系统售价,' . $sale_price);
+
+
                 $standing_book_data = [];
 
 //                //先找用户确认信息
@@ -186,7 +194,7 @@ class handleYzOrderData extends Command
 
                 $sale_price = $c_data['discount_price'];
 
-                if ($goodtype == 1) {
+//                if ($goodtype == 1) {
 //                    $good = Db::name("good_ladder")
 //                        ->where(["skuCode" => $skuCode, "is_del" => 0, "status" => 1])
 //                        ->where([["min_num", "<=", $good_num]])
@@ -194,9 +202,9 @@ class handleYzOrderData extends Command
 //                        ->find();
 //                    if ($good == false) throw new Exception('未找到相关阶梯价格');
 
-                    //$sale_price = $good['sale_price']; //不改动售价
+                //$sale_price = $good['sale_price']; //不改动售价
 
-                    //理论上不会出现实时金价的订单
+                //理论上不会出现实时金价的订单
 //                    if ($ct['is_gold_price'] == 1 && $is_stock != 1) {
 //                        $gold = Db::name("gold_price1")
 //                            ->field('id,price')
@@ -213,7 +221,7 @@ class handleYzOrderData extends Command
 //                    }
 
 
-                }
+//                }
 
 
                 $remark = $c_data['buyer_messages'];
@@ -482,7 +490,7 @@ class handleYzOrderData extends Command
             } catch (\think\Exception $exception) {
                 Db::rollback();
 
-                $message[] = $exception->getMessage() . '|' . $exception->getFile() . '|' . $exception->getLine();
+                $message[] = $exception->getMessage();
 
                 //回调更新有赞订单数据
                 $callback_rs = $this->callbackYz(['status' => 2, 'id' => $c_data['id'], 'reason' => $exception->getMessage()]);