修正树逻辑,添加获得预获产品券占优惠款,助购券
This commit is contained in:
parent
118fa7d210
commit
6acde199d7
BIN
H5436787D.wgt
BIN
H5436787D.wgt
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$data['version'] = 16;
|
||||
$data['version'] = 90;
|
||||
$data['ios_must_update'] = 1; //是否强制更新,0不强制,1强制
|
||||
$data['must_update'] = 1; //是否强制更新,0不强制,1强制
|
||||
$data['apk_version'] = '2.3.9';
|
||||
$data['apk_version'] = '2.4.0';
|
||||
$data['apk_down_url'] = 'http://www.zgqlg.com.cn/H5436787D.wgt';
|
||||
//$data['ios_version'] = '1.0.0';
|
||||
$data['ios_appid'] = '1355322179';
|
||||
|
@ -48,15 +48,13 @@ class UserLevel extends Base
|
||||
$userId = get_my_id();
|
||||
$treeArr = [];
|
||||
$goodsType = 3;
|
||||
$min = Db::name('orders')->where(compact('userId','goodsType'))->min('helpUserLevel');
|
||||
if(0 == $min){$min = 1;}
|
||||
$max = Db::name('orders')->where(compact('userId','goodsType'))->max('helpUserLevel');
|
||||
$newLevel = 0;
|
||||
do {
|
||||
$newLevel++;
|
||||
$userId = UT::getUpperId($userId);// 找到我的层级
|
||||
if ($userId == null) $userId = 1;// 上级uid
|
||||
if (($newLevel >= $min) && UT::checkUserCanDisplay($userId)) {// 如果有,则使用上级信息
|
||||
if (UT::checkUserCanDisplay($userId)) {// 如果有,则使用上级信息
|
||||
if($newLevel>10){
|
||||
$treeArr[$newLevel]['level'] = "第".$newLevel."层";
|
||||
}else{
|
||||
|
@ -1466,6 +1466,9 @@ class Orders extends Base{
|
||||
}
|
||||
$m = Model('common/Table');
|
||||
$userInfo = getUserInfo(['userId'=>$userId],'userName,userType,buyHelpMoney,helpMaxSaleMoney');
|
||||
// 计算 SUM(商品*优惠率) 的值
|
||||
$calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner')
|
||||
->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01');
|
||||
if (2 == $order['goodsType']){//助微吧购物
|
||||
if (1 == $userInfo['userType']){//是商户购物
|
||||
//加助微吧购物金额
|
||||
@ -1501,9 +1504,6 @@ 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.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01');
|
||||
// foreach ($orderGoods as $orderGood) {
|
||||
// // 在不考虑数据库变更的情况下,这两个值都是存储的数字类型,所以不做特殊处理
|
||||
// $calBaseNum += (float)$orderGood['goodsPrice'] * (float)$orderGood['discountRate'] / 100;
|
||||
@ -1523,8 +1523,13 @@ class Orders extends Base{
|
||||
// step 5 平台送自己:10000×N“助购预获”,
|
||||
// 10000“预获产品券”;
|
||||
// 10000×0.4×0.5×0.5=1000“预获优惠券”。
|
||||
$vm->insertHelpSaleNotice($userId, $orderId, $order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
||||
'交易订单【'.$order['orderNo'].'】购户购物所得', 1);
|
||||
if ((int)$order["helpUserLevel"] === 1) {
|
||||
$vm->insertHelpSaleNotice($userId, $orderId, $order['goodsMoney']*((int)$order["helpUserLevel"]),
|
||||
'交易订单【'.$order['orderNo'].'】购户购物所得', 1);
|
||||
} else {
|
||||
$vm->insertHelpSaleNotice($userId, $orderId, $order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
||||
'交易订单【'.$order['orderNo'].'】购户购物所得', 1);
|
||||
}
|
||||
|
||||
// step 8 平台送自己的上第N层:扣减“助购预获”、“预获产品券”各10000×0.4×0.5=2000,
|
||||
// 同时添加10000×0.4×0.5=2000“已获产品券”。
|
||||
@ -1556,12 +1561,23 @@ class Orders extends Base{
|
||||
}
|
||||
|
||||
// 10.15添加:助购户的 助购预获 减少的同时 代快付值等额减少
|
||||
if ((int)$order["helpUserLevel"] === 1) {
|
||||
Db::name("orders")->where(compact('orderId'))->update([
|
||||
"helpGetCount"=>$order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
||||
"helpGetCount"=>$order['goodsMoney']*((int)$order["helpUserLevel"]),
|
||||
"helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
||||
]);
|
||||
]);}
|
||||
else {
|
||||
Db::name("orders")->where(compact('orderId'))->update([
|
||||
"helpGetCount"=>$order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
||||
"helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
||||
]);
|
||||
}
|
||||
}
|
||||
//新增订单日志
|
||||
$vm = new UserVouchers();
|
||||
$vm->insertVouchersNotice($userId, $orderId, $calBaseNum*((float)dataConf('couponPercentCanUsetGet')/100), 0,
|
||||
'交易订单【'.$order['orderNo'].'】购户从优惠款中获得',1);
|
||||
|
||||
//新增订单日志
|
||||
$logOrder = [];
|
||||
$logOrder['orderId'] = $orderId;
|
||||
$logOrder['orderStatus'] = 2;
|
||||
|
@ -149,7 +149,7 @@ class UserVouchers extends Base{
|
||||
}else{
|
||||
$count = (float)$_each["helpSaleNum"];
|
||||
model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100),
|
||||
0, "助购预获为负,每天耗损预获产品券", 0);
|
||||
0, "助购券为负,每天耗损预获产品券", 0);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user