<?php

namespace App\Http\Controllers\WapAlipay\Other;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
class ErrorCollectionController extends Controller
{
    /**
     * @apiDefine Exception 异常收集
     */


    /**
     * @apiVersion 1.0.0
     * @apiDescription undefined错误收集
     * @api {POST} error/undefinedCollect undefined错误收集
     * @apiGroup Exception
     * @apiName undefinedCollect
     * @apiParam {String}         name 状态码
     * @apiParam {String}         content  信息
     * @apiSuccessExample {json} Success-Response:
     *     HTTP/1.1 200 OK
     *     {
     *       code: 0,
     *       msg: "",
     *       data:{}
     *       }
     */
    public function undefinedCollect(Request $request){
        $name = $request->input('name','unkown');
        $content = $request->input('content','');
        if($name || $content){
            DB::table('wap_error')->insert([
                'tag'=>$name,
                'content'=>$content,
                'created_at'=>date('Y-m-d H:i:s'),
                'updated_at'=>date('Y-m-d H:i:s'),
            ]);
        }
        return response()->success();
    }
}
