diff --git a/Application/Admin/Controller/AutoPackController.class.php b/Application/Admin/Controller/AutoPackController.class.php index 9da29ddaf..39ed6e914 100644 --- a/Application/Admin/Controller/AutoPackController.class.php +++ b/Application/Admin/Controller/AutoPackController.class.php @@ -37,7 +37,6 @@ class AutoPackController extends Think public function package() { - $find_web_stie = M('config') -> field('value') -> where(['name' => 'WEB_SITE']) @@ -49,18 +48,10 @@ class AutoPackController extends Think } $this->checkPackageStatus(); - $this->app_package();//app渠道自动打包 - $this->channel(); - $this->launch_package(false); - $this->leak_detection(); - - - - } /** @@ -209,7 +200,7 @@ class AutoPackController extends Think $to = "./Uploads/" . $file_name . "/" . $new_name; copy($url, ROOTTT . ltrim($to, './')); $zip_res = $zip -> open(ROOTTT . ltrim($to, './'), \ZipArchive::CREATE); - + if($zip_res == true) { #打包数据 $pack_data = array( @@ -311,7 +302,6 @@ class AutoPackController extends Think * @throws \think\exception\DbException */ private function channel() { - $zip = new \ZipArchive(); $map['status'] = 1; @@ -346,13 +336,11 @@ class AutoPackController extends Think $launchCount = $launchModel->where(['apply_id'=>$value['id']])->count(); if($launchCount>0) { - $applyModel->where(['id' => $value['id']]) -> setField('enable_status', 3); $launchModel->where(['apply_id'=>$value['id'], 'launch_packge'=>['in',[0,2,3]]])->save(['launch_packge'=>2,'launch_down_url'=>'','launch_plist_url'=>'']); } else { - $applyModel -> where(['id' => $value['id']]) -> setField('enable_status', 3); if ($value['sdk_version'] == 1) { @@ -377,7 +365,8 @@ class AutoPackController extends Think } $new_name = "game_package" . $value['game_id'] . "-" . $value['promote_id'] . $str_ver; $to = "./Uploads/" . $file_name . "/" . $new_name; - copy(get_game_source_file_url($value['game_id']), ROOTTT . ltrim($to, './')); + $localPath = ROOTTT . ltrim($to, './'); + copy(get_game_source_file_url($value['game_id']), $localPath); $zip_res = $zip -> open(ROOTTT . ltrim($to, './'), \ZipArchive::CREATE); if ($zip_res == true) { #打包数据 @@ -409,8 +398,10 @@ class AutoPackController extends Think $updata['savename'] = $newname; $updata['path'] = $new_to; $this -> upload_game_pak_oss($updata); - @unlink($new_to); + if (file_exists($new_to)) { + @unlink($new_to); + } } elseif (get_tool_status("qiniu_storage") == 1) { $this -> dleteQiNiuFile($newname); diff --git a/Application/Admin/Controller/PlistController.class.php b/Application/Admin/Controller/PlistController.class.php index 6b8e0e8d2..ed5f94f07 100644 --- a/Application/Admin/Controller/PlistController.class.php +++ b/Application/Admin/Controller/PlistController.class.php @@ -54,6 +54,39 @@ class PlistController extends ThinkController { } + public function create_org_plist($game_id=0,$promote_id=0,$marking="",$url=""){ + $xml = new \DOMDocument(); + $xml->load('./Uploads/Plist/testdemo.Plist'); + $online = $xml->getElementsByTagName('dict');//查找节点 + $asd=$online->item(1)->getElementsByTagName('string');//第二个节点下所有string + foreach ($asd as $key=>$value) { + switch ($value->textContent) { + case 'ipa_url': + if(preg_match("/Uploads/", $url)){ + $value->nodeValue="https://".$_SERVER['HTTP_HOST'].ltrim($url,".");//"https://iosdemo.vlcms.com/app/MCHSecretary.ipa";//替换xml对应的值 + }else{ + $value->nodeValue=$url; + } + break; + case 'icon': + $value->nodeValue="https://".$_SERVER["HTTP_HOST"].get_cover(get_game_icon_id($game_id),'path');; + break; + case 'com.dell': + $value->nodeValue=$marking; + break; + case '1.0.0': + $value->nodeValue=game_version($game_id); + break; + case 'mchdemo': + $value->nodeValue=get_ios_game_name($game_id); + break; + + } + $xml->save("./Uploads/OrgSourcePlist/$game_id.Plist"); + } + return "./Uploads/OrgSourcePlist/$game_id.Plist"; + } + //生成App plist文件 public function create_plist_app($version="",$app_id=0,$marking="",$url="", $promote_id=0){ diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index 59b64d639..b9b8ff816 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -250,7 +250,14 @@ class UserController extends AdminController { if($password != $repassword){ $this->error('管理员密码和确认密码不一致!'); } - + $usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find(); + if (!empty($usernameUser)) { + $this->error('用户名已存在!'); + } + $emailUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find(); + if (!empty($emailUser)) { + $this->error('邮箱已存在!'); + } /* 调用注册接口注册用户 */ $User = new UserApi; $uid = $User->register($username, $password, $email,$second_pwd); @@ -272,7 +279,7 @@ class UserController extends AdminController { $list=D('AuthGroup')->where(array('status'=>1))->select(); $this->assign('lists',$list); $this->meta_title = '新增管理员'; - + $this->m_title = '管理员列表'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); diff --git a/Application/Admin/Event/SourceEvent.class.php b/Application/Admin/Event/SourceEvent.class.php index 0e43f2823..1af21ac3f 100644 --- a/Application/Admin/Event/SourceEvent.class.php +++ b/Application/Admin/Event/SourceEvent.class.php @@ -41,6 +41,7 @@ class SourceEvent extends Controller $data['remark'] = json_encode(explode('@@@', $remark)); if ($data['file_type'] == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; + $data['org_plist_url'] = "./Uploads/OrgSourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($data['game_id'], 0, $data['bao_name'], $data['file_url']); } $res = $model -> add($data); @@ -100,6 +101,7 @@ class SourceEvent extends Controller } if ($data['file_type'] == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; + $data['org_plist_url'] = "./Uploads/OrgSourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($data['game_id'], 0, $data['bao_name'], $data['file_url']); } $data['source_version'] = $game_source['source_version'] + 1; @@ -204,6 +206,7 @@ class SourceEvent extends Controller $newFileName = $temp[count($temp)-1]; $to = $file_url; + $originalUrl = ''; if ($file_type == 1) { $new_file_url = $real_file_url; $zip = new \ZipArchive; @@ -213,6 +216,7 @@ class SourceEvent extends Controller } elseif ($file_type == 2) { if (preg_match("/.ipa/", $file_url)) { if($flag == 0 || ($flag ==1 && $newFileName != $file_name)) { + $originalUrl = $file_url; $new_file_url = str_replace('Uploads/SourcePack', 'Uploads/Ios/original', $real_file_url); $to = str_replace('Uploads/SourcePack', 'Uploads/Ios/original', $file_url); $zip_open_game_source = zip_open($real_file_url); @@ -231,7 +235,7 @@ class SourceEvent extends Controller $res = $zip -> open($new_file_url, \ZipArchive::CREATE); $zip -> addFromString($url_ver, json_encode($data)); $zip -> close(); - unlink($real_file_url); + // unlink($real_file_url); } } } @@ -256,13 +260,14 @@ class SourceEvent extends Controller } $model = D('Game_source'); - $model->where(['game_id'=>$game_id])->save(['file_url'=>$to]); + $model->where(['game_id'=>$game_id])->save(['file_url'=>$to, 'original_url' => $originalUrl]); $plist = A("Plist"); if ($file_type == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($game_id, 0, $baoName, $to); + $plist -> create_org_plist($game_id, 0, $baoName, $originalUrl); } } diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index 1c86b10b5..c87284739 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -1009,27 +1009,27 @@ function get_cover($cover_id, $field = null, $root = 1, $flag = true) $picture = M('Picture')->where(array('status' => 1))->getById($cover_id); if (get_tool_status("oss_storage") == 1) { if (!empty($picture['oss_url'])) { - return $picture['oss_url']; + return str_replace('http:', 'https:', $picture['oss_url']); } else { - return 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; + return 'https://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; } } elseif (get_tool_status("qiniu_storage") == 1) { if (!empty($picture['url'])) { return $picture['url']; } else { - return 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; + return '//' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; } } elseif (get_tool_status("cos_storage") == 1) { if (!empty($picture['url'])) { return $picture['url']; } else { - return 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; + return '//' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; } } elseif (get_tool_status("bos_storage") == 1) { if (!empty($picture['bos_url'])) { return $picture['bos_url']; } else { - return 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; + return '//' . $_SERVER['HTTP_HOST'] . __ROOT__ . $picture['path']; } } else { if ($field == 'path') { diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 8dd1a22ad..156950d71 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -519,7 +519,7 @@ class ApplyController extends BaseController $data = M("game", "tab_") /* 查询指定字段,不指定则查询所有字段 */ - ->field("tab_game.id,tab_game.game_size,tab_game.game_name,tab_game.features,tab_game.money,tab_game.sdk_version,tab_game.ratio,tab_game.icon,tab_game.game_type_name,tab_game.recommend_status,promote_id,status,tab_apply.dow_status,tab_apply.plist_url,tab_apply.id as applyid,enable_status,tab_game.sort,tab_game.relation_game_id,tab_game.relation_game_name,tab_game.material_url,dispose_time,tab_apply.promote_money as applymoney,tab_apply.promote_ratio as applyratio,apply_time,tab_apply.status as applystatus,tab_game.and_dow_address,tab_game.ios_dow_address,tab_game.add_game_address,tab_game.ios_game_address") + ->field("tab_game.id,tab_game.game_size,tab_game.game_name,tab_game.features,tab_game.money,tab_game.sdk_version,tab_game.ratio,tab_game.icon,tab_game.game_type_name,tab_game.recommend_status,promote_id,status,tab_apply.dow_status,tab_apply.plist_url,tab_apply.id as applyid,tab_apply.enable_status,tab_game.sort,tab_game.relation_game_id,tab_game.relation_game_name,tab_game.material_url,dispose_time,tab_apply.promote_money as applymoney,tab_apply.promote_ratio as applyratio,apply_time,tab_apply.status as applystatus,tab_game.and_dow_address,tab_game.ios_dow_address,tab_game.add_game_address,tab_game.ios_game_address") ->join("tab_apply ON tab_game.id = tab_apply.game_id and tab_apply.promote_id = " . $promoteId) // ->join("left join tab_game as tg ON (tab_game.id = tg.relation_game_id and tg.game_status = 1 and tab_game.id!=tab_game.relation_game_id) or (tab_game.id = tg.relation_game_id and tab_game.id!=tg.id and tg.game_status = 1) or (tab_game.id!=tab_game.relation_game_id and tab_game.relation_game_id=tg.id and tab_game.game_status=1)") // 查询条件 @@ -564,6 +564,7 @@ class ApplyController extends BaseController $this->assign('model', $model); $this->assign('promoteId', $promoteId); $this->assign('thisParentPromoteId', getParentPromoteId(PID)); + $this->assign('parentPromoteId', getParentPromoteId($promoteId)); $this->assign('pID', PID); $this->assign('promoteRole', $promoteRole); $this->assign('promoteData', getAllPromoteListByType($promoteRole)); @@ -1556,4 +1557,18 @@ class ApplyController extends BaseController $this->ajaxReturn(array("status" => 0, "msg" => "添加成功")); } + + public function getEnableStatus() + { + $applyId = I('post.apply_id'); + + if (empty($applyId)) { + $this->ajaxReturn(['status' => 0, 'msg' => '数据异常']); + } + + $map['id'] = $applyId; + $enableStatus = M('Apply', 'tab_')->where($map)->getField('enable_status'); + + $this->ajaxReturn(['status' => 1, 'data' => $enableStatus]); + } } diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 8e4344851..700548de0 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -18,6 +18,7 @@ namespace Home\Controller; use Think\Controller; +use User\Api\MemberApi; /** * 前台公共控制器 @@ -55,30 +56,48 @@ class HomeController extends Controller $secret = 'd3219c70a45c5e1954be4608b288d38b'; $tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret; - $result = file_get_contents($tokenUrl); - $result = json_decode($result, true); - if (!$result || isset($result['errcode'])) { - $this->ajaxReturn([ - 'status' => false, - 'msg' => '获取失败', - ]); + $content = file_get_contents(RUNTIME_PATH . 'Data/wechat_ticket'); + $ticketData = null; + if ($content) { + $ticketData = json_decode($content, true); } - $accessToken = $result['access_token']; - $ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi'; - $result = file_get_contents($ticketUrl); - $result = json_decode($result, true); - if (!$result || $result['errcode'] != 0) { - $this->ajaxReturn([ - 'status' => false, - 'msg' => '获取失败', - ]); + $isExpired = false; + $ticket = ''; + if ($ticketData) { + $isExpired = time() > $ticketData['expired_at'] ? true : false; + $time = $ticketData['time']; + $ticket = $ticketData['ticket']; + } + + if (!$ticketData || $isExpired) { + $ticket = $ticketData['ticket']; + $result = file_get_contents($tokenUrl); + $result = json_decode($result, true); + if (!$result || isset($result['errcode'])) { + $this->ajaxReturn([ + 'status' => false, + 'msg' => '获取失败', + ]); + } + $accessToken = $result['access_token']; + + $ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi'; + $result = file_get_contents($ticketUrl); + $result = json_decode($result, true); + if (!$result || $result['errcode'] != 0) { + $this->ajaxReturn([ + 'status' => false, + 'msg' => '获取失败', + ]); + } + $ticket = $result['ticket']; + + file_put_contents(RUNTIME_PATH . 'Data/wechat_ticket', json_encode(['ticket' => $ticket, 'expired_at' => time() + 3600])); } - $ticket = $result['ticket']; $randStr = 'aaabbbxeclsx'; $time = time(); - $signStr = 'jsapi_ticket=' . $ticket . '&noncestr=' . $randStr . '×tamp=' . $time . '&url=' . $url; $sign = sha1($signStr); @@ -123,12 +142,18 @@ class HomeController extends Controller { $gameId = I('get.gid'); $promoteId = I('get.pid'); + $status = I('get.status'); if (empty($gameId) || empty($promoteId)) { $this->error('链接丢失'); } - $downLink = get_apply_dow_url($gameId, $promoteId); + if ($status == 1) { + $downLink = 'itms-services://?action=download-manifest&url=' . "https://" . $_SERVER["HTTP_HOST"] . ltrim(M('GameSource', 'tab_')->where(array('game_id' => $gameId))->getField('org_plist_url'), '.'); + } else { + $downLink = get_apply_dow_url($gameId, $promoteId); + } + $this->assign('downLink', $downLink); $this->display(); } @@ -176,4 +201,60 @@ class HomeController extends Controller $this->assign('data', $data); $this->display(); } + + public function register() + { + $userApi = new MemberApi(); + $id = $userApi->wap_register($_POST); + if ($id > 0) { + $this->add_user_play($_POST); + $this->ajaxReturn([ + 'status' => true, + 'msg' => '注册成功' + ]); + } else { + $this->ajaxReturn([ + 'status' => false, + 'msg' => '数据有误' + ]); + } + } + + /** + *添加玩家信息 + */ + private function add_user_play($user = array()) + { + + $user_play = M("UserPlay", "tab_"); + $map["game_id"] = $user["game_id"]; + $map["user_id"] = $user["user_id"]; + $map['sdk_version'] = $user['sdk_version']; + $res = $user_play->where($map)->find(); + if (empty($res)) { + $user_entity = get_user_entity($user["user_id"]); + $data["user_id"] = $user["user_id"]; + $data["user_account"] = $user_entity["account"]; + $data["user_nickname"] = $user_entity["nickname"]; + $data["game_id"] = $user["game_id"]; + $data["game_appid"] = $user["game_appid"]; + $data["game_name"] = get_game_name($user["game_id"]); + $data["server_id"] = 0; + $data["server_name"] = ""; + $data["role_id"] = 0; + $data['parent_id'] = $user_entity["parent_id"]; + $data['parent_name'] = $user_entity["parent_name"]; + $data["role_name"] = ""; + $data["role_level"] = 0; + $data["bind_balance"] = 0; + $data["promote_id"] = $user_entity["promote_id"]; + $data["promote_account"] = $user_entity["promote_account"]; + $data['play_time'] = time(); + $data['play_ip'] = get_client_ip(); + $data["sdk_version"] = $user["sdk_version"]; + $data['ppuid'] = $user['puid'] == '' ? 0 : $user['puid']; + $data['check_time'] = time(); + $user_play->add($data); + } + } } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 023febd51..b04f7d97c 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -35,6 +35,10 @@ class PromoteController extends BaseController //系统首页 public function index($p=1) { + $this->meta_title = "首页"; + $this->display('prepare'); + exit(0); + header("Content-type:text/html;charset=utf-8"); $user = D('Promote')->isLogin(); if (empty($user)) { @@ -541,6 +545,12 @@ class PromoteController extends BaseController $this->assign("data", $data); $this->wxQrcode($data); + $user = D('Promote')->isLogin(); + if (empty($user)) { + $this->redirect("Home/Index/index"); + } + $promoteUrl = "https://m.wmtxkj.com/mobile.php?s=Ssg/login/promote_id/".$user['pid']; + $this->assign("promote_url", $promoteUrl); $this->display(); } diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 40298c6f8..3382bdd5b 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1731,7 +1731,7 @@ class QueryController extends BaseController $map['game_id'] = $gameId; } if ($serverId != 0) { - $map['serverId'] = $serverId; + $map['server_id'] = $serverId; } if ($roleName != '') { $map['role_name'] = ['like', '%' . $roleName . '%']; diff --git a/Application/Home/Event/UserEvent.class.php b/Application/Home/Event/UserEvent.class.php index 3bb224364..b645c7480 100644 --- a/Application/Home/Event/UserEvent.class.php +++ b/Application/Home/Event/UserEvent.class.php @@ -721,211 +721,214 @@ class UserEvent extends BaseEvent { public function arpu_analysis() { - if (IS_POST && $_POST['time_start'] && $_POST['time_end']) { - $request = $_REQUEST; - $game_id = $request['game_id']; - $promote_id = $request['promote_id']; - $this->assign('promote_arpu',$promote_id); - $start = strtotime($request['time_start']); - $end = strtotime($request['time_end'])+24*60*60-1; - if ($start>$end) { - $start = $end; - $_REQUEST['time_start'] = $request['time_end']; - $_REQUEST['time_end'] = $request['time_start']; - $end = strtotime($request['time_start']); - } + $promote = M('promote', 'tab_')->where(['id' => session('promote_auth.pid')])->find(); + $map = [ + '_logic' => 'or', + 'id' => $promote['id'], + 'parent_id' => $promote['id'], + 'grand_id' => $promote['id'], + ]; + $ids = M('promote', 'tab_')->where($map)->getField('id', true); + + if (IS_POST && $_POST['time_start'] && $_POST['time_end']) { + $request = $_REQUEST; + $game_id = $request['game_id']; + $promote_id = $request['promote_id']; + $this->assign('promote_arpu', $promote_id); + $start = strtotime($request['time_start']); + $end = strtotime($request['time_end'])+24*60*60-1; + if ($start>$end) { + $start = $end; + $_REQUEST['time_start'] = $request['time_end']; + $_REQUEST['time_end'] = $request['time_start']; + $end = strtotime($request['time_start']); + } - } else { - $game_id = empty($request['game_id'])?0:$request['game_id']; - $promote_id = empty($request['promote_id'])?0:$request['promote_id']; - $start = mktime(0,0,0,date('m'),date('d')-6,date('Y')); - $_REQUEST['time_start'] = date('Y-m-d',$start); - $end = time(); - $_REQUEST['time_end'] = date('Y-m-d'); - } + } else { + $game_id = empty($request['game_id'])?0:$request['game_id']; + $promote_id = empty($request['promote_id'])?0:$request['promote_id']; + $start = mktime(0,0,0,date('m'),date('d')-6,date('Y')); + $_REQUEST['time_start'] = date('Y-m-d',$start); + $end = time(); + $_REQUEST['time_end'] = date('Y-m-d'); + } - //包含绑币 和 排除绑币 - if (I('bind_coin') == 1){ - $bangbi = true; - }else{ - $bangbi = false; - } + //包含绑币 和 排除绑币 + if (I('bind_coin') == 1){ + $bangbi = true; + }else{ + $bangbi = false; + } - if ($end-$start<=7776000 ) { + if ($end - $start <= 7776000 ) { if ($promote_id <1) { - $pid = D('Promote')->get_child_promote(PID,'id'); - if (empty($pid[0])) { - $promote_id = PID; - } else { - $id = implode(',',array_column($pid,'id')); - $promote_id = PID.','.$id; - } + $pid = D('Promote')->get_child_promote(PID,'id'); + if (empty($pid[0])) { + $promote_id = PID; + } else { + $id = implode(',',array_column($pid,'id')); + $promote_id = PID.','.$id; + } } else { + if(PID == $promote_id) { - if(PID == $promote_id) { - - } else { - - - $pro_id1=get_prmoote_chlid_account($promote_id); - $pro_arr = array_column($pro_id1,'id'); - $pro_arr[] = $promote_id; - $promote_id=implode(',',$pro_arr); - } - - - } - $datelist = get_date_list($start,$end); - $user = D('User'); - $spend = D('Spend'); - /*付费游戏数*/ - $paygame = $spend->pay_game_by_time($start,$end,$game_id,$promote_id,$bangbi); - - $newslist = $user->register_list_by_time($start,$end,$game_id,$promote_id,'time',''); - - /* 活跃玩家 */ - $activelist = $user->login_count_by_time($start,$end,$game_id,$promote_id); - - /* 充值金额 */ - $incomelist = $spend -> money_amount_by_time($start,$end,$game_id,$promote_id,$bangbi); - - /* 付费玩家 */ - $paylist = $spend->pay_count_by_time($start,$end,$game_id,$promote_id,$bangbi); - - /* 新付费玩家 */ - $newspay = $spend->pay_count_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); - /*新付费金额*/ - $newspaysum = $spend->pay_sum_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); - /* 开始时间前的付费玩家 */ - $totalPayPlayer = $spend->payUsersStatisticsAgo($start,$game_id,$promote_id,$bangbi); - - /* 留存 */ - $ratention1 = $user->ratention_rate($newslist,$game_id,$promote_id); - - /* 数据整理 */ - foreach($datelist as $dv) { - $newPayUsers[$dv]=$activeUsers[$dv]=$newUsers[$dv]=$payUsers[$dv]=$usersIncome[$dv]=$ratentionRate1[$dv]=0; - - $data[$dv]['newPayUsers']=$data[$dv]['activeUsers']=$data[$dv]['newUsers']=$data[$dv]['payUsers']=$data[$dv]['usersIncome']=0; - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - $data[$dv]['ratentionRate1']='--'; - $data[$dv]['usersPayRate'] = '--'; - $data[$dv]['usersArpu']=0; - $data[$dv]['usersArppu']=0; - $data[$dv]['payGame'] = 0; + } else { + $pro_id1 = get_prmoote_chlid_account($promote_id); + $pro_arr = array_column($pro_id1,'id'); + $pro_arr[] = $promote_id; + $promote_id=implode(',',$pro_arr); + } } + $datelist = get_date_list($start,$end); + $user = D('User'); + $spend = D('Spend'); + /*付费游戏数*/ + $paygame = $spend->pay_game_by_time($start,$end,$game_id,$promote_id,$bangbi); + + $newslist = $user->register_list_by_time($start,$end,$game_id,$promote_id,'time',''); + + /* 活跃玩家 */ + $activelist = $user->login_count_by_time($start,$end,$game_id,$promote_id); + + /* 充值金额 */ + $incomelist = $spend -> money_amount_by_time($start,$end,$game_id,$promote_id,$bangbi); + + /* 付费玩家 */ + $paylist = $spend->pay_count_by_time($start,$end,$game_id,$promote_id,$bangbi); + + /* 新付费玩家 */ + $newspay = $spend->pay_count_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); + /*新付费金额*/ + $newspaysum = $spend->pay_sum_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); + /* 开始时间前的付费玩家 */ + $totalPayPlayer = $spend->payUsersStatisticsAgo($start,$game_id,$promote_id,$bangbi); + + /* 留存 */ + $ratention1 = $user->ratention_rate($newslist,$game_id,$promote_id); + + /* 数据整理 */ + foreach($datelist as $dv) { + $newPayUsers[$dv]=$activeUsers[$dv]=$newUsers[$dv]=$payUsers[$dv]=$usersIncome[$dv]=$ratentionRate1[$dv]=0; + + $data[$dv]['newPayUsers']=$data[$dv]['activeUsers']=$data[$dv]['newUsers']=$data[$dv]['payUsers']=$data[$dv]['usersIncome']=0; + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + $data[$dv]['ratentionRate1']='--'; + $data[$dv]['usersPayRate'] = '--'; + $data[$dv]['usersArpu']=0; + $data[$dv]['usersArppu']=0; + $data[$dv]['payGame'] = 0; + } - foreach($datelist as $dv) { - /** - * 付费游戏数 - */ - foreach ($paygame as $pgal) { - if($dv == $pgal['pay_time']) { - $paygame[$dv]=intval($pgal['pay_num']); - $data[$dv]['payGame']=intval($pgal['pay_num']);break; - } - } + foreach($datelist as $dv) { + /** + * 付费游戏数 + */ + foreach ($paygame as $pgal) { + if($dv == $pgal['pay_time']) { + $paygame[$dv]=intval($pgal['pay_num']); + $data[$dv]['payGame']=intval($pgal['pay_num']);break; + } + } - /* 新增玩家 */ - foreach ($newslist as $nlv) { - if ($dv == $nlv['time']) { + /* 新增玩家 */ + foreach ($newslist as $nlv) { + if ($dv == $nlv['time']) { - $data[$dv]['newUsers']=count(explode(',',$nlv['id']));break; - } - } - /* 活跃玩家 */ - foreach ($activelist as $alv) { - if ($dv == $alv['time']) { - $activeUsers[$dv]=intval($alv['login_num']); + $data[$dv]['newUsers']=count(explode(',',$nlv['id']));break; + } + } + /* 活跃玩家 */ + foreach ($activelist as $alv) { + if ($dv == $alv['time']) { + $activeUsers[$dv]=intval($alv['login_num']); - $data[$dv]['activeUsers']=intval($alv['login_num']);break; - } - } + $data[$dv]['activeUsers']=intval($alv['login_num']);break; + } + } - /* 充值金额 */ - foreach ($incomelist as $ilv) { - if($ilv['pay_time']==$dv) { - $usersIncome[$dv] = round($ilv['money_amount'],2); - $data[$dv]['usersIncome'] = round($ilv['money_amount'],2); - break; - } - } - /* 付费玩家 */ - foreach ($paylist as $plv) { - if ($plv['pay_time']==$dv) { - $payUsers[$dv]=intval($plv['pay_num']); + /* 充值金额 */ + foreach ($incomelist as $ilv) { + if($ilv['pay_time']==$dv) { + $usersIncome[$dv] = round($ilv['money_amount'],2); + $data[$dv]['usersIncome'] = round($ilv['money_amount'],2); + break; + } + } + /* 付费玩家 */ + foreach ($paylist as $plv) { + if ($plv['pay_time']==$dv) { + $payUsers[$dv]=intval($plv['pay_num']); - $data[$dv]['payUsers']=intval($plv['pay_num']);break; - } - } - /* 1日留存 */ - foreach ($ratention1 as $r1) { - if ($r1['play_time'] == $dv) { - $rate = str_replace('.00','',$r1['retention_rate1']); - $data[$dv]['ratentionRate1']=$rate.'%';break; - } - } - /* 新付费玩家 */ - foreach ($newspay as $npv) { - if ($npv['pay_time'] == $dv) { - $totalPayPlayer = $totalPayPlayer+intval($npv['pay_num']); + $data[$dv]['payUsers']=intval($plv['pay_num']);break; + } + } + /* 1日留存 */ + foreach ($ratention1 as $r1) { + if ($r1['play_time'] == $dv) { + $rate = str_replace('.00','',$r1['retention_rate1']); + $data[$dv]['ratentionRate1']=$rate.'%';break; + } + } + /* 新付费玩家 */ + foreach ($newspay as $npv) { + if ($npv['pay_time'] == $dv) { + $totalPayPlayer = $totalPayPlayer+intval($npv['pay_num']); - $data[$dv]['newPayUsers']=intval($npv['pay_num']); - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - break; - } else { + $data[$dv]['newPayUsers']=intval($npv['pay_num']); + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + break; + } else { - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - } - } - /*新付费金额*/ - foreach ($newspaysum as $nspv) { - if ($nspv['pay_time'] == $dv) { - $data[$dv]['newPaySum']=round($nspv['pay_sum'],2); - break; - } - } - } - foreach ($activeUsers as $k1=>$ap) { - /* 付费率=付费玩家/活跃玩家 */ - foreach ($payUsers as $k2 => $pp) { - if ($k1 === $k2 && $ap>0 && $pp>0) { - $payrate = sprintf("%.2f",$pp/$ap*100); - $data[$k1]['usersPayRate']=str_replace('.00','',$payrate).'%'; - break; - } elseif ($k1 === $k2) { - } + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + } + } + /*新付费金额*/ + foreach ($newspaysum as $nspv) { + if ($nspv['pay_time'] == $dv) { + $data[$dv]['newPaySum']=round($nspv['pay_sum'],2); + break; + } + } } - /* ARPU=当日总充值数/活跃玩家数 */ - foreach ($usersIncome as $k2 => $ns) { - if ($k1 === $k2 && $ap>0 && $ns>0) { - $data[$k1]['usersArpu']=$ns/$ap;//str_replace('.00','',$ui); - break; - } elseif ($k1 === $k2) { - } + foreach ($activeUsers as $k1=>$ap) { + /* 付费率=付费玩家/活跃玩家 */ + foreach ($payUsers as $k2 => $pp) { + if ($k1 === $k2 && $ap>0 && $pp>0) { + $payrate = sprintf("%.2f",$pp/$ap*100); + $data[$k1]['usersPayRate']=str_replace('.00','',$payrate).'%'; + break; + } elseif ($k1 === $k2) { + } + } + /* ARPU=当日总充值数/活跃玩家数 */ + foreach ($usersIncome as $k2 => $ns) { + if ($k1 === $k2 && $ap>0 && $ns>0) { + $data[$k1]['usersArpu']=$ns/$ap;//str_replace('.00','',$ui); + break; + } elseif ($k1 === $k2) { + } + } } - } - foreach ($usersIncome as $k1 => $ns) { - /* ARPPU=当日总充值/付费玩家数 */ - foreach ($payUsers as $k2 => $pp) { - if ($k1 === $k2 && $pp>0 && $ns>0) { - $data[$k1]['usersArppu']=$ns/$pp;//sprintf("%d",$ns/$pp); - break; - } elseif ($k1 === $k2) { - } - } - } - - } else { - $this->assign('timeout',1); - } + foreach ($usersIncome as $k1 => $ns) { + /* ARPPU=当日总充值/付费玩家数 */ + foreach ($payUsers as $k2 => $pp) { + if ($k1 === $k2 && $pp>0 && $ns>0) { + $data[$k1]['usersArppu']=$ns/$pp;//sprintf("%d",$ns/$pp); + break; + } elseif ($k1 === $k2) { + } + } + } - //file_put_contents(dirname(__FILE__) . '/../Controller/arpu'.PID.'.txt',json_encode($data)); + } else { + $this->assign('timeout',1); + } - $this->assign('list_data',$data); + //file_put_contents(dirname(__FILE__) . '/../Controller/arpu'.PID.'.txt',json_encode($data)); - $this->display(); + $this->assign('list_data',$data); + $this->display(); } diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 06457f978..5d9c45901 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -235,20 +235,31 @@ 游戏类型:{$vo.game_type_name}  

