فهرست منبع

book rank library

fly 4 سال پیش
والد
کامیت
a41055969f

+ 3 - 57
app/Http/Controllers/QuickApp/Book/BookCategoryController.php

@@ -5,65 +5,11 @@ namespace App\Http\Controllers\QuickApp\Book;
 use Illuminate\Http\Request;
 use App\Http\Controllers\Controller;
 use App\Modules\Book\Services\BookCategoryService;
+
 class BookCategoryController extends Controller
 {
-    /**
-     * @apiDefine Book 图书
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取分类
-     * @api {get} books/getCategory  获取分类
-     * @apiParam {String}  [token]  token
-     * @apiHeader {String} [Authorization]  token 两个token任选其一
-     * @apiGroup Book
-     * @apiName getCategory
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:  [
-     *                   {
-     *                   id: 1,
-     *                   name: "男频",
-     *                   children: [
-     *                           {
-     *                               id: 7,
-     *                               name: "灵异鬼怪"
-     *                           },
-     *                           {
-     *                               id: 8,
-     *                               name: "历史穿越"
-     *                           },
-     *                           {
-     *                               id: 30,
-     *                               name: "青春爱情"
-     *                           }
-     *                       ]
-     *                   },
-     *                   {
-     *                   id: 2,
-     *                   name: "女频",
-     *                   children: [
-     *                           {
-     *                               id: 26,
-     *                               name: "豪门总裁"
-     *                           },
-     *                           {
-     *                               id: 35,
-     *                               name: "民国爱情"
-     *                           }
-     *                       ]
-     *                   }
-     *               ]
-     *       }
-     */
-    public function getCategory(Request $request){
+    public function getCategory(Request $request)
+    {
         $res = BookCategoryService::getCategory(true);
         return response()->success($res);
     }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 9 - 505
app/Http/Controllers/QuickApp/Book/BookController.php


+ 9 - 233
app/Http/Controllers/QuickApp/Book/ChapterController.php

@@ -28,73 +28,6 @@ class ChapterController extends BaseController
 
     private $book_info;
 
-    /**
-     * @apiDefine Chapter 章节
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节列表不分页
-     * @api {get} books/{bid}/allcatalog 章节列表不分页
-     * @apiParam {String}  [token]  token
-     * @apiHeader {String} [Authorization]  token 两个token任选其一
-     * @apiGroup Chapter
-     * @apiName getCatalog
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {Array}       data.list 分页结果集
-     * @apiSuccess {Int}         data.list.bid   bid
-     * @apiSuccess {Int}         data.list.chapter_id   章节id
-     * @apiSuccess {String}      data.list.chapter_name   章节名称
-     * @apiSuccess {Int}         data.list.chapter_sequence   序号
-     * @apiSuccess {Int}         data.list.chapter_is_vip   是否vip
-     * @apiSuccess {Int}         data.list.chapter_size   章节大小
-     * @apiSuccess {Int}         data.list.prev_cid   上一章节id
-     * @apiSuccess {Int}         data.list.next_cid   下一章节
-     * @apiSuccess {String}      data.list.recent_update_at   更新时间
-     * @apiSuccess {Int}      data.list.is_need_charge  是否需要充值
-     * @apiSuccess {object}      data.meta   分页信息
-     * @apiSuccess {Int}         data.meta.total  总条数
-     * @apiSuccess {Int}         data.meta.per_page  每页条数
-     * @apiSuccess {Int}         data.meta.current_page 当前页
-     * @apiSuccess {Int}         data.meta.last_page  最后页
-     * @apiSuccess {String}      data.meta.next_page_url  下一页
-     * @apiSuccess {String}      data.meta.prev_page_url  上一页
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:
-     *            [
-     *             {
-     *               bid: 5,
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               is_need_charge: 0,
-     *            },
-     *             {
-     *               bid: 5,
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               is_need_charge: 0,
-     *            },
-     *          ]
-     *       }
-     */
     public function getCatalog(Request $request, $bid)
     {
         $bid = BookService::decodeBidStatic($bid);
@@ -107,79 +40,6 @@ class ChapterController extends BaseController
         return response()->collection(new ChapterListTransformer, $lists);
     }
 
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节列表分页
-     * @api {get} books/{bid}/catalog 章节列表分页
-     * @apiParam {String}  [token]  token
-     * @apiHeader {String} [Authorization]  token 两个token任选其一
-     * @apiGroup Chapter
-     * @apiName getCatalogPerPage
-     * @apiParam   {Int}         page_size  分页大小(默认15)
-     * @apiParam   {Int}         page  页码(默认1)
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {Array}       data.list 分页结果集
-     * @apiSuccess {Int}         data.list.bid   bid
-     * @apiSuccess {Int}         data.list.chapter_id   章节id
-     * @apiSuccess {String}      data.list.chapter_name   章节名称
-     * @apiSuccess {Int}         data.list.chapter_sequence   序号
-     * @apiSuccess {Int}         data.list.chapter_is_vip   是否vip
-     * @apiSuccess {Int}         data.list.chapter_size   章节大小
-     * @apiSuccess {Int}         data.list.prev_cid   上一章节id
-     * @apiSuccess {Int}         data.list.next_cid   下一章节
-     * @apiSuccess {String}      data.list.recent_update_at   更新时间
-     * @apiSuccess {Int}      data.list.is_need_charge  是否需要充值
-     * @apiSuccess {object}      data.meta   分页信息
-     * @apiSuccess {Int}         data.meta.total  总条数
-     * @apiSuccess {Int}         data.meta.per_page  每页条数
-     * @apiSuccess {Int}         data.meta.current_page 当前页
-     * @apiSuccess {Int}         data.meta.last_page  最后页
-     * @apiSuccess {String}      data.meta.next_page_url  下一页
-     * @apiSuccess {String}      data.meta.prev_page_url  上一页
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:
-     *            list:[
-     *             {
-     *               bid: 5,
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               is_need_charge: 0,
-     *            },
-     *             {
-     *               bid: 5,
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               is_need_charge: 0,
-     *            },
-     *          ]
-     *          meta:{
-     *              total: 1253,
-     *              per_page: 15,
-     *              current_page: 1,
-     *              last_page: 84,
-     *              next_page_url: "http://myapi.cn/api/books/1/chapter?page=2",
-     *              prev_page_url: ""
-     *         }
-     *       }
-     */
     public function getCatalogPerPage(Request $request, $bid)
     {
         $bid = BookService::decodeBidStatic($bid);
@@ -215,45 +75,6 @@ class ChapterController extends BaseController
         return $chapters;
     }
 
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节内容
-     * @api {get} books/{bid}/chapters/{chapter_id} 章节内容
-     * @apiParam {String}  [token]  token
-     * @apiHeader {String} [Authorization]  token 两个token任选其一
-     * @apiGroup Chapter
-     * @apiName index
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {Int}         data.chapter_id   章节id
-     * @apiSuccess {String}      data.chapter_name   章节名称
-     * @apiSuccess {Int}         data.chapter_sequence   序号
-     * @apiSuccess {Int}         data.chapter_is_vip   是否vip
-     * @apiSuccess {Int}         data.chapter_size   章节大小
-     * @apiSuccess {Int}         data.prev_cid   上一章节id
-     * @apiSuccess {Int}         data.next_cid   下一章节
-     * @apiSuccess {String}      data.recent_update_at   更新时间
-     * @apiSuccess {String}      data.chapter_content  章节内容
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               chapter_content: "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
-     *            }
-     *       }
-     */
     public function index(Request $request, $bid, $cid)
     {
         $oldbid = $bid;
@@ -346,45 +167,6 @@ class ChapterController extends BaseController
 
 
 
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 余额支付
-     * @api {get} books/{bid}/balance/chapterOrders/{cid} 余额支付
-     * @apiParam {String}  [token]  token
-     * @apiHeader {String} [Authorization]  token 两个token任选其一
-     * @apiGroup Chapter
-     * @apiName pay
-     * @apiParam   (Int)         remind 提醒
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {Int}         data.chapter_id   章节id
-     * @apiSuccess {String}      data.chapter_name   章节名称
-     * @apiSuccess {Int}         data.chapter_sequence   序号
-     * @apiSuccess {Int}         data.chapter_is_vip   是否vip
-     * @apiSuccess {Int}         data.chapter_size   章节大小
-     * @apiSuccess {Int}         data.prev_cid   上一章节id
-     * @apiSuccess {Int}         data.next_cid   下一章节
-     * @apiSuccess {String}      data.recent_update_at   更新时间
-     * @apiSuccess {String}      data.chapter_content  章节内容
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *               chapter_id: 5,
-     *               chapter_name: "第1240章 不是我",
-     *               chapter_sequence: 1239,
-     *               chapter_is_vip: 1,
-     *               chapter_size: 2422,
-     *               prev_cid: 0,
-     *               next_cid: 0,
-     *               recent_update_at: 2017-11-20 15:01:56,
-     *               chapter_content: "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
-     *            }
-     *       }
-     */
     public function pay(Request $request, $bid, $cid)
     {
         $remind = (int) $request->input('remind');
@@ -480,7 +262,7 @@ class ChapterController extends BaseController
         $old = Redis::hget($key, $field);
         if (!$old)  $old = 0;
         Redis::hset($key, $field, $old + 1);
-        $force_add_desk_type = $this->addDesktopType($bid,$chapter->sequence);
+        $force_add_desk_type = $this->addDesktopType($bid, $chapter->sequence);
         $chapter->force_add_desk_type = $force_add_desk_type;
         //统计
         $this->stats();
@@ -594,13 +376,6 @@ class ChapterController extends BaseController
      * @param $chapter_size
      * @return float
      */
-    /*protected function getPrice_($book_info, $chapter_size = 0)
-    {
-        if ($book_info->charge_type == 'BOOK')
-            return $book_info->price * 100;
-        return   ceil($chapter_size / 100);
-    }*/
-
     private function getPrice($book_info, $chapter_size = 0)
     {
         if ($book_info->charge_type == 'BOOK') {
@@ -690,18 +465,19 @@ class ChapterController extends BaseController
     }
 
     //加桌类型
-    private function addDesktopType($bid,$sequence){
+    private function addDesktopType($bid, $sequence)
+    {
         $force_add_desk_type = 0;
         $send_order_id = ReadRecordService::getSendOrderId($this->uid);
-        if(!$send_order_id) return $force_add_desk_type;
+        if (!$send_order_id) return $force_add_desk_type;
         $send_order_info = SendOrderService::getById($send_order_id);
-        if(!$send_order_info)  return $force_add_desk_type;
-        if($send_order_info->book_id == $bid){
-            if($send_order_info->force_add_desk_type == 1 && $send_order_info->force_add_desk_type){
+        if (!$send_order_info)  return $force_add_desk_type;
+        if ($send_order_info->book_id == $bid) {
+            if ($send_order_info->force_add_desk_type == 1 && $send_order_info->force_add_desk_type) {
                 $force_add_desk_type = $send_order_info->force_add_desk_type;
             }
-            if($send_order_info->force_add_desk_type == 2){
-                if($sequence >= $this->book_info->force_subscribe_chapter_seq && $sequence<= $this->book_info->force_subscribe_chapter_seq+3){
+            if ($send_order_info->force_add_desk_type == 2) {
+                if ($sequence >= $this->book_info->force_subscribe_chapter_seq && $sequence <= $this->book_info->force_subscribe_chapter_seq + 3) {
                     $force_add_desk_type = $send_order_info->force_add_desk_type;
                 }
             }

+ 9 - 9
app/Http/Controllers/QuickApp/Book/Transformers/BookTransformer.php

@@ -25,13 +25,13 @@ class BookTransformer
             'book_category_id' => $book->category_id,
             'book_category' => $book->category_name,
             'book_end_status' => $book->status,
-            'book_published_time' => is_null($book->updated_at) ? '' : $book->updated_at,
-            'copyright' => is_null($book->copyright) ? '' : $book->copyright,
-            'charge_type' => is_null($book->charge_type) ? '' : $book->charge_type,
+            'book_published_time' =>  $book->updated_at ?? '',
+            'copyright' =>  $book->copyright ?? '',
+            'charge_type' =>  $book->charge_type ?? '',
             'force_subscribe_chapter_id' => $book->force_subscribe_chapter_seq,
-            'update_time' => $book->updated_at,
-            'is_on_shelf' => $book->is_on_shelf,
-            'book_price' => is_null($book->price) ? 0 : $book->price,
+            'update_time' => $book->updated_at ?? '',
+            'is_on_shelf' => $book->is_on_shelf ?? 0,
+            'book_price' => $book->price ?? 0,
             'keyword' => $book->keyword,
             'recommend_index' => $book->recommend_index,
             'is_show_index_content' => $book->is_show_index_content,
@@ -42,10 +42,10 @@ class BookTransformer
             'last_chapter' => $book->last_chapter,
             'first_cid' => $book->first_cid,
             'is_on_user_shelf' => $book->is_on_user_shelf,
-            'last_chapter_is_vip' => $book->last_chapter_is_vip,
+            'last_chapter_is_vip' => $book->last_chapter_is_vip ?? 0,
             'is_need_charge' => $book->is_need_charge ? 1 : 0,
-            'record_chapter_id' => $book->record_chapter_id,
-            'record_chapter_name' => $book->record_chapter_name,
+            'record_chapter_id' => $book->record_chapter_id ?? 0,
+            'record_chapter_name' => $book->record_chapter_name ?? '',
         ];
     }
 }

+ 3 - 3
app/Http/Routes/QuickApp/QuickAppRoutes.php

@@ -31,6 +31,9 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
 
         // 相似推荐
         Route::get('books/similar', 'Book\BookController@similarRecom');
+        
+        //排行榜
+        Route::get('books/rank', 'Book\BookController@rank');
     });
 
     Route::group(['prefix' => 'api', 'middleware' => 'jwttoken'], function () {
@@ -40,8 +43,6 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
         Route::get('books/recommen', 'Book\BookController@recommen');
         //阅读完后的推荐
         Route::get('books/readOverRecommend', 'Book\BookController@readOverRecommend');
-        //排行榜
-        Route::get('books/rank', 'Book\BookController@rank');
         //图书详情
         Route::get('book/{bid}', 'Book\BookController@index');
         //目录不分页
@@ -102,7 +103,6 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
         Route::get('shortcut/add', 'User\ShortcutController@add');
         //删除快捷方式
         Route::get('shortcut/delete', 'User\ShortcutController@delete');
-
     });
 
     // 推送

+ 0 - 18
app/Modules/BaseService.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Modules;
-
-
-trait BaseService
-{
-    private static $_instance;
-
-    public static function __callStatic($name, $arguments)
-    {
-        $name = preg_replace('/Static$/', '', $name);
-        if (self::$_instance == null) {
-            self::$_instance = new self;
-        }
-        return self::$_instance->$name(...$arguments);
-    }
-}

+ 0 - 28
app/Modules/Book/Models/BookConfig.php

@@ -23,29 +23,7 @@ class BookConfig extends Model
         'copyright', 'charge_type', 'hot', 'is_on_shelf', 'source_domain', 'recommend_index', 'roles', 'test_status', 'plan_push_user_num', 'test_update_time',
         'is_show_index_content', 'click_count', 'promotion_domain', 'copyright_limit_data', 'recommend_cid', 'is_high_quality', 'vip_seq', 'editor_recommend', 'is_current_week_promotion'
     ];
-    /*
-    public static function getBooks($where, $order, $page_size = 15, $category = [], $key = null)
-    {
-        $res = self::join('books', 'book_configs.bid', '=', 'books.id')
-            ->join('book_categories', 'books.category_id', 'book_categories.id')
-            ->select('book_configs.bid', 'book_configs.force_subscribe_chapter_seq', 'book_configs.price',
-                'book_configs.cover', 'book_configs.book_name', 'book_configs.copyright', 'book_configs.charge_type', 'book_configs.is_on_shelf',
-                'books.author', 'books.intro', 'books.category_name', 'books.category_id', 'status', 'chapter_count', 'book_configs.click_count',
-                'first_cid', 'last_cid', 'size', 'last_chapter', 'books.keyword', 'book_configs.recommend_index', 'book_configs.is_show_index_content', 'book_configs.product_id'
-                , 'book_categories.channel_name', 'books.last_cid', 'books.last_chapter'
-            )
-            ->where($where)
-            ->orderBy($order[0], $order[1]);
 
-        if ($category) {
-            $res = $res->whereIn('books.category_id', $category);
-        }
-        if ($key) {
-            $res = $res->orwhere('book_configs.name', 'like', $key['name'])->orwhere('books.author', 'like', $key['author']);
-        }
-        return $res->paginate($page_size);
-    }
-    */
     /**
      * 根据条件获取图书
      * @param array $where
@@ -104,8 +82,6 @@ class BookConfig extends Model
             foreach ($where as $key => $v) {
                 //关键词查询
                 if ($key == 'key' && $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 . '%');
                         if (mb_strlen($v) <= 5) {
@@ -115,9 +91,6 @@ class BookConfig extends Model
                             }
                         }
                     });
-                    //->orWhere('books.intro', 'like', '%' . $v . '%')
-                    //->orWhere('books.category_name', 'like', '%' . $v . '%')->orWhere('books.author', 'like', '%' . $v . '%')
-                    //->orWhere('books.keyword', 'like', '%' . $v . '%');
                 }
                 //分类id查询
                 if ($key == 'category_id' && $v) {
@@ -189,7 +162,6 @@ class BookConfig extends Model
                 }
             }
         }
-        //$res->orderBy('book_configs.updated_at','desc');
         return $res->orderBy($order[0], $order[1])->orderBy('book_configs.updated_at', 'desc')->paginate($page_size);
     }
 

+ 1 - 8
app/Modules/Book/Services/BookService.php

@@ -2,7 +2,6 @@
 
 namespace App\Modules\Book\Services;
 
-use App\Modules\BaseService;
 use App\Modules\Book\Models\Book;
 use App\Modules\Book\Models\Chapter;
 use Hashids;
@@ -10,15 +9,9 @@ use Redis;
 use App\Modules\Statistic\Services\WapVisitStatService;
 use DB;
 
-/**
- * 
- * @method static int decodeBidStatic(string $bid) 解析bid
- */
 class BookService
 {
-    use BaseService;
-
-    public function decodeBid(string $bid)
+    public static function decodeBidStatic(string $bid)
     {
         return Hashids::decode($bid)[0];
     }

+ 1 - 7
app/Modules/RecommendBook/Services/RecommendService.php

@@ -9,17 +9,11 @@
 
 namespace App\Modules\RecommendBook\Services;
 
-use App\Modules\BaseService;
 use App\Modules\RecommendBook\Models\Recommend;
 
-/**
- * @method static array getRecommendIdsStatic(int $channel, string $type)
- */
 class RecommendService
 {
-    use BaseService;
-
-    public function getRecommendIds(int $channel, string $type)
+    public static function getRecommendIdsStatic(int $channel, string $type)
     {
         return Recommend::where([
             ['is_show', '=', 1],

+ 1 - 9
app/Modules/SendOrder/Services/SendOrderService.php

@@ -9,7 +9,6 @@
 
 namespace App\Modules\SendOrder\Services;
 
-use App\Modules\BaseService;
 use App\Modules\SendOrder\Models\QuickAppSendOrder;
 use App\Modules\SendOrder\Models\SendOrder;
 use App\Modules\SendOrder\Models\SendOrderExtraStat;
@@ -17,16 +16,9 @@ use App\Modules\Statistic\Services\WapVisitStatService;
 use DB;
 use Redis;
 
-/**
- * 
- * @method static \App\Modules\SendOrder\Models\SendOrder getSendOrderStatic(int $id) 根据ID获取派单信息
- * @method static \App\Modules\SendOrder\Models\QuickAppSendOrder getQuickAppSendOrderStatic(int $send_order_id) 获取快应用派单信息
- */
 class SendOrderService
 {
-    use BaseService;
-
-    public function getSendOrder(int $id)
+    public static function getSendOrderStatic(int $id)
     {
         return SendOrder::find($id);
     }

+ 0 - 7
app/Modules/Subscribe/Services/ChapterOrderService.php

@@ -2,19 +2,12 @@
 
 namespace App\Modules\Subscribe\Services;
 
-use App\Modules\BaseService;
 use DB;
 use App\Modules\User\Services\UserService;
 use App\Modules\Subscribe\Models\ChapterOrder;
 
-/**
- * 
- * @method static int checkIsOrderedStatic($uid, $bid, $cid)
- */
 class ChapterOrderService
 {
-    use BaseService;
-
     //判断是否订购
     public function checkIsOrdered($uid, $bid, $cid)
     {

+ 28 - 25
app/Modules/User/Services/ReadRecordService.php

@@ -9,7 +9,6 @@
 
 namespace App\Modules\User\Services;
 
-use App\Modules\BaseService;
 use App\Modules\User\Models\ReadRecordFromRedis;
 use Redis;
 use Hashids;
@@ -17,16 +16,9 @@ use App\Modules\Book\Services\BookConfigService;
 use App\Modules\Book\Models\Chapter;
 use DB;
 
-/**
- * @method static delReadRecordStatic(int $uid, array $bids) 删除最近阅读记录
- * @method static getBookReadRecordStatic(int $uid, int $bid) 获取单本书籍的最近阅读记录
- */
 class ReadRecordService
 {
-    #region 以后按照这种方式写静态方法
-    use BaseService;
-
-    public function getBookReadRecord(int $uid, int $bid)
+    public static function getBookReadRecordStatic(int $uid, int $bid)
     {
         $record = Redis::hGet('book_read:' . $uid, $bid);
         if ($record) {
@@ -42,7 +34,7 @@ class ReadRecordService
      * @param int $uid
      * @param array $bids
      */
-    public function delReadRecord(int $uid, array $bids)
+    public static function delReadRecordStatic(int $uid, array $bids)
     {
         $key = 'book_read:' . $uid;
         $last_record = explode('_', Redis::hGet($key, 'last_read'));
@@ -55,7 +47,7 @@ class ReadRecordService
             Redis::hDel($key, $bid);
         }
         if ($is_del_last) {
-            $this->reSetLastRecord($uid);
+            self::reSetLastRecord($uid);
         }
     }
 
@@ -63,7 +55,7 @@ class ReadRecordService
      * 重置用户最近阅读记录
      * @param int $uid
      */
-    public function reSetLastRecord($uid)
+    public static function reSetLastRecord($uid)
     {
         $key = 'book_read:' . $uid;
         $alls = Redis::hGetAll($key);
@@ -88,7 +80,6 @@ class ReadRecordService
             Redis::hDel($key, 'last_read');
         }
     }
-    #endregion
 
     //阅读记录数
     const RECORD_COUNT = 50;
@@ -278,7 +269,8 @@ class ReadRecordService
                 $bid = $record_arr[0];
                 return (int) $bid;
             }
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return 0;
     }
 
@@ -417,7 +409,8 @@ class ReadRecordService
                 'created_at' => date('Y-m-d H:i:s'),
                 'updated_at' => date('Y-m-d H:i:s'),
             ]);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
     }
 
     /**
@@ -431,7 +424,8 @@ class ReadRecordService
             $send_order_id = Redis::hget('book_read:' . $uid, 'send_order_id');
             if ($send_order_id)
                 return (int) $send_order_id;
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return 0;
     }
 
@@ -444,7 +438,8 @@ class ReadRecordService
     {
         try {
             Redis::hset('book_read:' . $uid, 'inner_send_order_id', $inner_order_id);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
     }
 
     /**
@@ -460,7 +455,8 @@ class ReadRecordService
                 return $inner_send_order_id;
             }
             return '';
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return '';
     }
     /**
@@ -472,7 +468,8 @@ class ReadRecordService
     {
         try {
             return Redis::hget('book_read:' . $uid, 'sign_day');
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return -1;
     }
 
@@ -511,7 +508,8 @@ class ReadRecordService
             if ($count) {
                 return $count;
             }
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return 0;
     }
 
@@ -528,7 +526,8 @@ class ReadRecordService
                 return (int) $count;
             }
             return 0;
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return 0;
     }
 
@@ -568,7 +567,8 @@ class ReadRecordService
     {
         try {
             return Redis::hget('book_read:' . $uid, $field);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return '';
     }
 
@@ -576,7 +576,8 @@ class ReadRecordService
     {
         try {
             return Redis::hmget('book_read:' . $uid, $field);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return '';
     }
 
@@ -587,7 +588,8 @@ class ReadRecordService
         }
         try {
             return Redis::hset('book_read:' . $uid, $field, $value);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return '';
     }
 
@@ -601,7 +603,8 @@ class ReadRecordService
         }
         try {
             return Redis::hmset('book_read:' . $uid, $kv);
-        } catch (\Exception $e) { }
+        } catch (\Exception $e) {
+        }
         return '';
     }