ErrorCollectionController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers\Wap\Other;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use DB;
  6. class ErrorCollectionController extends Controller
  7. {
  8. /**
  9. * @apiDefine Exception 异常收集
  10. */
  11. /**
  12. * @apiVersion 1.0.0
  13. * @apiDescription undefined错误收集
  14. * @api {POST} error/undefinedCollect undefined错误收集
  15. * @apiGroup Exception
  16. * @apiName undefinedCollect
  17. * @apiParam {String} name 状态码
  18. * @apiParam {String} content 信息
  19. * @apiSuccessExample {json} Success-Response:
  20. * HTTP/1.1 200 OK
  21. * {
  22. * code: 0,
  23. * msg: "",
  24. * data:{}
  25. * }
  26. */
  27. public function undefinedCollect(Request $request){
  28. $name = $request->input('name','unkown');
  29. $content = $request->input('content','');
  30. if($name || $content){
  31. DB::table('wap_error')->insert([
  32. 'tag'=>$name,
  33. 'content'=>$content,
  34. 'created_at'=>date('Y-m-d H:i:s'),
  35. 'updated_at'=>date('Y-m-d H:i:s'),
  36. ]);
  37. }
  38. return response()->success();
  39. }
  40. }