1.本地生活余额支付新增5%推广店铺收益

This commit is contained in:
xucong 2024-08-19 14:08:28 +08:00
parent 7423b4725e
commit 541b928b1e
3 changed files with 42 additions and 14 deletions

@ -14,6 +14,7 @@ use app\common\logic\IntegralLogic;
use app\common\logic\OrderLogLogic;
use app\common\logic\PayNotifyLogic;
use app\common\model\Client_;
use app\common\model\distribution\Distribution;
use app\common\model\distribution\DistributionGoods;
use app\common\model\distribution\DistributionLevel;
use app\common\model\distribution\DistributionOrderGoods;
@ -761,6 +762,31 @@ class PayLogic extends Logic
Db::rollback();
return JsonServer::error('账户明细记录添加失败');
}
$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.05,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,
'remark' => '本地商家支付佣金增加'
]);
}
}
$company = Db::name("local_store")->where("lstore_id",$post['lid'])->where("is_delete",0)->find();
$dt['lstore_id'] = $post['lid'];
$dt['payment_type'] = $company['bankType'];

@ -722,18 +722,18 @@ class PayNotifyLogic
'log_sn' => $sn,
'user_id' => $user['first_leader'],
'source_type' => AccountLog::recharge_billions_inc_earnings, //todo 改为充值类型
'source_id' => $order['id'], //todo 改为充值订单主键
'source_sn' => $order['order_sn'], // todo 改为充值订单编号
'source_id' => 0, //todo 改为充值订单主键
'source_sn' => 0, // todo 改为充值订单编号
'change_amount' => $first_leader_percent,
'left_amount' => $earnings_buy + $first_leader_percent,
'change_type' => 1,
'remark' => '消费返补佣金增加'
'remark' => '充值消费返补佣金增加'
]);
DistributionOrderGoods::create([
'sn' => $sn,
'user_id' => $user['first_leader'],
'ratio' => $first_leader,
'order_id' => $order['id'], //todo 改为充值订单主键
'order_id' => 0, //todo 改为充值订单主键
'order_goods_id' => 0, //todo 因为是充值所以改为0
'goods_num' => 1, // todo 因为是充值所以改为1
'money' => $first_leader_percent,
@ -767,8 +767,8 @@ class PayNotifyLogic
'log_sn' => $sn,
'user_id' => $user['divide_second_user_id'],
'source_type' => AccountLog::billions_inc_earnings,
'source_id' => $order['id'],
'source_sn' => $order['order_sn'],
'source_id' => 0,
'source_sn' => 0,
'change_amount' => $performance_person,
'left_amount' => $earnings_buy + $performance_person,
'change_type' => 1,
@ -778,13 +778,13 @@ class PayNotifyLogic
'sn' => $sn,
'user_id' => $user['divide_second_user_id'],
'ratio' => $performance,
'order_id' => $order['id'],
'order_goods_id' => $value['id'],
'goods_num' => $value['goods_num'],
'order_id' => 0,
'order_goods_id' => 0,
'goods_num' => 1,
'money' => $performance_person,
'status' => 2,
'create_time' => time(),
'shop_id' => $value['shop_id'],
'shop_id' => 0,
'settlement_time' => time()
]);
}
@ -808,12 +808,12 @@ class PayNotifyLogic
'log_sn' => $sn,
'user_id' => $user['divide_role_user_id'],
'source_type' => AccountLog::recharge_billions_inc_earnings, //todo 改为充值类型
'source_id' => $order['id'], //todo 改为充值订单主键
'source_id' => 0, //todo 改为充值订单主键
'source_sn' => $order['order_sn'], // todo 改为充值订单编号
'change_amount' => $divide_percent,
'left_amount' => $earnings_buy + $divide_percent,
'change_type' => 1,
'remark' => '充值百亿返补佣金增加'
'remark' => '充值消费返补佣金增加'
]);
DistributionOrderGoods::create([
'sn' => $sn,

@ -56,7 +56,7 @@ class AccountLog extends Models
const billions_inc_earnings = 406;//百亿返补佣金增加
const recharge_billions_inc_earnings = 407;//充值百亿返补佣金增加
const recharge_billions_inc_balance = 408;//充值百亿返补本地余额增加
const local_inc_earnings = 409;//本地商家支付佣金增加
const money_change = [ //余额变动类型
self::admin_add_money,self::admin_reduce_money,self::recharge_money,self::balance_pay_order,self::cancel_order_refund,self::after_sale_refund
, self::withdraw_to_balance,self::user_transfer_inc_balance, self::user_transfer_dec_balance, self::integral_order_dec_balance, self::integral_order_inc_balance
@ -81,7 +81,8 @@ class AccountLog extends Models
self::admin_reduce_earnings, //后台减少佣金
self::shop_reduce_wallet, //商户佣金减少
self::baiyibutie, //百亿补贴
self::billions_inc_earnings//百亿返贴
self::billions_inc_earnings,//百亿返贴
self::local_inc_earnings//本地商家支付佣金增加
];
public static function getAcccountDesc($from = true){
@ -106,6 +107,7 @@ class AccountLog extends Models
self::after_sale_refund => '售后退回余额',
self::baiyibutie => '百亿补贴结算获得佣金',
self::billions_inc_earnings => '百亿返补佣金增加',
self::local_inc_earnings => '本地商家支付佣金增加',
self::withdraw_to_balance => '佣金提现',
self::withdraw_dec_earnings => '提现扣减佣金',
self::withdraw_back_earnings => '拒绝提现返还佣金',