+ -
+
- 添加组长游戏 + + 添加组长游戏 + 添加推广员游戏 - 复制下载链接 + 复制下载链接 $vo['id'],'pid'=>$vo['promote_id']));?> - 落地页链接 + 落地页链接 下架
@@ -963,35 +974,58 @@ $('.game-link').on('click', function () { var url = $(this).attr('data-url'); var qrcode = $(this).attr('data-qrcode'); + var applyId = parseInt($(this).attr('data-apply-id')); - // $.ajax({ - // type: "post", - // url: "__URL__/qrcodeNew", - // dataType: "json", - // data: {'url':url}, - // success: function (data) { - // console.log(data); - // }, - // error: function (result) { - // layer.msg('网络异常', {icon: 5}); - // } - // }); - - // $.get("__URL__/qrcodeNew/url/" + url,function(data,status){ - // console.log(data); - // qrcode = data; - // }); - - // $('#download_copy').attr('data-url',url); - $('#game_link_ercode').attr('src',qrcode); - $('#game_link_address').text(url); - $('#game_link_address_copy').text(url); - $('#game_link').show(); - $('.game-window-bg').show(); + $.ajax({ + type: "post", + url: "__URL__/getEnableStatus", + dataType: "json", + data: {'apply_id': applyId}, + success: function (data) { + console.log(data); + if (data.status == 0) { + layer.msg(data.msg, {icon: 5}); + return false; + } - var e = document.getElementById("game_link_address_copy"); - e.select(); // 选择对象 - document.execCommand("Copy"); // 执行浏览器复制命令 + var enableStatus = parseInt(data.data); + if (enableStatus == 1) { + // $('#download_copy').attr('data-url',url); + $('#game_link_ercode').attr('src',qrcode); + $('#game_link_address').text(url); + $('#game_link_address_copy').text(url); + $('#game_link').show(); + $('.game-window-bg').show(); + + var e = document.getElementById("game_link_address_copy"); + e.select(); // 选择对象 + document.execCommand("Copy"); // 执行浏览器复制命令 + } else { + var iconIndex = 7; + var enableStatusName = ''; + + switch (enableStatus) { + case 0: + enableStatusName = '未打包'; + break; + case 2: + case 3: + enableStatusName = '打包中'; + break; + case -1: + iconIndex = 5; + enableStatusName = '打包失败'; + break; + } + + layer.alert(enableStatusName, {icon: iconIndex}); + return false; + } + }, + error: function (result) { + layer.msg('网络异常', {icon: 5}); + } + }); }); // $("#download_copy").zclip({ diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index 406287833..1f0638980 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -2,7 +2,19 @@ - + + + + @@ -52,15 +64,89 @@ margin-top: 21px; width: 100%; } + + .register-box-max { + width: 80%; + height: 40%; + top: 30%; + left: 10%; + position: fixed; + z-index: 10; + background-color: #fff; + border-radius: 10px; + } + + .register-bg { + width: 100%; + height: inherit; + position: fixed; + background-color: #0a0a0a; + opacity: 0.5; + } + + .register-title-box { + padding: 10px 10px; + margin-top: 10px; + text-align: center; + font-size: 1.2rem; + } + + .register-title-box span { + font-weight: 600; + } + + .register-input-box { + text-align: center; + font-size: 1rem; + } + + .register-input-box input { + width: calc(80% - 5px); + height: 2rem; + padding-left: 5px; + margin-top: 10px; + margin-bottom: 10px; + border: 1px solid #6f6f6f; + border-radius: 3px; + } + + .register-btn-box { + margin-top: 40px; + text-align: center; + } + + .register-btn-box button { + width: 80%; + height: 2.5rem; + border: 0; + border-radius: 5px; + background-color: #1993ff; + color: #fff; + font-size: 1.1rem; + } - + + + + + + + + + + + + + + +
-
@@ -124,6 +209,18 @@ } } else { if (is_ios()) { + if (Boolean(navigator.userAgent.match(/OS [1][3]_[1][_\d]* like Mac OS X/i))) { + if (parseInt("{:I('get.status')}") > 0) { + location.href = "{:U('iosDown',array('gid'=>$gameId,'pid'=>I('get.pid'),'status'=>1))}"; + return false; + } else { + layer.confirm('请先到官网注册',{title:''} , function () { + location.href = "/mobile.php?s=/User/login/pid/" + "{:I('get.pid')}" + "/gid/" + "{:I('get.gid')}" + ".html"; + }); + return false; + } + } + location.href = "{:U('iosDown',array('gid'=>$gameId,'pid'=>I('get.pid')))}"; } else { var downLink = $(this).attr('down-link'); @@ -152,7 +249,8 @@ }) var title = $('[name=title]').val(); var description = $('[name=desc]').val(); - var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); + // var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); + var icon = $('[name=icon]').val(); wxReady(title, description, icon) } } diff --git a/Application/Home/View/default/Promote/base_info.html b/Application/Home/View/default/Promote/base_info.html index 7edb422c7..197e7e551 100644 --- a/Application/Home/View/default/Promote/base_info.html +++ b/Application/Home/View/default/Promote/base_info.html @@ -82,6 +82,15 @@ + + + *超级签链接: + + {$promote_url} + + + + diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index d628ae620..69944d15c 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -5,37 +5,37 @@
    -
  • 推广总用户

    {$user_count}
  • -
  • 推广总充值

    ¥{$total_money}
  • -
  • 当日新增用户充值

    ¥{$today_add_user_money}
  • -
  • 当月新增用户充值

    ¥{$month_add_user_money}
  • +
  • +
  • +
  • +
    -
  • 昨日注册用户

    {$yesterday_user_regist_count}
  • -
  • 昨日充值金额

    ¥{$yesterday_total_money}
  • -
  • 今日注册用户

    {$yesterday_regist_user_count}
  • -
  • 今日充值金额

    ¥{$yesterday_total_money}
  • +
  • +
  • +
  • +
  • -
    快捷菜单自定义>
    +
    快捷菜单
    暂无数据 -
      +
    diff --git a/Application/Home/View/default/Promote/mygrand.html b/Application/Home/View/default/Promote/mygrand.html index 9d4b99d78..98c0f7d55 100644 --- a/Application/Home/View/default/Promote/mygrand.html +++ b/Application/Home/View/default/Promote/mygrand.html @@ -93,12 +93,13 @@ 取消换组 - - - - 玩家迁移 - - 取消玩家迁移 + + + + 玩家迁移 + + 取消玩家迁移 + diff --git a/Application/Home/View/default/Promote/prepare.html b/Application/Home/View/default/Promote/prepare.html new file mode 100644 index 000000000..b9f3cc2b5 --- /dev/null +++ b/Application/Home/View/default/Promote/prepare.html @@ -0,0 +1,10 @@ + + + + + +
    +
    首页优化中,暂未开放!
    +
    +
    + \ No newline at end of file diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 36c149d7f..5fc9abf33 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -47,16 +47,17 @@ 推广员管理
