Ver código fonte

personal account new debug

zz 6 anos atrás
pai
commit
add9014654

+ 1 - 1
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -400,7 +400,7 @@ class ChapterController extends BaseController
         //强制导粉
         //$force_guide_sites = redisEnv('FORCE_GUIDE_SITES');
         //$img = redisEnv('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
-        list($force_guide_sites,$img)  = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
+        list($force_guide_sites,$img)  = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
         if($force_guide_sites &&
             $img &&
             in_array($this->distribution_channel_id,explode(',',$force_guide_sites)) &&

+ 16 - 7
app/Http/Controllers/Wap/User/CoflController.php

@@ -102,17 +102,23 @@ class CoflController extends Controller
         }elseif($uri == 'wfreecurrency'){
             $fee = 200;
             $type = 'WCRM';
+        }elseif ($uri == 'frocefreethrhcurrency'){
+            $fee = 200;
+            $type = 'CRM_FORCE';
         }
         else{
             $this->stats('reward_200',$crm);
             $fee = $this->freeCurrencyFee($token,$rfee);
         }
+
         $user = $this->getUsers($openid);
         if(!$user || !$user[0] || !$user[1]) return redirect()->to($this->getLink().'?'.http_build_query($params));
 
         if($type == 'CRM'){
             $this->statsDetail($user[0],'reward',0);
-        }else{
+        }elseif ($type == 'CRM_FORCE'){
+            $this->statsDetail($user[0],'forcereward',0);
+        } else{
             $this->statsDetail($user[0],'wreward',0);
         }
         $get_free_currency = UserBindHkWelfareService::isHasGet($user[0]);
