Explorar el Código

api同步productid

lvhao hace 2 semanas
padre
commit
45a08644cd
Se han modificado 1 ficheros con 7 adiciones y 3 borrados
  1. 7 3
      core/CoreApp/models/Model_api.php

+ 7 - 3
core/CoreApp/models/Model_api.php

@@ -1050,8 +1050,9 @@ function __construct(){
 		$row_total_tmp = isset($v['row_total'])?$v['row_total']:"0";
 		$tax_amount_tmp = isset($v['tax_amount'])?$v['tax_amount']:"0";
 		$discount_amount_tmp = isset($v['discount_amount'])?$v['discount_amount']:"0";
+		$product_ids_tmp = isset($v['product_ids'])?$v['product_ids']:"";
 		
-		$extra_price = $this->tranExtraPrice($post['issku'],$post['quantity'],$price_tmp,$row_total_tmp,$tax_amount_tmp,$discount_amount_tmp);
+		$extra_price = $this->tranExtraPrice($post['issku'],$post['quantity'],$price_tmp,$row_total_tmp,$tax_amount_tmp,$discount_amount_tmp,$product_ids_tmp);
 		$post['extra_price'] = json_encode($extra_price,JSON_UNESCAPED_UNICODE);
 		$post['shipremarks'] = $matching['title'];
 		$post['cost'] = $matching['cost'];
@@ -1062,13 +1063,14 @@ function __construct(){
 		return $post;
 	}
 
-	public function tranExtraPrice($issku,$org_qty,$org_price,$org_row_total,$org_tax_amount,$org_discount_amount){
+	public function tranExtraPrice($issku,$org_qty,$org_price,$org_row_total,$org_tax_amount,$org_discount_amount,$product_ids_tmp){
 		$sku = explode(',',$issku);
 		$tmp_qty = explode(';',$org_qty);
 		$tmp_price = explode(",",$org_price);
 		$tmp_row_total = explode(",",$org_row_total);
 		$tmp_tax_amount = explode(",",$org_tax_amount);
 		$tmp_discount_amount = explode(",",$org_discount_amount);
+		$product_ids = explode(",",$product_ids_tmp);
 		$extra_price = [];
 		foreach ($sku as $k=>$value) 
 		{
@@ -1077,13 +1079,15 @@ function __construct(){
 			$row_total = isset($tmp_row_total[$k])?$tmp_row_total[$k]:0;
 			$tax_amount = isset($tmp_tax_amount[$k])?$tmp_tax_amount[$k]:0;
 			$discount_amount = isset($tmp_discount_amount[$k])?$tmp_discount_amount[$k]:0;
+			$product_id = empty($product_ids[$k])?"":$product_ids[$k];
 			$extra_price[$k] = [
 				'qty'=>$qty,
 				'price'=>sprintf("%.2f",$price),
 				'row_total'=> sprintf("%.2f",($row_total*1 - $discount_amount*1 + $tax_amount*1)) ,
 				'sub_total'=>$price*$qty,
 				'tax_amount'=>$tax_amount,
-				'discount_amount'=>$discount_amount
+				'discount_amount'=>$discount_amount,
+				'product_id'=>$product_id,
 
 			];
 		}