quguofeng il y a 2 ans
Parent
commit
b203af9ca5
1 fichiers modifiés avec 5 ajouts et 19 suppressions
  1. 5 19
      app/controller/api/user/UserRelation.php

+ 5 - 19
app/controller/api/user/UserRelation.php

@@ -59,28 +59,14 @@ class UserRelation extends BaseController
         //关注店铺返利
         $user = $repository->get($params['uid']);
         if($user->order_id){
+            $order_info = $order_epository->findOrCreate(array('order_id'=>$user->order_id));
             $percentage_info = $store_percentage->getWhere(array('passivity_user_id'=>$params['uid'],'deduction_type'=>5));
             if(empty($percentage_info)){
                 //一级关注店铺折扣百分比
-                $store_percentage->deduction_percentage(1,$user->uid,$user->order_id);
-                if($two_attention_percentage > 0){
-                    $p_user = $repository->get($order_info->uid);
-                    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_attention_percentage));
-                            $store_percentage = app()->make(StorePercentageRepository::class);
-                            $percentage_data = array(
-                                'user_id' => $p_order_info->uid,
-                                'deduction_num' => $two_attention_percentage,
-                                'deduction_type' => 6,
-                                'passivity_user_id' => $params['uid'],
-                                'order_id' => $p_order_info->order_id
-                            );
-                            $store_percentage->create($percentage_data);
-                        }
-                    }
+                $store_percentage->deduction_percentage(5,$user->uid,$user->order_id);
+                $p_user = $repository->get($order_info->uid);
+                if($p_user->order_id){
+                    $store_percentage->deduction_percentage(6,$user->uid,$p_user->order_id);
                 }
             }
         }