作者 何书鹏

去掉分销二级

... ... @@ -32,21 +32,25 @@ class Finish
if($first_user){
// 一级佣金
$share = json_decode(Config::where(['name' => 'share'])->value('value'), true);
$first_commission = $order['pay_fee'] * $share['order_first'] / 100;
$first_user->commission = Db::raw('commission + ' . $first_commission);
$first_user->save();
// 记录 UserCommissionLog
\app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'order_commssion', $order['id'], 1);
// 二级佣金
$second_user = User::get($first_user['pid']);
if($second_user){
$second_commission = $order['pay_fee'] * $share['order_second'] / 100;
$second_user->commission = Db::raw('commission + ' . $second_commission);
$second_user->save();
$first_commission = ($share['order_first'] > 0) ? ($order['pay_fee'] * $share['order_first'] / 100) : 0;
if($first_commission > 0){
$first_user->commission = Db::raw('commission + ' . $first_commission);
$first_user->save();
// 记录 UserCommissionLog
\app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'order_commssion', $order['id'], 1);
\app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'order_commssion', $order['id'], 1);
}
// // 二级佣金
// $second_user = User::get($first_user['pid']);
// if($second_user){
// $second_commission = ($share['order_second'] > 0) ? ($order['pay_fee'] * $share['order_second'] / 100) : 0;
// if($second_commission > 0){
// $second_user->commission = Db::raw('commission + ' . $second_commission);
// $second_user->save();
// // 记录 UserCommissionLog
// \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'order_commssion', $order['id'], 1);
// }
// }
}
return $order;
... ...
... ... @@ -246,15 +246,15 @@
<el-form-item label="购买会员返1级佣金(元):" label-width="170px">
<el-input v-model="detailForm.member_first" placeholder="开通会员返一级佣金"></el-input>
</el-form-item>
<el-form-item label="购买会员返2级佣金(元):" label-width="170px">
<!--<el-form-item label="购买会员返2级佣金(元):" label-width="170px">
<el-input v-model="detailForm.member_second" placeholder="开通会员返二级佣金"></el-input>
</el-form-item>
</el-form-item>-->
<el-form-item label="购买商品返1级佣金比例(%):" label-width="200px">
<el-input v-model="detailForm.order_first" placeholder="下单返一级佣金比例"></el-input>
</el-form-item>
<el-form-item label="购买商品返2级佣金比例(%):" label-width="200px">
<!--<el-form-item label="购买商品返2级佣金比例(%):" label-width="200px">
<el-input v-model="detailForm.order_second" placeholder="下单返二级佣金比例"></el-input>
</el-form-item>
</el-form-item>-->
<!--<el-form-item label="拼团分享背景:">
<div class="display-flex">
<div class="platform-images" v-if="detailForm.groupon_poster_bg">
... ...
... ... @@ -267,20 +267,24 @@ class PackageOrder extends Base
// 一级佣金
$share = json_decode(Config::where(['name' => 'share'])->value('value'), true);
$first_commission = $share['member_first'];
$first_user->commission = Db::raw('commission + ' . $first_commission);
$first_user->save();
// 记录 UserCommissionLog
\app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'package_commission', $order['id'], 1,$order['user_id']);
// 二级佣金
$second_user = User::get($first_user['pid']);
if($second_user){
$second_commission = $share['member_second'];
$second_user->commission = Db::raw('commission + ' . $second_commission);
$second_user->save();
if($first_commission > 0){
$first_user->commission = Db::raw('commission + ' . $first_commission);
$first_user->save();
// 记录 UserCommissionLog
\app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'package_commission', $order['id'], 1,$order['user_id']);
\app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'package_commission', $order['id'], 1,$order['user_id']);
}
// // 二级佣金
// $second_user = User::get($first_user['pid']);
// if($second_user){
// $second_commission = $share['member_second'];
// if($second_commission > 0){
// $second_user->commission = Db::raw('commission + ' . $second_commission);
// $second_user->save();
// // 记录 UserCommissionLog
// \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'package_commission', $order['id'], 1,$order['user_id']);
// }
// }
}
// 赠送优惠券
... ...
... ... @@ -268,9 +268,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
user_poster_bg_arr:[],
groupon_poster_bg_arr:[],
member_first:'',
member_second:'',
// member_second:'',
order_first:'',
order_second:'',
// order_second:'',
},
score:{
everyday: '',
... ...