github/app/Services/TG/Hook/Mod/Db.php
2025-07-15 17:30:33 +08:00

45 lines
1000 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Services\TG\Hook\Mod;
//use App\Models\Article as ModelArticle;
class Db extends Base {
public function sql($aParam)
{
if ($aParam["aArg"][1] == "?") {
return "/db#sql {value}";
}
$aValue = $aParam["aArg"];
$sValue = implode(" ", $aValue);
$r = \DB::statement($sValue);
return $r;
}
public function me()
{
$str = "
添加字段ALTER Table `ship` ADD `good_test` TEXT DEFAULT NULL AFTER `api_huodong`
删除字段ALTER TABLE `ship` DROP COLUMN `good_test`
修改字段ALTER TABLE `ship` MODIFY `good_test` VARCHAR(255) DEFAULT NULL
";
return $str;
}
public function showCreateTable($aParam)
{
$sValue = $aParam["aArg"][1] ?? false;
$columns = \DB::select("SHOW CREATE TABLE `{$sValue}`");
return $this->toJson($columns[0]->{"Create Table"});
}
}