diff --git a/app/api/controller/Gtpay.php b/app/api/controller/Gtpay.php index 9bd880af..1f208741 100644 --- a/app/api/controller/Gtpay.php +++ b/app/api/controller/Gtpay.php @@ -303,7 +303,7 @@ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlu5coHWBbtrz8DyX0VbPWiJZlAsofwZ99pZq $order['order_sn'] = $gtpay_msg['orderNo']; $order['type'] = 4; $type = "local_pay"; - $billions_result = $billions->billions($order,$user['id'],$type); + $billions_result = $billions->billions($order,$user['id'],$type,$post['lid']); return JsonServer::success('分账成功'); } } diff --git a/app/shop/logic/goods/GoodsLogic.php b/app/shop/logic/goods/GoodsLogic.php index eeaaaa1d..1e5edae9 100755 --- a/app/shop/logic/goods/GoodsLogic.php +++ b/app/shop/logic/goods/GoodsLogic.php @@ -324,11 +324,11 @@ class GoodsLogic extends Logic } $info['item'][$key]['item_goods_purchase'] = $goodspurchase; } - + $info['gw'] = $arr; $info['pur'] = $arr1; $info['ast'] = $ast; - $info['contact'] = Goodscontact::where(['goods_id' => $goods_id])->select(); + $info['contact'] = Goodscontact::where(['goods_id' => $goods_id])->select(); // 商品规格项 $info['spec'] = GoodsSpec::where(['goods_id' => $goods_id])->select(); // 商品规格值 @@ -361,7 +361,7 @@ class GoodsLogic extends Logic $wholesale_price = $post['one_wholesale_pce']; $purchase_price = $post['one_purchase_price']; $issuing_price = $post['one_issuing_price']; - + } else { $max_price = max($post['price']); $min_price = min($post['price']); @@ -373,7 +373,7 @@ class GoodsLogic extends Logic $issuing_price = $post['issuing_price'][0]; } if($purchase_price == ""){ - $purchase_price = 0; + $purchase_price = 0; } // 库存校验 if($post['status'] == GoodsEnum::STATUS_SHELVES && $total_stock == 0) { @@ -383,37 +383,37 @@ class GoodsLogic extends Logic // $old_spec_type = Goods::where('id', $post['goods_id'])->value('spec_type'); $goods_msg = Goods::where('id', $post['goods_id'])->find(); $old_spec_type = $goods_msg['spec_type']; - if($goods_msg['wholesale_percent'] > 0){ + if(isset($goods_msg['wholesale_percent'])&&$goods_msg['wholesale_percent'] > 0&&$wholesale_price!=""){ $wholesale_price = round((100+$goods_msg['wholesale_percent'])*$wholesale_price/100,2); } if($goods_msg['purchase_percent'] > 0){ if($purchase_price>0&&$purchase_price!=""){ - $purchase_price = round((100+$goods_msg['purchase_percent'])*$purchase_price/100,2); + $purchase_price = round((100+$goods_msg['purchase_percent'])*$purchase_price/100,2); } } - if($goods_msg['issuing_percent'] > 0){ + if($goods_msg['issuing_percent'] > 0&&$issuing_price>0&&$issuing_price!=""){ $issuing_price = round((100+$goods_msg['issuing_percent'])*$issuing_price/100,2); } // 格式化数据 $post = self::formatGoodsData($post); - if(isset($post['first_cate_id'])){ - sort($post['first_cate_id']); - $post['first_cate_id'] = implode(',', $post['first_cate_id']); - }else{ - $post['first_cate_id'] = 0; - } - if(isset($post['second_cate_id'])){ - sort($post['second_cate_id']); - $post['second_cate_id'] = implode(',', $post['second_cate_id']); - }else{ - $post['second_cate_id'] = 0; - } - if(isset($post['third_cate_id'])){ - sort($post['third_cate_id']); - $post['third_cate_id'] = implode(',', $post['third_cate_id']); - }else{ - $post['third_cate_id'] = 0; - } + if(isset($post['first_cate_id'])){ + sort($post['first_cate_id']); + $post['first_cate_id'] = implode(',', $post['first_cate_id']); + }else{ + $post['first_cate_id'] = 0; + } + if(isset($post['second_cate_id'])){ + sort($post['second_cate_id']); + $post['second_cate_id'] = implode(',', $post['second_cate_id']); + }else{ + $post['second_cate_id'] = 0; + } + if(isset($post['third_cate_id'])){ + sort($post['third_cate_id']); + $post['third_cate_id'] = implode(',', $post['third_cate_id']); + }else{ + $post['third_cate_id'] = 0; + } //更新主表 $data = [ 'name' => $post['name'], @@ -453,7 +453,7 @@ class GoodsLogic extends Logic 'purchase_price' =>$purchase_price, 'issuing_price' =>$issuing_price, 'goods_remark' =>$post['goods_remark'], - 'work_remark' =>$post['work_remark'], + 'work_remark' =>$post['work_remark'], 'doudian_data' =>'', 'subsidy_id' =>$post['subsidy_id'], ]; @@ -740,19 +740,19 @@ class GoodsLogic extends Logic $wholesale_pce = $v['wholesale_pce']; $purchase_price = $v['purchase_price']; $issuing_price = $v['issuing_price']; - if($goods_msg['wholesale_percent'] > 0){ + if($goods_msg['wholesale_percent'] > 0&&$wholesale_pce>0&&$wholesale_pce!=""){ $wholesale_pce = round((100+$goods_msg['wholesale_percent'])*$wholesale_pce/100,2); } - if($goods_msg['purchase_percent'] > 0){ + if($goods_msg['purchase_percent'] > 0&&$purchase_price>0&&$purchase_price!=""){ $purchase_price = round((100+$goods_msg['purchase_percent'])*$purchase_price/100,2); } - if($goods_msg['issuing_percent'] > 0){ + if($goods_msg['issuing_percent'] > 0&&$issuing_price>0&&$issuing_price!=""){ $issuing_price = round((100+$goods_msg['issuing_percent'])*$issuing_price/100,2); } $spec_lists[$k]['wh_price'] = $v['wholesale_pce']; $spec_lists[$k]['pu_price'] = $v['purchase_price']; $spec_lists[$k]['is_price'] = $v['issuing_price']; - unset($spec_lists[$k]['c_name']); + unset($spec_lists[$k]['c_name']); unset($spec_lists[$k]['c_phone']); $spec_lists[$k]['wholesale_pce'] = $wholesale_pce; $spec_lists[$k]['purchase_price'] = $purchase_price; @@ -931,26 +931,26 @@ class GoodsLogic extends Logic // 处理商品数据 $post = self::formatGoodsData($post); - if(isset($post['first_cate_id'])){ - sort($post['first_cate_id']); - $post['first_cate_id'] = implode(',', $post['first_cate_id']); + if(isset($post['first_cate_id'])){ + sort($post['first_cate_id']); + $post['first_cate_id'] = implode(',', $post['first_cate_id']); }else{ $post['first_cate_id'] = 0; } - if(isset($post['second_cate_id'])){ - sort($post['second_cate_id']); - $post['second_cate_id'] = implode(',', $post['second_cate_id']); + if(isset($post['second_cate_id'])){ + sort($post['second_cate_id']); + $post['second_cate_id'] = implode(',', $post['second_cate_id']); }else{ $post['second_cate_id'] = 0; } if(isset($post['third_cate_id'])){ - sort($post['third_cate_id']); - $post['third_cate_id'] = implode(',', $post['third_cate_id']); + sort($post['third_cate_id']); + $post['third_cate_id'] = implode(',', $post['third_cate_id']); }else{ $post['third_cate_id'] = 0; } - - + + //写入主表 $data = [ 'type' => $post['type'], @@ -999,7 +999,7 @@ class GoodsLogic extends Logic 'subsidy_id' =>$post['subsidy_id'], ]; $goods = Goods::create($data); - foreach($post['c_name'] as $key=>$value){ + foreach($post['c_name'] as $key=>$value){ $d = [ 'c_name'=>$value, 'c_phone'=>$post['c_phone'][$key], @@ -1228,7 +1228,7 @@ class GoodsLogic extends Logic } -/** + /** * @notes 格式化商品数据 * @param array $data * @return array