替换掉之前人写的代码

This commit is contained in:
2019-10-31 00:19:33 +08:00
parent c87be61877
commit eb90d5f32a
2 changed files with 11 additions and 9 deletions

View File

@ -64,8 +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.discountRate*0.01');
if($sellerPreProductNum >= 0.01 || $sellerPreCoupousNum>=0.01){
if(3 != $order->goodsType){
// step 3 平台送商户10000×0.4=4000“预获产品券”
@ -80,27 +79,27 @@ class Settlements extends Base
// step 4 平台送商户的推荐人当消费超过限制值时10000×0.4×0.5×0.5=1000“预获产品券”。
// 当消费低于限制值时10000×0.4×0.5×0.2=400“预获产品券”。
$uUserId = UserTrees::getUpperId($shops["userId"]);
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.'"');
// 因为count一定会有数据所以不判断了
if($data[0]["total"]<=dataConf("refPreProductYdGTMoney")){
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductNoInSaleScale")/100),
0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1);
}else{
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductYesInSaleScale ")/100),
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductYesInSaleScale")/100),
0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1);
}
// step 6 平台送自己的推荐人当消费超过限制值时10000×0.4×0.5×0.5=1000“预获产品券”
// 当消费低于限制值时10000×0.4×0.5×0.2=400“预获产品券”。
$uUserId = UserTrees::getUpperId($order['userId']);
if($uUserId === null){$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.'"');
// 因为count一定会有数据所以不判断了
if($data[0]["total"]<=dataConf("refPreProductYdGTMoney")){
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductNoInSaleScale")/100),
0,'交易订单【'.$order['orderNo'].'】推荐购户所得',1);
}else{
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductYesInSaleScale ")/100),
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductYesInSaleScale")/100),
0,'交易订单【'.$order['orderNo'].'】推荐购户所得',1);
}
// step 7 平台送自己的被推荐人10000×0.4×0.5×0.5÷5=200“预获产品券”。