作者 王智

222

@@ -476,23 +476,51 @@ class Api @@ -476,23 +476,51 @@ class Api
476 ->field('p.id,p.avatar,p.name,c.class_con,l.logo') 476 ->field('p.id,p.avatar,p.name,c.class_con,l.logo')
477 ->select(); 477 ->select();
478 $tidu = Db::name('product')->where(['id' => $product_id])->find(); 478 $tidu = Db::name('product')->where(['id' => $product_id])->find();
479 - if ($buy_num < $tidu['tidu1'] & $buy_num > 0) {  
480 - $price = $buy_num * $tidu['price'];  
481 - }  
482 - if ($buy_num > $tidu['tidu1'] - 1 & $buy_num < $tidu['tidu2']) {  
483 - $price = $buy_num * $tidu['price1'];  
484 - }  
485 - if ($buy_num > $tidu['tidu2'] - 1 & $buy_num < $tidu['tidu3']) {  
486 - $price = $buy_num * $tidu['price2'];  
487 - }  
488 - if ($buy_num > $tidu['tidu3'] - 1 & $buy_num < $tidu['tidu4']) {  
489 - $price = $buy_num * $tidu['price3'];  
490 - }  
491 - if ($buy_num > $tidu['tidu4'] - 1 & $buy_num < $tidu['tidu5']) {  
492 - $price = $buy_num * $tidu['price4'];  
493 - }  
494 - if ($buy_num > $tidu['tidu5'] - 1) {  
495 - $price = $buy_num * $tidu['price5']; 479 +// if ($buy_num < $tidu['tidu1'] & $buy_num > 0) {
  480 +// $price = $buy_num * $tidu['price'];
  481 +// }
  482 +// if ($buy_num > $tidu['tidu1'] - 1 & $buy_num < $tidu['tidu2']) {
  483 +// $price = $buy_num * $tidu['price1'];
  484 +// }
  485 +// if ($buy_num > $tidu['tidu2'] - 1 & $buy_num < $tidu['tidu3']) {
  486 +// $price = $buy_num * $tidu['price2'];
  487 +// }
  488 +// if ($buy_num > $tidu['tidu3'] - 1 & $buy_num < $tidu['tidu4']) {
  489 +// $price = $buy_num * $tidu['price3'];
  490 +// }
  491 +// if ($buy_num > $tidu['tidu4'] - 1 & $buy_num < $tidu['tidu5']) {
  492 +// $price = $buy_num * $tidu['price4'];
  493 +// }
  494 +// if ($buy_num > $tidu['tidu5'] - 1) {
  495 +// $price = $buy_num * $tidu['price5'];
  496 +// }
  497 + if ($tidu['tidu1'] != "") {
  498 + if ($buy_num < $tidu['tidu1'] & $buy_num > 0) {
  499 + $price = $buy_num * $tidu['price'];
  500 + }
  501 + if ($tidu['tidu2'] != "") {
  502 + if ($buy_num > $tidu['tidu1'] - 1 & $buy_num < $tidu['tidu2']) {
  503 + $price = $buy_num * $tidu['price1'];
  504 + }
  505 + if ($tidu['tidu3'] != "") {
  506 + if ($buy_num > $tidu['tidu2'] - 1 & $buy_num < $tidu['tidu3']) {
  507 + $price = $buy_num * $tidu['price2'];
  508 + }
  509 + if ($tidu['tidu4'] != "") {
  510 + if ($buy_num > $tidu['tidu3'] - 1 & $buy_num < $tidu['tidu4']) {
  511 + $price = $buy_num * $tidu['price3'];
  512 + }
  513 + if ($tidu['tidu5'] != "") {
  514 + if ($buy_num > $tidu['tidu4'] - 1 & $buy_num < $tidu['tidu5']) {
  515 + $price = $buy_num * $tidu['price4'];
  516 + }
  517 + if ($buy_num > $tidu['tidu5'] - 1) {
  518 + $price = $buy_num * $tidu['price5'];
  519 + }
  520 + }
  521 + }
  522 + }
  523 + }
496 } 524 }
497 $tidu_new = Db::name('product')->where(['id' => $product_id])->select(); 525 $tidu_new = Db::name('product')->where(['id' => $product_id])->select();
498 foreach ($tidu_new as $k => $v) { 526 foreach ($tidu_new as $k => $v) {