首次提交 Laravel 專案

This commit is contained in:
2025-05-18 08:52:56 +07:00
commit 5e392ae581
264 changed files with 88756 additions and 0 deletions
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use App\Models\tg_Msg;
use App\Services\TgApi;
use App\Services\UserFun;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class TgController extends Controller
{
public function Msg($token,Request $request)
{
$data = $request->all();
$data='{"update_id":240447110,"message":{"message_id":1356,"from":{"id":5909523353,"is_bot":false,"first_name":"流浪的","last_name":"阿江","username":"winchen1688","language_code":"zh-hans"},"chat":{"id":-937402821,"title":"易利机器人测试群","type":"group","all_members_are_administrators":true},"date":1745980807,"text":"@xiongia +2000","entities":[{"offset":0,"length":8,"type":"mention"}]}}';
$msg=UserFun::Json2Arr($data); //将JSON转换成一維扁平陣列
$msg['token']=$token;
$tgmsg=tg_Msg::storeFromWebhookJson($msg);
$chat_id=TgApi::GetChatInfo($msg);
dd($chat_id);
return $tgmsg;
// return response()->json(['status' => 'ok']);
}
}