作者 何书鹏

去掉分销二级

@@ -32,21 +32,25 @@ class Finish @@ -32,21 +32,25 @@ class Finish
32 if($first_user){ 32 if($first_user){
33 // 一级佣金 33 // 一级佣金
34 $share = json_decode(Config::where(['name' => 'share'])->value('value'), true); 34 $share = json_decode(Config::where(['name' => 'share'])->value('value'), true);
35 - $first_commission = $order['pay_fee'] * $share['order_first'] / 100;  
36 - $first_user->commission = Db::raw('commission + ' . $first_commission);  
37 - $first_user->save();  
38 - // 记录 UserCommissionLog  
39 - \app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'order_commssion', $order['id'], 1);  
40 -  
41 - // 二级佣金  
42 - $second_user = User::get($first_user['pid']);  
43 - if($second_user){  
44 - $second_commission = $order['pay_fee'] * $share['order_second'] / 100;  
45 - $second_user->commission = Db::raw('commission + ' . $second_commission);  
46 - $second_user->save(); 35 + $first_commission = ($share['order_first'] > 0) ? ($order['pay_fee'] * $share['order_first'] / 100) : 0;
  36 + if($first_commission > 0){
  37 + $first_user->commission = Db::raw('commission + ' . $first_commission);
  38 + $first_user->save();
47 // 记录 UserCommissionLog 39 // 记录 UserCommissionLog
48 - \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'order_commssion', $order['id'], 1); 40 + \app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'order_commssion', $order['id'], 1);
49 } 41 }
  42 +
  43 +// // 二级佣金
  44 +// $second_user = User::get($first_user['pid']);
  45 +// if($second_user){
  46 +// $second_commission = ($share['order_second'] > 0) ? ($order['pay_fee'] * $share['order_second'] / 100) : 0;
  47 +// if($second_commission > 0){
  48 +// $second_user->commission = Db::raw('commission + ' . $second_commission);
  49 +// $second_user->save();
  50 +// // 记录 UserCommissionLog
  51 +// \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'order_commssion', $order['id'], 1);
  52 +// }
  53 +// }
50 } 54 }
51 55
52 return $order; 56 return $order;
@@ -246,15 +246,15 @@ @@ -246,15 +246,15 @@
246 <el-form-item label="购买会员返1级佣金(元):" label-width="170px"> 246 <el-form-item label="购买会员返1级佣金(元):" label-width="170px">
247 <el-input v-model="detailForm.member_first" placeholder="开通会员返一级佣金"></el-input> 247 <el-input v-model="detailForm.member_first" placeholder="开通会员返一级佣金"></el-input>
248 </el-form-item> 248 </el-form-item>
249 - <el-form-item label="购买会员返2级佣金(元):" label-width="170px"> 249 + <!--<el-form-item label="购买会员返2级佣金(元):" label-width="170px">
250 <el-input v-model="detailForm.member_second" placeholder="开通会员返二级佣金"></el-input> 250 <el-input v-model="detailForm.member_second" placeholder="开通会员返二级佣金"></el-input>
251 - </el-form-item> 251 + </el-form-item>-->
252 <el-form-item label="购买商品返1级佣金比例(%):" label-width="200px"> 252 <el-form-item label="购买商品返1级佣金比例(%):" label-width="200px">
253 <el-input v-model="detailForm.order_first" placeholder="下单返一级佣金比例"></el-input> 253 <el-input v-model="detailForm.order_first" placeholder="下单返一级佣金比例"></el-input>
254 </el-form-item> 254 </el-form-item>
255 - <el-form-item label="购买商品返2级佣金比例(%):" label-width="200px"> 255 + <!--<el-form-item label="购买商品返2级佣金比例(%):" label-width="200px">
256 <el-input v-model="detailForm.order_second" placeholder="下单返二级佣金比例"></el-input> 256 <el-input v-model="detailForm.order_second" placeholder="下单返二级佣金比例"></el-input>
257 - </el-form-item> 257 + </el-form-item>-->
258 <!--<el-form-item label="拼团分享背景:"> 258 <!--<el-form-item label="拼团分享背景:">
259 <div class="display-flex"> 259 <div class="display-flex">
260 <div class="platform-images" v-if="detailForm.groupon_poster_bg"> 260 <div class="platform-images" v-if="detailForm.groupon_poster_bg">
@@ -267,20 +267,24 @@ class PackageOrder extends Base @@ -267,20 +267,24 @@ class PackageOrder extends Base
267 // 一级佣金 267 // 一级佣金
268 $share = json_decode(Config::where(['name' => 'share'])->value('value'), true); 268 $share = json_decode(Config::where(['name' => 'share'])->value('value'), true);
269 $first_commission = $share['member_first']; 269 $first_commission = $share['member_first'];
270 - $first_user->commission = Db::raw('commission + ' . $first_commission);  
271 - $first_user->save();  
272 - // 记录 UserCommissionLog  
273 - \app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'package_commission', $order['id'], 1,$order['user_id']);  
274 -  
275 - // 二级佣金  
276 - $second_user = User::get($first_user['pid']);  
277 - if($second_user){  
278 - $second_commission = $share['member_second'];  
279 - $second_user->commission = Db::raw('commission + ' . $second_commission);  
280 - $second_user->save(); 270 + if($first_commission > 0){
  271 + $first_user->commission = Db::raw('commission + ' . $first_commission);
  272 + $first_user->save();
281 // 记录 UserCommissionLog 273 // 记录 UserCommissionLog
282 - \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'package_commission', $order['id'], 1,$order['user_id']); 274 + \app\api\model\UserCommissionLog::doAdd($first_user, $first_commission, 'package_commission', $order['id'], 1,$order['user_id']);
283 } 275 }
  276 +
  277 +// // 二级佣金
  278 +// $second_user = User::get($first_user['pid']);
  279 +// if($second_user){
  280 +// $second_commission = $share['member_second'];
  281 +// if($second_commission > 0){
  282 +// $second_user->commission = Db::raw('commission + ' . $second_commission);
  283 +// $second_user->save();
  284 +// // 记录 UserCommissionLog
  285 +// \app\api\model\UserCommissionLog::doAdd($second_user, $second_commission, 'package_commission', $order['id'], 1,$order['user_id']);
  286 +// }
  287 +// }
284 } 288 }
285 289
286 // 赠送优惠券 290 // 赠送优惠券
@@ -268,9 +268,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -268,9 +268,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
268 user_poster_bg_arr:[], 268 user_poster_bg_arr:[],
269 groupon_poster_bg_arr:[], 269 groupon_poster_bg_arr:[],
270 member_first:'', 270 member_first:'',
271 - member_second:'', 271 + // member_second:'',
272 order_first:'', 272 order_first:'',
273 - order_second:'', 273 + // order_second:'',
274 }, 274 },
275 score:{ 275 score:{
276 everyday: '', 276 everyday: '',