fly 4 years ago
parent
commit
ced4b297c8
2 changed files with 4 additions and 20 deletions
  1. 3 19
      src/Services/BaseConfig.php
  2. 1 1
      src/Services/Book/BookService.php

+ 3 - 19
src/Services/BaseConfig.php

@@ -22,34 +22,19 @@ trait BaseConfig
     //获取当前登录用户ID
     //获取当前登录用户ID
     private function login_user_id()
     private function login_user_id()
     {
     {
-        if (empty(session('manage_user'))) {
-            if (env('APP_ENV') == 'local') return 1;
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user->id;
+        return $this->login_user->id;
     }
     }
 
 
     //获取当前登录用户角色
     //获取当前登录用户角色
     private  function login_user_role()
     private  function login_user_role()
     {
     {
-        if (empty(session('manage_user'))) {
-            if (env('APP_ENV') == 'local') return 'admin';
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user->role;
+        return $this->login_user->role;
     }
     }
 
 
     //获取当前登录用户
     //获取当前登录用户
     private function login_user_account()
     private function login_user_account()
     {
     {
-        if (empty(session('manage_user'))) {
-            if (env('APP_ENV') == 'local') return 'admin';
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user->account;
+        return $this->login_user->account;
     }
     }
 
 
     private function login_user()
     private function login_user()
@@ -57,7 +42,6 @@ trait BaseConfig
         if (empty(session('manage_user'))) {
         if (empty(session('manage_user'))) {
             if (env('APP_ENV') == 'local') return '';
             if (env('APP_ENV') == 'local') return '';
         }
         }
-
         $user = unserialize(session('manage_user'));
         $user = unserialize(session('manage_user'));
         return $user;
         return $user;
     }
     }

+ 1 - 1
src/Services/Book/BookService.php

@@ -64,7 +64,7 @@ class BookService
      */
      */
     public function getBooks(array $params, bool $is_page = true)
     public function getBooks(array $params, bool $is_page = true)
     {
     {
-        $sql = BookConfig::orderBy('bid', 'desc');
+        $sql = BookConfig::orderBy('recommend_index', 'desc');
         if (isset($params['type']) && $params['type']) {
         if (isset($params['type']) && $params['type']) {
             $sql = $sql->where('is_on_shelf', $params['type']);
             $sql = $sql->where('is_on_shelf', $params['type']);
             if ($params['type'] == 1) {
             if ($params['type'] == 1) {