123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- * Created by PhpStorm.
- * User: hanle
- * Date: 2018/10/19
- * Time: 12:43
- */
-
- namespace App\Http\Controllers;
-
- use App\Common\Curl;
- use App\Common\Api;
- use Illuminate\Http\Request;
-
- class LogApiController extends Controller
- {
- public function __construct(){}
-
- /**
- * 日志收集接口
- * @param Request $request
- * @return string
- */
- public function getLogCollect(Request $request){
- $params = $request->all();
-
- if(empty(env('APP_LOG_URL')) || !env('APP_LOG_URL')){
- return Api::json(config('code.success'), trans('msg.success'));
- }
-
- $url = env('APP_LOG_URL').'/log/collect?admin_id='.$params['admin_id'].'&event='.$params['event'];
- $curl = new Curl($url);
- $res = json_decode($curl->httpGet(), true);
-
- if($res) {
- return Api::json($res['error'], $res['message']);
- } else {
- return Api::json(config('code.fail'), trans('msg.fail'));
- }
- }
- }
- ?>
|