ソースを参照

Merge branch 'master' of iqiyoo:zhuishuyun_wap

onlinetest 6 年 前
コミット
b0dedcabf4

+ 76 - 0
app/Console/Commands/UpdateOuter.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace App\Console\Commands;
+
+use GuzzleHttp\Cookie\SetCookie;
+use Illuminate\Console\Command;
+use GuzzleHttp\Client;
+use App\Modules\Book\Models\Book;
+use App\Modules\Book\Models\Chapter;
+
+class UpdateOuter extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'book:updateouter {--type=} {--bid=}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        //
+    }
+
+    //微月云
+    private function updateOneFromWyy($bid,$wyy_bid){
+        $jar = new \GuzzleHttp\Cookie\CookieJar(false,[
+            new SetCookie(['Name'=>'PHPSESSID','Value'=>'np1pu5oj2taacado7h4gn0usf2']),
+            new SetCookie(['Name'=>'getuserinfo','Value'=>'1']),
+            new SetCookie(['Name'=>'user_id','Value'=>'268860471']),
+            new SetCookie(['Name'=>'subscribe','Value'=>'1']),
+            new SetCookie(['Name'=>'user_name','Value'=>'we20190312']),
+            new SetCookie(['Name'=>'admin_id','Value'=>'326695218']),
+            new SetCookie(['Name'=>'shell','Value'=>'8de1e2d1789ed1a7a6f1673d9373123d']),
+            new SetCookie(['Name'=>'OPENID','Value'=>'olpZ50lR6G-pLQ8WYiQXVw6Wg8U0']),
+            new SetCookie(['Name'=>'VALIDON','Value'=>'1566467472']),
+            new SetCookie(['Name'=>'CRC','Value'=>'5e3a06c9424d5c3c80ad82371d5dec16'])
+        ]);
+        $last_chapter = Chapter::where('bid',$bid)
+            ->select('id','name','sequence','prev_cid','next_cid')
+            ->orderBy('sequence','desc')
+            ->first();
+        $now_sequence  = $last_chapter->sequence+1;
+        $url_format = 'https://wxg6y88rwiqvjkvx.weiyueyunsc.com/ChapterContent/content/fromaid/326695218.html?bookid=%s&num=%s';
+        while (true){
+
+        }
+
+        $url = sprintf($url_format,$wyy_bid,1);
+        $client = new Client();
+
+    }
+
+}

+ 1 - 1
app/Http/Controllers/Wap/BaseController.php

@@ -74,7 +74,7 @@ class BaseController extends Controller
             $auth_uid = $request->get('auth_uid');
             $atime = $request->get('atime');
             $sign = $request->get('sign');
-            if(get_sign(compact('auth_uid','atime')) == $sign && (time() - $atime) < 6){
+            if(get_sign(compact('auth_uid','atime')) == $sign && (time() - $atime) < 20){
                 $this->uid = $auth_uid;
             }
         }

ファイルの差分が大きいため隠しています
+ 15 - 5
app/Http/Controllers/Wap/Book/ChapterController.php


+ 22 - 1
app/Http/Controllers/Wap/Oauth/UsersV2Controller.php

@@ -86,7 +86,14 @@ class UsersV2Controller extends Controller
                 unset($rp['ip']);
             }
         }
-        !$user && $user = $this->createUser($openid,$unionid,$distribution_channel_id,$send_order_id,$ip);
+        if(!$user){
+            $user = $this->createUser($openid,$unionid,$distribution_channel_id,$send_order_id,$ip);
+            $from = $request->get('from');
+            if($from && $from == 'xiyue' && $distribution_channel_id == 6985){
+                $this->xiyueUser($user->id,$openid);
+            }
+        }
+
 
         $query = ['auth_uid'=>$user->id,'atime'=>time()];
         $sign = get_sign($query);
@@ -230,4 +237,18 @@ class UsersV2Controller extends Controller
         return '';
     }
 
+
+    private function xiyueUser($uid,$openid){
+        try{
+            DB::table('xiyue_zsy_users')->insert([
+                'uid'=>$uid,
+                'xiyue_uid'=>0,
+                'openid'=>$openid,
+                'created_at'=>date('Y-m-d H:i:s'),
+                'updated_at'=>date('Y-m-d H:i:s')
+            ]);
+        }catch (\Exception $e){}
+
+    }
+
 }

+ 29 - 0
app/Http/Controllers/Wap/Order/OrdersController.php

