liu 6 years ago
parent
commit
e45e8a6fdf

+ 15
- 1
manage-server/app/Http/Controllers/CommonController.php View File

@@ -14,6 +14,7 @@ use App\Models\Reward;
14 14
 use App\Models\ProductOrder;
15 15
 use App\Models\ServerInfo;
16 16
 use App\Models\WechatInfo;
17
+use App\Models\Comment;
17 18
 use Illuminate\Http\Request;
18 19
 use Illuminate\Support\Facades\Storage;
19 20
 use Carbon\Carbon;
@@ -140,7 +141,20 @@ class CommonController extends Controller
140 141
         $order_id = $request->route("order_id");
141 142
         $order_type = $request->route("order_type");
142 143
         if ($order_id && $order_type) {
143
-            return Comment::where("order_id", $order_id)->where("type", $order_type)->paginate(20);
144
+            return Comment::where("order_id", $order_id)->where("order_type", $order_type)->orderBy('id', 'desc')->paginate(20);
145
+        }
146
+    }
147
+
148
+    /**
149
+     * 分页获取订单评论
150
+     * @param Request $request
151
+     * @return mixed
152
+     */
153
+    public function type_comments(Request $request, $order_type)
154
+    {
155
+        $order_type = $request->route("order_type");
156
+        if ($order_type) {
157
+            return Comment::where("order_type", $order_type)->orderBy('id', 'desc')->paginate(20);
144 158
         }
145 159
     }
146 160
 

+ 1
- 1
manage-server/routes/web.php View File

@@ -27,7 +27,7 @@ Route::middleware(['manage.token'])->group(function () {
27 27
 
28 28
     Route::post('/upload', 'CommonController@upload');
29 29
     Route::get('/classify/{id}', 'ClassifyController@get');
30
-    Route::get('/{order_type}/{order_id}/comments', 'CommonController@comments');
30
+    Route::get('/{order_type}/comments', 'CommonController@type_comments');
31 31
     Route::post('/{order_type}/status', 'CommonController@status');
32 32
     Route::get('/{order_type}/{id}', 'CommonController@get')->where('id', '[0-9]+');
33 33
     Route::delete('/{order_type}/{id}', 'CommonController@delete')->where('id', '[0-9]+');

Loading…
Cancel
Save