diff --git a/hyhproject/common/model/Orders.php b/hyhproject/common/model/Orders.php index 4621ddd..498b214 100755 --- a/hyhproject/common/model/Orders.php +++ b/hyhproject/common/model/Orders.php @@ -1498,8 +1498,7 @@ class Orders extends Base{ elseif (3 == $order['goodsType']){//助购吧购物 // 计算 SUM(商品*优惠率) 的值 $calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner') - ->where(['o.userId'=>$userId,'o.orderId'=>$orderId]) - ->sum('g.goodsPrice*g.discountRate*0.01'); + ->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01'); // foreach ($orderGoods as $orderGood) { // // 在不考虑数据库变更的情况下,这两个值都是存储的数字类型,所以不做特殊处理 // $calBaseNum += (float)$orderGood['goodsPrice'] * (float)$orderGood['discountRate'] / 100; diff --git a/hyhproject/common/model/Settlements.php b/hyhproject/common/model/Settlements.php index c0ee7d9..75938c6 100755 --- a/hyhproject/common/model/Settlements.php +++ b/hyhproject/common/model/Settlements.php @@ -64,7 +64,7 @@ class Settlements extends Base $sellerPreProductNum = round($discountMoney * (dataConf('sellerPreProductInProductScale')*0.01),2);//1 $sellerPreCoupousNum = round($discountMoney * (dataConf('sellerPreCoupousInSaleScale')*0.01),2);//2 $calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner') - ->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.discountRate*0.01'); + ->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01'); if($sellerPreProductNum >= 0.01 || $sellerPreCoupousNum>=0.01){ if(3 != $order->goodsType){ // step 3 平台送商户:10000×0.4=4000“预获产品券” @@ -82,7 +82,7 @@ class Settlements extends Base if($uUserId == null || $uUserId == 0){$uUserId = 1;} $data = Db::query('SELECT count(`goodsMoney`) as `total` FROM `hyh_orders` WHERE DATE_FORMAT(`createTime`,"%Y%m%d")=DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day),"%Y%m%d") and `userId`="'.$uUserId.'"'); // 因为count一定会有数据所以不判断了 - if($data[0]["total"]<=dataConf("refPreProductYdGTMoney")){ + if((float)$data[0]["total"]<=(float)dataConf("refPreProductYdGTMoney")){ Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductNoInSaleScale")/100), 0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1); }else{