Explorar o código

Merge branch 'master' of iqiyoo:zhuishuyun_wap

onlinetest %!s(int64=6) %!d(string=hai) anos
pai
achega
2322cd17bf

+ 25 - 2
app/Http/Controllers/Wap/Order/OrdersController.php

@@ -16,6 +16,7 @@ use App\Modules\User\Services\ForceSubscribeUserIService;
 use App\Modules\User\Services\UserDivisionCpcPropertyService;
 use App\Modules\User\Services\UserDivisionPropertyService;
 use App\Modules\User\Services\UserGiftService;
+use App\Modules\User\Services\UserMonthService;
 use App\Modules\User\Services\UserService;
 use App\Modules\Book\Services\BookService;
 use App\Modules\Channel\Services\PayTemplateService;
@@ -263,12 +264,16 @@ class OrdersController extends BaseController
         $appad = 0;
 
         $property = UserDivisionCpcPropertyService::getUserProperty($this->uid);
-
+        $user_info = $this->_user_info;
+        $this->monthPayExposureRecord($property,$user_info->openid);
         foreach ($res as $v) {
             if ($template_id == 7 && $book_config && $book_config->charge_type == 'BOOK' && $v->price == 2) {
                 continue;
             }
-
+            if($template_id == 2 && $v->type == 'NEW_USER' && !$bid){
+                //2元模版,直接进充值,不出现
+                continue;
+            }
             if ($v->type == 'NEW_USER' && $is_first_recharge) {
                 if (env('NO_NEW_USER_CHARGE') &&
                     in_array(
@@ -887,4 +892,22 @@ class OrdersController extends BaseController
             'Referer'=>$refer
         ]);
     }*/
+
+    private function monthPayExposureRecord($property,$openid){
+        if (!$property) return '';
+        if (in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))
+            && in_array($property, ['none','low', 'medium'])
+        ) {
+            if(!UserMonthService::isSignMonth($openid)){
+                try{
+                    DB::table('user_month_visit_record')->insert([
+                        'uid'=>$this->uid,'day'=>date('Y-m-d'),
+                        'created_at'=>date('Y-m-d H:i:s'),
+                        'updated_at'=>date('Y-m-d H:i:s')
+                    ]);
+                }catch (\Exception $e){}
+            }
+        }
+        return '';
+    }
 }

+ 17 - 3
app/Http/Controllers/Wap/Pay/MonthOrderController.php

@@ -8,6 +8,7 @@
 
 namespace App\Http\Controllers\Wap\Pay;
 
+use App\Modules\SendOrder\Services\SendOrderService;
 use App\Modules\Subscribe\Models\Order;
 use App\Modules\Subscribe\Services\OrderService;
 use App\Modules\Subscribe\Services\YearOrderService;
@@ -17,6 +18,7 @@ use GuzzleHttp\Client;
 use Illuminate\Routing\Controller;
 use Illuminate\Http\Request;
 use Log;
