Default.class.php 1.79 KB
<?php
/**
 * 默认控制器
 */
class Controller_Default extends Controller_Abstract
{
	
	public function init()
	{
		
	}
    /**
     * 首页
     */
    public function indexAction()
    {
    	//连接数据库测试
    	Facade_Userinfo::getUserinfoByUid(1);
    	return "Run....";
    }
    
    public function testAction()
    {
    	$uid = Facade_Auth::getAuthedUid();
    	if ($uid) 
    	{
    		dump( Facade_Userinfo::getUserinfoByUid($uid) );
    	}else
    	{
    		echo "尚未登录";
    	}
    }
    
    
    public function loginAction()
    {
        $accounts = array
	    (
	        'jsnjmayangda@163.com',
	        'jsnjmayaangda@163.com',
	        'jsnjmayaadngda@163.com',
	        'jsnjmayaadngdda@163.com',
	        'jsnjmayaadndgdda@163.com',
	        'jsnjmayaaddndgdda@163.com',
	        'jsnjmayaadddndgdda@163.com',
	        'jsnjmayaadaddndgdda@163.com',
	        'jsnjmayaadadddndgdda@163.com',
	        'jsnjmaayaadadddndgdda@163.com',
	        'jsnjmaayaadadddndagdda@163.com',
	        'demo@163.com',
	        'demo20@163.com',
	        'demo21@163.com',
	        'demo22@163.com',
	        'demo23@163.com',
	        'demotest@163.com',
	        'demotest3@163.com',
	        'demotest10@163.com',
	        'demotest11@163.com',
	        'login@163.com',
	    );
		$account = array_rand($accounts);
		$account = $accounts[$account];
		$password = '123456';
		$result = Facade_Auth::checkLogin($account, $password) ;
		if (isset($result['uid'])) 
		{
			//构造信息返回
			$data = Facade_Userinfo::getUserinfoForApp($result['uid'],$fields, $this->_appScope);
			if (!isset($data['uid'])) 
			{
				$data['uid'] = $result['uid'];
			}
			return $this->returnJson($result['code'], $data,$result['message']);
		}
		return $this->returnJson($result['code'], array(), $result['message']);
    }
}