Browse Source

有赞商品上线优化

wufeng 2 years ago
parent
commit
a11e135775
1 changed files with 16 additions and 11 deletions
  1. 16 11
      app/youzan/logic/Goodup.php

+ 16 - 11
app/youzan/logic/Goodup.php

@@ -239,19 +239,24 @@ class Goodup
             //审核通过
             if ($data['exam_status'] == $db::$exam_status_1) {
 
-                $ladder_info = Db::name('good_ladder')
-                    ->field('id,cost_fee')
+//                $ladder_info = Db::name('good_ladder')
+//                    ->field('id,cost_fee')
+//                    ->where('id', $data['good_ladder_id'])
+//                    ->where('is_del', 0)
+//                    ->find();
+//
+//                if (empty($ladder_info)) throw new Exception('该商品阶梯记录不存在');
+
+                //运费,单位分,整数
+                $nake_info = Db::name('good_nake')
+//                    ->where(['spuCode' => $rs->spuCode, 'is_del' => 0])
+//                    ->where('min_num', '<=', $data['start_sale_num'])
+                    ->field('id,delivery_fee,cost_fee')
                     ->where('id', $data['good_ladder_id'])
-                    ->where('is_del', 0)
-                    ->find();
+                    ->findOrEmpty();
 
-                if (empty($ladder_info)) throw new Exception('该商品阶梯记录不存在');
+                $post_fee = isset($nake_info['delivery_fee'])?$nake_info['delivery_fee']:0;
 
-                //运费,单位分,整数
-                $post_fee = Db::name('good_nake')
-                    ->where(['spuCode' => $rs->spuCode, 'is_del' => 0])
-                    ->where('min_num', '<=', $data['start_sale_num'])
-                    ->value('delivery_fee', 0);
 
                 $desc = explode(',', $rs->good_info_img);
                 $desc_string = [];
@@ -270,7 +275,7 @@ class Goodup
                     'yz_cat_id' => $data['yz_cat_id'],
                     'is_support_barter' => $data['is_support_barter'],
                     'sale_price' => $sale_price,
-                    'cost_fee' => $ladder_info['cost_fee'],
+                    'cost_fee' => $nake_info['cost_fee']??0,
                     'final_price' => $data['final_price'],
                     'start_sale_num' => $data['start_sale_num'],
                     'reject_reason' => '',