You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.8 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\service;
use app\common\cache\AdminTokenCache;
use app\common\model\auth\AdminSession;
use think\facade\Config;
use app\common\model\game\UserRoles;
use app\common\model\game\UserAccount;
/**
* 管理员token
* Class AdminTokenService
* @package app\adminapi\service
*/
class GameService
{
public static function getInnerUids()
{
return UserAccount::where('Usertype', 8)
->where('Inner', 1)
->column('Uid');
}
public static function getPermission($per)
{
$permission = [];
if ($per & 1) {
$permission[] = '已封号';
}
if ($per & 2) {
$permission[] = '已禁言';
}
return implode('、', $permission);
}
// 游戏服务平台登录
public static function gameUserLogin($uid)
{
$baseUrl = env('app.game_server_url');
$appid = env('app.appid', 'daodao');
$account = UserAccount::where('Appid', $appid)
->where('Usertype', 8)
->where('Uid', $uid)
->find();
if (!$account) {
return false;
}
$openAccount = UserAccount::where('Appid', $appid)
->where('Usertype', 7)
->where('Uid', $account['Openid'])
->find();
$platformLogin = $baseUrl . '/user/loginPlatform?cid=' . $account['Cid'] . '&openid=' . $openAccount['Openid'];
// $roleLoginUrl = $baseUrl . '/user/login?cid=' . $account['Cid'] . '&token=' . $role['token'];
// $roleLoginRes = file_get_contents($roleLoginUrl);
// if (!$roleLoginRes) {
// return false;
// }
return true;
}
// 游戏服务协议调用
public static function gameBasicLogin($uid, $cmd = '/basic/login')
{
// $baseUrl = env('app.game_server_url');
// $basicLoginRes = file_get_contents($baseUrl . '?userId=' . $params['uid'] . '&isAuti=1&token=' . $roleLoginRes['token']);
// if ($basicLoginRes) {
// }
return true;
}
}