Jelajahi Sumber

personal account

zz 6 tahun lalu
induk
melakukan
a34bd582b1

+ 22 - 8
app/Http/Controllers/Wap/User/CoflController.php

@@ -352,21 +352,34 @@ class CoflController extends Controller
     public function guidePersonalAccount(Request $request,$channel_id){
         $uid = $request->get('uid',0);
 
-        $env_config = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','GUIDE_PERSONAL_ACCOUNT_MAX_USER','GUIDE_PERSONAL_ACCOUNT_ID');
+        $env_config = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','GUIDE_PERSONAL_ACCOUNT_MAX_USER','GUIDE_PERSONAL_ACCOUNT_ID','GUIDE_PERSONAL_ACCOUNT_ONE_LOOP_MAX_USER');
         $img = empty($env_config[0])?'https://cdn-novel.iycdm.com/h5/personal_account/chenchen.jpg':$env_config[0];
         $max = empty($env_config[1])?100:$env_config[1];
+        $one_loop_max = empty($env_config[3])?10:$env_config[3];
         $now_id = (int)$env_config[2];
         $uv = Redis::scard('guide_personal_uv');
-        if($uv>=$max){
-            DB::table('personal_account_list')->where('id',$now_id)->update([
-                'status'=>2,
-                'count'=>$uv,
-                'updated_at'=>date('Y-m-d H:i:s')
-            ]);
+        $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('count')->first();
+        $total_max = $personal_info->count+$uv;
+        //Log::info('$total_max is: '.);
+        if($uv >= $one_loop_max || $total_max>=$max){
+            if($total_max>=$max){
+                DB::table('personal_account_list')->where('id',$now_id)->update([
+                    'status'=>2,
+                    'count'=>$total_max,
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
+            }else{
+                DB::table('personal_account_list')->where('id',$now_id)->increment('count',$uv,[
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
+            }
+
             $account = DB::table('personal_account_list')
                 ->where('is_enable',1)
-                ->where('status',0)
+                ->whereIn('status',[1,0])
                 ->select('id','url')
+                ->where('count','<',$max)
+                ->orderBy('count','asc')
                 ->orderBy('id')
                 ->first();
             Redis::del('guide_personal_uv');
@@ -379,6 +392,7 @@ class CoflController extends Controller
                 $now_id = $account->id;
                 Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
             }else{
+                Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','GUIDE_PERSONAL_ACCOUNT_ID','');
                 return back();
             }
         }

+ 2 - 18
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -2073,8 +2073,8 @@ class WelcomeController extends BaseController
         //\Log::info('guidePersonalAccount------------------------guidePersonalAccount');
         //\Log::info($env_config);
 
-        if(empty($env_config[0]) || empty($env_config[1]) ){
-            \Log::info( 'empty' );
+        if(empty($env_config[0]) || empty($env_config[1]) || empty($env_config[2]) ){
+            //\Log::info( 'empty' );
             return '';
         }
         //Log::info( '$this->distribution_channel_id is: '.$this->distribution_channel_id );
@@ -2085,22 +2085,6 @@ class WelcomeController extends BaseController
         $guide_personal_account_start_time = $env_config[1];
         if(!$guide_personal_account_start_time)
             return false;
-        if(empty($env_config[2])){
-            $account = DB::table('personal_account_list')
-                ->where('is_enable',1)
-                ->where('status',0)
-                ->select('id','url')
-                ->orderBy('id')
-                ->first();
-            if(!$account){
-                return false;
-            }
-            DB::table('personal_account_list')->where('id',$account->id)->update([
-                'status'=>1,
-                'updated_at'=>date('Y-m-d H:i:s')
-            ]);
-            Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
-        }
 
         $get_info = UserBindHkWelfareService::isHasGet($this->uid);
         if($get_info){