后台GM命令的明文,路径\www\wwwroot\helloyuan.com\application\common\controller

主要是发邮件,充值和获取角色信息的,有想法的可以自己定制

将下面代码重命名Game.php,并放到指定位置

<?php

namespace app\common\controller;
//更多游戏资源:helloyuan.com
class Game extends \think\Controller
{
	public function Test()
	{
	}
	public function admingm($gmdata)
	{
		$url = "http://127.0.0.1:8877/gm";
		$data_user = \think\Db::name("gameconfig")->where("server", $gmdata["server"])->field("ip,gmport")->find();
		if (!$data_user["ip"]) {
			return "ip未设置";
		}
		$getdata = ["server" => $gmdata["server"], "cmd" => $gmdata["cmda"], "subcmd" => $gmdata["cmdb"], "body" => $gmdata["body"], "ip" => $data_user["ip"], "gmport" => $data_user["gmport"]];
		$Test = ["server", "cmd", "subcmd"];
		$Testyz = "#1346#";
		foreach ($Test as $x => $x_value) {
			if (isset($getdata[$x_value])) {
				$Testyz = $Testyz . $x_value . "*" . $getdata[$x_value];
			} else {
				$Testyz = $Testyz . $x_value . "*" . "";
			}
		}
		$Testyz = $Testyz . "#6431#";
		$getdata["md5"] = md5($Testyz);
		$getdata["body"] = json_encode($getdata["body"]);
		$returngm = http_curl($url, "get", $getdata);
        
		if ($returngm) {
			$returngm = json_decode($returngm, true);
			if (isset($returngm["code"])) {
				if (isset($returngm["msg"]["body"])) {
					if ($gmdata["cmdb"] == "userNums") {
						return $returngm["msg"]["body"];
					} else {
						return $returngm["msg"]["body"]["msg"];
					}
				} else {
					return ["code" => $returngm["code"], "msg" => "服务器返回参数错误 body"];
				}
			} else {
				return ["code" => "1001", "msg" => "服务器返回参数错误"];
			}
		} else {
			return ["code" => "1001", "msg" => "服务器连接失败"];
		}
	}
	public function pay($paydata)
	{
		$url = "http://127.0.0.1:8877/gm";
		$data_user = \think\Db::name("gameconfig")->where("server", $paydata["server"])->field("ip,gmport")->find();
		if (!$data_user["ip"]) {
			return "ip未设置";
		}
		$getdata = ["server" => $paydata["server"], "cmd" => $paydata["cmda"], "subcmd" => $paydata["cmdb"], "body" => $paydata["body"], "ip" => $data_user["ip"], "gmport" => $data_user["gmport"]];
		$Test = ["server", "cmd", "subcmd"];
		$Testyz = "#1346#";
		foreach ($Test as $x => $x_value) {
			if (isset($getdata[$x_value])) {
				$Testyz = $Testyz . $x_value . "*" . $getdata[$x_value];
			} else {
				$Testyz = $Testyz . $x_value . "*" . "";
			}
		}
		$Testyz = $Testyz . "#6431#";
		$getdata["md5"] = md5($Testyz);
		$Test = ["orderid", "accid", "roleid", "mallType", "goodsid", "money", "time"];
		$Testyz = "";
		foreach ($Test as $x => $x_value) {
			if (isset($getdata["body"][$x_value])) {
				$Testyz = $Testyz . $getdata["body"][$x_value];
			} else {
				$Testyz = $Testyz . "0";
			}
		}
		$userdata = \think\Db::name("config")->field("title")->where(["state" => 1, "name" => "skey"])->find();
		$Testyz = $Testyz . $userdata["title"];
		$getdata["body"]["token"] = md5($Testyz);
		$getdata["body"] = json_encode($getdata["body"]);
		$returngm = http_curl($url, "get", $getdata);
		if ($returngm) {
			$returngm = json_decode($returngm, true);
			if (isset($returngm["code"])) {
				if (isset($returngm["msg"]["body"])) {
					return $returngm["msg"]["body"]["result"];
				} else {
					return ["code" => "1001", "msg" => "服务器返回参数错误 body"];
				}
			} else {
				return ["code" => "1001", "msg" => "服务器返回参数错误"];
			}
		} else {
			return ["code" => "1001", "msg" => "服务器连接失败"];
		}
	}
	public function regionname($server = "", $surface = "", $page = "", $limit = "", $Account = "", $rolesee = "", $Accounta = false)
	{
		if ($surface) {
			$database = config("database");
			$data_user = \think\Db::name("gameconfig")->field("surface")->where("server", $server)->find();
			if ($data_user) {
				$surfaced = $data_user["surface"];
				$connect = "mysql://" . $database["username"] . ":" . $database["password"] . "@" . $database["hostname"] . ":3306/" . $surfaced . "#utf8";
				if ($page && $limit) {
					if ($Account) {
						$data = \think\Db::connect($connect)->field("guid,accid,name,level,viplvl,vipexp")->where("guid|accid|name", $Account)->table($surface)->page($page, $limit)->select();
						$count = \think\Db::connect($connect)->where("guid|accid|name", $Account)->table($surface)->count();
					} else {
						$data = \think\Db::connect($connect)->field("guid,accid,name,level,viplvl,vipexp")->table($surface)->page($page, $limit)->select();
						$count = \think\Db::connect($connect)->table($surface)->count();
					}
					return ["count" => $count, "data" => $data];
				}
				
				if ($Accounta) {
					$data = \think\Db::connect($connect)->field("guid,accid,name,level,viplvl,vipexp")->where("guid|accid|name", $Account)->table($surface)->find();
					return $data;
				}
				if ($rolesee) {
					$data = \think\Db::connect($connect)->field("guid,accid,name,level,viplvl,vipexp")->table($surface)->where("name", $rolesee)->find();
					return $data;
				}
			}
		}
		if ($server) {
			$data_user = \think\Db::name("gameconfig")->field("name")->where("server", $server)->find();
			if ($data_user) {
				return $data_user["name"];
			}
			return "未知大区名";
		}
	}
	public function gamelimit($data = [])
	{
		$limitd = [1 => ["se.jq.3usd.wc" => 1, "se.jq.5usd.wc" => 1, "se.jq.1usd.lb" => 3, "se.jq.2usd.lb" => 3, "se.jq.3usd.lb" => 3, "se.jq.5usd.palb" => 5, "se.jq.14usd.hllb" => 5, "se.jq.50usd.jxlb" => 5, "se.jq.100usd.wxlb" => 5, "se.jq.101usd.wxlb" => 5]];
		if ($data) {
			$data_userd = \think\Db::name("gameorder")->where(["server" => $data["server"], "role" => $data["role"], "cmda" => $data["cmda"], "cmdb" => $data["cmdb"], "state" => 1])->whereTime("uptime", "today")->count();
			if (isset($limitd[$data["cmda"]])) {
				if (isset($limitd[$data["cmda"]][$data["cmdb"]])) {
					if ($limitd[$data["cmda"]][$data["cmdb"]] <= $data_userd) {
						return false;
					} else {
						return true;
					}
				} else {
					return true;
				}
			} else {
				return true;
			}
		}
		return false;
	}
	public function serverread()
	{
		$res = new Res();
		$admin_server = \think\Session::get("admin_server");
		$admin_role = \think\Session::get("admin_role");
		if ($res->decryptByPrivateKey($admin_server) && $res->decryptByPrivateKey($admin_role)) {
			return ["server" => $res->decryptByPrivateKey($admin_server), "role" => $res->decryptByPrivateKey($admin_role)];
		}
	}
}

18 评论

  1. 楼王

    镇楼

  2. 2 楼

    感谢分享

  3. 3 楼

    感谢分享

  4. 4 楼

    啦啦啦啦啦啦

  5. 5 楼

    啊大风刮过飞飞飞

  6. 6 楼

    啊大风刮过飞飞飞

  7. 7 楼

    啊大风刮过飞飞飞

  8. 8 楼

    啊大风刮过飞飞飞

  9. 9 楼

    啊大风刮过飞飞飞

  10. 10 楼

    啊大风刮过飞飞飞

回复主题

VIP中心
任务中心