From 6e1fc0c3ef04a4fd2eec8ff3f657dfa77d64adb2 Mon Sep 17 00:00:00 2001 From: zhouzp <1558048883@qq.com> Date: Wed, 17 Jun 2026 10:12:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Index.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 427d9b2..9bdb472 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -2,16 +2,19 @@ namespace app\api\controller; +use app\common\service\XyxServices; use ba\Tree; use Throwable; use think\facade\Db; use think\facade\Config; use app\common\controller\Frontend; use app\common\library\token\TokenExpirationException; +use app\admin\model\User as UserModel; +use app\admin\model\Config as ConfigModel; class Index extends Frontend { - protected array $noNeedLogin = ['index']; + protected array $noNeedLogin = ['index', 'xyxLogin']; public function initialize(): void { @@ -81,4 +84,27 @@ class Index extends Frontend 'menus' => $menus, ]); } + + public function xyxLogin() + { + $encodedContent = $this->request->param('userData', ''); + $merchantId = $this->request->param('clientMerchant', ''); + $gameId = $this->request->post('page'); + if (!$encodedContent || !$merchantId || !$gameId) { + $this->error(__('Parameter %s can not be empty')); + } + $config = ConfigModel::where('group', 'jdk_api')->where('name', 'access_id')->where('value', $merchantId)->find(); + if (!$config) { + $this->error(__('clientMerchant error')); + } + parse_str(base64_decode($encodedContent), $output); + $user = $output['jdkUserId'] ?? ''; + $player = UserModel::where('jk_user_id', $user)->find(); + if (!$player) { + $this->error(__('player not found')); + } + $xyxServices = new XyxServices($player); + $res = $xyxServices->login(['gameCode' => $gameId]); + $this->success('success',[$res]); + } } \ No newline at end of file