|
@@ -352,21 +352,34 @@ class CoflController extends Controller
|
|
public function guidePersonalAccount(Request $request,$channel_id){
|
|
public function guidePersonalAccount(Request $request,$channel_id){
|
|
$uid = $request->get('uid',0);
|
|
$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];
|
|
$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];
|
|
$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];
|
|
$now_id = (int)$env_config[2];
|
|
$uv = Redis::scard('guide_personal_uv');
|
|
$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')
|
|
$account = DB::table('personal_account_list')
|
|
->where('is_enable',1)
|
|
->where('is_enable',1)
|
|
- ->where('status',0)
|
|
|
|
|
|
+ ->whereIn('status',[1,0])
|
|
->select('id','url')
|
|
->select('id','url')
|
|
|
|
+ ->where('count','<',$max)
|
|
|
|
+ ->orderBy('count','asc')
|
|
->orderBy('id')
|
|
->orderBy('id')
|
|
->first();
|
|
->first();
|
|
Redis::del('guide_personal_uv');
|
|
Redis::del('guide_personal_uv');
|
|
@@ -379,6 +392,7 @@ class CoflController extends Controller
|
|
$now_id = $account->id;
|
|
$now_id = $account->id;
|
|
Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
|
|
Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
|
|
}else{
|
|
}else{
|
|
|
|
+ Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','GUIDE_PERSONAL_ACCOUNT_ID','');
|
|
return back();
|
|
return back();
|
|
}
|
|
}
|
|
}
|
|
}
|