|
@@ -435,40 +435,36 @@ class Auth extends BaseController
|
|
|
$one_register_percentage = 5;
|
|
|
$two_register_percentage = 3;
|
|
|
//扣减订单剩余支付百分比
|
|
|
- if($one_register_percentage > 0){
|
|
|
- if(in_array($order_info->status,[4])){
|
|
|
- //一级注册折扣比
|
|
|
- $order_epository->update($user->order_id,array('residue_percentage'=>$order_info->residue_percentage - $one_register_percentage));
|
|
|
+ if($one_register_percentage > 0 && in_array($order_info->status,[0,1,4])){
|
|
|
+ //一级注册折扣比
|
|
|
+ $order_epository->update($user->order_id,array('residue_percentage'=>$order_info->residue_percentage - $one_register_percentage));
|
|
|
+ $store_percentage = app()->make(StorePercentageRepository::class);
|
|
|
+ $percentage_data = array(
|
|
|
+ 'user_id' => $order_info->uid,
|
|
|
+ 'deduction_num' => $one_register_percentage,
|
|
|
+ 'deduction_type' => 1,
|
|
|
+ 'passivity_user_id' => $user->uid,
|
|
|
+ 'order_id' => $order_info->order_id
|
|
|
+ );
|
|
|
+ $store_percentage->create($percentage_data);
|
|
|
+ }
|
|
|
+ if($two_register_percentage > 0 && in_array($order_info->status,[0,1,4])){
|
|
|
+ $p_user = $repository->get($pid);
|
|
|
+ if($p_user->order_id){
|
|
|
+ $p_order_info = $order_epository->findOrCreate(array('order_id'=>$p_user->order_id));
|
|
|
+ //二级注册折扣比
|
|
|
+ $order_epository->update($p_user->order_id,array('residue_percentage'=>$p_order_info->residue_percentage - $two_register_percentage));
|
|
|
$store_percentage = app()->make(StorePercentageRepository::class);
|
|
|
$percentage_data = array(
|
|
|
- 'user_id' => $order_info->uid,
|
|
|
- 'deduction_num' => $one_register_percentage,
|
|
|
- 'deduction_type' => 1,
|
|
|
+ 'user_id' => $p_order_info->uid,
|
|
|
+ 'deduction_num' => $two_register_percentage,
|
|
|
+ 'deduction_type' => 2,
|
|
|
'passivity_user_id' => $user->uid,
|
|
|
- 'order_id' => $order_info->order_id
|
|
|
+ 'order_id' => $p_order_info->order_id
|
|
|
);
|
|
|
$store_percentage->create($percentage_data);
|
|
|
}
|
|
|
}
|
|
|
- if($two_register_percentage > 0){
|
|
|
- $p_user = $repository->get($pid);
|
|
|
- if($p_user->order_id){
|
|
|
- $p_order_info = $order_epository->findOrCreate(array('order_id'=>$p_user->order_id));
|
|
|
- if(in_array($p_order_info->status,[4])){
|
|
|
- //一级注册折扣比
|
|
|
- $order_epository->update($p_user->order_id,array('residue_percentage'=>$p_order_info->residue_percentage - $two_register_percentage));
|
|
|
- $store_percentage = app()->make(StorePercentageRepository::class);
|
|
|
- $percentage_data = array(
|
|
|
- 'user_id' => $p_order_info->uid,
|
|
|
- 'deduction_num' => $two_register_percentage,
|
|
|
- 'deduction_type' => 2,
|
|
|
- 'passivity_user_id' => $user->uid,
|
|
|
- 'order_id' => $p_order_info->order_id
|
|
|
- );
|
|
|
- $store_percentage->create($percentage_data);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
if ($auth){
|
|
|
$repository->syncBaseAuth($auth, $user);
|