1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Http\Controllers\Controller;
- use App\Service\AdService;
- use Illuminate\Http\Request;
- use Illuminate\Validation\Rule;
- class AdController extends Controller
- {
- public function getAdPlacement(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'app_id' => 'required|string',
- 'type' => ['nullable', Rule::in([1, 2, 3, 4, 5, 6])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $appId = $request->input('app_id');
- $type = $request->input('type', 2);
- $data = AdService::getAdPlacement($appId, $type);
- return self::returnValue($data);
- }
- }
|