25 Star 218 Fork 72

BBBUG/BBBUG API

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BaseCommand.php 1023 Bytes
一键复制 编辑 原始数据 按行查看 历史
Hamm 提交于 2020-11-14 01:25 +08:00 . fix: 抽离部分常量配置
<?php
declare(strict_types=1);
namespace app\command;
use think\console\Command;
use app\model\Conf as ConfModel;
class BaseCommand extends Command
{
public function loadConfig(){
$confModel = new ConfModel();
$configs = $confModel->select()->toArray();
$c = [];
foreach ($configs as $config) {
$c[$config['conf_key']] = $config['conf_value'];
}
config($c, 'startadmin');
}
protected function console($text, $break = true)
{
print_r($text . ($break ? PHP_EOL : ''));
}
protected function success($text, $break = true)
{
print_r(chr(27) . "[42m" . "$text" . chr(27) . "[0m" . ($break ? PHP_EOL : ''));
}
protected function error($text, $break = true)
{
print_r(chr(27) . "[41m" . "$text" . chr(27) . "[0m" . ($break ? PHP_EOL : ''));
}
protected function warning($text, $break = true)
{
print_r(chr(27) . "[43m" . "$text" . chr(27) . "[0m" . ($break ? PHP_EOL : ''));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/bbbug_com/ChatAPI.git
git@gitee.com:bbbug_com/ChatAPI.git
bbbug_com
ChatAPI
BBBUG API
master

搜索帮助