diff --git a/app/api/logic/PayLogic.php b/app/api/logic/PayLogic.php index 86421a37..c3991718 100755 --- a/app/api/logic/PayLogic.php +++ b/app/api/logic/PayLogic.php @@ -715,14 +715,18 @@ class PayLogic extends Logic $dt['bank_name'] = $company['bankName']; $dt['bank_card'] = $company['bankCard']; $dt['large_number'] = $company['largeNumber']; + $dt['separate_account'] = round($post['money']*0.7,2); + $dt2['separate_account'] = round($post['money']*0.22,2); + $dt3['separate_account'] = round($post['money']*0.06,2); if($post['lid'] == 138){ $dt['separate_account'] = round($post['money']*0.72,2); $dt2['separate_account'] = round($post['money']*0.20,2); - }else{ - $dt['separate_account'] = round($post['money']*0.7,2); - $dt2['separate_account'] = round($post['money']*0.22,2); } - + if($post['lid'] == 140){ + $dt['separate_account'] = round($post['money']*0.76,2); + $dt2['separate_account'] = round($post['money']*0.22,2); + $dt3['separate_account'] = 0; + } $dt['create_time'] = date("Y-m-d H:i:s"); $dt['user_id'] = $user_id; $dt['order_no'] = $out_trade_no; @@ -766,7 +770,7 @@ class PayLogic extends Logic // $dt3['bank_card'] = "1204068809100138961"; // $dt3['large_number'] = "102335006882"; $dt3['large_number'] = "102335006448"; - $dt3['separate_account'] = round($post['money']*0.06,2); +// $dt3['separate_account'] = round($post['money']*0.06,2); $dt3['create_time'] = date("Y-m-d H:i:s"); $dt3['user_id'] = $user_id; $dt3['local_our_company'] = 1; @@ -806,41 +810,51 @@ class PayLogic extends Logic } $local_store = Db::name("local_store")->where("lstore_id",$post['lid'])->find(); $first_user = Db::name("user")->where("id",$local_store['user_id'])->find(); - if($first_user['first_leader']!=0){ - $is_d = Distribution::where('user_id', $first_user['first_leader'] )->where('is_distribution', 1 )->find(); - if($is_d!=null){ - $earnings = round($post['money']*0.01,2); - User::where('id', $first_user['first_leader']) - ->inc('earnings', $earnings)->update(); - $earnings_buy = AccountLog::where('user_id', $first_user['first_leader'])->order("create_time desc")->limit(1)->value('left_amount'); - $sn = createSn('account_log', 'log_sn', '', 4); - AccountLog::create([ - 'log_sn' => $sn, - 'user_id' => $first_user['first_leader'], - 'source_type' => AccountLog::local_inc_earnings, //todo 改为充值类型 - 'source_id' => 0, //todo 改为充值订单主键 - 'source_sn' => 0, // todo 改为充值订单编号 - 'change_amount' => $earnings, - 'left_amount' => $earnings_buy + $earnings, - 'change_type' => 1, - 'shop_id'=>$post['lid'], - 'remark' => '本地商家支付佣金增加' - ]); + if($post['lid'] != 140) { + if ($first_user['first_leader'] != 0) { + $is_d = Distribution::where('user_id', $first_user['first_leader'])->where('is_distribution', 1)->find(); + if ($is_d != null) { + $earnings = round($post['money'] * 0.01, 2); + User::where('id', $first_user['first_leader']) + ->inc('earnings', $earnings)->update(); + $earnings_buy = AccountLog::where('user_id', $first_user['first_leader'])->order("create_time desc")->limit(1)->value('left_amount'); + $sn = createSn('account_log', 'log_sn', '', 4); + AccountLog::create([ + 'log_sn' => $sn, + 'user_id' => $first_user['first_leader'], + 'source_type' => AccountLog::local_inc_earnings, //todo 改为充值类型 + 'source_id' => 0, //todo 改为充值订单主键 + 'source_sn' => 0, // todo 改为充值订单编号 + 'change_amount' => $earnings, + 'left_amount' => $earnings_buy + $earnings, + 'change_type' => 1, + 'shop_id' => $post['lid'], + 'remark' => '本地商家支付佣金增加' + ]); + } } } - $company = Db::name("local_store")->where("lstore_id",$post['lid'])->where("is_delete",0)->find(); $local_store_order_no = createSn('local_store_order', 'order_no', '', 4); + $dt['separate_account'] = round($post['money']*0.7,2); + $dt2['separate_account'] = round($post['money']*0.22,2); + $dt1['separate_account'] = round($post['money']*0.02,2); + $dt3['separate_account'] = round($post['money']*0.06,2); + $price = round($post['money']*0.7,2); if($post['lid'] == 138){ $dt['separate_account'] = round($post['money']*0.72,2); $dt2['separate_account'] = round($post['money']*0.20,2); $price = round($post['money']*0.72,2); - }else{ - $dt['separate_account'] = round($post['money']*0.7,2); - $dt2['separate_account'] = round($post['money']*0.22,2); - $price = round($post['money']*0.7,2); } + if($post['lid'] == 140){ + $dt['separate_account'] = round($post['money']*0.76,2); + $dt2['separate_account'] = 0; + $price = round($post['money']*0.69,2); + $dt1['separate_account'] = round($post['money']*0.02,2); + $dt3['separate_account'] = 0; + } + if ($company['empowerPhone']) { event('Notice', [ 'scene' => NoticeEnum::LOCAL_SHOP_COLLECTION_NOTICE, @@ -900,7 +914,7 @@ class PayLogic extends Logic $dt1['bank_name'] = "中国工商银行"; $dt1['bank_card'] = "1204068809100138961"; $dt1['large_number'] = "102335006882"; - $dt1['separate_account'] = round($post['money']*0.02,2); +// $dt1['separate_account'] = round($post['money']*0.02,2); $dt1['create_time'] = date("Y-m-d H:i:s"); $dt1['user_id'] = $user_id; $dt1['state'] = 1; @@ -936,7 +950,7 @@ class PayLogic extends Logic // $dt3['bank_card'] = "1204068809100138961"; // $dt3['large_number'] = "102335006882"; $dt3['large_number'] = "102335006448"; - $dt3['separate_account'] = round($post['money']*0.06,2); +// $dt3['separate_account'] = round($post['money']*0.06,2); $dt3['create_time'] = date("Y-m-d H:i:s"); $dt3['user_id'] = $user_id; $dt3['state'] = 1; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 0c4d54ae..831c3fab 100755 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -822,11 +822,7 @@ class PayNotifyLogic } $user_subsidy = 2; // 自我补贴 - if($lstore_id == 138){ - $all_user_subsidy = 18; //全用户获取的比例 - }else{ - $all_user_subsidy = 20; - } + $all_user_subsidy = 20; $user_start_num = 1; // 补贴前几位数量 $user_start_subsidy = 30; //补贴前几位比例 全用户比例中扣除 $user_end_subsidy = 70; //补贴剩余部分比例 @@ -836,6 +832,15 @@ class PayNotifyLogic $donglonghui = 2; //东龙汇服务费 $other_leader = 3; //分公司收入 如没有则并入东龙汇 $shop_com = 70; // 商家获取收入 + if($lstore_id == 138){ + $all_user_subsidy = 18; //全用户获取的比例 + } + if($lstore_id == 140){ + $first_leader=0; + $other_leader = 0; + $all_user_subsidy = 20; //全用户获取的比例 + } + $user = Db::name("user")->where(['id' => $user_id])->find(); $first_leader_user = Db::name("user")->where("id", $user['first_leader'])->find(); $is_d = Distribution::where('user_id', $user['first_leader'] )->where('is_distribution', 1 )->find();