@@ -532,12 +538,14 @@ 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','GUIDE_PERSONAL_ACCOUNT_ONE_LOOP_MAX_USER');
+        $env_config = redisEnvMulti('ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
+            'ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_UV','ACTIVE_GUIDE_PERSONAL_ACCOUNT_ID',
+            'ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
         $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');
+        $uv = Redis::scard('active_guide_personal_uv');
         $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: '.);
@@ -558,11 +566,12 @@ class CoflController extends Controller
                 ->where('is_enable',1)
                 ->whereIn('status',[1,0])
                 ->select('id','url')
+                ->where('group','ACTIVE')
                 ->where('count','<',$max)
                 ->orderBy('count','asc')
                 ->orderBy('id')
                 ->first();
-            Redis::del('guide_personal_uv');
+            Redis::del('active_guide_personal_uv');
             if($account){
                 DB::table('personal_account_list')->where('id',$account->id)->update([
                     'status'=>1,
@@ -570,13 +579,13 @@ class CoflController extends Controller
                 ]);
                 $img = $account->url;
                 $now_id = $account->id;
-                Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
+                Redis::Hmset('env','ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'ACTIVE_GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
             }else{
-                Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','GUIDE_PERSONAL_ACCOUNT_ID','');
+                Redis::Hmset('env','ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','ACTIVE_GUIDE_PERSONAL_ACCOUNT_ID','');
                 return back();
             }
         }
-        Redis::sadd('guide_personal_uv',$uid);
+        Redis::sadd('active_guide_personal_uv',$uid);
 
         if($uid){
             DB::table('ad_pdd')->insert([

+ 51 - 8
app/Http/Controllers/Wap/User/UserController.php

@@ -434,19 +434,58 @@ class UserController extends BaseController
     }
 
     public function guidePersonalAccount(Request $request){
-        //
-        Log::info('in000000000000000000000000000');
-        list($img,$now_id) = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','GUIDE_PERSONAL_ACCOUNT_ID');
         $bid = $request->get('bid');
         $cid = $request->get('cid');
         $book_name = $request->get('book_name');
         $bid_no = Hashids::decode($bid)[0];
-        Log::info($bid);
-        Log::info($cid);
-        Log::info($bid_no);
-        ForceGuidePersonAccountService::create($this->uid,$bid_no,$cid);
 
-        $link = sprintf('/reader?bid=%s&cid=%s',$bid,$cid);
+        $env_config = redisEnvMulti('FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','FORCE_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
+            'FORCE_GUIDE_PERSONAL_ACCOUNT_ID','FORCE_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
+        $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('force_guide_personal_uv');
+        $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)
+                ->whereIn('status',[1,0])
+                ->select('id','url')
+                ->where('count','<',$max)
+                ->where('group','FORCE')
+                ->orderBy('count','asc')
+                ->orderBy('id')
+                ->first();
+            Redis::del('force_guide_personal_uv');
+            if($account){
+                DB::table('personal_account_list')->where('id',$account->id)->update([
+                    'status'=>1,
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
+                $img = $account->url;
+                $now_id = $account->id;
+                Redis::Hmset('env','FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'FORCE_GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
+            }else{
+                Redis::Hmset('env','FORCE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','FORCE_GUIDE_PERSONAL_ACCOUNT_ID','');
+            }
+        }
+        Redis::sadd('force_guide_personal_uv',$this->uid);
+
         DB::table('ad_pdd')->insert([
             'uid'=>$this->uid,
             'img'=>'FORCE_GUIDE_PERSONAL_ACCOUNT_'.$now_id,
@@ -454,6 +493,10 @@ class UserController extends BaseController
             'created_at'=>date('Y-m-d H:i:s'),
             'updated_at'=>date('Y-m-d H:i:s')
         ]);
+
+        ForceGuidePersonAccountService::create($this->uid,$bid_no,$cid);
+
+        $link = sprintf('/reader?bid=%s&cid=%s',$bid,$cid);
         return view('jump.forceGuidePersonalAccount',['img'=>$img,'link'=>$link,'title'=>$book_name]);
     }
     

+ 23 - 27
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -31,6 +31,7 @@ use App\Modules\User\Services\ReadRecordService;
 use App\Modules\Book\Services\BookConfigService;
 use DB;
 use App\Http\Controllers\Wap\Book\Transformers\BookTransformer;
+use Log;
 
 class WelcomeController extends BaseController
 {
@@ -2107,42 +2108,37 @@ class WelcomeController extends BaseController
     }
 
     private function guidePersonalAccount(){
-        //GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE
-        $env_config = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','GUIDE_PERSONAL_ACCOUNT_START_TIME','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
-        //\Log::info('guidePersonalAccount------------------------guidePersonalAccount');
-        //\Log::info($env_config);
-
-        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 );
-        $other_crm = Redis::hmget('channel:setting:'.$this->distribution_channel_id,['crm_status','crm_link']);
-        $other_switch = (!empty($other_crm[0]) && !empty($other_crm[1]));
-        if(!in_array($this->distribution_channel_id,explode(',',$env_config[0])) && !$other_switch ){
+        //weidian
+        $other_crm_config = Redis::hmget('channel:setting:'.$this->distribution_channel_id,['crm_status','crm_link']);
+        $crm_config = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_SITES','ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE');
+        if(empty($other_crm_config[0]) && empty($other_crm_config[1]) && empty($crm_config[0]) && empty($crm_config[1])){
             return '';
         }
-        //\Log::info('distribution_channel_id in');
-        $guide_personal_account_start_time = $env_config[1];
-        if(!$guide_personal_account_start_time)
-            return false;
-
+        Log::info('guidePersonalAccount1111111111111111111111');
         $get_info = UserBindHkWelfareService::isHasGet($this->uid);
-        if($get_info){
-            return '';
-        }
+        if($get_info)   return '';
+        Log::info('guidePersonalAccount2222222222222222222222');
         $charge = $this->is_paid;
         if($this->distribution_channel_id == 6687){
             $charge = true;
         }
+
+        if($other_crm_config[0] && $other_crm_config[1]){
+            if($charge)
+                return ['title'=>'点击领取200书币>>','link'=>$other_crm_config[1]];
+            return '';
+        }
+        Log::info('guidePersonalAccount33333333333333333');
+        if(empty($crm_config[0]) || empty($crm_config[1])) return '';
+        Log::info('guidePersonalAccount4444444444444444');
+        if(!in_array($this->distribution_channel_id,explode(',',$crm_config[0]))){
+            return '';
+        }
+        Log::info('guidePersonalAccount555555555555555');
         if($charge){
-            if(!empty($other_crm[1])){
-                return ['title'=>'点击领取200书币>>','link'=>$other_crm[1]];
-            }else{
-                return ['title'=>'点击领取200书币>>','link'=>'/guidestrem?uid='.$this->uid];
-            }
+            return ['title'=>'点击领取200书币>>','link'=>'/guidestrem?uid='.$this->uid];
         }
-        return  '';
+        return '';
     }
 
     private function setIsPaid(){

+ 1 - 0
app/Http/Routes/Wap/WapRoutes.php

@@ -54,6 +54,7 @@ Route::group(['domain'=>env('FRIEND_LINK_DOMAIN'),'namespace'=>'App\Http\Control
     Route::get('freecurrency','User\CoflController@freeCurrencyView');
     Route::get('wfreecurrency','User\CoflController@freeCurrencyView');
     Route::get('freethrhcurrency','User\CoflController@freeCurrencyView');
+    Route::get('frocefreethrhcurrency','User\CoflController@freeCurrencyView');
     Route::post('freecurrency','User\CoflController@freeCurrencyPost');
     Route::get('activity','User\CoflController@longActivity');
 });