+use Redis;
 
 class MonthOrderController extends Controller
 {
@@ -128,6 +130,18 @@ class MonthOrderController extends Controller
     private function createOrder($uid,$distribution_channel_id,$product_id,$price,$trade_no,$transaction_id){
         $count = OrderService::getUserChargeTimes($uid);
         $count = $count + 1;
+        $send_order_id = 0;
+        try {
+            $send_order_id = (int)Redis::hget('book_read:' . $uid, 'send_order_id');
+        } catch (\Exception $e) {
+        }
+        $send_order_name = '';
+        if ($send_order_id) {
+            $send_order_info = SendOrderService::getById($send_order_id);
+            if ($send_order_info && isset($send_order_info->name) && !empty($send_order_info->name)) {
+                $send_order_name = $send_order_info->name;
+            }
+        }
         $init_order = [
             'distribution_channel_id' => $distribution_channel_id,
             'uid' => $uid,
@@ -138,9 +152,9 @@ class MonthOrderController extends Controller
             'pay_merchant_source' => 'MONTH',
             'pay_merchant_id' => 99,
             'create_ip' => '',
-            'send_order_id' => '',
-            'send_order_name' => '',
-            'order_type' => 'MONTH_ORDER',
+            'send_order_id' => $send_order_id,
+            'send_order_name' => $send_order_name,
+            'order_type' => 'RECHARGE',
             'from_bid' => '0',
             'from_type' => 'auto_month',
             'activity_id' => 0,

+ 3 - 3
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -2190,15 +2190,15 @@ class WelcomeController extends BaseController
     }
     private function monthOrderInfo($openid){
         $property = $this->property;
-        if (!$property) $property = 'low';
+        if (!$property) return '';
         if (in_array($this->distribution_channel_id, explode(',', redisEnv('OPEN_ORDER_INNER_SITES')))
-            && in_array($property, ['low', 'medium'])
+            && in_array($property, ['none','low', 'medium'])
         ) {
             if(!UserMonthService::isSignMonth($openid)){
                 return [
                     'price'=>'30元',
                     'text' => '30元包月 全站万本精彩小说免费看',
-                    'link'=> generateMonthOrderUrl($this->uid).'&redirect_url='
+                    'link'=> generateMonthOrderUrl($this->uid)
                 ];
             }
         }

+ 3 - 1
app/Libs/Pay/Merchants/Official.php

@@ -66,7 +66,7 @@ class Official
         ];
         $order = new Wxorder($attributes);
         $result = $payment->prepare($order);
-        Log::info('Official -------pay-----result----------');
+        Log::info('Official -------pay-----result---------- order is: '.$data['trade_no']);
         Log::info($result);
         if ($result->return_code == 'SUCCESS' && $result->result_code == 'SUCCESS') {
             $data = [
@@ -79,6 +79,8 @@ class Official
             $data['paySign'] = $this->MakeSign($data);
             return $data;
         }
+        Log::error('pay error order is: '.$data['trade_no']);
+        Log::error($result);
         return [];
     }
 

+ 9 - 1
app/Modules/Book/Models/BookConfig.php

@@ -2,6 +2,7 @@
 
 namespace App\Modules\Book\Models;
 
+use App\Modules\Book\Services\BookRoleService;
 use App\Modules\Book\Services\BookTagsService;
 use App\Modules\User\Services\ReadRecordService;
 use App\Modules\Book\Services\BookConfigService;
@@ -70,7 +71,14 @@ class BookConfig extends Model
                 //关键词查询
                 if ($key == 'key' && $v) {
 
-                    $res = $res->where('book_configs.book_name', 'like', '%' . $v . '%');
+                    //$res = $res->where('book_configs.book_name', 'like', '%' . $v . '%');
+                    $res = $res->where(function ($query) use ($v) {
+                        $query->where('book_configs.book_name', 'like', '%' . $v . '%');
+                            $roles_bids = BookRoleService::getBidsByRole($v);
+                            if(count($roles_bids)>0) {
+                                $query->orWhereIn('book_configs.bid',$roles_bids);
+                            }
+                    });
                     //->orWhere('books.intro', 'like', '%' . $v . '%')
                     //->orWhere('books.category_name', 'like', '%' . $v . '%')->orWhere('books.author', 'like', '%' . $v . '%')
                     //->orWhere('books.keyword', 'like', '%' . $v . '%');

+ 22 - 0
app/Modules/Book/Models/BookRoles.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Modules\Book\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class BookRoles extends Model
+{
+    protected $table = 'book_roles';
+    protected $fillable = ['bid','role'];
+
+    public static function getRolesByBid($bid) {
+        return self::where('bid',$bid)->get();
+    }
+
+    public static function getBidsByRole($role) {
+        return self::where('role',$role)->select('bid')->get()->pluck('bid')->all();
+    }
+    public static function  getById($id){
+        return self::where('id',$id)->first();
+    }
+}

+ 34 - 0
app/Modules/Book/Services/BookRoleService.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: tandunzhao
+ * Date: 2017/12/4
+ * Time: 上午11:49
+ */
+
+namespace App\Modules\Book\Services;
+
+use App\Modules\Book\Models\BookGifts;
+use App\Modules\Book\Models\BookGiftsSend;
+use App\Modules\Book\Models\BookRoles;
+use App\Modules\BookGifts\Models\BookGiftsStatsByBook;
+use App\Modules\BookGifts\Models\BookGiftsStatsByGift;
+use App\Modules\User\Services\UserService;
+use DB;
+use Redis;
+
+class BookRoleService
+{
+
+    public static function getRolesByBid($bid) {
+        return BookRoles::getRolesByBid($bid);
+    }
+
+    public static function getBidsByRole($role) {
+        return BookRoles::getBidsByRole($role);
+    }
+
+    public static function getById($id) {
+        return BookRoles::getById($id);
+    }
+}

+ 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-8-1/css/app.573de38fd36e46ece26aa959c23ae12d.css rel=stylesheet>
+    <link href=https://cdn-novel.iycdm.com/static2019-8-6/css/app.dbad105ca37bbc7083af10d1f386cb72.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-8-1/js/manifest.87663abffcdb74da9a8c.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-8-1/js/vendor.67516a6a43f9adc48771.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-8-1/js/app.82273e31eaba2bd73565.js></script>
+        src=https://cdn-novel.iycdm.com/static2019-8-6/js/manifest.805d1c033fb3dc77b6e7.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-8-6/js/vendor.67516a6a43f9adc48771.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-8-6/js/app.200c9f90582284fca6b3.js></script>
 </body>
 </html>

+ 8 - 5
resources/views/wap/signV3.blade.php

@@ -80,13 +80,15 @@
 
         .sign_list {
             position: absolute;
-            top: 60px;
+            left: 50%;
+            transform: translate(-50%);
+            top: 0.6rem;
             width: 100%;
             color: #333;
             line-height: 25px;
             display: flex;
             justify-content: space-between;
-            font-size: 13px;
+            font-size: 12px;
             margin-top: 15px;
         }
 
@@ -112,10 +114,11 @@
         .sign_line {
             border-bottom: 4px #318cf5 solid;
             position: absolute;
-            width: 35px;
-            top: 47%;
-            right: -20px;
+            width: 100%;
+            top: 48%;
+            right: -25px;
             z-index: 10;
+            margin-left: 5px;
         }
 
         .sign_line-wei {