@@ -267,6 +267,7 @@ class OrdersController extends BaseController
         $property = UserDivisionCpcPropertyService::getUserPropertyV2($this->uid);
         $user_info = $this->_user_info;
         $this->monthPayExposureRecord($property,$user_info->openid);
+        $this->monthAbTest($property,$user_info->openid);
         foreach ($res as $v) {
             if ($template_id == 7 && $book_config && $book_config->charge_type == 'BOOK' && $v->price == 2) {
                 continue;
@@ -928,4 +929,32 @@ class OrdersController extends BaseController
         }
         return '';
     }
+
+    private function monthAbTest($property,$openid){
+        $start_time = redisEnv('MONTH_TEMPLATE_COMPARE_START_TIME', 0);
+        if (!$start_time) {
+            return 0;
+        }
+
+        $user = $this->_user_info;
+        if (strtotime($user->created_at) < $start_time) {
+            return 0;
+        }
+
+        if (in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))
+            && in_array($property, ['none','low', 'medium'])
+        ) {
+            $exist = DataAnalysisSelectUserService::getByUidAndType($this->uid, 'MONTH');
+            if ($exist) return true;
+            if(!UserMonthService::isSignMonth($openid)){
+                $attach = $this->uid %2 == 0 ? 'show':'hide';
+                DataAnalysisSelectUserService::create(
+                    $this->uid,
+                    $this->distribution_channel_id,
+                    'MONTH',
+                    -1, $attach);
+            }
+        }
+        return '';
+    }
 }

+ 7 - 1
app/Http/Controllers/Wap/Pay/OrdersController.php

@@ -2,7 +2,6 @@
 
 namespace App\Http\Controllers\Wap\Pay;
 
-use App\Admin\Models\User;
 use App\Modules\Book\Services\BookGiftsService;
 use App\Modules\Book\Services\ChapterService;
 use App\Modules\OfficialAccount\Services\OfficialAccountService;
@@ -2065,4 +2064,11 @@ class OrdersController extends Controller
             ]);
         }catch (\Exception $e){}*/
     }
+
+    private function notifyXiyue($uid,$price){
+        $xiyue_user = DB::table('xiyue_zsy_users')->where('uid',$uid)->select('openid')->first();
+        if($xiyue_user){
+
+        }
+    }
 }

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

@@ -193,9 +193,10 @@ class WelcomeController extends BaseController
                 }
             }
         }
+        $xiyue_info = $this->isXiyueUser();
 
         //用户分割
-        $this->userPproperty($user->openid);
+        $this->userPproperty();
         $month_order_info = $this->monthOrderInfo($user->openid);
         $options = json_encode([
             'distribution_channel_id' => (int)$this->distribution_channel_id,
@@ -243,7 +244,8 @@ class WelcomeController extends BaseController
             'banners'=>$banners,
             'guidepersonalaccount'=>$this->guidePersonalAccount($user->openid),
             'cpc_channel'=>$cpc_channel,
-            'month_order_info'=>$month_order_info
+            'month_order_info'=>$month_order_info,
+            'xiyue_info'=>$xiyue_info
         ]);
         if ($this->uid == env('SPECIAL_USER_LOG', 2)) {
             myLog('special')->info('welcome --------------------------');
@@ -2253,6 +2255,20 @@ class WelcomeController extends BaseController
     private function monthOrderInfo($openid){
         $property = $this->property;
         if (!$property) return '';
+        if(in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))){
+            $info = DataAnalysisSelectUserService::getByUidAndType($this->uid,'MONTH');
+            if($info){
+                if($info->attach == 'show'){
+                    return [
+                        'price'=>'30元',
+                        'text' => '30元包月 全站万本精彩小说免费看',
+                        'link'=> generateMonthOrderUrl($this->uid)
+                        //'link'=> '/rmonthpay'
+                    ];
+                }
+                return [];
+            }
+        }
         if (in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))
             && in_array($property, ['none','low', 'medium'])
         ) {
@@ -2268,4 +2284,16 @@ class WelcomeController extends BaseController
         return '';
     }
 
+    private function isXiyueUser(){
+        $result = DB::table('xiyue_zsy_users')->where('uid',$this->uid)->select('id')->first();
+        if($result){
+            return [
+                'is_xiyue_user'=>1,
+                'xiyue_index_page'=>'https://site5.leyuee.com',
+                'xiyue_pay_page'=>'https://site5.leyuee.com'
+            ];
+        }
+        return "";
+    }
+
 }

+ 1 - 1
app/Http/Middleware/ReadOauth.php

