diff --git a/application/admin/controller/GameGmController.php b/application/admin/controller/GameGmController.php index 44eb0fe..4e9d240 100644 --- a/application/admin/controller/GameGmController.php +++ b/application/admin/controller/GameGmController.php @@ -23,12 +23,12 @@ class GameGmController extends Controller $param = $request->param(); // 获取请求参数 // 校验密码场景,验证管理员输入的 GM 操作密码是否正确 - $validate->scene('password')->check($param) or admin_error($validate->getError()); + //$validate->scene('password')->check($param) or admin_error($validate->getError()); // 验证密码是否匹配配置项中的加密密码 - if (!password_verify($param['password'], base64_decode(Config::get('game.gm.password')))) { + //if (!password_verify($param['password'], base64_decode(Config::get('game.gm.password')))) { // admin_error(lang('gm_password_error')); - } + //} // 根据前端传入的 type 参数判断要执行的 GM 操作类型 switch ($param['type']) { @@ -203,6 +203,15 @@ class GameGmController extends Controller admin_error($e->getMessage()); } break; + + case 'closeserver': + //设置关服时间 + try { + $result = $model::closeserver($param['times']); // 标识多少分钟后关闭 + } catch (\Exception $e) { + admin_error($e->getMessage()); + } + break; } // 操作成功,统一返回成功提示;否则返回 GM 接口失败 diff --git a/application/admin/view/game_gm/index.html b/application/admin/view/game_gm/index.html index c3af0f0..eec37b6 100644 --- a/application/admin/view/game_gm/index.html +++ b/application/admin/view/game_gm/index.html @@ -267,6 +267,20 @@ + +
+ +
+ +
+
+
+ +
+ +
+
diff --git a/application/common/model/GameGm.php b/application/common/model/GameGm.php index d85fced..87d98de 100644 --- a/application/common/model/GameGm.php +++ b/application/common/model/GameGm.php @@ -247,6 +247,17 @@ class GameGm extends Model return self::apiResult($result); } + public static function closeserver($time, int $server_id=0) + { + $data = [ + 'sign' => self::$sign, + 'server_id' => $server_id, + 'time' => $time + ]; + $result = self::$Curl->url(self::$api_url . '/say_close?' . http_build_query($data)); + return self::apiResult($result); + } + public static function get_item_list() { $path = Env::get('config_path'); diff --git a/application/game/controller/UserController.php b/application/game/controller/UserController.php new file mode 100644 index 0000000..f8cd3b8 --- /dev/null +++ b/application/game/controller/UserController.php @@ -0,0 +1,40 @@ +isPost()) { + $param = $request->param(); + + try { + $inset = [ + 'account' => $param['email'], + 'salt' => $param['salt'], + 'password' => $param['password'], + 'invite' => rand(100000,999999), + 'register_time' => date("Y-m-d H:i:s",time()) + ]; + $result = $model->insertGetId($inset); + + } catch (\Exception $e) { + return error($e->getMessage()); + } + return success('success'); + } + } + +} \ No newline at end of file diff --git a/public/static/admin/js/game_gm.js b/public/static/admin/js/game_gm.js index 5343167..c71713a 100644 --- a/public/static/admin/js/game_gm.js +++ b/public/static/admin/js/game_gm.js @@ -33,7 +33,6 @@ $("#create_robot").on("click", function () { return false; }); - $("#clear_robot").on("click", function () { // 通过,则发起ajax请求,提交表单 $.post({ @@ -486,3 +485,28 @@ $("#inform").on("click", function () { }); return false; }); + + +$("#set_close").on("click", function () { + // 通过,则发起ajax请求,提交表单 + $.post({ + url: GM_URL, + data: { + type: 'closeserver', + times: $('#closetime').val(), + }, + cache: false, + dataType: 'json', + success: function (result) { + if (result.code == 1) { + layer.msg(result.msg, {icon: 6}); + } else { + layer.msg(result.msg, {icon: 5}); + } + }, + error: function () { + layer.msg('连接失败...请重试', {icon: 5}); + } + }); + return false; +}); \ No newline at end of file