...
|
...
|
@@ -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']);
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
// 赠送优惠券
|
...
|
...
|
|