日了狗忘记乘以数量

This commit is contained in:
Jerry Yan 2019-11-01 19:43:37 +08:00
parent eb90d5f32a
commit 18ffc37a4d
2 changed files with 3 additions and 4 deletions

View File

@ -1498,8 +1498,7 @@ class Orders extends Base{
elseif (3 == $order['goodsType']){//助购吧购物 elseif (3 == $order['goodsType']){//助购吧购物
// 计算 SUM(商品*优惠率) 的值 // 计算 SUM(商品*优惠率) 的值
$calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner') $calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner')
->where(['o.userId'=>$userId,'o.orderId'=>$orderId]) ->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01');
->sum('g.goodsPrice*g.discountRate*0.01');
// foreach ($orderGoods as $orderGood) { // foreach ($orderGoods as $orderGood) {
// // 在不考虑数据库变更的情况下,这两个值都是存储的数字类型,所以不做特殊处理 // // 在不考虑数据库变更的情况下,这两个值都是存储的数字类型,所以不做特殊处理
// $calBaseNum += (float)$orderGood['goodsPrice'] * (float)$orderGood['discountRate'] / 100; // $calBaseNum += (float)$orderGood['goodsPrice'] * (float)$orderGood['discountRate'] / 100;

View File

@ -64,7 +64,7 @@ class Settlements extends Base
$sellerPreProductNum = round($discountMoney * (dataConf('sellerPreProductInProductScale')*0.01),2);//1 $sellerPreProductNum = round($discountMoney * (dataConf('sellerPreProductInProductScale')*0.01),2);//1
$sellerPreCoupousNum = round($discountMoney * (dataConf('sellerPreCoupousInSaleScale')*0.01),2);//2 $sellerPreCoupousNum = round($discountMoney * (dataConf('sellerPreCoupousInSaleScale')*0.01),2);//2
$calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner') $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($sellerPreProductNum >= 0.01 || $sellerPreCoupousNum>=0.01){
if(3 != $order->goodsType){ if(3 != $order->goodsType){
// step 3 平台送商户10000×0.4=4000“预获产品券” // step 3 平台送商户10000×0.4=4000“预获产品券”
@ -82,7 +82,7 @@ class Settlements extends Base
if($uUserId == null || $uUserId == 0){$uUserId = 1;} 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.'"'); $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一定会有数据所以不判断了 // 因为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), Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductNoInSaleScale")/100),
0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1); 0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1);
}else{ }else{