|
|
<?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;
|
|
|
}
|
|
|
}
|