首次提交 Laravel 專案
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4" style="margin-bottom: -8px;">
|
||||
<path fill-rule="evenodd" d="M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<?php /**PATH /var/www/ExpinBot/vendor/laravel/framework/src/Illuminate/Foundation/Providers/../resources/exceptions/renderer/components/icons/chevron-up.blade.php ENDPATH**/ ?>
|
||||
|
After Width: | Height: | Size: 482 B |
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tg_group_users', function (Blueprint $table) {
|
||||
$table->increments('id'); // 主键 + AUTO_INCREMENT
|
||||
$table->string('chat_id', 50)->comment('隶属群ID');
|
||||
$table->string('user_id', 15)->comment('tg的ID');
|
||||
$table->string('first_name')->nullable();
|
||||
$table->string('last_name')->nullable();;
|
||||
$table->string('username')->nullable()->comment('tg的username');
|
||||
$table->string('status')->comment('用户在群的角色'); // creator, administrator, member, left, kicked
|
||||
// | status 值 | 中文说明 | 含义与场景说明 |
|
||||
// | --------------- | ---- | ----------------------------- |
|
||||
// | `creator` | 群主 | 用户是该群的创建者,拥有全部权限。 |
|
||||
// | `administrator` | 管理员 | 用户被群主授权,具有部分或全部管理权限。 |
|
||||
// | `member` | 普通成员 | 用户是该群的普通成员。 |
|
||||
// | `restricted` | 受限成员 | 用户仍在群中,但被禁言或限制了部分行为(如发图、发链接)。 |
|
||||
// | `left` | 已退出 | 用户曾在群内,但已离开。 |
|
||||
// | `kicked` | 被踢出 | 用户已被管理员踢出群组,且无法自动重新加入。 |
|
||||
$table->string('language_code')->nullable();
|
||||
$table->json('raw_data')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['chat_id', 'user_id']); // 防止重复记录
|
||||
|
||||
// $table->decimal('rate', 10, 2)->default(0)->comment('费率');
|
||||
// $table->decimal('exchange_rate', 10, 2)->default(0)->comment('汇率');
|
||||
// $table->integer('end_time')->nullable()->comment('日结束时间');
|
||||
// $table->integer('operator')->default(0)->comment('操作员 0不是1是');
|
||||
// $table->integer('competence')->default(0)->comment('0普通权限,1管理员');
|
||||
// $table->string('inviter', 50)->nullable()->comment('邀请人');
|
||||
// $table->timestamp('created_at')->nullable();
|
||||
// $table->timestamp('updated_at')->nullable();
|
||||
// 设置字符集与排序规则
|
||||
$table->charset = 'utf8mb4';
|
||||
$table->collation = 'utf8mb4_0900_ai_ci';
|
||||
});
|
||||
|
||||
// 若需要设置表注释(Laravel 原生不支持)
|
||||
// 可借助 doctrine/dbal 手动添加,或使用迁移后执行 SQL 语句
|
||||
DB::statement("ALTER TABLE `group_users` COMMENT = '群用户人员'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('group_users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*/
|
||||
public function test_the_application_returns_a_successful_response(): void
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user