作者 jinglong
1 个管道 的构建 通过 耗费 1 秒

修改结算优惠券

@@ -534,13 +534,13 @@ class Cars extends Api @@ -534,13 +534,13 @@ class Cars extends Api
534 $r_value['use_goods_id'] = $goods_id_s; 534 $r_value['use_goods_id'] = $goods_id_s;
535 }else if($r_value['type_tag'] == $type[1]){ 535 }else if($r_value['type_tag'] == $type[1]){
536 //品牌 536 //品牌
537 - $r_value['use_goods_id'] = []; 537 + $arr = [];
538 foreach($res1 as $value1){ 538 foreach($res1 as $value1){
539 if($r_value['bg_id'] == $value1['t_id']){ 539 if($r_value['bg_id'] == $value1['t_id']){
540 - $r_value['use_goods_id'] = [$value1['id']]; 540 + array_push($arr,$value1['id']);
541 } 541 }
542 } 542 }
543 - $r_value['use_goods_str'] = implode(',',$r_value['use_goods_id']); 543 + $r_value['use_goods_id'] = $arr;
544 }else{ 544 }else{
545 //商品 545 //商品
546 $r_value['use_goods_id'] = []; 546 $r_value['use_goods_id'] = [];
@@ -553,6 +553,7 @@ class Cars extends Api @@ -553,6 +553,7 @@ class Cars extends Api
553 } 553 }
554 } 554 }
555 $res2 = []; 555 $res2 = [];
  556 + //满减金额的优惠券
556 foreach($res as $res_value){ 557 foreach($res as $res_value){
557 $res2_flag = 0; 558 $res2_flag = 0;
558 if($res_value['c_type'] == 1){ 559 if($res_value['c_type'] == 1){
@@ -562,8 +563,22 @@ class Cars extends Api @@ -562,8 +563,22 @@ class Cars extends Api
562 if(($total_goods_price <=> $res_value['full_reduce']) == -1){ 563 if(($total_goods_price <=> $res_value['full_reduce']) == -1){
563 $res2_flag = 1; 564 $res2_flag = 1;
564 } 565 }
  566 + }else if($res_value['type_tag'] == $type[1]){
  567 + //品牌
  568 + $price = 0;
  569 + foreach($res_goods as $goods_value){
  570 + foreach($res_value['use_goods_id'] as $u_value){
  571 + //品牌下的商品id
  572 + if($u_value == $goods_value['goods_id']){
  573 + $price += $goods_value['price'];
  574 + }
  575 + }
  576 + }
  577 + if(($price <=> $res_value['full_reduce']) == -1){
  578 + $res2_flag = 1;
  579 + }
565 }else{ 580 }else{
566 - //品牌,商品 581 + //商品
567 $price = 0; 582 $price = 0;
568 foreach($res_goods as $goods_value){ 583 foreach($res_goods as $goods_value){
569 if($res_value['use_goods_str'] == $goods_value['goods_id']){ 584 if($res_value['use_goods_str'] == $goods_value['goods_id']){