Преглед на файлове

添加只修改金额的接口

chenxiqiang преди 6 години
родител
ревизия
66ccf0a5f5
променени са 2 файла, в които са добавени 32 реда и са изтрити 0 реда
  1. 31
    0
      manage-server/app/Http/Controllers/CommonController.php
  2. 1
    0
      manage-server/routes/web.php

+ 31
- 0
manage-server/app/Http/Controllers/CommonController.php Целия файл

294
         }
294
         }
295
     }
295
     }
296
 
296
 
297
+    /**
298
+     * 修改状态
299
+     * @param Request $request
300
+     * @return \Illuminate\Http\JsonResponse
301
+     */
302
+    public function price(Request $request, $order_type)
303
+    {
304
+        $id = $request->input("id");
305
+        $price = $request->input("price");
306
+        $order_type = $request->route("order_type");
307
+        if ($id && $order_type) {
308
+            $record = $this->getRecord($order_type, $id);
309
+            if ($record) {
310
+                $record->price = $price;
311
+                $record->save();
312
+                return Response()->json([
313
+                    "status" => 0,
314
+                    "message" => "保存成功!"
315
+                ]);
316
+            }
317
+            return Response()->json([
318
+                "status" => -2,
319
+                "message" => "不存在的记录!"
320
+            ]);
321
+        } else {
322
+            return Response()->json([
323
+                "status" => -1,
324
+                "message" => "信息不能为空!"
325
+            ]);
326
+        }
327
+    }
297
 
328
 
298
     /**
329
     /**
299
      * 删除记录
330
      * 删除记录

+ 1
- 0
manage-server/routes/web.php Целия файл

35
     Route::get('/classify/{id}', 'ClassifyController@get');
35
     Route::get('/classify/{id}', 'ClassifyController@get');
36
     Route::get('/{order_type}/comments', 'CommonController@type_comments');
36
     Route::get('/{order_type}/comments', 'CommonController@type_comments');
37
     Route::post('/{order_type}/status', 'CommonController@status');
37
     Route::post('/{order_type}/status', 'CommonController@status');
38
+    Route::post('/{order_type}/price', 'CommonController@price');
38
     Route::get('/{order_type}/{id}', 'CommonController@get')->where('id', '[0-9]+');
39
     Route::get('/{order_type}/{id}', 'CommonController@get')->where('id', '[0-9]+');
39
     Route::delete('/{order_type}/{id}', 'CommonController@delete')->where('id', '[0-9]+');
40
     Route::delete('/{order_type}/{id}', 'CommonController@delete')->where('id', '[0-9]+');
40
 
41
 

Loading…
Отказ
Запис