dd/app/Services/Tg/Hook/Mod/Db.php
2025-11-13 18:03:24 +08:00

45 lines
985 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 $columns[0]->{"Create Table"};
}
}