12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Cas\Controller;
- use KIF\Cookie;
- class Controller extends \KIF\Core\WXController {
-
- public function run() {
- $action = $this->action;
- $this->$action();
-
- if (self::getUid()) {
- // $objWeixinUser = new WeixinUser();
- // $user = $objWeixinUser->get(self::getUid());
- // if ($user['status'] == 1) {
- // $this->setOutput('IS_FOLLOW_WX', 1);
- // }
- // if ($user['fromsource'] == 'app') { //app中打开时,不显示“底部关注拦”
- // $this->setOutput('IS_FOLLOW_WX', 1);
- // }
- }
-
- // 来源是否是app
- define('FROMSOURCE_APP', 'true');
- $tmPassortCookie = Cookie::get('TM_PASSPORT_MEMBER');
- if(strstr($tmPassortCookie, 'fromsource=app')){
- if (!defined('FROMSOURCE_APP')) define('FROMSOURCE_APP', 'true');
- }
-
- }
-
- /**
- *
- * 错误消息
- * @param unknown $msg 错误内容
- * @param unknown $back_text 文案。如“返回”
- * @param unknown $back_url 文案链接
- */
- public function fail_exit($msg, $back_text = null, $back_url = null) {
- $this->tpl = 'error';
- $this->setOutput('title', '错误消息');
- $this->setOutput('data', array(
- 'msg' => $msg,
- 'back_text' => $back_text ? $back_text : '返回',
- 'back_url' => $back_url ? $back_url : $_SERVER['HTTP_REFERER'],
- ));
- $this->setOutput('error', 1);
- $this->render();exit;
- }
-
- /**
- *
- * 授权错误
- * @param unknown $msg
- */
- public function fail_exit_oauth($msg) {
- $this->tpl = 'error';
- $this->setOutput('title', '授权失败');
- $this->setOutput('data', array(
- 'msg' => $msg,
- ));
- $this->setOutput('error', 2);
- $this->render();exit;
- }
-
- /**
- *
- * 404页
- * @param unknown $msg
- */
- public function echo_404() {
- $this->tpl = 'error';
- $this->setOutput('title', '404');
- $this->setOutput('error', 3);
- $this->render();exit;
- }
- }
|