Authored by Rock Zhang

修复android登录问题

@@ -42,7 +42,7 @@ class YuanxiaoController extends HuodongAction @@ -42,7 +42,7 @@ class YuanxiaoController extends HuodongAction
42 'shareDesc' => '元宵节快乐!一起来YOHO!BUY有货玩2016年潮流开运测试!', 42 'shareDesc' => '元宵节快乐!一起来YOHO!BUY有货玩2016年潮流开运测试!',
43 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/02/19/16/02dbd38c84eccf1097b7e240452f0de856.png', 43 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/02/19/16/02dbd38c84eccf1097b7e240452f0de856.png',
44 'shareUrl' => Helpers::url('/cuxiao/yuanxiao/index'), 44 'shareUrl' => Helpers::url('/cuxiao/yuanxiao/index'),
45 - 'playUrl' => $this->_isApp ? $playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}': $playUrl, 45 + 'playUrl' => $this->isApp() ? $playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}': $playUrl,
46 )); 46 ));
47 } 47 }
48 48
@@ -56,7 +56,9 @@ class YuanxiaoController extends HuodongAction @@ -56,7 +56,9 @@ class YuanxiaoController extends HuodongAction
56 if (!$this->_isApp) { 56 if (!$this->_isApp) {
57 $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/yuanxiao/info')), 'default')); 57 $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/yuanxiao/info')), 'default'));
58 } else { 58 } else {
59 - exit(); 59 + $playUrl = Helpers::url('/cuxiao/yuanxiao/index');
  60 + $playUrlEncode = strtr($playUrl, array('/' => '\\/'));
  61 + $this->$playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}';
60 } 62 }
61 } 63 }
62 64
@@ -82,7 +84,7 @@ class YuanxiaoController extends HuodongAction @@ -82,7 +84,7 @@ class YuanxiaoController extends HuodongAction
82 $this->setCookie('yuanxiaochouqian', json_encode($cookieData), time() + 15 * 60); 84 $this->setCookie('yuanxiaochouqian', json_encode($cookieData), time() + 15 * 60);
83 85
84 $waitUrl = Helpers::url('/cuxiao/yuanxiao/wait'); 86 $waitUrl = Helpers::url('/cuxiao/yuanxiao/wait');
85 - $this->go($this->isWeixin() ? $waitUrl : $waitUrl . '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","param":{"from":"app"}}}'); 87 + $this->go($this->_isApp ? $waitUrl . '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","param":{"from":"app"}}}' : $waitUrl);
86 88
87 } else { // 不成功就显示返回的错误信息 89 } else { // 不成功就显示返回的错误信息
88 90
@@ -134,7 +136,7 @@ class YuanxiaoController extends HuodongAction @@ -134,7 +136,7 @@ class YuanxiaoController extends HuodongAction
134 $this->_view->display('wait', array( 136 $this->_view->display('wait', array(
135 'staticTitle' => '2016潮流运势测试', 137 'staticTitle' => '2016潮流运势测试',
136 'staticFile' => self::STATIC_FILE, 138 'staticFile' => self::STATIC_FILE,
137 - 'activityUrl' => $this->isWeixin() ? $activityUrl : $activityUrl . '?app_version=' . $this->get('app_version') . '&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","param":{"from":"app"},"share":"'.$activityUrl.'", shareparam:":{"share_id":"1"}}}', 139 + 'activityUrl' => $this->_isApp ? $activityUrl . '?app_version=' . $this->get('app_version') . '&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","param":{"from":"app"},"share":"'.$activityUrl.'", shareparam:":{"share_id":"1"}}}' : $activityUrl,
138 'staticJS' => array( 140 'staticJS' => array(
139 'wait.js' 141 'wait.js'
140 ), 142 ),
@@ -254,13 +256,13 @@ class YuanxiaoController extends HuodongAction @@ -254,13 +256,13 @@ class YuanxiaoController extends HuodongAction
254 } 256 }
255 257
256 /** 258 /**
257 - * 判断是否是微信访问 259 + * 判断是否是APP访问
258 * 260 *
259 * @return bool 261 * @return bool
260 */ 262 */
261 - private function isWeixin() 263 + private function isApp()
262 { 264 {
263 - return (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false); 265 + return (null !== $this->get('app_version'));
264 } 266 }
265 267
266 /** 268 /**