- + + + + + + + + + + + @@ -82,14 +83,16 @@ --> - - + + + + diff --git a/Application/Home/View/default/Query/arpu_analysis.html b/Application/Home/View/default/Query/arpu_analysis.html index ba9b4f95f..da3920b2c 100644 --- a/Application/Home/View/default/Query/arpu_analysis.html +++ b/Application/Home/View/default/Query/arpu_analysis.html @@ -112,15 +112,15 @@
- - - + + +
diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html index c537a8270..2089d42bf 100644 --- a/Application/Home/View/default/Query/userRecharges.html +++ b/Application/Home/View/default/Query/userRecharges.html @@ -28,7 +28,7 @@
@@ -47,22 +47,22 @@
- +
- + + +
- +
- + + +
diff --git a/Application/Home/View/default/Query/userRoles.html b/Application/Home/View/default/Query/userRoles.html index 6305a1965..2761b20a5 100644 --- a/Application/Home/View/default/Query/userRoles.html +++ b/Application/Home/View/default/Query/userRoles.html @@ -28,7 +28,7 @@ @@ -58,7 +58,7 @@ @@ -68,7 +68,7 @@ diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 07c49507c..354e53961 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -21,9 +21,19 @@ class SsgController extends BaseController { public function login(){ $user = session("user_auth"); + $promoteId = I("promote_id"); + if (!$promoteId) { + $this->error("参数非法"); + } + $exists = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$exists) { + $this->error("参数非法."); + } + /*if ($user) { redirect(U("ssg/index")); }*/ + $this->assign("promote_id", $promoteId); $this->display(); } @@ -36,6 +46,15 @@ class SsgController extends BaseController { { $account = I("Account"); $password = I("Password"); + $promoteId = I("promote_id"); + if (!$promoteId) { + $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法")); + } + $promote = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$promote) { + $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法.")); + } + //var_dump($password); $verify = new \Think\Verify(); if (!$verify->check(I("VerifyCode"))) { @@ -62,6 +81,18 @@ class SsgController extends BaseController { } if($user_id>0){ $_SESSION['user_id'] = $user_id; + + $user = M('user', 'tab_')->where(array( + 'id' => $user_id + ))->find(); + if (!$user['promote_id']) { + M('user', 'tab_')->where(array( + 'id' => $user_id + ))->save(array( + 'promote_id' => $promoteId, + 'promote_account' => $promote['account'] + )); + } } $this->ajaxReturn(array("ErrorCode"=>$res_code,"ResultMsg"=>$res_msg),'JSON'); } @@ -95,6 +126,15 @@ class SsgController extends BaseController { $map['a.user_id']= $user['user_id']; $map['a.sdk_version'] = 2; $game_list = M("user_play a","tab_")->field("b.*,b.id as game_id,od.pay_status")->join("inner join tab_game b on a.game_id=b.id left join tab_game_supersign od on od.user_id=a.user_id and od.game_id=b.id and od.pay_status=1")->where($map)->select(); + if (!$game_list) { + $game_list = M("game", "tab_")->field("*, id as game_id")->where(array( + "sdk_version" => 2, + "game_status" => 1, + ))->select(); + foreach ($game_list as &$v) { + $v['pay_status'] = 0; + } + } $this->assign("data_list",$game_list); $this->display(); } diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 7d0bf98d4..1ded2361b 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -5,6 +5,7 @@ use User\Api\SuserApi; use Org\UcenterSDK\Ucservice; use User\Api\MemberApi; use Admin\Model\PointTypeModel; +use Think\Log; class UserController extends BaseController { private $suser; @@ -31,8 +32,7 @@ class UserController extends BaseController { $member = new MemberApi(); /*是否开启Ucenter*/ - if( C('UC_OPEN')==1 ){ - + if( C('UC_OPEN')==1 ) { $username = $account; //Ucenter登录 @@ -142,13 +142,69 @@ class UserController extends BaseController { } } - $res = $this->suser->login($account,$password);file_put_contents(dirname(__FILE__) . '/login_res_text.txt',json_encode([$res])); if($res > 0) { - $data=array( - 'status' => 1, - 'msg' => '登录成功', - ); + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + + if ($promoteId > 0) { + $wherePromote['id'] = $promoteId; + $promoteData = M('Promote','tab_')->field('id,account')->where($wherePromote)->find(); + + if (!empty($promoteData)) { + $whereUser['account'] = $account; + $whereUser['_logic'] = 'or'; + $whereUser['mobile_phone'] = $account; + $userData = M('User', 'tab_')->where($whereUser)->find(); + + if (!empty($userData)) { + if (empty($userData['promote_id'])) { + $saveData['promote_id'] = $promoteId; + $saveData['promote_account'] = $promoteData['account']; + + $saveRes = M('User', 'tab_')->where(array('id'=>$userData['id']))->save($saveData); + if ($saveRes) { + $data = array( + 'status' => 2, + 'msg' => '登录成功!绑定成功', + ); + } else { + $data = array( + 'status' => 0, + 'msg' => '绑定失败', + ); + } + } else { + if ($userData['promote_id'] == $promoteId) { + $data = array( + 'status' => 2, + 'msg' => '登录成功!绑定成功', + ); + } else { + $data = array( + 'status' => 0, + 'msg' => '号码已绑定其他推广员', + ); + } + } + } else { + $data = array( + 'status' => 0, + 'msg' => '数据异常', + ); + } + } else { + $data = array( + 'status' => 0, + 'msg' => '数据异常', + ); + } + } else { + $data=array( + 'status' => 1, + 'msg' => '登录成功', + ); + } } else { switch($res) { case -1000: $error = '账号不存在'; break; @@ -163,6 +219,12 @@ class UserController extends BaseController { } echo json_encode($data);die(); } else { + $pid = I('get.pid', 0); + $gid = I('get.gid', 0); + if ($pid > 0 || $gid > 0) { + cookie('pgInfo', json_encode(['pid' => $pid, 'gid' => $gid]), 3600 * 24); + } + if($_REQUEST['url']){ $this->assign('url',base64_decode(base64_decode($_REQUEST['url']))); }else{ @@ -190,9 +252,18 @@ class UserController extends BaseController { if (empty($password)) { echo json_encode(array('status'=>0,'msg'=>'请输入密码'));exit; } - $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1); + + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + if ($promoteId > 0) { + $gameId = intval(I('post.game_id')); + $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1,'promote_id' => $promoteId, 'game_id' => $gameId); + } else { + $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1); + } session('safeinfo',$safeinfo); $url = U('register'); + echo json_encode(array('status'=>1,'msg'=>$url)); } else{ $this->display(); @@ -255,8 +326,6 @@ class UserController extends BaseController { } - - $register_way = 4; $register_type = 2; switch ($sex) { @@ -268,18 +337,36 @@ class UserController extends BaseController { break; } + if (!preg_match("/^1[34578]\d{9}$/", $phone)) { + echo json_encode(['status' => 0,'msg' => '手机号格式不正确']); + die; + } + if (!preg_match("/^[a-zA-Z0-9]{6,15}+$/", $password)) { + echo json_encode(['status' => 0,'msg' => '密码格式不正确']); + die; + } + $pgInfo = strval(cookie('pgInfo')); + Log::write('register:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($_POST) . ' --- ' . $pgInfo, 'INFO'); if (isset($_POST['promote_id']) && !empty($_POST['promote_id'])) { $pid = $this->suser->register($phone,$password,$phone,$register_way,$register_type,$_POST['promote_id'],$_POST['promote_account'],$sex,$nickname,$head_img); } else { $pid = $this->suser->register($phone,$password,$phone,$register_way,$register_type,'','',$sex,$nickname,$head_img); } if($pid > 0){ - $data = array( - 'status' => 1, - 'msg' => '注册成功', - 'url' => U('Index/index'), - ); + if (empty($safeinfo['promote_id'])) { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('Index/index'), + ); + } else { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('User/login', array('pid' => $safeinfo['promote_id'], 'gid' => $safeinfo['game_id'])), + ); + } session('safeinfo',null); } else{ $data = array( @@ -289,6 +376,12 @@ class UserController extends BaseController { } echo json_encode($data); } else{ + $pid = I('get.pid', 0); + $gid = I('get.gid', 0); + if ($pid > 0 || $gid > 0) { + cookie('pgInfo', json_encode(['pid' => $pid, 'gid' => $gid]), 3600 * 24); + } + if ($_REQUEST['url']) { $url= base64_decode($_REQUEST['url']); } else { @@ -315,6 +408,9 @@ class UserController extends BaseController { $password = $post['password']; $sex = $post['sex']; + $pgInfo = strval(cookie('pgInfo')); + Log::write('step1:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($post) . ' --- ' . $pgInfo, 'INFO'); + /**是否开启ucenter**/ if(C('UC_OPEN')==1){ @@ -369,14 +465,38 @@ class UserController extends BaseController { if($is_setting){ echo json_encode(array('status'=>0,'msg'=>'账号已存在'));exit; } + + if (!preg_match("/^[a-z\d]{6,15}$/i", $account)) { + echo json_encode(['status' => 0,'msg' => '账号格式不正确']); + die; + } + + if (!preg_match("/^[a-zA-Z0-9]{6,15}+$/", $password)) { + echo json_encode(['status' => 0,'msg' => '密码格式不正确']); + die; + } + $pid = $this->suser->register($account,$password,'',$register_way,$register_type,'','',$sex,$nickname,$head_img); if($pid > 0){ - $data = array( - 'status' => 1, - 'msg' => '注册成功', - 'url' => U('Index/index'), - ); + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + + if ($promoteId > 0) { + $gameId = intval(I('post.game_id')); + + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('User/login', array('pid' => $promoteId, 'gid' => $gameId)), + ); + } else { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('Index/index'), + ); + } } else{ $data = array( 'status' => $pid, diff --git a/Application/Mobile/View/Ssg/index.html b/Application/Mobile/View/Ssg/index.html index 88d83addd..ba9928588 100644 --- a/Application/Mobile/View/Ssg/index.html +++ b/Application/Mobile/View/Ssg/index.html @@ -34,6 +34,8 @@ 1.选择游戏产品同时,即选择购买超级签游戏下载链接和对应游戏礼包,无法退换哦~
2.不同手机设备需要分别付费安装哦 +
+ 3.如您已购买个人签,请到<订单查询>重新下载安装,无需二次购买!
diff --git a/Application/Mobile/View/Ssg/login.html b/Application/Mobile/View/Ssg/login.html index 710adda9e..31367ac15 100644 --- a/Application/Mobile/View/Ssg/login.html +++ b/Application/Mobile/View/Ssg/login.html @@ -15,6 +15,7 @@
@@ -53,6 +55,7 @@ var loginName = $("#userAccount").val(); var loginPass = $("#password").val(); var userCode = $("#userCode").val(); + var promoteId = $("#promote_id").val(); if (loginName == "") { alert("账号不能为空"); return false; @@ -65,6 +68,10 @@ alert("验证码不能为空"); return false; } + if (promoteId == "") { + alert("推广员ID不能为空"); + return false; + } jQuery.ajax({ type: 'POST', @@ -72,7 +79,8 @@ data: { 'Account':loginName, 'Password':(loginPass), - 'VerifyCode':userCode + 'VerifyCode':userCode, + 'promote_id' :promoteId, }, dataType: 'JSON', xhrFields:{ diff --git a/Application/Mobile/View/Ssg/order.html b/Application/Mobile/View/Ssg/order.html index 1e752618c..a9fa77510 100644 --- a/Application/Mobile/View/Ssg/order.html +++ b/Application/Mobile/View/Ssg/order.html @@ -26,7 +26,7 @@