后台添加我的返补和我的推广菜单
This commit is contained in:
parent
6b6824e557
commit
7d96e1f534
@ -37,8 +37,8 @@ class MenuDecorateLogic extends Logic {
|
||||
$where[] = ['decorate_type','=',$get['type']];
|
||||
|
||||
$lists = Db::name('menu_decorate')
|
||||
->where($where)
|
||||
->paginate(['list_rows'=>$get['limit'],'page'=>$get['page']]);
|
||||
->where($where)
|
||||
->paginate(['list_rows'=>$get['limit'],'page'=>$get['page']]);
|
||||
|
||||
$list = $lists->items();
|
||||
$count = $lists->total();
|
||||
@ -126,8 +126,8 @@ class MenuDecorateLogic extends Logic {
|
||||
*/
|
||||
public static function getMenuDecorate($id){
|
||||
$info = Db::name('menu_decorate')
|
||||
->where(['del'=>0,'id'=>$id])
|
||||
->find();
|
||||
->where(['del'=>0,'id'=>$id])
|
||||
->find();
|
||||
$info['image'] = empty($info['image']) ? '' : UrlServer::getFileUrl($info['image']);
|
||||
|
||||
return $info;
|
||||
@ -154,6 +154,12 @@ class MenuDecorateLogic extends Logic {
|
||||
|
||||
}else{
|
||||
ConfigServer::set('decoration_center','background_image',UrlServer::setFileUrl($post['background_image'] ?? ''));
|
||||
ConfigServer::set('decoration_center','my_refund_image',UrlServer::setFileUrl($post['my_refund_image'] ?? ''));
|
||||
ConfigServer::set('decoration_center','my_refund_name',$post['my_refund_name']);
|
||||
ConfigServer::set('decoration_center','show_my_refund',$post['show_my_refund']);
|
||||
ConfigServer::set('decoration_center','my_promotion_image',UrlServer::setFileUrl($post['my_promotion_image'] ?? ''));
|
||||
ConfigServer::set('decoration_center','my_promotion_name',$post['my_promotion_name']);
|
||||
ConfigServer::set('decoration_center','show_my_promotion',$post['show_my_promotion']);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -178,9 +184,24 @@ class MenuDecorateLogic extends Logic {
|
||||
];
|
||||
$data['background_image'] && $data['background_image'] = UrlServer::getFileUrl($data['background_image']);
|
||||
}else{
|
||||
$background_image = ConfigServer::get('decoration_center','background_image','');
|
||||
$background_image && $background_image = UrlServer::getFileUrl($background_image);
|
||||
$data['background_image'] = $background_image;
|
||||
$background_image = ConfigServer::get('decoration_center','background_image','');
|
||||
$background_image && $background_image = UrlServer::getFileUrl($background_image);
|
||||
|
||||
//我的返补
|
||||
$my_refund_image = ConfigServer::get('decoration_center','my_refund_image','');
|
||||
$my_refund_image && $my_refund_image = UrlServer::getFileUrl($my_refund_image);
|
||||
$data['my_refund_name'] = ConfigServer::get('decoration_center','my_refund_name','');
|
||||
$data['show_my_refund'] = ConfigServer::get('decoration_center','show_my_refund','');
|
||||
|
||||
//分销推广
|
||||
$my_promotion_image = ConfigServer::get('decoration_center','my_promotion_image','');
|
||||
$my_promotion_image && $my_promotion_image = UrlServer::getFileUrl($my_promotion_image);
|
||||
$data['my_promotion_name'] = ConfigServer::get('decoration_center','my_promotion_name','');
|
||||
$data['show_my_promotion'] = ConfigServer::get('decoration_center','show_my_promotion','');
|
||||
|
||||
$data['background_image'] = $background_image;
|
||||
$data['my_refund_image'] = $my_refund_image;
|
||||
$data['my_promotion_image'] = $my_promotion_image;
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -295,7 +316,7 @@ class MenuDecorateLogic extends Logic {
|
||||
$hideCount = Db::name('dev_navigation')
|
||||
->where(['del' => 0, 'status' => 1])
|
||||
->count();
|
||||
|
||||
|
||||
if ($hideCount <= 2) {
|
||||
return '最少保留两个导航菜单';
|
||||
}
|
||||
|
||||
@ -234,9 +234,10 @@ class WithdrawLogic extends Logic
|
||||
$model = new WithdrawApply();
|
||||
$successWithdraw = $model->where(['status' => WithdrawEnum::STATUS_SUCCESS])->sum('money');
|
||||
$handleWithdraw = $model->where(['status' => WithdrawEnum::STATUS_ING])->sum('money');
|
||||
$countWaitWithdraw = $model->where(['status' => WithdrawEnum::STATUS_WAIT])->count();
|
||||
$totalEarnings = (new User())->where(['del' => 0])->sum('earnings');
|
||||
|
||||
return ['successWithdraw' => $successWithdraw, 'handleWithdraw' => $handleWithdraw, 'totalEarnings' => $totalEarnings];
|
||||
return ['successWithdraw' => $successWithdraw, 'handleWithdraw' => $handleWithdraw, 'totalEarnings' => $totalEarnings, 'countWaitWithdraw' => $countWaitWithdraw];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -122,40 +122,81 @@
|
||||
</div>
|
||||
</div>
|
||||
{else /}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">页面顶部背景图:</label>
|
||||
<div class="layui-input-block">
|
||||
{if $other_set.background_image}
|
||||
<div class="upload-image-div">
|
||||
<img src="{$other_set.background_image}" alt="img">
|
||||
<input type="hidden" name="background_image" value="{$other_set.background_image}">
|
||||
<div class="del-upload-btn">x</div>
|
||||
</div>
|
||||
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image"> + 添加图片</a></div>
|
||||
{else}
|
||||
<div class="upload-image-elem"><a class="add-upload-image"> + 添加图片</a></div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">页面顶部背景图:</label>
|
||||
<div class="layui-input-block">
|
||||
{if $other_set.background_image}
|
||||
<div class="upload-image-div">
|
||||
<img src="{$other_set.background_image}" alt="img">
|
||||
<input type="hidden" name="background_image" value="{$other_set.background_image}">
|
||||
<div class="del-upload-btn">x</div>
|
||||
</div>
|
||||
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image add-background-image"> + 添加图片</a></div>
|
||||
{else}
|
||||
<div class="upload-image-elem"><a class="add-upload-image add-background-image"> + 添加图片</a></div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="layui-form-item"><label class="layui-form-label"></label>
|
||||
<span style="color: #a3a3a3;font-size: 9px">页面顶部背景图,建议尺寸:宽400px*高400px。jpg,jpeg,png格式</span>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn {$view_theme_color}" lay-submit lay-filter="submit">确定</button>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{$other_set.my_refund_name}:</label>
|
||||
<div class="layui-input-block">
|
||||
{if $other_set.my_refund_image}
|
||||
<div class="upload-image-div">
|
||||
<img src="{$other_set.my_refund_image}" alt="img">
|
||||
<input type="hidden" name="my_refund_image" value="{$other_set.my_refund_image}">
|
||||
<div class="del-upload-btn">x</div>
|
||||
</div>
|
||||
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image add-refund-image"> +
|
||||
添加图片</a></div>
|
||||
{else}
|
||||
<div class="upload-image-elem"><a class="add-upload-image add-refund-image"> + 添加图片</a></div>
|
||||
{/if}
|
||||
<div>
|
||||
<input type="text" name="my_refund_name" value="{$other_set.my_refund_name}" lay-verify="required" lay-verType="tips" placeholder="菜单名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="show_my_refund" {if($other_set.show_my_refund == 1)} checked {/if} value="1" title="开启">
|
||||
<input type="radio" name="show_my_refund" {if($other_set.show_my_refund == 0)} checked {/if} value="0" title="关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{$other_set.my_promotion_name}:</label>
|
||||
<div class="layui-input-block">
|
||||
{if $other_set.my_promotion_image}
|
||||
<div class="upload-image-div">
|
||||
<img src="{$other_set.my_promotion_image}" alt="img">
|
||||
<input type="hidden" name="my_promotion_image" value="{$other_set.my_promotion_image}">
|
||||
<div class="del-upload-btn">x</div>
|
||||
</div>
|
||||
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image add-promotion-image"> +
|
||||
添加图片</a></div>
|
||||
{else}
|
||||
<div class="upload-image-elem"><a class="add-upload-image add-promotion-image"> + 添加图片</a></div>
|
||||
{/if}
|
||||
<div>
|
||||
<input type="text" name="my_promotion_name" value="{$other_set.my_promotion_name}" lay-verify="required" lay-verType="tips" placeholder="菜单名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="show_my_promotion" {if($other_set.show_my_promotion == 1)} checked {/if} value="1" title="开启">
|
||||
<input type="radio" name="show_my_promotion" {if($other_set.show_my_promotion == 0)} checked {/if} value="0" title="关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn {$view_theme_color}" lay-submit lay-filter="submit">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(["table", "element", "laydate"], function(){
|
||||
@ -315,13 +356,32 @@
|
||||
});
|
||||
|
||||
like.delUpload();
|
||||
$(document).on("click", ".add-upload-image", function () {
|
||||
$(document).on("click", ".add-background-image", function () {
|
||||
like.imageUpload({
|
||||
limit: 1,
|
||||
field: "background_image",
|
||||
that: $(this)
|
||||
});
|
||||
})
|
||||
|
||||
// 我的返补图片上传
|
||||
$(document).on("click", ".add-refund-image", function () {
|
||||
like.imageUpload({
|
||||
limit: 1,
|
||||
field: "my_refund_image",
|
||||
that: $(this)
|
||||
});
|
||||
})
|
||||
|
||||
// 分销推广图片上传
|
||||
$(document).on("click", ".add-promotion-image", function () {
|
||||
like.imageUpload({
|
||||
limit: 1,
|
||||
field: "my_promotion_image",
|
||||
that: $(this)
|
||||
});
|
||||
})
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submit)', function (data) {
|
||||
var data = data.field;
|
||||
|
||||
@ -29,12 +29,35 @@
|
||||
white-space:normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.notice-container {
|
||||
margin: 0 auto;
|
||||
width: 300px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
color: red;
|
||||
overflow: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.scroll {
|
||||
width: auto;
|
||||
}
|
||||
::-webkit-scrollbar{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-collapse like-layui-collapse" lay-accordion="" style="bcommission:1px dashed #c4c4c4">
|
||||
{if ($summary.countWaitWithdraw > 0) }
|
||||
<marquee behavior="" direction="">
|
||||
通知: 您有{$summary.countWaitWithdraw}条佣金提现消息待审核
|
||||
</marquee>
|
||||
{/if}
|
||||
|
||||
<div class="layui-collapse like-layui-collapse" lay-accordion="" style="bcommission:1px dashed #c4c4c4">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
|
||||
<div class="layui-colla-content layui-show">
|
||||
@ -43,6 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 提现汇总-->
|
||||
<div class="layui-form-item div-flex">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
@ -460,4 +484,23 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var scroll = document.getElementsByClassName('notice-container')[0];
|
||||
var scrollWidth = scroll.scrollWidth;
|
||||
console.log(scrollWidth)
|
||||
var scrollLeft = scroll.scrollLeft;
|
||||
console.log(scrollLeft)
|
||||
|
||||
function animate () {
|
||||
if ( scroll.scrollLeft>=scrollWidth) {
|
||||
scroll.scrollLeft = 0;
|
||||
} else {
|
||||
scroll.scrollLeft += 1;
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
if(scroll.offsetWidth<scrollWidth){
|
||||
document.getElementsByClassName('scroll')[0].style.transform='translateX(100%)'
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -44,15 +44,13 @@ class BillionsLogic extends Logic
|
||||
$where[] = ['b.state', '=', 0];
|
||||
}
|
||||
|
||||
// $list = Billions::alias('b')->where($where)
|
||||
// ->leftjoin('order o', 'o.id = b.order_id')
|
||||
// ->leftjoin('goods g', 'g.id = b.goods_id')
|
||||
// ->leftjoin('shop s', 's.id = b.shop_id')
|
||||
// ->field('b.*, o.order_sn, s.name')
|
||||
// ->page($page,$size)->select();
|
||||
|
||||
$list = Billions::alias('b')->where($where)
|
||||
->page($page,$size)->select();
|
||||
if ($state == 1) {
|
||||
$list = Billions::alias('b')->where($where)->order('billions_id', 'desc')
|
||||
->page($page,$size)->select();
|
||||
} else {
|
||||
$list = Billions::alias('b')->where($where)
|
||||
->page($page,$size)->select();
|
||||
}
|
||||
|
||||
foreach ($list as &$v) {
|
||||
if ($v['type'] == 1) {
|
||||
@ -67,12 +65,18 @@ class BillionsLogic extends Logic
|
||||
|
||||
$count = Billions::alias('b')->where($where)->count();
|
||||
|
||||
// 消费订单笔数
|
||||
$historyOrder = Billions::where('user_id', $user_id)->count();
|
||||
|
||||
// 商家最高补贴
|
||||
$highSubsidy = Billions::where('user_id', $user_id)->sum('order_price', false);
|
||||
|
||||
// 已完成订单笔数
|
||||
$doneOrder = Billions::where([
|
||||
['user_id', '=', $user_id],
|
||||
['state', '>', 0]
|
||||
])->count();
|
||||
|
||||
// 正在排队的数量
|
||||
$queuesNumber = Billions::where(['user_id' => $user_id, 'state' => 0])->count();
|
||||
|
||||
// 已返补到的金额
|
||||
$getSubsidy = Billions::where(array(
|
||||
['user_id', '=', $user_id],
|
||||
@ -87,9 +91,10 @@ class BillionsLogic extends Logic
|
||||
'page_size' => $size,
|
||||
'count' => $count,
|
||||
'more' => $more,
|
||||
'historyOrder' => $historyOrder,
|
||||
'doneOrder' => $doneOrder,
|
||||
'highSubsidy' => $highSubsidy,
|
||||
'getSubsidy' => $getSubsidy
|
||||
'getSubsidy' => $getSubsidy,
|
||||
'queuesNumber' => $queuesNumber
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
@ -295,7 +300,7 @@ class BillionsLogic extends Logic
|
||||
|
||||
$user_subsidy = 2; // 自我补贴
|
||||
$all_user_subsidy = 20; //全用户获取的比例
|
||||
$user_start_num = 5; // 补贴前几位数量
|
||||
$user_start_num = 1; // 补贴前几位数量
|
||||
$user_start_subsidy = 30; //补贴前几位比例 全用户比例中扣除
|
||||
$user_end_subsidy = 70; //补贴剩余部分比例
|
||||
$user_first_leader = 30; // 推广者排队补贴
|
||||
@ -314,13 +319,13 @@ class BillionsLogic extends Logic
|
||||
$data['order_id'] = $id;
|
||||
$data['dtime'] = date("Y-m-d H:i:s");
|
||||
$data['type'] = 3; // 类型是充值
|
||||
$data['subsidy_price'] = round($money * $user_subsidy / 100,6);
|
||||
$data['subsidy_price'] = round($money * $user_subsidy / 100,8);
|
||||
$res = Db::name("user_billions")->save($data);
|
||||
$billions_msg = Db::name("user_billions")->where("state",0)->select()->toArray();
|
||||
|
||||
$subsidy = $money * $all_user_subsidy / 100;
|
||||
if($is_d != null){
|
||||
$ufl = round($subsidy*$user_first_leader/100,6);
|
||||
$subsidy_ufl = round($subsidy - $ufl,6);
|
||||
$ufl = round($subsidy*$user_first_leader/100,8);
|
||||
$subsidy_ufl = round($subsidy - $ufl,8);
|
||||
$first_billions_msg = Db::name("user_billions")->where("user_id",$user['first_leader'])->where("state",0)->select()->toArray();
|
||||
// var_dump($first_billions_msg);die;
|
||||
if(count($first_billions_msg) > 0){
|
||||
@ -375,9 +380,9 @@ class BillionsLogic extends Logic
|
||||
return -3;
|
||||
}
|
||||
// 剩余金额
|
||||
$ufl = round($ufl+$v['subsidy_price']-$v['order_price'],6);
|
||||
$ufl = round($ufl+$v['subsidy_price']-$v['order_price'],8);
|
||||
}else{
|
||||
$subsidy_price_sum = round($v['subsidy_price']+$ufl,6);
|
||||
$subsidy_price_sum = round($v['subsidy_price']+$ufl,8);
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->update(['subsidy_price'=>$subsidy_price_sum]);
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$ufl)->update();
|
||||
$ufl = 0;
|
||||
@ -385,17 +390,18 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
|
||||
}
|
||||
$subsidy = round($subsidy_ufl + $ufl,6);
|
||||
$subsidy = round($subsidy_ufl + $ufl,8);
|
||||
}
|
||||
}
|
||||
// $first_msg = Db::name("user_billions")->where("user_id",$user['first_leader'])->where("state",0)->select()->toArray();
|
||||
$billions_msg = Db::name("user_billions")->where("state",0)->select()->toArray();
|
||||
$count = count($billions_msg);
|
||||
$arr = $arr1 = array();
|
||||
// 数量超出前几位补贴用户
|
||||
if($count > $user_start_num) {
|
||||
$start_subsidy = $subsidy * $user_start_subsidy / 100;
|
||||
$average = round($start_subsidy / $user_start_num, 6);
|
||||
$last = round($start_subsidy - $average * ($user_start_num - 1), 6);
|
||||
$average = round($start_subsidy / $user_start_num, 8);
|
||||
$last = round($start_subsidy - $average * ($user_start_num - 1), 8);
|
||||
for ($i = 0; $i < $user_start_num; $i++) {
|
||||
if ($i + 1 == $user_start_num) {
|
||||
$arr[$i] = $last;
|
||||
@ -408,9 +414,9 @@ class BillionsLogic extends Logic
|
||||
// var_dump($count-$user_start_num);
|
||||
|
||||
// 剩余人数补贴
|
||||
$end_average = round(($subsidy - $start_subsidy)/ ($count-$user_start_num), 6);
|
||||
$end_average = round(($subsidy - $start_subsidy)/ ($count-$user_start_num), 8);
|
||||
// var_dump($end_average);
|
||||
$end_last = round($subsidy - $start_subsidy - $end_average * ($count-$user_start_num - 1), 6);
|
||||
$end_last = round($subsidy - $start_subsidy - $end_average * ($count-$user_start_num - 1), 8);
|
||||
// var_dump($end_last);
|
||||
for ($y = 0; $y < $count-$user_start_num; $y++) {
|
||||
if ($y + 1 == $count-$user_start_num) {
|
||||
@ -422,8 +428,8 @@ class BillionsLogic extends Logic
|
||||
}else{
|
||||
$user_start_num = $count;
|
||||
// 数量不超出前几位补贴用户,按全部金额计算
|
||||
$average = round($subsidy/$count, 6);
|
||||
$last = round($subsidy - $average * ($count - 1), 6);
|
||||
$average = round($subsidy/$count, 8);
|
||||
$last = round($subsidy - $average * ($count - 1), 8);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($i + 1 == $count) {
|
||||
$arr[$i] = $last;
|
||||
@ -496,15 +502,15 @@ class BillionsLogic extends Logic
|
||||
// 剩余数量
|
||||
$residue_count = $user_start_num - $k - 1;
|
||||
// 剩余金额
|
||||
$residue_price = round($arr[$k]+$v['subsidy_price']-$v['order_price'],6);
|
||||
$residue_price = round($arr[$k]+$v['subsidy_price']-$v['order_price'],8);
|
||||
foreach($arr as $k1=>$v1){
|
||||
if($k1 > $k){
|
||||
$residue_price+=$arr[$k1];
|
||||
}
|
||||
}
|
||||
|
||||
$average = round($residue_price/$residue_count,6);
|
||||
$last = round($residue_price - $average*($residue_count-1),6);
|
||||
$average = round($residue_price/$residue_count,8);
|
||||
$last = round($residue_price - $average*($residue_count-1),8);
|
||||
foreach($arr as $k1=>$v1){
|
||||
if($k1+1 == $user_start_num){
|
||||
$arr[$k1] = $last;
|
||||
@ -516,14 +522,14 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
|
||||
}else{
|
||||
$subp = round($v['subsidy_price']+$arr[$k],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// $subp = round($v['subsidy_price']+$arr[$k],6);
|
||||
// $billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
// $billion_arr_id.=$v['billions_id'].",";
|
||||
// $dataSet[] = [
|
||||
// 'billions_id' => $v['billions_id'], // 假设每个模型数据都有一个ID字段
|
||||
// 'subsidy_price' => round($v['subsidy_price']+$arr[$k],6) // 其他字段数据
|
||||
// ];
|
||||
// Db::name("user_billions")->where("billions_id", $v['billions_id'])->inc("subsidy_price", $arr[$k])->update();
|
||||
Db::name("user_billions")->where("billions_id", $v['billions_id'])->inc("subsidy_price", $arr[$k])->update();
|
||||
}
|
||||
}else{
|
||||
if($v['order_price'] <= $arr1[$k - $user_start_num] + $v['subsidy_price']){
|
||||
@ -581,14 +587,14 @@ class BillionsLogic extends Logic
|
||||
// 剩余数量
|
||||
$residue_count = $count-$user_start_num - $k+$user_start_num - 1;
|
||||
// 剩余金额
|
||||
$residue_price = round($arr1[$k-$user_start_num]+$v['subsidy_price']-$v['order_price'],6);
|
||||
$residue_price = round($arr1[$k-$user_start_num]+$v['subsidy_price']-$v['order_price'],8);
|
||||
foreach($arr1 as $k1=>$v1){
|
||||
if($k1 > $k - $user_start_num){
|
||||
$residue_price+=$arr1[$k1];
|
||||
}
|
||||
}
|
||||
$average = round($residue_price/$residue_count,6);
|
||||
$last = round($residue_price - $average*($residue_count-1),6);
|
||||
$average = round($residue_price/$residue_count,8);
|
||||
$last = round($residue_price - $average*($residue_count-1),8);
|
||||
foreach($arr1 as $k1=>$v1){
|
||||
if($k1+1 == $count-$user_start_num){
|
||||
$arr1[$k1] = $last;
|
||||
@ -599,33 +605,34 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$subp = round($v['subsidy_price']+$arr1[$k-$user_start_num],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// $subp = round($v['subsidy_price']+$arr1[$k-$user_start_num],6);
|
||||
// $billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
// $billion_arr_id.=$v['billions_id'].",";
|
||||
// $dataSet[] = [
|
||||
// 'billions_id' => $v['billions_id'], // 假设每个模型数据都有一个ID字段
|
||||
// 'subsidy_price' => round($v['subsidy_price']+$arr1[$k-$user_start_num],6) // 其他字段数据
|
||||
// ];
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
$billion_arr_id = explode(",",$billion_arr_id);
|
||||
array_pop($billion_arr_id);
|
||||
// print_r("<pre>");
|
||||
// var_dump($billion_arr_id);die;
|
||||
$billion_arr_id = implode(",",$billion_arr_id);
|
||||
$sql = "UPDATE `ls_user_billions`
|
||||
SET subsidy_price = CASE billions_id
|
||||
$billion_arr
|
||||
END
|
||||
WHERE billions_id IN ($billion_arr_id)";
|
||||
$query = Db::query($sql);
|
||||
// $billion_arr_id = explode(",",$billion_arr_id);
|
||||
// array_pop($billion_arr_id);
|
||||
// // print_r("<pre>");
|
||||
// // var_dump($billion_arr);
|
||||
// // var_dump($billion_arr_id);die;
|
||||
// $billion_arr_id = implode(",",$billion_arr_id);
|
||||
// $sql = "UPDATE `ls_user_billions`
|
||||
// SET subsidy_price = CASE billions_id
|
||||
// $billion_arr
|
||||
// END
|
||||
// WHERE billions_id IN ($billion_arr_id)";
|
||||
// $query = Db::query($sql);
|
||||
|
||||
// Db::name("billions")->updateAll($dataSet,"billions_id");
|
||||
if($is_d!=null){
|
||||
if($user['first_leader']>0){
|
||||
$first_leader_percent = round($money * $first_leader / 100, 6);
|
||||
$first_leader_percent = round($money * $first_leader / 100, 8);
|
||||
// Order::where('id', $order['id'])
|
||||
// ->inc('distribution_money',$first_leader_percent)->update();
|
||||
UserDistribution::where('user_id', $user['first_leader'])
|
||||
@ -669,7 +676,7 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
// 3%对公司
|
||||
if($user['divide_role_user_id'] > 0&&$state>0 ){
|
||||
$divide_percent = round($money * $other_leader / 100, 6);
|
||||
$divide_percent = round($money * $other_leader / 100, 8);
|
||||
// Order::where('id', $order['id'])
|
||||
// ->inc('distribution_money',$divide_percent)->update();
|
||||
// $shopDistribution_msg = UserShopDistribution::where('shop_id', $value['shop_id'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user