diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 79488797a..894fbe205 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -19,22 +19,26 @@ class SsgController extends BaseController { const RETURN_FALSE = 2; - public function login(){ + public function login() + { + $promoteId = I("promote_id", 0); $user = session("user_auth"); - $promoteId = I("promote_id"); - if (!$promoteId) { + if ($user) { + redirect(U("ssg/index", array('promete_id' => $promoteId))); + } + + /*if (!$promoteId) { echo "链接失效,请重新向推广员索取链接。"; exit(); $this->error("参数非法"); - } - $exists = M("promote", "tab_")->where(array('id' => $promoteId))->find(); - if (!$exists) { - $this->error("参数非法."); - } - - /*if ($user) { - redirect(U("ssg/index")); }*/ + if ($promoteId) { + $exists = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$exists) { + $this->error("链接失效,请重新向推广员索取链接."); + } + } + $this->assign("promote_id", $promoteId); $this->display(); } @@ -48,13 +52,16 @@ class SsgController extends BaseController { { $account = I("Account"); $password = I("Password"); - $promoteId = I("promote_id"); - if (!$promoteId) { + $promoteId = I("promote_id", 0); + /*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" => "参数非法.")); + }*/ + $promote = array(); + if ($promoteId) { + $promote = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$promote) { + $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法.")); + } } //var_dump($password); @@ -87,7 +94,7 @@ class SsgController extends BaseController { $user = M('user', 'tab_')->where(array( 'id' => $user_id ))->find(); - if (!$user['promote_id']) { + if (!$user['promote_id'] && $promote) { M('user', 'tab_')->where(array( 'id' => $user_id ))->save(array( diff --git a/Application/Mobile/View/Ssg/login.html b/Application/Mobile/View/Ssg/login.html index 31367ac15..ff0a56119 100644 --- a/Application/Mobile/View/Ssg/login.html +++ b/Application/Mobile/View/Ssg/login.html @@ -38,7 +38,7 @@
登录
-
注册
+
注册