|
@@ -6,6 +6,7 @@ use App\Commons\Model\Money_recharge;
|
|
|
use Biz\Account\Repository\AccountRepository;
|
|
use Biz\Account\Repository\AccountRepository;
|
|
|
use Biz\TokenManager;
|
|
use Biz\TokenManager;
|
|
|
use App\Api\Model\Dc_user_grade;
|
|
use App\Api\Model\Dc_user_grade;
|
|
|
|
|
+use App\Commons\Model\WagentCheckToken as WagentCheckTokenModel;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Created by PhpStorm.
|
|
* Created by PhpStorm.
|
|
@@ -16,9 +17,11 @@ use App\Api\Model\Dc_user_grade;
|
|
|
// ini_set('display_errors', 1);
|
|
// ini_set('display_errors', 1);
|
|
|
|
|
|
|
|
// error_reporting(E_ALL);
|
|
// error_reporting(E_ALL);
|
|
|
-class AccountManager {
|
|
|
|
|
|
|
+class AccountManager
|
|
|
|
|
+{
|
|
|
|
|
|
|
|
- public function __construct() {
|
|
|
|
|
|
|
+ public function __construct()
|
|
|
|
|
+ {
|
|
|
$this->model = lm('account', 'Commons');
|
|
$this->model = lm('account', 'Commons');
|
|
|
$this->repository = new AccountRepository();
|
|
$this->repository = new AccountRepository();
|
|
|
}
|
|
}
|
|
@@ -30,8 +33,8 @@ class AccountManager {
|
|
|
* @param $password
|
|
* @param $password
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
- public function login($account, $password) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public function login($account, $password, $agentuseToken = '')
|
|
|
|
|
+ {
|
|
|
$password = trim($password);
|
|
$password = trim($password);
|
|
|
$account = strtolower(trim($account));
|
|
$account = strtolower(trim($account));
|
|
|
define("OVERTIME", 1800);
|
|
define("OVERTIME", 1800);
|
|
@@ -39,8 +42,15 @@ class AccountManager {
|
|
|
$result = ['status' => -4025, 'msg' => lang()->get('user does not exist')];
|
|
$result = ['status' => -4025, 'msg' => lang()->get('user does not exist')];
|
|
|
return $result;
|
|
return $result;
|
|
|
} else {
|
|
} else {
|
|
|
- if ($this->checkPassword($user, $password)) {
|
|
|
|
|
|
|
+ if (!empty($agentuseToken)) {
|
|
|
|
|
+ $ret = (new WagentCheckTokenModel())->getByToken($agentuseToken, $account);
|
|
|
|
|
+ if ($ret) {
|
|
|
|
|
+ goto CHECKOKLAB;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if ($this->checkPassword($user, $password)) {
|
|
|
|
|
+ CHECKOKLAB:
|
|
|
try {
|
|
try {
|
|
|
//绑定用户
|
|
//绑定用户
|
|
|
// lm('user_logs')->bindUser($user->identity,$user->account);
|
|
// lm('user_logs')->bindUser($user->identity,$user->account);
|
|
@@ -106,13 +116,13 @@ class AccountManager {
|
|
|
// lm('nagent_detailed', 'commons')->where('agent_identity', $userInfo[0]['account_identity'])->update(['invite' => $userInfo[0]['open_invitation']]);
|
|
// lm('nagent_detailed', 'commons')->where('agent_identity', $userInfo[0]['account_identity'])->update(['invite' => $userInfo[0]['open_invitation']]);
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
- $userInfo[0]['remark'] = str_replace("%","",$userInfo[0]['remark']);
|
|
|
|
|
|
|
+ $userInfo[0]['remark'] = str_replace("%", "", $userInfo[0]['remark']);
|
|
|
//获取当前用户分组名称
|
|
//获取当前用户分组名称
|
|
|
- $substr = substr($userInfo[0]['group_name'],strpos($userInfo[0]['group_name'],'|')+1);
|
|
|
|
|
|
|
+ $substr = substr($userInfo[0]['group_name'], strpos($userInfo[0]['group_name'], '|') + 1);
|
|
|
$role_name = substr($substr, 0, -1);
|
|
$role_name = substr($substr, 0, -1);
|
|
|
//获取用户分组的投注限额
|
|
//获取用户分组的投注限额
|
|
|
$bet_money_limit = Dc_user_grade::get_bet_money_limit($role_name);
|
|
$bet_money_limit = Dc_user_grade::get_bet_money_limit($role_name);
|
|
|
- $userInfo[0]['bet_money_limit'] = ['lower_limit'=>$bet_money_limit->lower_limit,'upper_limit'=>$bet_money_limit->upper_limit];
|
|
|
|
|
|
|
+ $userInfo[0]['bet_money_limit'] = ['lower_limit' => $bet_money_limit->lower_limit, 'upper_limit' => $bet_money_limit->upper_limit];
|
|
|
|
|
|
|
|
$result = ['data' => $userInfo, 'status' => 1, 'msg' => lang()->get('login successful')];
|
|
$result = ['data' => $userInfo, 'status' => 1, 'msg' => lang()->get('login successful')];
|
|
|
return $result;
|
|
return $result;
|
|
@@ -130,7 +140,8 @@ class AccountManager {
|
|
|
/*
|
|
/*
|
|
|
* 生成用户邀请码
|
|
* 生成用户邀请码
|
|
|
*/
|
|
*/
|
|
|
- public function setrandomcodes($account_identity) {
|
|
|
|
|
|
|
+ public function setrandomcodes($account_identity)
|
|
|
|
|
+ {
|
|
|
if (empty($account_identity)) {
|
|
if (empty($account_identity)) {
|
|
|
return -4080;
|
|
return -4080;
|
|
|
}
|
|
}
|
|
@@ -151,7 +162,8 @@ class AccountManager {
|
|
|
* @param $user
|
|
* @param $user
|
|
|
* @return \Sting
|
|
* @return \Sting
|
|
|
*/
|
|
*/
|
|
|
- public function getAccount($account) {
|
|
|
|
|
|
|
+ public function getAccount($account)
|
|
|
|
|
+ {
|
|
|
$result = $this->model->where(['account' => $account, 'status' => 1])->first();
|
|
$result = $this->model->where(['account' => $account, 'status' => 1])->first();
|
|
|
if (!$result) {
|
|
if (!$result) {
|
|
|
$result = $this->model->where(['account' => $account, 'status' => 4])->first();
|
|
$result = $this->model->where(['account' => $account, 'status' => 4])->first();
|
|
@@ -166,7 +178,8 @@ class AccountManager {
|
|
|
* @param $password
|
|
* @param $password
|
|
|
* @return bool
|
|
* @return bool
|
|
|
*/
|
|
*/
|
|
|
- public function checkPassword($user, $password) {
|
|
|
|
|
|
|
+ public function checkPassword($user, $password)
|
|
|
|
|
+ {
|
|
|
$accountPassword = lm('account_password', 'Commons')->where(['account_identity' => $user->identity, 'status' => 1])->first();
|
|
$accountPassword = lm('account_password', 'Commons')->where(['account_identity' => $user->identity, 'status' => 1])->first();
|
|
|
$dataPassword = md5(md5($accountPassword->encryption . $password));
|
|
$dataPassword = md5(md5($accountPassword->encryption . $password));
|
|
|
return $dataPassword == $accountPassword->account_password ? true : false;
|
|
return $dataPassword == $accountPassword->account_password ? true : false;
|
|
@@ -178,7 +191,8 @@ class AccountManager {
|
|
|
* @param $userInfo
|
|
* @param $userInfo
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function insertLogLife($userInfo) {
|
|
|
|
|
|
|
+ public function insertLogLife($userInfo)
|
|
|
|
|
+ {
|
|
|
$type = $this->CheckisMobile();
|
|
$type = $this->CheckisMobile();
|
|
|
if ($type) {
|
|
if ($type) {
|
|
|
$intype = "手机端";
|
|
$intype = "手机端";
|
|
@@ -207,12 +221,14 @@ class AccountManager {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*移动端判断*/
|
|
/*移动端判断*/
|
|
|
- public function CheckisMobile() {
|
|
|
|
|
|
|
+ public function CheckisMobile()
|
|
|
|
|
+ {
|
|
|
return is_mobile();
|
|
return is_mobile();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*获取浏览器*/
|
|
/*获取浏览器*/
|
|
|
- public function GetBrowser() {
|
|
|
|
|
|
|
+ public function GetBrowser()
|
|
|
|
|
+ {
|
|
|
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
|
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
|
|
$br = $_SERVER['HTTP_USER_AGENT'];
|
|
$br = $_SERVER['HTTP_USER_AGENT'];
|
|
|
if (preg_match('/MSIE/i', $br)) {
|
|
if (preg_match('/MSIE/i', $br)) {
|
|
@@ -235,7 +251,8 @@ class AccountManager {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*获取设备*/
|
|
/*获取设备*/
|
|
|
- public function device() {
|
|
|
|
|
|
|
+ public function device()
|
|
|
|
|
+ {
|
|
|
foreach ($_SERVER as $name => $value) {
|
|
foreach ($_SERVER as $name => $value) {
|
|
|
|
|
|
|
|
if (substr($name, 0, 5) == 'HTTP_') {
|
|
if (substr($name, 0, 5) == 'HTTP_') {
|
|
@@ -288,13 +305,14 @@ class AccountManager {
|
|
|
*
|
|
*
|
|
|
* @return int
|
|
* @return int
|
|
|
*/
|
|
*/
|
|
|
- public function refreshToken($token = '') {
|
|
|
|
|
- if(!empty($token)) {
|
|
|
|
|
|
|
+ public function refreshToken($token = '')
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!empty($token)) {
|
|
|
$str_token = $token ? trim($token) : '';
|
|
$str_token = $token ? trim($token) : '';
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$str_token = $_POST['token'] ? trim($_POST['token']) : '';
|
|
$str_token = $_POST['token'] ? trim($_POST['token']) : '';
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$token = new TokenManager();
|
|
$token = new TokenManager();
|
|
|
$userInfo = $token->getAccountInfo($str_token);
|
|
$userInfo = $token->getAccountInfo($str_token);
|
|
|
if (count($userInfo) > 0) {
|
|
if (count($userInfo) > 0) {
|
|
@@ -311,7 +329,8 @@ class AccountManager {
|
|
|
* @param [type] $token [description]
|
|
* @param [type] $token [description]
|
|
|
* @return [type] [description]
|
|
* @return [type] [description]
|
|
|
*/
|
|
*/
|
|
|
- public function refreshStatus($str_token) {
|
|
|
|
|
|
|
+ public function refreshStatus($str_token)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
$token = new TokenManager();
|
|
$token = new TokenManager();
|
|
|
if (empty($str_token)) {
|
|
if (empty($str_token)) {
|
|
@@ -348,15 +367,16 @@ class AccountManager {
|
|
|
* @return array JsonString
|
|
* @return array JsonString
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function savePassword($post) {
|
|
|
|
|
- $userInfo = $this -> getCurrentUser();
|
|
|
|
|
|
|
+ public function savePassword($post)
|
|
|
|
|
+ {
|
|
|
|
|
+ $userInfo = $this->getCurrentUser();
|
|
|
// 判断用户登录
|
|
// 判断用户登录
|
|
|
if (empty($userInfo)) {
|
|
if (empty($userInfo)) {
|
|
|
- $result = ['status' => -4001, 'msg' => lang() -> get('user does not exist')];
|
|
|
|
|
|
|
+ $result = ['status' => -4001, 'msg' => lang()->get('user does not exist')];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
// 验证用户状态
|
|
// 验证用户状态
|
|
|
- if ($row = $this -> repository -> checkAccountStatus($userInfo)) {
|
|
|
|
|
|
|
+ if ($row = $this->repository->checkAccountStatus($userInfo)) {
|
|
|
return $row;
|
|
return $row;
|
|
|
};
|
|
};
|
|
|
$oldPassword = strip_tags($post['oldPassword']);
|
|
$oldPassword = strip_tags($post['oldPassword']);
|
|
@@ -366,10 +386,10 @@ class AccountManager {
|
|
|
return $r;
|
|
return $r;
|
|
|
}*/
|
|
}*/
|
|
|
// 验证密码
|
|
// 验证密码
|
|
|
- if ($this -> checkPassword($userInfo, $oldPassword)) {
|
|
|
|
|
|
|
+ if ($this->checkPassword($userInfo, $oldPassword)) {
|
|
|
// 密码加密
|
|
// 密码加密
|
|
|
$pwdData = GenPassword($newPassword);
|
|
$pwdData = GenPassword($newPassword);
|
|
|
- lm('account_password', 'Commons') -> updatePassword($userInfo -> identity, $pwdData);
|
|
|
|
|
|
|
+ lm('account_password', 'Commons')->updatePassword($userInfo->identity, $pwdData);
|
|
|
$result = ['status' => 1, 'msg' => lang()->get('update successful')];
|
|
$result = ['status' => 1, 'msg' => lang()->get('update successful')];
|
|
|
return $result;
|
|
return $result;
|
|
|
} else {
|
|
} else {
|
|
@@ -388,15 +408,16 @@ class AccountManager {
|
|
|
* @return array JsonString
|
|
* @return array JsonString
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function savePayPassword() {
|
|
|
|
|
- $userInfo = $this -> getCurrentUser();
|
|
|
|
|
|
|
+ public function savePayPassword()
|
|
|
|
|
+ {
|
|
|
|
|
+ $userInfo = $this->getCurrentUser();
|
|
|
// 判断用户登录
|
|
// 判断用户登录
|
|
|
if (empty($userInfo)) {
|
|
if (empty($userInfo)) {
|
|
|
- $result = ['status' => -4001, 'msg' => lang() -> get('user does not exist')];
|
|
|
|
|
|
|
+ $result = ['status' => -4001, 'msg' => lang()->get('user does not exist')];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
// 验证用户状态
|
|
// 验证用户状态
|
|
|
- if ($row = $this -> repository -> checkAccountStatus($userInfo)) {
|
|
|
|
|
|
|
+ if ($row = $this->repository->checkAccountStatus($userInfo)) {
|
|
|
return $row;
|
|
return $row;
|
|
|
};
|
|
};
|
|
|
$oldPayPassword = strip_tags($_POST['oldPayPassword']);
|
|
$oldPayPassword = strip_tags($_POST['oldPayPassword']);
|
|
@@ -406,14 +427,14 @@ class AccountManager {
|
|
|
return $r;
|
|
return $r;
|
|
|
}*/
|
|
}*/
|
|
|
// 验证交易密码
|
|
// 验证交易密码
|
|
|
- $this -> verifyPayPwd($userInfo['identity'], $oldPayPassword);
|
|
|
|
|
|
|
+ $this->verifyPayPwd($userInfo['identity'], $oldPayPassword);
|
|
|
// 获取新支付密码加密
|
|
// 获取新支付密码加密
|
|
|
$pwdData = GenPassword($newPayPassword);
|
|
$pwdData = GenPassword($newPayPassword);
|
|
|
// 修改支付密码
|
|
// 修改支付密码
|
|
|
$upPayPwdWhere['account_identity'] = $userInfo['identity'];
|
|
$upPayPwdWhere['account_identity'] = $userInfo['identity'];
|
|
|
$upPayPwdData['pay_password'] = $pwdData['password'];
|
|
$upPayPwdData['pay_password'] = $pwdData['password'];
|
|
|
$upPayPwdData['encryption'] = $pwdData['encryption'];
|
|
$upPayPwdData['encryption'] = $pwdData['encryption'];
|
|
|
- lm('pay_password', 'Commons') -> updatePayPassword($upPayPwdWhere, $upPayPwdData);
|
|
|
|
|
|
|
+ lm('pay_password', 'Commons')->updatePayPassword($upPayPwdWhere, $upPayPwdData);
|
|
|
$result = ['status' => 1, 'msg' => lang()->get('update successful')];
|
|
$result = ['status' => 1, 'msg' => lang()->get('update successful')];
|
|
|
|
|
|
|
|
return $result;
|
|
return $result;
|
|
@@ -428,20 +449,21 @@ class AccountManager {
|
|
|
* @return String
|
|
* @return String
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function verifyPayPwd($identity, $payPassword) {
|
|
|
|
|
|
|
+ public function verifyPayPwd($identity, $payPassword)
|
|
|
|
|
+ {
|
|
|
$payPasswordWhere['account_identity'] = $identity;
|
|
$payPasswordWhere['account_identity'] = $identity;
|
|
|
$payPasswordSelect = ['encryption'];
|
|
$payPasswordSelect = ['encryption'];
|
|
|
$payPasswordMd = lm('pay_password', "commons");
|
|
$payPasswordMd = lm('pay_password', "commons");
|
|
|
// 获取加密盐值
|
|
// 获取加密盐值
|
|
|
- $accountPwdInfo = $payPasswordMd -> payPassword($payPasswordSelect, $payPasswordWhere);
|
|
|
|
|
|
|
+ $accountPwdInfo = $payPasswordMd->payPassword($payPasswordSelect, $payPasswordWhere);
|
|
|
$encryptionPwd = md5(md5($accountPwdInfo["encryption"] . $payPassword));
|
|
$encryptionPwd = md5(md5($accountPwdInfo["encryption"] . $payPassword));
|
|
|
$verifyPayPwdWhere['account_identity'] = $identity;
|
|
$verifyPayPwdWhere['account_identity'] = $identity;
|
|
|
$verifyPayPwdWhere['pay_password'] = $encryptionPwd;
|
|
$verifyPayPwdWhere['pay_password'] = $encryptionPwd;
|
|
|
$verifyPayPwdSelect = ['id'];
|
|
$verifyPayPwdSelect = ['id'];
|
|
|
// 验证支付密码
|
|
// 验证支付密码
|
|
|
- $verifyPayPwd = $payPasswordMd -> payPassword($verifyPayPwdSelect, $verifyPayPwdWhere);
|
|
|
|
|
|
|
+ $verifyPayPwd = $payPasswordMd->payPassword($verifyPayPwdSelect, $verifyPayPwdWhere);
|
|
|
if (!$verifyPayPwd['id']) {
|
|
if (!$verifyPayPwd['id']) {
|
|
|
- Render([], '2020', lang('Common','Api') -> get('payment password error'));
|
|
|
|
|
|
|
+ Render([], '2020', lang('Common', 'Api')->get('payment password error'));
|
|
|
}
|
|
}
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -453,7 +475,8 @@ class AccountManager {
|
|
|
* @return array
|
|
* @return array
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function updatePayPassword($post) {
|
|
|
|
|
|
|
+ public function updatePayPassword($post)
|
|
|
|
|
+ {
|
|
|
$checkPassword = $this->repository->checkOldPayPassword($post['token'], strip_tags($post['oldPassword']));
|
|
$checkPassword = $this->repository->checkOldPayPassword($post['token'], strip_tags($post['oldPassword']));
|
|
|
if ($checkPassword['status'] != 1) {
|
|
if ($checkPassword['status'] != 1) {
|
|
|
return $checkPassword;
|
|
return $checkPassword;
|
|
@@ -464,7 +487,8 @@ class AccountManager {
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function chHeadImg($imgUrl, $imgId) {
|
|
|
|
|
|
|
+ public function chHeadImg($imgUrl, $imgId)
|
|
|
|
|
+ {
|
|
|
$userInfo = $this->getCurrentUser();
|
|
$userInfo = $this->getCurrentUser();
|
|
|
$uuid = $userInfo->account_identity;
|
|
$uuid = $userInfo->account_identity;
|
|
|
if (!$uuid) return -4001;
|
|
if (!$uuid) return -4001;
|
|
@@ -479,9 +503,10 @@ class AccountManager {
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function getCurrentUser($token = '') {
|
|
|
|
|
- if(empty($token)) $token = $_POST['token'];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public function getCurrentUser($token = '')
|
|
|
|
|
+ {
|
|
|
|
|
+ if (empty($token)) $token = $_POST['token'];
|
|
|
|
|
+
|
|
|
$token = trim($token, "\"");
|
|
$token = trim($token, "\"");
|
|
|
|
|
|
|
|
$token = trim($token, "'");
|
|
$token = trim($token, "'");
|
|
@@ -499,7 +524,8 @@ class AccountManager {
|
|
|
*
|
|
*
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function register($post) {
|
|
|
|
|
|
|
+ public function register($post)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
|
return $check;
|
|
return $check;
|
|
@@ -535,7 +561,7 @@ class AccountManager {
|
|
|
// $newAgent['parent_path'] = !empty($data['parent_path']) ? $data['parent_path'] . ',' . $data['account_identity'] : $data['account_identity'];
|
|
// $newAgent['parent_path'] = !empty($data['parent_path']) ? $data['parent_path'] . ',' . $data['account_identity'] : $data['account_identity'];
|
|
|
//
|
|
//
|
|
|
// } else {
|
|
// } else {
|
|
|
- //为空默认父级代理为root
|
|
|
|
|
|
|
+ //为空默认父级代理为root
|
|
|
// $root = $this->repository->getRoot();
|
|
// $root = $this->repository->getRoot();
|
|
|
// if ($root < 0) {
|
|
// if ($root < 0) {
|
|
|
// $result = ['status' => -4004, 'msg' => lang()->get('root does not exist')];
|
|
// $result = ['status' => -4004, 'msg' => lang()->get('root does not exist')];
|
|
@@ -616,7 +642,7 @@ class AccountManager {
|
|
|
|
|
|
|
|
return $result;
|
|
return $result;
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
- $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'),'data'=>$e->getMessage()];
|
|
|
|
|
|
|
+ $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'), 'data' => $e->getMessage()];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -624,7 +650,8 @@ class AccountManager {
|
|
|
/*
|
|
/*
|
|
|
* 随机生成
|
|
* 随机生成
|
|
|
*/
|
|
*/
|
|
|
- public function getRandomString($len, $chars = null) {
|
|
|
|
|
|
|
+ public function getRandomString($len, $chars = null)
|
|
|
|
|
+ {
|
|
|
if (is_null($chars)) {
|
|
if (is_null($chars)) {
|
|
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
}
|
|
}
|
|
@@ -638,7 +665,8 @@ class AccountManager {
|
|
|
/*
|
|
/*
|
|
|
* 用户开新户
|
|
* 用户开新户
|
|
|
*/
|
|
*/
|
|
|
- public function newhouseholds($post) {
|
|
|
|
|
|
|
+ public function newhouseholds($post)
|
|
|
|
|
+ {
|
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
|
return $check;
|
|
return $check;
|
|
|
};
|
|
};
|
|
@@ -698,7 +726,7 @@ class AccountManager {
|
|
|
_commit();
|
|
_commit();
|
|
|
return $result;
|
|
return $result;
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
- $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'),'data'=>$e->getMessage()];
|
|
|
|
|
|
|
+ $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'), 'data' => $e->getMessage()];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -707,7 +735,8 @@ class AccountManager {
|
|
|
/*
|
|
/*
|
|
|
* 手机端直接开户 Anton Liu
|
|
* 手机端直接开户 Anton Liu
|
|
|
*/
|
|
*/
|
|
|
- public function directAccountOpening($post) {
|
|
|
|
|
|
|
+ public function directAccountOpening($post)
|
|
|
|
|
+ {
|
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
if ($check = $this->repository->checkRegisterData($post)) {
|
|
|
return $check;
|
|
return $check;
|
|
|
};
|
|
};
|
|
@@ -809,7 +838,7 @@ class AccountManager {
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
- $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'),'data'=>$e->getMessage()];
|
|
|
|
|
|
|
+ $result = ['status' => -4005, 'msg' => lang()->get('registration failed. please re-registration'), 'data' => $e->getMessage()];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -819,7 +848,8 @@ class AccountManager {
|
|
|
*
|
|
*
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function checkEffectiveTime($token = '') {
|
|
|
|
|
|
|
+ public function checkEffectiveTime($token = '')
|
|
|
|
|
+ {
|
|
|
//重写此方法 by xmj
|
|
//重写此方法 by xmj
|
|
|
define("OVERTIME", 1800);
|
|
define("OVERTIME", 1800);
|
|
|
|
|
|
|
@@ -852,7 +882,8 @@ class AccountManager {
|
|
|
* @param $accountIdentity
|
|
* @param $accountIdentity
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function logout($accountIdentity) {
|
|
|
|
|
|
|
+ public function logout($accountIdentity)
|
|
|
|
|
+ {
|
|
|
$result = $this->repository->updateToken($accountIdentity);
|
|
$result = $this->repository->updateToken($accountIdentity);
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
@@ -862,7 +893,8 @@ class AccountManager {
|
|
|
*
|
|
*
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
- public function getAccountId() {
|
|
|
|
|
|
|
+ public function getAccountId()
|
|
|
|
|
+ {
|
|
|
$threebefore = date('Y-m-d H:i:s', time() - 3 * 24 * 3600);
|
|
$threebefore = date('Y-m-d H:i:s', time() - 3 * 24 * 3600);
|
|
|
//$account = $this->model->join('account_detailed', 'account.identity', '=', 'account_detailed.account_identity')->where('account.status', 4)->get();
|
|
//$account = $this->model->join('account_detailed', 'account.identity', '=', 'account_detailed.account_identity')->where('account.status', 4)->get();
|
|
|
$account = $this->model->select('logfile.account_identity')->join('logfile', 'account.identity', '=', 'logfile.account_identity')->where('account.status', 4)->where('logfile.add_time', '<', $threebefore)->groupBy('logfile.account_identity')->get();
|
|
$account = $this->model->select('logfile.account_identity')->join('logfile', 'account.identity', '=', 'logfile.account_identity')->where('account.status', 4)->where('logfile.add_time', '<', $threebefore)->groupBy('logfile.account_identity')->get();
|
|
@@ -879,23 +911,21 @@ class AccountManager {
|
|
|
*/
|
|
*/
|
|
|
public function demoAccount()
|
|
public function demoAccount()
|
|
|
{
|
|
{
|
|
|
- $uname = isset($_POST['account']) ? $_POST['account'] : 'gust'.($this->getAccountId() + 1); //由ikeke修改于2019-01-08主要增加默认密码便于登录
|
|
|
|
|
|
|
+ $uname = isset($_POST['account']) ? $_POST['account'] : 'gust' . ($this->getAccountId() + 1); //由ikeke修改于2019-01-08主要增加默认密码便于登录
|
|
|
$uname = strtolower($uname);
|
|
$uname = strtolower($uname);
|
|
|
$num = $this->getAccountId();
|
|
$num = $this->getAccountId();
|
|
|
$name = 'gust' . ($num + 1);
|
|
$name = 'gust' . ($num + 1);
|
|
|
|
|
|
|
|
$account = $this->model->where("account", $uname)->first();
|
|
$account = $this->model->where("account", $uname)->first();
|
|
|
|
|
|
|
|
- if (!empty($account) || ($uname != $name))
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ if (!empty($account) || ($uname != $name)) {
|
|
|
$result = ['status' => -4022, 'msg' => '试玩账号有误'];
|
|
$result = ['status' => -4022, 'msg' => '试玩账号有误'];
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$pwd = isset($_POST['password']) ? $_POST['password'] : '123456'; //由ikeke修改于2019-01-08主要增加默认密码便于登录
|
|
$pwd = isset($_POST['password']) ? $_POST['password'] : '123456'; //由ikeke修改于2019-01-08主要增加默认密码便于登录
|
|
|
|
|
|
|
|
- if (!$pwd)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ if (!$pwd) {
|
|
|
return ['status' => 400, 'msg' => '没有密码'];
|
|
return ['status' => 400, 'msg' => '没有密码'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -916,7 +946,8 @@ class AccountManager {
|
|
|
* @return array
|
|
* @return array
|
|
|
* @throws \Exception
|
|
* @throws \Exception
|
|
|
*/
|
|
*/
|
|
|
- public function Iscard() {
|
|
|
|
|
|
|
+ public function Iscard()
|
|
|
|
|
+ {
|
|
|
//获取用户ID并验证
|
|
//获取用户ID并验证
|
|
|
$uidentity = isset($_SESSION['uinfo']['identity']) ? $_SESSION['uinfo']['account_identity'] : '';
|
|
$uidentity = isset($_SESSION['uinfo']['identity']) ? $_SESSION['uinfo']['account_identity'] : '';
|
|
|
if ($uidentity == '') {
|
|
if ($uidentity == '') {
|
|
@@ -937,7 +968,8 @@ class AccountManager {
|
|
|
* @param $identity
|
|
* @param $identity
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function getAccountDetailed($token) {
|
|
|
|
|
|
|
+ public function getAccountDetailed($token)
|
|
|
|
|
+ {
|
|
|
$result = ['data' => '', '-4001', 'msg' => lang()->get('user does not exist')];
|
|
$result = ['data' => '', '-4001', 'msg' => lang()->get('user does not exist')];
|
|
|
$account = lm('account_detailed', 'Commons')->join('account', 'account_detailed.account_identity', '=', 'account.identity')->where('account_detailed.token', $token)->first();
|
|
$account = lm('account_detailed', 'Commons')->join('account', 'account_detailed.account_identity', '=', 'account.identity')->where('account_detailed.token', $token)->first();
|
|
|
if ($account) {
|
|
if ($account) {
|
|
@@ -952,7 +984,8 @@ class AccountManager {
|
|
|
* @param $data
|
|
* @param $data
|
|
|
* @return int
|
|
* @return int
|
|
|
*/
|
|
*/
|
|
|
- public function applyAgent($data) {
|
|
|
|
|
|
|
+ public function applyAgent($data)
|
|
|
|
|
+ {
|
|
|
// try {
|
|
// try {
|
|
|
$row = $this->repository->checkAgent($data['agent_user']);
|
|
$row = $this->repository->checkAgent($data['agent_user']);
|
|
|
if ($row == 1) {
|
|
if ($row == 1) {
|
|
@@ -971,7 +1004,8 @@ class AccountManager {
|
|
|
* @param $data
|
|
* @param $data
|
|
|
* @return int
|
|
* @return int
|
|
|
*/
|
|
*/
|
|
|
- public function agentAccount($data) {
|
|
|
|
|
|
|
+ public function agentAccount($data)
|
|
|
|
|
+ {
|
|
|
try {
|
|
try {
|
|
|
lm('agent_child', 'Commons')->insert($data);
|
|
lm('agent_child', 'Commons')->insert($data);
|
|
|
return 1;
|
|
return 1;
|
|
@@ -986,7 +1020,8 @@ class AccountManager {
|
|
|
* @param $data
|
|
* @param $data
|
|
|
* @return array|int
|
|
* @return array|int
|
|
|
*/
|
|
*/
|
|
|
- public function agentLogin($data) {
|
|
|
|
|
|
|
+ public function agentLogin($data)
|
|
|
|
|
+ {
|
|
|
try {
|
|
try {
|
|
|
return $this->repository->agentLogin($data);
|
|
return $this->repository->agentLogin($data);
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
@@ -1000,7 +1035,8 @@ class AccountManager {
|
|
|
* @param $accountIdentity
|
|
* @param $accountIdentity
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function agentlogout($agentIdentity) {
|
|
|
|
|
|
|
+ public function agentlogout($agentIdentity)
|
|
|
|
|
+ {
|
|
|
$result = $this->repository->updateAgentToken($agentIdentity);
|
|
$result = $this->repository->updateAgentToken($agentIdentity);
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
@@ -1011,7 +1047,8 @@ class AccountManager {
|
|
|
* @param $token
|
|
* @param $token
|
|
|
* @return array|int
|
|
* @return array|int
|
|
|
*/
|
|
*/
|
|
|
- public function agentTokenOverdue($token) {
|
|
|
|
|
|
|
+ public function agentTokenOverdue($token)
|
|
|
|
|
+ {
|
|
|
if (!$token) {
|
|
if (!$token) {
|
|
|
return -4017;
|
|
return -4017;
|
|
|
}
|
|
}
|
|
@@ -1029,7 +1066,8 @@ class AccountManager {
|
|
|
/**
|
|
/**
|
|
|
* 记录登录区域
|
|
* 记录登录区域
|
|
|
*/
|
|
*/
|
|
|
- public function areaLog($ip, $accountIdentity) {
|
|
|
|
|
|
|
+ public function areaLog($ip, $accountIdentity)
|
|
|
|
|
+ {
|
|
|
try {
|
|
try {
|
|
|
$ipget = C()->get('IP');
|
|
$ipget = C()->get('IP');
|
|
|
$location = $ipget->getlocation($ip);
|
|
$location = $ipget->getlocation($ip);
|
|
@@ -1051,7 +1089,8 @@ class AccountManager {
|
|
|
* @param $data
|
|
* @param $data
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function getSetOdds($data) {
|
|
|
|
|
|
|
+ public function getSetOdds($data)
|
|
|
|
|
+ {
|
|
|
try {
|
|
try {
|
|
|
$result = [];
|
|
$result = [];
|
|
|
foreach ($data as $key => $val) {
|
|
foreach ($data as $key => $val) {
|
|
@@ -1069,7 +1108,8 @@ class AccountManager {
|
|
|
* @param $data
|
|
* @param $data
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
- public function getNeedData($data) {
|
|
|
|
|
|
|
+ public function getNeedData($data)
|
|
|
|
|
+ {
|
|
|
$lang = $data['lang'];
|
|
$lang = $data['lang'];
|
|
|
$item = $data['data'];
|
|
$item = $data['data'];
|
|
|
$result = [];
|
|
$result = [];
|
|
@@ -1089,7 +1129,8 @@ class AccountManager {
|
|
|
* @param $k
|
|
* @param $k
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
- public function getGameName($k) {
|
|
|
|
|
|
|
+ public function getGameName($k)
|
|
|
|
|
+ {
|
|
|
substr($k, 0, 5) == 'chain' ? $parent = 'chain' : '';
|
|
substr($k, 0, 5) == 'chain' ? $parent = 'chain' : '';
|
|
|
substr($k, 0, 6) == 'dragon' ? $parent = 'dragon' : '';
|
|
substr($k, 0, 6) == 'dragon' ? $parent = 'dragon' : '';
|
|
|
substr($k, 0, 8) == 'head_one' ? $parent = 'head_one' : '';
|
|
substr($k, 0, 8) == 'head_one' ? $parent = 'head_one' : '';
|