|
|
|
<?php
|
|
|
|
namespace Mobile\Controller;
|
|
|
|
use User\Api\MemberApi;
|
|
|
|
|
|
|
|
class SsgController extends BaseController {
|
|
|
|
const USER_NOT_ILLEGAL = -1; //用户名不合法
|
|
|
|
const USER_HAVE_SENSITIVE_STR = -2; //包含敏感字符
|
|
|
|
const USER_HAS_REGISTERED = -3; //用户已存在
|
|
|
|
const USER_PROMOTE_NATURAL = 0;//自然注册
|
|
|
|
const EMPTY_DATA = -100; //数据为空
|
|
|
|
const SIGN_ERROR = -99; //验签失败
|
|
|
|
const USER_NOT_EXIST = -1000; //用户不存在
|
|
|
|
const USER_FORBIDDEN = -1001; //被禁用
|
|
|
|
const USER_PWD_ERROR = -10021; //密码错误
|
|
|
|
const UNKNOWN_ERROR = -1100; //未知错误
|
|
|
|
const CODE_TIMEOUT = -98; //验证码超时
|
|
|
|
const CODE_ERROR = -97; //验证码错误
|
|
|
|
const RETURN_SUCCESS = 1;
|
|
|
|
const RETURN_FALSE = 2;
|
|
|
|
|
|
|
|
|
|
|
|
public function login(){
|
|
|
|
$user = session("user_auth");
|
|
|
|
if ($user) {
|
|
|
|
redirect(U("ssg/index"));
|
|
|
|
}
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function home(){
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
//用户登录
|
|
|
|
public function do_login()
|
|
|
|
{
|
|
|
|
$account = I("Account");
|
|
|
|
$password = I("Password");
|
|
|
|
//var_dump($password);
|
|
|
|
$verify = new \Think\Verify();
|
|
|
|
if (!$verify->check(I("VerifyCode"))) {
|
|
|
|
$this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "验证码错误"));
|
|
|
|
}
|
|
|
|
$userApi = new MemberApi();
|
|
|
|
$user_id = $userApi->login($account, $password,1);//调用登录
|
|
|
|
$res_code = 0;
|
|
|
|
$res_msg = "登录成功";
|
|
|
|
if ($user_id < 0) {
|
|
|
|
switch ($user_id) {
|
|
|
|
case -1000 :
|
|
|
|
$res_code = self::USER_NOT_EXIST;
|
|
|
|
$res_msg = "用户不存在";
|
|
|
|
break;
|
|
|
|
case -10021 :
|
|
|
|
$res_code = self::USER_PWD_ERROR;
|
|
|
|
$res_msg = "登录密码错误";
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
$res_code = self::UNKNOWN_ERROR;
|
|
|
|
$res_msg = "未知错误";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($user_id>0){
|
|
|
|
$_SESSION['user_id'] = $user_id;
|
|
|
|
}
|
|
|
|
$this->ajaxReturn(array("ErrorCode"=>$res_code,"ResultMsg"=>$res_msg),'JSON');
|
|
|
|
}
|
|
|
|
|
|
|
|
//验证码
|
|
|
|
public function verify($vid = '')
|
|
|
|
{
|
|
|
|
$config = array(
|
|
|
|
'seKey' => 'ThinkPHP.CN', //验证码加密密钥
|
|
|
|
'fontSize' => 16, // 验证码字体大小(px)
|
|
|
|
'imageH' => 42, // 验证码图片高度
|
|
|
|
'imageW' => 107, // 验证码图片宽度
|
|
|
|
'length' => 4, // 验证码位数
|
|
|
|
'fontttf' => '4.ttf', // 验证码字体,不设置随机获取
|
|
|
|
'useCurve' => false,
|
|
|
|
);
|
|
|
|
|
|
|
|
ob_clean();
|
|
|
|
$verify = new \Think\Verify($config);
|
|
|
|
$verify->codeSet = '0123456789';
|
|
|
|
$verify->entry($vid);
|
|
|
|
}
|
|
|
|
|
|
|
|
//首页
|
|
|
|
public function index(){
|
|
|
|
$user = session("user_auth");
|
|
|
|
if (!$user) {
|
|
|
|
redirect(U("ssg/login"));
|
|
|
|
//$this->error("请登入", U('ssg/login'));
|
|
|
|
}
|
|
|
|
$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")->join("tab_game b on a.game_id=b.id")->where($map)->select();
|
|
|
|
$this->assign("data_list",$game_list);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function order(){
|
|
|
|
//.echo md5(sha1('123456') . 'UmtW6-Z(S^8xvwDn;B:J{X7FG9z2+Np.|C#~QRY"');exit();
|
|
|
|
$user = session("user_auth");
|
|
|
|
if (!$user) {
|
|
|
|
redirect(U("ssg/login"));
|
|
|
|
//$this->error("请登入", U('ssg/login'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$order_list = M("game_supersign a","tab_")->field("a.order_id, b.game_name, b.icon, b.id as game_id, a.pay_status, a.user_id")->join("left join tab_game b on a.game_id=b.id")->where(array(
|
|
|
|
'a.user_id' => $user['user_id'],
|
|
|
|
))->order("a.id")->select();
|
|
|
|
// pp($order_list);
|
|
|
|
$this->assign("data_list", $order_list);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
//流程
|
|
|
|
public function process(){
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
//教程
|
|
|
|
public function tutorial(){
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
//帮助
|
|
|
|
public function help(){
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
//规则
|
|
|
|
public function rule(){
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 支付页面
|
|
|
|
public function alipay($data) {
|
|
|
|
$this->assign("url", $data['url']);
|
|
|
|
$this->assign("price", $data['price']);
|
|
|
|
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|