Browse Source

crm guide year and month

zz 5 years ago
parent
commit
c649a39133

+ 107 - 166
app/Http/Controllers/Wap/Crm/CrmGuideFansController.php

@@ -17,137 +17,62 @@ use Hashids;
 
 class CrmGuideFansController extends BaseController
 {
-
+    private $crm_one_day_exposure_limit;
+    private $crm_one_time_exposure_limit;
+    private $now_personal_account_info;
+    private $crm_now_exposure_uv;
     /**
      * 主动导粉
      * @param Request $request
      * @param $channel_id
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View}
      */
-    public function activeGuidePersonalAccount(Request $request,$channel_id){
-        $uid = $request->get('uid',0);
-        //$user_cookie = Cookie::get(env('COOKIE_AUTH_WEB_WECHAT'));
-        //$uid = $user_cookie ? decrypt($user_cookie) : null;
+    public function activeGuidePersonalAccountV2(Request $request){
+        $uid = $this->uid;
         $cookie_crm_img = Cookie::get('crm_person_img');
         $cookie_crm_name = Cookie::get('crm_person_name','');
-        $request_img = $request->get('img');
         $fee = $request->get('fee',200);
-        if($request_img){
-            $name = $request_img = $request->get('name');
-            return view('jump.guidePersonalAccountOurs',['img'=>$cookie_crm_img,'name'=>$name,'fee'=>$fee]);
+        $group = $request->get('group','ACTIVE');
+        $page = 'jump.guidePersonalAccountOurs';
+        if(in_array($group,['ACTIVE_YEAR','ACTIVE_MONTH'])){
+            $page = 'crm.vipguidePersonalAccount';
         }
-        $get_info = UserBindHkWelfareService::isHasGet($uid);
-
-        if($get_info)   return back();
         if($cookie_crm_img){
-            return view('jump.guidePersonalAccountOurs',['img'=>$cookie_crm_img,'name'=>$cookie_crm_name,'fee'=>$fee]);
+            return view($page,['img'=>$cookie_crm_img,'name'=>$cookie_crm_name,'fee'=>$fee]);
         }
 
-        $distribution_channel_id = decodeDistributionChannelId($channel_id);
-        //$distribution_channel_id = $channel_id;
-        //if(in_array($distribution_channel_id,Redis::SISMEMBER('')));
-        //$out = false;
-        $group = 'ACTIVE';
-        if(Redis::SISMEMBER('crm:out_channel_sites',$distribution_channel_id)){
-            //$out = true;
-            $group = 'OUT_ACTIVE';
-            $env_config = redisEnvMulti('OUT_ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
-                'OUT_ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_UV','OUT_ACTIVE_GUIDE_PERSONAL_ACCOUNT_ID',
-                'OUT_ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
-        }else{
-            $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');
-        }
-        if(empty($env_config[0])){
+        list($img,$max,$now_id,$one_loop_max) = redisEnvMulti(strtoupper($group).'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
+            strtoupper($group).'_GUIDE_PERSONAL_ACCOUNT_MAX_UV',strtoupper($group).'_GUIDE_PERSONAL_ACCOUNT_ID',
+            strtoupper($group).'_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
+        if(empty($img) || empty($now_id)){
             return back();
         }
-        //$img = empty($env_config[0])?'https://cdn-novel.iycdm.com/h5/personal_account/chenchen.jpg':$env_config[0];
-        $img =$env_config[0];
-        $max = empty($env_config[1])?100:$env_config[1];
-        $max = (int)$max;
-        $one_loop_max = empty($env_config[3])?10:$env_config[3];
-        $now_id = (int)$env_config[2];
-
-        if($group == 'OUT_ACTIVE'){
-            $uv_key = 'out_active_guide_personal_uv';
-        }else{
-            $uv_key = 'active_guide_personal_uv';
-        }
-        $uv = Redis::scard($uv_key);
-        $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('count')->first();
+        $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('id','name','count','status','url','group')->first();
         if(!$personal_info){
             return back();
         }
-        $total_max = (int)($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('group',$group)
-                ->where('count','<',$max)
-                ->orderBy('count','asc')
-                ->orderBy('id')
-                ->first();
-            Redis::del($uv_key);
-            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',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,$group.'_GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
-            }else{
-                Redis::Hmset('env',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','',$group.'_GUIDE_PERSONAL_ACCOUNT_ID','');
-                return back();
-            }
-        }
-        Redis::sadd($uv_key,$uid);
-
-        if($uid){
-            if($group == 'OUT_ACTIVE'){
-                DB::table('ad_pdd')->insert([
-                    'uid'=>$uid,
-                    'img'=>'OUT_GUIDE_PERSONAL_ACCOUNT_'.$now_id,
-                    'date'=>date('Y-m-d'),
-                    'created_at'=>date('Y-m-d H:i:s'),
-                    'updated_at'=>date('Y-m-d H:i:s')
-                ]);
-                $user = UserService::getById($uid);
-                Redis::hset('crm:out_guide_exposure_user',$user->openid,$uid);
-            }else{
-                DB::table('ad_pdd')->insert([
-                    'uid'=>$uid,
-                    'img'=>'GUIDE_PERSONAL_ACCOUNT_'.$now_id,
-                    'date'=>date('Y-m-d'),
-                    'created_at'=>date('Y-m-d H:i:s'),
-                    'updated_at'=>date('Y-m-d H:i:s')
-                ]);
-            }
+        $this->now_personal_account_info = $personal_info;
+        //单日曝光上线
+        $max = (int)(empty($max)?100:$max);
+        $this->crm_one_day_exposure_limit = $max;
+        //单次曝光上线
+        $one_loop_max = empty($one_loop_max)?10:$one_loop_max;
+        $this->crm_one_time_exposure_limit = $one_loop_max;
+        $uv_key = strtolower($group).'_guide_personal_uv';
+        $uv = Redis::scard($uv_key);
+        $this->crm_now_exposure_uv = $uv;
 
+        $this->crmGuideProcess();
+        if(!$this->now_personal_account_info){
+            return back();
         }
-        $name = '';
-        $name_info = DB::table('personal_account_list')->where('id',$now_id)->select('name')->first();
-        if($name_info){
-            $name = $name_info->name;
+        if($group == 'OUT_ACTIVE'){
+            $user = UserService::getById($uid);
+            Redis::hset('crm:out_guide_exposure_user',$user->openid,$uid);
         }
 
-        $page = 'jump.guidePersonalAccountOurs';
+        $name = $this->now_personal_account_info->name;
+        $img = $this->now_personal_account_info->url;
         $time = strtotime(date('Y-m-d',time()+86400))-time();
         Cookie::queue('crm_person_img', $img,$time);
         Cookie::queue('crm_person_name', $name,$time);
@@ -159,85 +84,101 @@ class CrmGuideFansController extends BaseController
      * @param Request $request
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
      */
-    public function forceGuidePersonalAccount(Request $request)
+    public function forceGuidePersonalAccountV2(Request $request)
     {
         $bid = $request->get('bid');
         $cid = $request->get('cid');
         $prev_cid = $request->get('prev_cid');
         $book_name = $request->get('book_name');
         $bid_no = Hashids::decode($bid)[0];
-        if (Redis::SISMEMBER('crm:out_channel_sites', $this->distribution_channel_id)) {
+        $group = $request->get('group','FORCE');
+        /*if (Redis::SISMEMBER('crm:out_channel_sites', $this->distribution_channel_id)) {
             $group = 'OUT_FORCE';
         } else {
             $group = 'FORCE';
-        }
-        $env_config = redisEnvMulti($group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
+        }*/
+        list($img,$max,$now_id,$one_loop_max) = redisEnvMulti($group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
             $group . '_GUIDE_PERSONAL_ACCOUNT_ID', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
-        if (empty($env_config[0])) return back();
-        $img = $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(strtolower($group) . '_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', $group)
-                ->orderBy('count', 'asc')
-                ->orderBy('id')
-                ->first();
-            Redis::del(strtolower($group) . '_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', $group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $account->url, $group . '_GUIDE_PERSONAL_ACCOUNT_ID', $account->id);
-            } else {
-                Redis::Hmset('env', $group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', '', $group . '_GUIDE_PERSONAL_ACCOUNT_ID', '');
-            }
+        $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('id','name','count','status','url','group')->first();
+        if(!$personal_info){
+            return back();
         }
-        Redis::sadd(strtolower($group) . '_guide_personal_uv', $this->uid);
+        $this->now_personal_account_info = $personal_info;
+        //单日曝光上线
+        $max = (int)(empty($max)?100:$max);
+        $this->crm_one_day_exposure_limit = $max;
+        //单次曝光上线
+        $one_loop_max = empty($one_loop_max)?10:$one_loop_max;
+        $this->crm_one_time_exposure_limit = $one_loop_max;
+        $uv_key = strtolower($group).'_guide_personal_uv';
+        $uv = Redis::scard($uv_key);
+        $this->crm_now_exposure_uv = $uv;
+        $this->crmGuideProcess();
+
         if ($group == 'OUT_FORCE') {
             $data = UserService::getById($this->uid);
             Redis::hset('crm:out_guide_exposure_user', $data->openid, $this->uid);
         }
-        $personal_info = DB::table('personal_account_list')->where('id', $now_id)->select('name')->first();
-        DB::table('ad_pdd')->insert([
-            'uid' => $this->uid,
-            'img' => $group . '_GUIDE_PERSONAL_ACCOUNT_' . $now_id,
-            'date' => date('Y-m-d'),
-            'created_at' => date('Y-m-d H:i:s'),
-            'updated_at' => date('Y-m-d H:i:s')
-        ]);
 
+        $img = $this->now_personal_account_info->url;
         ForceGuidePersonAccountService::create($this->uid, $bid_no, $cid);
 
         $link['next'] = sprintf('/reader?bid=%s&cid=%s', $bid, $cid);
         $link['prev'] = sprintf('/reader?bid=%s&cid=%s', $bid, $prev_cid);
         $link['catalog'] = sprintf('/catalog?id=%s', $bid);
 
-        return view('jump.forceGuidePersonalAccountV2', ['img' => $img, 'link' => $link, 'title' => $book_name, 'name' => $personal_info->name]);
+        return view('jump.forceGuidePersonalAccountV2', ['img' => $img, 'link' => $link, 'title' => $book_name, 'name' => $this->now_personal_account_info->name]);
+    }
+
+    private function crmGuideProcess(){
+        $group = strtoupper($this->now_personal_account_info->group);
+        $total_max = $this->crm_now_exposure_uv+$this->now_personal_account_info->count;
+        if($this->crm_now_exposure_uv >= $this->crm_one_time_exposure_limit || $total_max >= $this->crm_one_day_exposure_limit){
+            if($total_max>= $this->crm_one_day_exposure_limit){
+                DB::table('personal_account_list')->where('id',$this->now_personal_account_info->id)->update([
+                    'status'=>2,
+                    'count'=>$total_max,
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
+            }else{
+                DB::table('personal_account_list')->where('id',$this->now_personal_account_info->id)->increment('count',$this->crm_now_exposure_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','name','count','status','url','group')
+                ->where('group',$this->now_personal_account_info->group)
+                ->where('count','<',$this->crm_one_day_exposure_limit)
+                ->orderBy('count','asc')
+                ->orderBy('id')
+                ->first();
+
+            Redis::del(strtolower($group) . '_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')
+                ]);
+                $this->now_personal_account_info = $account;
+                Redis::Hmset('env',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,$group.'_GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
+            }else{
+                Redis::Hmset('env',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','',$group.'_GUIDE_PERSONAL_ACCOUNT_ID','');
+                $this->now_personal_account_info= null;
+            }
+        }
+        if($this->now_personal_account_info){
+            Redis::sadd(strtolower($group) . '_guide_personal_uv',$this->uid);
+            DB::table('ad_pdd')->insert([
+                'uid'=>$this->uid,
+                'img'=>strtoupper($group).'_PERSONAL_ACCOUNT_'.$this->now_personal_account_info->id,
+                'date'=>date('Y-m-d'),
+                'created_at'=>date('Y-m-d H:i:s'),
+                'updated_at'=>date('Y-m-d H:i:s')
+            ]);
+        }
     }
 
 

+ 79 - 1
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -244,7 +244,7 @@ class WelcomeController extends BaseController
             'crm' => $crm,
             'self_pa_ad_switch' => $self_pa_ad_switch,//自有平台广告开关
             'banners' => $banners,
-            'guidepersonalaccount' => $this->guidePersonalAccount($user->openid),
+            'guidepersonalaccount' => $this->guidePersonalAccountV2(),
             'cpc_channel' => $cpc_channel,
             'month_order_info' => $month_order_info,
             'xiyue_info' => $xiyue_info
@@ -2156,7 +2156,84 @@ class WelcomeController extends BaseController
             \Log::info($e);
         }*/
     }
+    private function guidePersonalAccountV2(){
+        //内部站点导粉
+        list($inner_sites,$year_qrcode,$month_qrcode,$out_qrcode) =  redisEnvMulti(
+            'GUIDE_PERSONAL_ACCOUNT_SITES',
+            'ACTIVE_YEAR_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
+            'ACTIVE_MONTH_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
+            'OUT_ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE'
+        );
+        //if(in_array($thy))
+        if ($inner_sites && in_array($this->distribution_channel_id, explode(',', $inner_sites))) {
+            //1.包年包月用户
+            $get_info = UserBindHkWelfareService::isHasGet($this->uid);
+            if ($get_info) return '';
+            $charge = false;
+            if (in_array($this->property, ['medium', 'high'])) {
+                $charge = true;
+            } else {
+                if ($this->property == 'undefined' && OrderService::getChargeNum($this->uid) >= 10) {
+                    $charge = true;
+                }
+            }
+            if(!$charge) return '';
+            if($year_qrcode && OrderService::isYearOrderUser($this->uid) ){
+                //包年
+                return ['title' => '您有500书币待领取>>', 'link' => '/guidestremv2?group=ACTIVE_YEAR&fee=500'];
+            }
+            if($month_qrcode && UserMonthService::isMonthOrderUser($this->uid) ){
+                //包月
+                return ['title' => '您有500书币待领取>>', 'link' => '/guidestremv2?group=ACTIVE_MONTH&fee=500'];
+            }
+            return ['title' => '您有500书币待领取>>', 'link' => '/guidestrem?uid=' . $this->uid . '&fee=500'];
+        }
+        //外站导粉
+        if($out_qrcode && Redis::SISMEMBER('crm:out_channel_sites', $this->distribution_channel_id)){
+            $get_info = UserBindHkWelfareService::isHasGet($this->uid);
+            if ($get_info) return '';
+            $charge = false;
+            if (in_array($this->property, ['medium', 'high'])) {
+                $charge = true;
+            } else {
+                if ($this->property == 'undefined' && OrderService::getChargeNum($this->uid) >= 10) {
+                    $charge = true;
+                }
+            }
+            if(!$charge) return '';
+            $filter_city = ['长沙', '深圳', '杭州'];
+            $ip2region = new Ip2Region();
+            if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
+                $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+            } else {
+                $ip = get_client_ip();
+            }
+            $info = [];
+            try {
+                $info = $ip2region->btreeSearch($ip);
+            } catch (\Exception $e) {
+            }
 
+            if (!$info || !isset($info['region'])) return '';
+            $region = explode('|', $info['region']);
+            $city = isset($region[3]) ? $region[3] : '';
+            if (in_array($city, $filter_city)) {
+                return '';
+            }
+            $count = ChapterOrderService::getRecentChapterOrderCount($this->uid);
+            if ($count < 50) {
+                return '';
+            }
+            Cookie::queue('is_force_out_guide', 1);
+            return ['title' => '您有500书币待领取>>', 'link' => '/guidestrem?uid=' . $this->uid . '&fee=500'];
+        }
+        //渠道自己导粉
+        $other_crm_config = Redis::hmget('channel:setting:' . $this->distribution_channel_id, ['crm_status', 'crm_link']);
+        if (empty($other_crm_config[0]) && empty($other_crm_config[1])) return '';
+        if($this->is_paid || $this->distribution_channel_id == 6687)
+            return ['title' => '点击领取200书币>>', 'link' => $other_crm_config[1]];
+        return '';
+    }
     private function guidePersonalAccount($openid)
     {
         //weidian
@@ -2236,6 +2313,7 @@ class WelcomeController extends BaseController
         //Log::info('guidePersonalAccount555555555555555');
         if ($charge) {
             return ['title' => '您有500书币待领取>>', 'link' => '/guidestrem?uid=' . $this->uid . '&fee=500'];
+            //return ['title' => '您有500书币待领取>>', 'link' => '/guidestrem?uid=' . $this->uid . '&fee=500'];
         }
         return '';
     }

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

@@ -329,6 +329,8 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
 
         Route::get('rmonthpay','Order\OrdersController@monthPay');
         Route::get('crmpush','User\UserController@crmPushView');
+        //crm导粉
+        Route::get('guidestremv2','Crm\CrmGuideFansController@activeGuidePersonalAccountV2');
 
         Route::any('{slug}','Web\WelcomeController@index')->where('slug', '(.*)?');
 

+ 13 - 0
app/Modules/Subscribe/Services/OrderService.php

@@ -224,4 +224,17 @@ WHERE  send_order_id = %s and order_type= 'RECHARGE' ";
     {
         return Order::where('uid',$uid)->where('status','PAID')->sum('price');
     }
+
+    public static function isYearOrderUser($uid){
+        $info = Order::where('uid',$uid)
+            ->where('status','PAID')
+            ->where('order_type','YEAR')
+            ->orderBy('id','desc')
+            ->select('created_at')
+            ->first();
+        if($info && strtotime($info->created_at)+365*86400 >time() ){
+            return true;
+        }
+        return false;
+    }
 }

+ 13 - 0
app/Modules/User/Services/UserMonthService.php

@@ -87,4 +87,17 @@ class UserMonthService
         $result = $client->request('post',$url)->getBody()->getContents();
         return json_decode($result,true);
     }
+
+
+    public static function isMonthOrderUser($uid){
+        $info = UserMonthOrder::where('uid',$uid)
+            ->where('type','MONTH')
+            ->orderBy('id','desc')
+            ->select('created_at')
+            ->first();
+        if($info && strtotime($info->created_at)+365*86400 >time() ){
+            return true;
+        }
+        return false;
+    }
 }

+ 97 - 0
resources/views/crm/vipguidePersonalAccount.blade.php

@@ -0,0 +1,97 @@
+<!--?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2019/9/18
+ * Time: 10:34
+ */
+-->
+<!--
+ * @Author: ZhengXiaowei
+ * @Date: 2019-08-15 16:39:23
+ * @LastEditors: ZhengXiaowei
+ * @LastEditTime: 2019-09-03 14:15:51
+ * @Description: 弹窗页
+ -->
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8" />
+    <meta
+            name="viewport"
+            content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
+    />
+    <link rel=icon type=image/png href="data:image/png;base64,iVBORw0KGgo=">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+    <style>
+        html,
+        body,
+        p {
+            padding: 0;
+            margin: 0;
+        }
+
+        html {
+            font-size: 100px;
+        }
+
+        main {
+            font-size: 0;
+            position: relative;
+        }
+
+        main img {
+            width: 100%;
+        }
+
+        main .month {
+            position: absolute;
+            top: 2%;
+            left: 50%;
+            -webkit-transform: translate(-50%, 0);
+            transform: translate(-50%, 0);
+            width: 60%;
+        }
+
+        main .qrcode-wrap {
+            position: absolute;
+            top: 51%;
+            left: 50%;
+            -webkit-transform: translate(-50%, 0);
+            transform: translate(-50%, 0);
+            width: 60%;
+            font-size: 14px;
+            font-weight: bold;
+            color: #666;
+            text-align: center;
+        }
+
+        main .qrcode-wrap img {
+            width: 45%;
+            height: 45%;
+        }
+    </style>
+    <title>畅销小说榜</title>
+</head>
+<body>
+<main>
+    <img class="month" src="https://cdn-novel.iycdm.com/crm/guide/{{date('n')}}.png" alt="" />
+    <img class="bg" src="https://cdn-novel.iycdm.com/crm/guide/bg.jpg" alt="" />
+    <div class="qrcode-wrap">
+        <img src="{{$img}}" alt="" class="qr-code" />
+        <p>添加微信阅读管家 {{$name}}</p>
+    </div>
+</main>
+</body>
+<script>
+    var doc = document;
+    doc.body.addEventListener(
+            "click",
+            function() {
+                var qrcodeTop = doc.querySelector(".qrcode-wrap");
+                window.scrollTo(0, qrcodeTop.offsetTop);
+            },
+            false
+    );
+</script>
+</html>