🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ <?php namespace app\index\controller; use think\Log; /** * 禁言封号 */ class Ban extends Controller { /** * 初始化 */ protected function logInit() { Log::init([ 'type' => 'File', 'path' => APP_PATH . 'index' . DS . 'logs' . DS, ]); } /** * 账户解封 */ public function unbanAccount() { try { $this->logInit(); $ids = json_decode(input('id'), true); foreach ($ids as $key => $id) { //账号解封 $this->user->banAccount($id, 1); //增加解封标记 BanModel::where('uid', $id) ->where('operation', 1) ->update(['unsealed' => 1]); } $output['success'] = true; $output['msg'] = '解封操作成功'; _callback($output); } catch (\Exception $e) { throw new \think\Exception('异常消息:' . $e->getMessage()); } } ~~~ 日志记录 ~~~ --------------------------------------------------------------- [ 2017-11-30T10:39:56+08:00 ] ::1 ::1 GET /workspace/DragonApi/public/index.php/index/Ban/unbanComment/?id=%5B1000424%2C1000427%5D&_dc=1512009595819&callback=Ext.data.JsonP.callback36 [ sql ] [ DB ] CONNECT:[ UseTime:0.137007s ] mysql:host=rm-bp1h205f36fv8pecto.mysql.rds.aliyuncs.com;dbname=test;charset=utf8 [ sql ] [ SQL ] SHOW COLUMNS FROM `d_character` [ RunTime:0.061003s ] [ sql ] [ SQL ] UPDATE `d_character` SET `donttalk`=0 WHERE `id` = 1000424 [ RunTime:0.069004s ] [ sql ] [ DB ] CONNECT:[ UseTime:0.089005s ] mysql:host=rm-bp1h205f36fv8pecto.mysql.rds.aliyuncs.com;dbname=test;charset=utf8 [ sql ] [ SQL ] SHOW COLUMNS FROM `acc_dragon_ban` [ RunTime:0.060004s ] [ sql ] [ SQL ] UPDATE `acc_dragon_ban` SET `unsealed`=1 WHERE `uid` = 1000424 AND `operation` = '0' [ RunTime:0.070004s ] [ sql ] [ SQL ] UPDATE `d_character` SET `donttalk`=0 WHERE `id` = 1000427 [ RunTime:0.037002s ] [ sql ] [ SQL ] UPDATE `acc_dragon_ban` SET `unsealed`=1 WHERE `uid` = 1000427 AND `operation` = '0' [ RunTime:0.031002s ] ~~~