فهرست منبع

Merge pull request #1171 from visuddhinanda/laravel

隐藏私有译文
visuddhinanda 2 سال پیش
والد
کامیت
ea4c47edb3
5فایلهای تغییر یافته به همراه23 افزوده شده و 20 حذف شده
  1. 2 2
      app/Console/Commands/UpgradeDaily.php
  2. 7 14
      app/Http/Controllers/CourseController.php
  3. 1 0
      composer.json
  4. 2 2
      config/app.php
  5. 11 2
      public/app/usent/sent_query.php

+ 2 - 2
app/Console/Commands/UpgradeDaily.php

@@ -50,9 +50,9 @@ class UpgradeDaily extends Command
 		}
 
         //巴利原文段落库目录结构改变时运行
-        $this->call('upgrade:palitext');
+        //$this->call('upgrade:palitext');
         #巴利段落标签
-        $this->call('upgrade:palitexttag');
+        //$this->call('upgrade:palitexttag');
 
         //更新单词首选意思
         $this->call('upgrade:dict.default.meaning');

+ 7 - 14
app/Http/Controllers/CourseController.php

@@ -96,23 +96,16 @@ class CourseController extends Controller
                 break;
         }
         $table = $table->select($indexCol);
-        if(isset($_GET["search"])){
-            $table = $table->where('title', 'like', $_GET["search"]."%");
+        if($request->has('search')){
+            $table = $table->where('title', 'like', $request->get('search')."%");
         }
         $count = $table->count();
-        if(isset($_GET["order"]) && isset($_GET["dir"])){
-            $table = $table->orderBy($_GET["order"],$_GET["dir"]);
-        }else{
-            $table = $table->orderBy('updated_at','desc');
-        }
+        $table = $table->orderBy($request->get('order','updated_at'),
+                                 $request->get('dir','desc'));
+
+        $table = $table->skip($request->get('offset',0))
+                       ->take($request->get('limit',1000));
 
-        if(isset($_GET["limit"])){
-            $offset = 0;
-            if(isset($_GET["offset"])){
-                $offset = $_GET["offset"];
-            }
-            $table = $table->skip($offset)->take($_GET["limit"]);
-        }
         $result = $table->get();
 		if($result){
 			return $this->ok(["rows"=>CourseResource::collection($result),"count"=>$count]);

+ 1 - 0
composer.json

@@ -11,6 +11,7 @@
         "fruitcake/laravel-cors": "^3.0",
         "godruoyi/php-snowflake": "^2.0",
         "guzzlehttp/guzzle": "^7.0.1",
+        "intervention/image": "^2.7",
         "laravel/framework": "^8.75",
         "laravel/sanctum": "^2.11",
         "laravel/tinker": "^2.5",

+ 2 - 2
config/app.php

@@ -165,7 +165,7 @@ return [
         /*
          * Package Service Providers...
          */
-
+        Intervention\Image\ImageServiceProvider::class,
         /*
          * Application Service Providers...
          */
@@ -229,7 +229,7 @@ return [
         'URL' => Illuminate\Support\Facades\URL::class,
         'Validator' => Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
-
+        'Image' => Intervention\Image\Facades\Image::class,
     ],
 
     /*

+ 11 - 2
public/app/usent/sent_query.php

@@ -7,6 +7,11 @@ require_once "../public/_pdo.php";
 require_once "../public/function.php";
 require_once "../ucenter/function.php";
 
+if(!isset($_COOKIE['user_uid'])){
+    echo json_encode([], JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
 $sent = $_POST["sent"];
 $filter = $_POST["filter"];
 
@@ -33,11 +38,15 @@ $query = "SELECT uid as id,
 				 version as ver,
 				 status,
 				 strlen,
-				 modify_time FROM "._TABLE_SENTENCE_." WHERE (book_id = ?  AND paragraph = ? AND word_start = ? AND word_end = ? AND strlen > 0  ) order by modify_time DESC limit 10";
+				 modify_time FROM "._TABLE_SENTENCE_.
+        " WHERE (book_id = ?  AND paragraph = ? AND word_start = ? AND word_end = ? AND strlen > 0)
+                 and (status = 30 or editor_uid = ? )
+                 order by modify_time DESC limit 10";
+
 $stmt = $dbh->prepare($query);
 foreach ($sentList as $key => $value) {
     # code...
-    $stmt->execute(array($value->book, $value->para, $value->start, $value->end));
+    $stmt->execute(array($value->book, $value->para, $value->start, $value->end,$_COOKIE['user_uid']));
     $Fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
     for ($i = 0; $i < count($Fetch); $i++) {
         $Fetch[$i]["nickname"] = ucenter_getA($Fetch[$i]["editor"]);