Ver código fonte

удаление предыдущего шага

ilg2005 4 meses atrás
pai
commit
64a7d83774
2 arquivos alterados com 2 adições e 121 exclusões
  1. 1 113
      app/Http/Controllers/CharController.php
  2. 1 8
      routes/api.php

+ 1 - 113
app/Http/Controllers/CharController.php

@@ -310,120 +310,8 @@ class CharController extends Controller
         $data = $request->except($protected);
 
         return $this->_updateAndRespond($item, $data, 'Item successfully updated.');
-    }
-      
-    
-    /**
-     * Получение всех квестов конкретного персонажа.
-     *
-     * @param  int  $char_id
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function GetCharacterQuests($char_id, Request $request)
-    {
-        // 1. Проверяем существование персонажа
-        if (!CharBase::find($char_id)) {
-            return response()->json(['code' => -2, 'msg' => 'Character not found.'], 404);
-        }
-        
-        // 2. Валидация и параметры запроса
-        $validated = $request->validate([
-            'per_page' => 'sometimes|integer|min:1|max:100',
-        ]);
-
-        $perPage = $validated['per_page'] ?? 15;
-        $sortField = $request->input('sort_field', 'Slot');
-        $sortOrder = strtolower($request->input('sort_order', 'asc')) === 'desc' ? 'desc' : 'asc';
-
-        // 3. Получаем квесты персонажа
-        $query = CharQuest::where('Owner', $char_id);
-        $questsPaginator = $query->orderBy($sortField, $sortOrder)->paginate($perPage);
-
-        // 4. Формируем ответ
-        if ($questsPaginator->total() === 0) {
-            return response()->json([
-                'quests' => [],
-                'code' => -3,
-                'msg' => 'No quests found for this character.'
-            ], 200);
-        }
-
-        return response()->json([
-            'code' => 0,
-            'msg' => 'Character quests successfully received.',
-            'quests' => $questsPaginator,
-        ], 200);
-    }
-    
-    /**
-     * Получение конкретного квеста персонажа по ID персонажа и слоту.
-     *
-     * @param  int  $char_id
-     * @param  int  $slot
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function GetCharacterQuest($char_id, $slot)
-    {
-        // 1. Проверяем существование персонажа
-        if (!CharBase::find($char_id)) {
-            return response()->json(['code' => -2, 'msg' => 'Character not found.'], 404);
-        }
-        
-        // 2. Ищем квест по Owner и Slot
-        $quest = CharQuest::where('Owner', $char_id)
-            ->where('Slot', $slot)
-            ->first();
-            
-        if (!$quest) {
-            return response()->json([
-                'code' => -3,
-                'msg' => 'Quest not found for this character.'
-            ], 404);
-        }
-        
-        // 3. Формируем ответ
-        return response()->json([
-            'code' => 0,
-            'msg' => 'Character quest successfully received.',
-            'quest' => $quest,
-        ], 200);
-    }
+    }    
     
-    /**
-     * Обновление квеста персонажа по ID персонажа и слоту.
-     *
-     * @param  int  $char_id
-     * @param  int  $slot
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function UpdateCharacterQuest($char_id, $slot, Request $request)
-    {
-        // 1. Проверяем существование персонажа
-        if (!CharBase::find($char_id)) {
-            return response()->json(['code' => -2, 'msg' => 'Character not found.'], 404);
-        }
-        
-        // 2. Ищем квест по Owner и Slot
-        $quest = CharQuest::where('Owner', $char_id)
-            ->where('Slot', $slot)
-            ->first();
-            
-        if (!$quest) {
-            return response()->json([
-                'code' => -3,
-                'msg' => 'Quest not found for this character.'
-            ], 404);
-        }
-        
-        // 3. Защищенные поля, которые нельзя изменить
-        $protectedFields = ['Owner', 'Slot'];
-        $data = $request->except($protectedFields);
-        
-        // 4. Обновляем запись и формируем ответ
-        return $this->_updateAndRespond($quest, $data, 'Quest successfully updated.');
-    }
 
     //------------------------------ ПРИВАТНЫЕ МЕТОДЫ -----------------------------------------
     /**

+ 1 - 8
routes/api.php

@@ -37,15 +37,8 @@ Route::group(['prefix' => 'api'], function () {
 
     // Получение и обновление предмета по char_item_id в нужной таблице
     Route::get('GetCharItem/{table}/{char_item_id}', 'CharController@GetCharItem');
-    Route::post('UpdateCharItem/{table}/{char_item_id}', 'CharController@UpdateCharItem');
+    Route::post('UpdateCharItem/{table}/{char_item_id}', 'CharController@UpdateCharItem');    
     
-    // Получение всех квестов конкретного персонажа
-    Route::get('GetCharacterQuests/{char_id}', 'CharController@GetCharacterQuests');
-    
-    // Получение и обновление конкретного квеста персонажа по ID персонажа и слоту
-    Route::get('GetCharacterQuest/{char_id}/{slot}', 'CharController@GetCharacterQuest');    
-    Route::post('UpdateCharacterQuest/{char_id}/{slot}', 'CharController@UpdateCharacterQuest');
-
     Route::group(['prefix' => 'funcs_adm'], function () {
         Route::get('UpdateCharItemAccount/{CharID?}', 'ADMIN\AdminController@UpdateCharItemAccount');
         Route::get('CheckCharItemAccount/{CharID?}/{StrRecordKind?}', 'ADMIN\AdminController@CheckCharItemAccount');