彭俊 6 lat temu
rodzic
commit
4b9b2e0f92

+ 96 - 53
Application/Api/Controller/Account.php

@@ -19,17 +19,20 @@ use App\Api\Model\AccountDetail;
 use App\Api\Model\AccountNews;
 
 
-class Account extends BaseController {
+class Account extends BaseController
+{
     private $accountManager;
 
-    public function init() {
+    public function init()
+    {
         $this->accountManager = new AccountManager();
     }
 
     /**
      * 验证用户资金密码
      */
-    public function checkPayPass() {
+    public function checkPayPass()
+    {
         $payPass = $_POST['payPass'];
         $token = $_GET['token'] ?? '';
         if (empty($token)) {
@@ -43,8 +46,13 @@ class Account extends BaseController {
     /**
      * 用户登录
      */
-    public function Login() {
-        $result = $this->accountManager->login($_POST['account'], $_POST['password']);
+    public function Login()
+    {
+        $account = isset($_POST['account']) ? trim($_POST['account']) : '';
+        $passwd = isset($_POST['password']) ? trim($_POST['password']) : '';
+        $token = isset($_POST['wagenttoken']) ? trim($_POST['wagenttoken']) : '';
+
+        $result = $this->accountManager->login($account, $passwd, $token);
 
         //$result = $this->accountManager->login('x0053', '123456');
 
@@ -57,23 +65,26 @@ class Account extends BaseController {
     /**
      * 用户修改密码
      */
-    public function resetPassword() {
-        $result = $this -> accountManager -> savePassword($_POST);
+    public function resetPassword()
+    {
+        $result = $this->accountManager->savePassword($_POST);
         Render($result['data'], $result['status'], $result['msg']);
     }
 
     /**
      * 用户修改支付密码
      */
-    public function resetPayPassword() {
-        $result = $this -> accountManager -> savePayPassword();
+    public function resetPayPassword()
+    {
+        $result = $this->accountManager->savePayPassword();
         Render($result['data'], $result['status'], $result['msg']);
     }
 
     /**
      * 用户注册
      */
-    public function enroll() {
+    public function enroll()
+    {
         $account_name = $_POST['account'];
 //        if (stripos($_POST['account_name'],'guest') === false){
 ////                var_dump($v['account_name']);
@@ -91,7 +102,8 @@ class Account extends BaseController {
     /**
      * 直接开户
      */
-    public function directAccount() {
+    public function directAccount()
+    {
         $result = $this->accountManager->directAccountOpening($_POST);
         Render($result['data'], $result['status'], $result['msg']);
     }
@@ -99,7 +111,8 @@ class Account extends BaseController {
     /**
      * token获取用户详情
      */
-    public function getAccount() {
+    public function getAccount()
+    {
         if ($_REQUEST['dbg'] == 1) dd($_SESSION);
         $checkToken = $this->accountManager->checkEffectiveTime();
         if ($checkToken['status'] != 1) {
@@ -130,7 +143,8 @@ class Account extends BaseController {
     /**
      * 用户退出登录
      */
-    public function Logout() {
+    public function Logout()
+    {
         $account = $this->accountManager->getCurrentUser();
 
         if ($account) {
@@ -144,7 +158,8 @@ class Account extends BaseController {
     /**
      * 试玩用户注册
      */
-    public function Playtest() {
+    public function Playtest()
+    {
         $ip = GETIP();
 
         $time = lm('Setinfo', 'commons')->select('infocontent')->where('status', 1)->where('infotype', '2000')->first();
@@ -163,7 +178,8 @@ class Account extends BaseController {
     /**
      * 判断是否已绑定银行卡
      */
-    public function Iscard() {
+    public function Iscard()
+    {
         $result = $this->accountManager->Iscard();
         Render($result['data'], $result['status'], $result['msg']);
     }
@@ -171,7 +187,8 @@ class Account extends BaseController {
     /**
      * 申请代理用户
      */
-    public function applyAgent() {
+    public function applyAgent()
+    {
         $result = $this->accountManager->applyAgent($_POST);
         Render('', $result, lang('errors')->get($result));
     }
@@ -179,7 +196,8 @@ class Account extends BaseController {
     /**
      * 代理用户登录
      */
-    public function agentLogin() {
+    public function agentLogin()
+    {
         $result = $this->accountManager->agentLogin($_POST);
         if ($result < 0) {
             Render('', $result);
@@ -191,7 +209,8 @@ class Account extends BaseController {
     /**
      * 代理用户token是否过期
      */
-    public function agentTokenOverdue() {
+    public function agentTokenOverdue()
+    {
 
         $token = isset($_GET['token']) ? $_GET['token'] : '';
         $result = $this->accountManager->agentTokenOverdue($token);
@@ -205,7 +224,8 @@ class Account extends BaseController {
     /**
      *登录添加登录区域日志
      */
-    public function areaLog() {
+    public function areaLog()
+    {
         $result = $this->accountManager->areaLog($_GET['ip'], $_GET['accountIdentity']);
         if ($result == 1) {
             Render('', $result, '成功');
@@ -217,7 +237,8 @@ class Account extends BaseController {
     /**
      * 获取用户信息
      */
-    function getAccountInfo() {
+    function getAccountInfo()
+    {
         $data = array();
         $data = $_SESSION['uinfo'];
         $bankInfo = lm('account_bank', 'commons')->where('account_identity', $_SESSION['uinfo']['account_identity'])->first();
@@ -234,7 +255,8 @@ class Account extends BaseController {
     /**
      * token获取用户详情
      */
-    public function getAgent() {
+    public function getAgent()
+    {
         $checkToken = $this->accountManager->checkEffectiveTime();
 
         if ($checkToken['status'] != 1) {
@@ -249,7 +271,8 @@ class Account extends BaseController {
      * 等级升级申请
      * @return [type] [description]
      */
-    public function UserUpgrade(int $total_flow = 0) {
+    public function UserUpgrade(int $total_flow = 0)
+    {
 
         $uinfo = $this->accountManager->getCurrentUser();
         if (!$uinfo) {
@@ -272,7 +295,8 @@ class Account extends BaseController {
      * 活动升级彩金公用接口
      * @return [type] [description]
      */
-    public function Promotiongold() {
+    public function Promotiongold()
+    {
         $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : "";
         if (empty($id)) {
             Render('', "-50009");
@@ -296,7 +320,8 @@ class Account extends BaseController {
     }
 
     //晋级彩金
-    public function rank($id) {
+    public function rank($id)
+    {
         $uinfo = $this->accountManager->getCurrentUser();
         if (!$uinfo) {
             return '-50003';
@@ -314,7 +339,8 @@ class Account extends BaseController {
 
     }
 
-    protected function firstRecharge($active_id, $utype = '') {
+    protected function firstRecharge($active_id, $utype = '')
+    {
         $uinfo = $this->accountManager->getCurrentUser();
         if (!$uinfo) {
             Render('', -50011);
@@ -393,7 +419,8 @@ class Account extends BaseController {
         Render('', -30018);
     }
 
-    public function analysis($str = '', $arr = array()) {
+    public function analysis($str = '', $arr = array())
+    {
         if (empty($str)) {
             return -51055;
         }
@@ -409,7 +436,8 @@ class Account extends BaseController {
 
 
     //申请vip
-    public function ApplyVip() {
+    public function ApplyVip()
+    {
         $result = $this->accountManager->refreshToken();
         if ($result['status'] < 0) {
             Render('', "-50011");
@@ -452,7 +480,8 @@ class Account extends BaseController {
     }
 
     //开新用户
-    public function households() {
+    public function households()
+    {
 
         if (empty($_POST['account'])) {
             Render('', "-50060", '缺少用户名称');
@@ -482,7 +511,8 @@ class Account extends BaseController {
         Render($result['data'], $result['status'], $result['msg']);
     }
 
-    protected function checkLogin() {
+    protected function checkLogin()
+    {
         $checkToken = $this->accountManager->checkEffectiveTime();
         if ($checkToken['status'] != 1) {
             Render($checkToken['data'], $checkToken['status'], $checkToken['msg']);
@@ -490,7 +520,8 @@ class Account extends BaseController {
         $this->accountManager->refreshToken();
     }
 
-    public function checkHandPass() {
+    public function checkHandPass()
+    {
         $hand_pass = $_REQUEST['hand_pass'];
         $this->checkLogin();
         $uinfo = $this->accountManager->getCurrentUser();
@@ -510,7 +541,8 @@ class Account extends BaseController {
         Render('', -51017);//用户不存在
     }
 
-    public function getUserSetting() {
+    public function getUserSetting()
+    {
         $this->checkLogin();
         $uinfo = $this->accountManager->getCurrentUser();
         $uuid = $uinfo->account_identity;
@@ -522,7 +554,8 @@ class Account extends BaseController {
         Render($ret, 1);
     }
 
-    public function setUserSetting() {
+    public function setUserSetting()
+    {
         $this->checkLogin();
         $uinfo = $this->accountManager->getCurrentUser();
         //if ($uinfo && $uinfo->account_identity)
@@ -548,7 +581,8 @@ class Account extends BaseController {
         Render('', 1);
     }
 
-    public function setUserSet() {
+    public function setUserSet()
+    {
         $this->checkLogin();
         $uinfo = $this->accountManager->getCurrentUser();
         //if ($uinfo && $uinfo->account_identity)
@@ -572,7 +606,8 @@ class Account extends BaseController {
 
     }
 
-    public function setHeadImg() {
+    public function setHeadImg()
+    {
         //$imgUrl = $_REQUEST['imgUrl'];
         $imgId = $_REQUEST['imgId'] ?? 0;
         $accountMan = new AccountManager();
@@ -594,7 +629,8 @@ class Account extends BaseController {
         Render($ret, 1);
     }
 
-    public function setDetail() {
+    public function setDetail()
+    {
         $phone = $_POST['phone'] ? strip_tags(trim($_POST['phone'])) : '';
         $qq = $_POST['qq'] ? strip_tags(trim($_POST['qq'])) : '';
         $email = $_POST['email'] ? strip_tags(trim($_POST['email'])) : '';
@@ -631,7 +667,8 @@ class Account extends BaseController {
     }
 
     //获取当前用户安全等级
-    public function safetygrade() {
+    public function safetygrade()
+    {
         //if($_REQUEST['dbg']==1)dd($_SESSION);
         $checkToken = $this->accountManager->checkEffectiveTime();
         if ($checkToken['status'] != 1) {
@@ -655,7 +692,8 @@ class Account extends BaseController {
     }
 
     //检查用户是否已注册
-    public function isRegistered() {
+    public function isRegistered()
+    {
         $an = $_REQUEST['account_name'];
         $ret = (new \App\Api\Model\Account())->where('account', $an)->exists();
         Render(null, $ret ? -40040 : 1);
@@ -664,7 +702,8 @@ class Account extends BaseController {
     /**
      *错误码列表接口
      */
-    public function getErrLangs() {
+    public function getErrLangs()
+    {
         $lang = Lang('Errors', 'Api');
         $langs = $lang->getAll();
         $newLangs = [];
@@ -678,7 +717,8 @@ class Account extends BaseController {
     /**
      * 玩法语言包总列表接口
      */
-    public function getGameLangs() {
+    public function getGameLangs()
+    {
         if (C()->get('cache')->has('totalGameLangs')) {
             $data = C()->get('cache')->get('totalGameLangs');
 //            C()->get('cache')->delete('totalGameLangs');
@@ -696,16 +736,17 @@ class Account extends BaseController {
      * @access public
      * @return array JsonString
      */
-    public function updateUserInfo() {
+    public function updateUserInfo()
+    {
         $code = 0;
-        $msg = lang('Common','Api') -> get('error');
-        try{
+        $msg = lang('Common', 'Api')->get('error');
+        try {
             $accountDetailClass = new AccountDetail();
             // 修改用户基本信息
-            $result = $accountDetailClass -> updateUserInfo();
+            $result = $accountDetailClass->updateUserInfo();
             if ($result) {
                 $code = 1;
-                $msg = lang('Index','Api') -> get('success');
+                $msg = lang('Index', 'Api')->get('success');
 
                 Render($result, $code, $msg);
             } else {
@@ -722,15 +763,16 @@ class Account extends BaseController {
      * @access public
      * @return array JsonString
      */
-    public function userNews() {
+    public function userNews()
+    {
         $code = 0;
-        $msg = lang('Common','Api') -> get('error');
-        try{
+        $msg = lang('Common', 'Api')->get('error');
+        try {
             $accountDetailClass = new AccountNews();
             // 获取用户消息
-            $result = $accountDetailClass -> userNews();
+            $result = $accountDetailClass->userNews();
             $code = 1;
-            $msg = lang('Index','Api') -> get('success');
+            $msg = lang('Index', 'Api')->get('success');
 
             Render($result, $code, $msg);
         } catch (Exception $e) {
@@ -744,13 +786,14 @@ class Account extends BaseController {
      * @access public
      * @return array JsonString
      */
-    public function updateHeader() {
+    public function updateHeader()
+    {
         $code = 0;
-        $msg = lang('Common','Api') -> get('error');
-        try{
+        $msg = lang('Common', 'Api')->get('error');
+        try {
             $accountDetailClass = new AccountDetail();
             // 修改用户基本信息
-            $result = $accountDetailClass -> updateHeader();
+            $result = $accountDetailClass->updateHeader();
             $code = 1;
             $msg = lang('Index', 'Api')->get('success');
 

+ 3 - 1
Application/Sports/Controller/ResultMatch.php

@@ -73,7 +73,9 @@ class ResultMatch extends Controller{
                 }
             }
 
-            Render($match_result_data, '1', lang('Tips','Sports')->get('success'));
+            $data = [$match_result_league,$match_result_data];
+
+            Render($data, '1', lang('Tips','Sports')->get('success'));
         } catch (\Exception $e) {
             echo $e->getMessage();
         }

+ 109 - 68
Biz/Account/AccountManager.php

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

+ 9 - 2
Biz/Game/GameLogic.php

@@ -13,6 +13,7 @@ use  Biz\Game\TranferMoneyLogic;
 use  App\Commons\Model\Wagent_clientgame_log as Wagent_clientgame_logModel;
 use  Illuminate\Database\Capsule\Manager as DB;
 use Biz\Game\SportbetRecordLogic;
+use App\Commons\Model\WagentCheckToken as WagentCheckTokenModel;
 
 
 class GameLogic
@@ -268,8 +269,14 @@ class GameLogic
 
             if (isset($ret2['status']) && $ret2['status'] == 1 && isset($ret2['data']['0']['token'])) {
                 $t_d = $ret2['data']['0'];
-                $token = urlencode(json_encode(['img_url' => $t_d['img_url'], 'name' => $t_d['name'], 'token' => $t_d['token'], 'cash' => $t_d['cash']], 256));
-                return $this->makeret(1, $ret2['msg'], ['ret' => 0, 'tokenold' => $t_d['token'], 'token' => $token, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/m/jump.html?token=' . $token]);
+                $cmodel = new WagentCheckTokenModel();
+                $retchktoken = $cmodel->AddCheckToken($username);
+                $token = $retchktoken->token;
+
+                //$token = urlencode(json_encode(['img_url' => $t_d['img_url'], 'name' => $t_d['name'], 'token' => $t_d['token'], 'cash' => $t_d['cash']], 256));
+                $token = urlencode(json_encode(['name' => $username, 'token' => $token, 'cash' => $t_d['cash']], 256));
+
+                return $this->makeret(1, $ret2['msg'], ['ret' => 0, 'tokenold' => '', 'token' => $token, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/m/jump.html?token=' . $token]);
             } else {
                 return $this->makeret(0, 'false', 0);
             }

+ 4 - 3
index.php

@@ -14,10 +14,11 @@ header('content-type:text/html; charset=utf-8');
 header('Access-Control-Allow-Origin:*');
 header('Access-Control-Allow-Methods:POST,GET,PUT,DELETE');
 header('Access-Control-Allow-Credentials:true');
+
 define('ROOT_PATH', dirname(__FILE__));
-require ROOT_PATH.'/Library/Common/InitSess.php';
+require ROOT_PATH . '/Library/Common/InitSess.php';
 InitSess::init()->iniSession();
 session_start();
-require ROOT_PATH.'/Library/Init';
-require ROOT_PATH.'/Library/RouteImpl/Route';
+require ROOT_PATH . '/Library/Init';
+require ROOT_PATH . '/Library/RouteImpl/Route';
 Run\Init::RunInit();

+ 10 - 0
m_web/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>首页</title>
+</head>
+<body>
+首页
+</body>
+</html>

+ 58 - 0
m_web/jump.html

@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>跳转中....</title>
+</head>
+<body>
+<script type="text/javascript">
+    function setItem(key, val) {
+        if (val instanceof Array) {
+            let str = JSON.stringify(val);
+            localStorage.setItem(key, str);
+        }
+        else {
+            localStorage.setItem(key, val);
+        }
+    }
+
+    function parseUrl(url = '') {
+        if (url == '') {
+            url = document.URL;
+        }
+        var result = [];
+        var query = url.split("?")[1];
+        var queryArr = query.split("&");
+        var Obj = {} , i=0 ;
+
+        for (i = 0; i < queryArr.length; i++) {
+            var item = queryArr[i];
+            var key = item.split("=")[0];
+            var value = item.split("=")[1];
+            Obj[key] = value;
+        }
+        return Obj;
+    }
+
+    var allpara = parseUrl();
+
+    try {
+        if (allpara.token !== undefined) {
+            var Tokstr = decodeURIComponent(allpara.token);
+            var TokenObj = JSON.parse(Tokstr);
+            var userobj = {};
+            userobj['wagenttoken'] = TokenObj.token;
+            userobj['name'] = TokenObj.name;
+            userobj['cash'] = TokenObj.cash;
+            setItem('user', JSON.stringify(userobj));
+            setItem('token', TokenObj.token);
+        }
+       self.location = "/m/index.html";
+    } catch (e) {
+        self.location = "/m/index.html";
+    }
+
+</script>
+<div></div>
+</body>
+</html>

+ 58 - 0
web/jump.html

@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>跳转中....</title>
+</head>
+<body>
+<script type="text/javascript">
+    function setItem(key, val) {
+        if (val instanceof Array) {
+            let str = JSON.stringify(val);
+            localStorage.setItem(key, str);
+        }
+        else {
+            localStorage.setItem(key, val);
+        }
+    }
+
+    function parseUrl(url = '') {
+        if (url == '') {
+            url = document.URL;
+        }
+        var result = [];
+        var query = url.split("?")[1];
+        var queryArr = query.split("&");
+        var Obj = {} , i=0 ;
+
+        for (i = 0; i < queryArr.length; i++) {
+            var item = queryArr[i];
+            var key = item.split("=")[0];
+            var value = item.split("=")[1];
+            Obj[key] = value;
+        }
+        return Obj;
+    }
+
+    var allpara = parseUrl();
+
+    try {
+        if (allpara.token !== undefined) {
+            var Tokstr = decodeURIComponent(allpara.token);
+            var TokenObj = JSON.parse(Tokstr);
+            var userobj = {};
+            userobj['wagenttoken'] = TokenObj.token;
+            userobj['name'] = TokenObj.name;
+            userobj['cash'] = TokenObj.cash;
+            setItem('user', JSON.stringify(userobj));
+            setItem('token', TokenObj.token);
+        }
+       self.location = "/m/index.html";
+    } catch (e) {
+        self.location = "/m/index.html";
+    }
+
+</script>
+<div></div>
+</body>
+</html>