wugg %!s(int64=2) %!d(string=hai) anos
pai
achega
031ab8e7e2

+ 12 - 0
app/abutment/controller/Record.php

@@ -0,0 +1,12 @@
+<?php
+
+
+namespace app\abutment\controller;
+
+
+class Record extends HomeBaseController{
+
+	public function Create(){
+
+	}
+}

+ 3 - 3
app/admin/model/GoodStockInfo.php

@@ -57,7 +57,7 @@ class GoodStockInfo extends Model
 	*/
 	static function SaleBn($stockid,int $num,int $isstock=1){
 		$arr = self::where([["balance_num",">",0]])->where(["stockid"=>$stockid])->select()->toArray();
-		if(empty($arr)) throw new Exception("库存批次数量不足","1006");
+		if(empty($arr)) throw new Exception("库存批次数量不足",1006);
 		$list=[];
 		foreach ($arr as $item) {
 			$stock = self::name("good_stock")->where(["id"=>$item['stockid']])->field("id,usable_stock,wait_out_stock")->find()->toArray();
@@ -79,10 +79,10 @@ class GoodStockInfo extends Model
 				$num=0;
 		    }
 			$up=self::update($update,$item);
-		    if($up==false)  throw new Exception("库存批次库存更新失败","1006");
+		    if($up==false)  throw new Exception("库存批次库存更新失败",1006);
 		    if($isstock==1) {
 		    	$stup=self::name("good_stock")->where($stock)->update($stockup);
-		    	if($stup==false)  throw new Exception("库存更新失败","1006");
+		    	if($stup==false)  throw new Exception("库存更新失败",1006);
 
 		    }
 		    $list[]=$temp;

+ 6 - 5
app/command/handleYzOrderData.php

@@ -188,10 +188,11 @@ class handleYzOrderData extends Command
 //                    ->find();
 
                 $sale_price = $c_data['discount_price'];
-                if (false) {
-                    //如果是泰行销的单子,要取原始价格(即优惠前的价格)
-                    $sale_price = $c_data['discount_price'];
-                }
+	            if (isset($c_data['coupon']) && is_discount($c_data['coupon'])) {
+		            //如果是泰行销的单子,要取原始价格(即优惠前的价格)
+		            $sale_price = $c_data['price'];
+	            }
+
 
                 $act = check_activity((string)$spuCode, (string)$skuCode, (int)$platform_id, (int)$is_stock, (float)$sale_price, (int)$good_num);
                 $is_activity = 0;
@@ -202,7 +203,7 @@ class handleYzOrderData extends Command
 //                    if ($act['activity_stock'] < $good_num) throw new Exception('商品活动库存剩余' . $act['activity_stock']);
                 }else{
 
-	                if ($c_data['discount_price'] < $ct['sale_price'] && $c_data['is_approved'] == '0') {
+	                if ($sale_price < $ct['sale_price'] && $c_data['is_approved'] == '0') {
 		                Db::rollback();
 		                $this->callbackYz(['status' => 2, 'id' => $c_data['id'], 'reason' => '价格低于系统售价' . $ct['sale_price']]);
 		                Cache::store('redis')->set("YzTimeLimit",0);

+ 17 - 0
app/common.php

@@ -1460,4 +1460,21 @@ if (!function_exists('check_activity')) {
             return array_merge($act,$merge);
         }
     }
+}
+
+//是否使用券后金额 txx活动 用户领券兑换商品 商品转单时注意价格置换为售价
+if(!function_exists('is_discount')){
+	/**
+	* @param array $order_promotion
+	 * @return bool
+	 */
+	function is_discount($coupon=[]){
+		$bol=false;
+		if(!empty($coupon)){
+			$title=implode("|",array_unique(array_column($coupon,"promotion_title")));
+			 $str = stristr($title,"泰直播");
+			 if($str!=false) $bol=true;
+		}
+		return $bol;
+	}
 }