Browse Source

前台滑落红字的条件

lizhen_gitee 1 year ago
parent
commit
e4602dbf0a

+ 3 - 1
application/admin/controller/Userwithdraw.php

@@ -92,7 +92,9 @@ class Userwithdraw extends Backend
 
             //tag任务赠送金币
             if($status == 1){
-
+                //封号,账户异常,联系客服
+                //不能再给他加钱
+                //他的上下级自动衔接
 
             }elseif($status == 2){
                 //还钱

+ 55 - 1
application/common/library/Auth.php

@@ -557,11 +557,65 @@ class Auth
         $userinfo['intro_number'] = Db::name('user')->where('intro_uid',$this->id)->count('id');//我的粉丝
 
         //账号升级提醒
-        $userinfo['hualuo_msg'] = '您的账号需要升级,请联系客服处理';
+        $is_hualuo = $this->is_hualuo();
+        $userinfo['hualuo_msg'] = $is_hualuo ? '您的账号需要升级,请联系客服处理' : '';
 
         return $userinfo;
     }
 
+    //是否要滑落
+    private function is_hualuo(){
+        //上次购买日期已经过去11天了
+        if($this->_user->last_paytime < $this->hualuo_tendays_ago()){
+            return true;
+        }
+
+        //收益总额超过了消费总额
+        $map = [
+            'user_id' => $this->id,
+            'status'  => 1,
+            'have_paid' => ['gt',0],
+        ];
+        $order_price_sum = Db::name('unishop_order')->where($map)->sum('order_price');
+
+        $score = model('wallet')->getWallet($this->id,'score');//积分
+
+        if($score >= $order_price_sum){
+            return true;
+        }
+
+        return false;
+    }
+
+    //滑落要按11天算
+    private function hualuo_tendays_ago(){
+        $nowtime = time();
+
+        /*if(input('date','')){
+            $nowtime = strtotime(input('date',''));
+        }*/
+
+        $today   = strtotime(date('Y-m-d',$nowtime));
+
+        $toweek  = date('w',$nowtime);
+
+
+        $enum = [
+            1 => 12,//这一天没人滑落
+            2 => 12,
+            3 => 12,
+            4 => 12,
+            5 => 11,
+            6 => 11,
+            0 => 11,
+        ];
+
+        $rs = $today - ($enum[$toweek] * 86400);
+//        dump(date('Y-m-d',$rs));
+
+        return $rs;
+    }
+
 
     /**
      * 获取会员组别规则列表

+ 1 - 0
application/index/controller/Plantask.php

@@ -12,6 +12,7 @@ class Plantask extends Controller
         exit;
     }
 
+    //用不到了
     //10天不买的用户,第10天结算完,第11天自动滑落,上下级自动衔接
     //该用户的所有下级,的推荐人,改成此人的上级。
     public function auto_hualuo(){