Browse Source

Merge branch 'master' of iqiyoo:zhuishuyun_wap

onlinetest 6 years ago
parent
commit
672a4e2a9d

+ 2 - 1
app/Http/Controllers/Wap/Pay/MonthOrderController.php

@@ -71,8 +71,9 @@ class MonthOrderController extends Controller
         }
         $sign = _sign(compact('app_id','plan_id','user_id','change_type'),$key.$key);
         $sign = strtoupper($sign);
+        $user_info = UserService::getById($user_id);
         if($sign == $request->post('sign')){
-            UserMonthService::createSign($user_id,$plan_id,$change_type);
+            UserMonthService::createSign($user_id,$plan_id,$change_type,$user_info->openid);
         }
         Log::info('signCallBack-------------------end-----------------------signCallBack');
         return response('success');

+ 10 - 7
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -16,6 +16,7 @@ use App\Modules\User\Services\ForceSubscribeUserIService;
 use App\Modules\User\Services\UserBindHkWelfareService;
 use App\Modules\User\Services\UserDivisionCpcPropertyService;
 use App\Modules\User\Services\UserDivisionPropertyService;
+use App\Modules\User\Services\UserMonthService;
 use App\Modules\User\Services\UserService;
 use Illuminate\Http\Request;
 use App\Http\Controllers\Wap\BaseController;
@@ -189,7 +190,7 @@ class WelcomeController extends BaseController
 
         //用户分割
         $this->userPproperty($user->openid);
-        $month_order_info = $this->monthOrderInfo();
+        $month_order_info = $this->monthOrderInfo($user->openid);
         $options = json_encode([
             'distribution_channel_id' => (int)$this->distribution_channel_id,
             'send_order_id' => $send_order_id,
@@ -2187,17 +2188,19 @@ class WelcomeController extends BaseController
             }
         }
     }
-    private function monthOrderInfo(){
+    private function monthOrderInfo($openid){
         $property = $this->property;
         if (!$property) $property = 'low';
         if (in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))
             && in_array($property, ['low', 'medium'])
         ) {
-            return [
-                'price'=>'30元',
-                'text' => '30元包月 全站万本精彩小说免费看',
-                'link'=>generateMonthOrderUrl($this->uid)
-            ];
+            if(!UserMonthService::isSignMonth($openid)){
+                return [
+                    'price'=>'30元',
+                    'text' => '30元包月 全站万本精彩小说免费看',
+                    'link'=>generateMonthOrderUrl($this->uid)
+                ];
+            }
         }
         return '';
     }

+ 1 - 1
app/Modules/User/Models/UserMonthSign.php

@@ -7,5 +7,5 @@ use Illuminate\Database\Eloquent\Model;
 class UserMonthSign extends Model
 {
     protected $table = 'user_month_sign';
-    protected $fillable = ['uid','plan_id','change_type'];
+    protected $fillable = ['uid','plan_id','change_type','openid'];
 }

+ 7 - 1
app/Modules/User/Services/UserMonthService.php

@@ -13,7 +13,7 @@ use App\Modules\User\Models\UserMonthSign;
 
 class UserMonthService
 {
-    public static function createSign(int $uid, int $plan_id, string $change_type)
+    public static function createSign(int $uid, int $plan_id, string $change_type,string $openid)
     {
         $model = new UserMonthSign();
         $info = $model->where('uid', $uid)->where('plan_id', $plan_id)->first();
@@ -24,11 +24,17 @@ class UserMonthService
             $model->uid = $uid;
             $model->plan_id = $plan_id;
             $model->change_type = $change_type;
+            $model->openid = $openid;
             $model->save();
         }
         return;
     }
 
+    public static function isSignMonth($openid){
+        $model = new UserMonthSign();
+        return $model->where('openid',$openid)->where('change_type','ADD')->select('id')->first();
+    }
+
     public static function createLOrder(int $uid, int $plan_id, int $total_fee, string $trade_no,string $out_trade_no)
     {
         $model = new UserMonthOrder();

+ 4 - 4
resources/views/wap/index.blade.php

@@ -9,7 +9,7 @@
     <script>window.VueRouter || document.write('<script src="https://cdn-novel.iycdm.com/static/vue-router.min.js"><\/script>')</script>
     <script>(window.Vue && window.VueLazyload) || document.write('<script src="https://cdn-novel.iycdm.com/static/vue-lazyload.js"><\/script>')</script>
     <title>{{$title}}</title>
-    <link href=https://cdn-novel.iycdm.com/static2019-7-30/css/app.b9e2cf4ae5caf4911372a00d337f8a47.css rel=stylesheet>
+    <link href=https://cdn-novel.iycdm.com/static2019-7-31/css/app.924cd356e44e4ab8a47c25a7485d3f6e.css rel=stylesheet>
 </head>
 <body>
 <div id=app></div>
@@ -32,8 +32,8 @@
     })();</script>
 <script id=options>window.options = {!! $options!!};</script>
 <script type=text/javascript
-        src=https://cdn-novel.iycdm.com/static2019-7-30/js/manifest.7d589a9e4ea59354792d.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-7-30/js/vendor.67516a6a43f9adc48771.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-7-30/js/app.66031ffabc3372dab827.js></script>
+        src=https://cdn-novel.iycdm.com/static2019-7-31/js/manifest.4b65c9f1fb675a959558.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-7-31/js/vendor.67516a6a43f9adc48771.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-7-31/js/app.318862f944c8bb5c5f7f.js></script>
 </body>
 </html>