@@ -661,7 +661,7 @@ class ReadOauth
         $sign = $request->get('sign');
         if (!$auth_uid || !$atime || !$sign) return 0;
         if (!is_numeric($auth_uid) || !is_numeric($atime)) return 0;
-        if ((time() - $atime) > 5) return 0;
+        if ((time() - $atime) > 20) return 0;
         if (get_sign(compact('auth_uid', 'atime')) !== $sign) return 0;
         Cookie::queue(env('COOKIE_AUTH_WEB_WECHAT'), $auth_uid, env('U_COOKIE_EXPIRE'), null, null, false, false);
         return $auth_uid;

+ 1 - 0
app/Libs/Pay/Merchants/OriginBank.php

@@ -61,6 +61,7 @@ class OriginBank
                 ];
                 return $pay_info;
             }
+            Log::error($return_info);
         }catch (\Exception $e)
         {
             echo $e->getMessage();

+ 8 - 0
app/Modules/Subscribe/Services/YearOrderService.php

@@ -123,4 +123,12 @@ class YearOrderService
         ]);
         return true;
     }
+
+    static function cancel_year_order($uid){
+        $old = YearOrder::where('uid', $uid)->select('id', 'uid', 'u', 'begin_time', 'end_time', 'fee')->first();
+        if ($old) {
+            $old->end_time = date('Y-m-d H:i:s');
+            $old->save();
+        }
+    }
 }

+ 16 - 2
app/Modules/User/Services/UserDivisionCpcPropertyService.php

@@ -268,7 +268,14 @@ WHERE openid in (SELECT openid FROM users WHERE id = $uid)";
         $result =  UserDivisionCpcPropertyV2::where('openid',$openid)->where('is_enable',1)->select('property')->first();
         if($result)
             return $result->property;
-        return 'none';
+        $sql_format = 'select id,created_at from users WHERE  openid="%s" ORDER by created_at limit 1';
+        $info = DB::select(sprintf($sql_format,$openid));
+        if(!$info) return 'unknown';
+        foreach ($info as $item){
+            if( time()-strtotime($item->created_at) > 3*86400 )
+                return 'none';
+        }
+        return 'unknown';
     }
 
     public static function getUserPropertyV2($uid){
@@ -277,7 +284,14 @@ WHERE openid in (SELECT openid FROM users WHERE id = $uid)";
             ->select('user_division_cpc_property_v2.property')->first();
         if($result)
             return $result->property;
-        return 'none';
+        $sql_format = 'select id,created_at from users WHERE  openid = (select openid FROM users WHERE id=%s) ORDER by created_at limit 1';
+        $info = DB::select(sprintf($sql_format,$uid));
+        if(!$info) return 'unknown';
+        foreach ($info as $item){
+            if( time()-strtotime($item->created_at) > 3*86400 )
+                return 'none';
+        }
+        return 'unknown';
     }
 
     public static function updateV2($openid,$property=''){

+ 3 - 3
resources/views/wap-browser/index/index.blade.php

@@ -110,12 +110,12 @@
   .LOOP .x-book{
     padding: .2rem .56rem .2rem .28rem;        
   }
-  .HOT .x-book, .RECOM .x-book{
+  .HOT a, .RECOM a{
     float: left;
     padding-right: .5rem;
     margin-top: .36rem;
   }
-  .HOT a:nth-child(3n+1) .x-book, .RECOM  a:nth-child(3n+1) .x-book{
+  .HOT a:nth-child(3n+1), .RECOM  a:nth-child(3n+1){
     padding-right: 0;
   }
   .ZHIBO .x-book,.NEW_RECOM .x-book{
@@ -231,7 +231,6 @@
     text-align: center;
   }
 </style>
-<script src="/wapbrowser/web/TouchSlider.js"></script>
 @endsection
 
 @section('body')
@@ -344,6 +343,7 @@
 @endsection
 
 @section('foot')
+  <script src="/wapbrowser/web/TouchSlider.js"></script>
   <script>
     new TouchSlider('loop-wrap',{
       duration:600, 

+ 1 - 1
resources/views/wap-browser/template.blade.php

@@ -9,12 +9,12 @@
    {{-- <meta http-equiv="X-UA-Compatible" content="ie=edge">--}}
     <title>{{$title}}</title>
     <link href="/wapbrowser/web/base.css" rel="stylesheet">
-    <script src="/wapbrowser/web/refreshRem.js"></script>
     @yield('head')
 </head>
 <body>
 @yield('body')
 @yield('foot')
+<script src="/wapbrowser/web/refreshRem.js"></script>
 <script>
     var _hmt = _hmt || [];
     (function() {