ReceiveController.php
837 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2022/11/2
* Time: 16:21
*/
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\BtEvents;
use Illuminate\Http\Request;
/**
* Class ReceiveControllers
* @package App\Http\Controllers\Api
*/
class ReceiveController extends Controller
{
/**
* 接收异步事件
* @param Request $request
* @return string
*/
public function createEvent(Request $request)
{
try {
$type = intval($request->input('type', 0));
$param = $request->all();
$event_id = BtEvents::createBtEvent($type, json_encode($param));
return $event_id ? $this->success() : $this->error();
} catch (\Exception $e) {
return $this->error($e->getMessage());
}
}
}