Пример #1
0
 public static function getNameAvatar($id = null, $role = null)
 {
     // 	    if(!is_numeric($id) || !is_numeric($role)){
     // 	    	return array(
     // 	    		'name'   => '',
     // 	    	    'avatar' => '',
     // 	    	);
     // 	    }
     if ($role == 1) {
         $user = Application_Model_M_Nuser::find($id);
         $avatarurl = Application_Model_M_Nuser::getAvatarUrl($id);
     } elseif ($role == 2) {
         $user = Application_Model_M_Doctor::find($id);
         $avatarurl = Application_Model_M_Doctor::getAvatarUrl($id);
     } elseif ($role == 3) {
         $user = Application_Model_M_Hospital::find($id);
         $avatarurl = Application_Model_M_Hospital::getAvatarUrl($id);
     } else {
         $user = NULL;
     }
     if ($user) {
         $res = array('name' => $user->getName(), 'avatar' => $avatarurl);
     } else {
         $res = array('name' => '', 'avatar' => '');
     }
     return $res;
 }
Пример #2
0
 public function viewAction()
 {
     if ($this->_auth->userid && $this->_auth->role == 1) {
         $nuser = Application_Model_M_Nuser::find($this->_auth->userid);
         if ($nuser) {
             $out['errno'] = '0';
             $out['mobile'] = $nuser->getMobile();
             $out['email'] = $nuser->getEmail();
             $out['phone'] = $nuser->getPhone();
             $out['name'] = $nuser->getName();
             $out['avatar'] = Application_Model_M_Nuser::getAvatarUrl($nuser->getId());
             $out['sex'] = $nuser->getSex();
             $out['job'] = $nuser->getJob();
             $out['postcode'] = $nuser->getPostcode();
             $out['idcard'] = $nuser->getIdcard();
             $out['country'] = $nuser->getCountry();
             $out['address'] = $nuser->getAddress();
             $out['birthday'] = $nuser->getBirthday();
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '200';
     }
     $out['msg'] = Yy_ErrMsg_User::getMsg('view', $out['errno']);
     Yy_Utils::jsonOut($out);
 }