/** * --------------------------------------------------------------------------------------------- * > 接口说明:头像列表接口 * <code> * URL地址:/image/faceList * 提交方式:GET * </code> * --------------------------------------------------------------------------------------------- * @title 头像列表接口 * @action /image/faceList * @method get */ public function faceListAction() { // valid face ids $faceIdArr = range(0, 14); // get face images $faceList = array(); foreach ($faceIdArr as $faceId) { $faceList[] = Demos_Util_Image::getFaceImage($faceId); } $this->render('10000', 'Get face list ok', array('Image.list' => $faceList)); }
/** * Get all blog list * @param int $pageId */ public function getListByPage($pageId = 0) { $list = array(); $sql = $this->select()->from($this->t1, '*')->order("{$this->t1}.uptime desc")->limitPage($pageId, 10); $res = $this->dbr()->fetchAll($sql); if ($res) { $customerDao = new Core_Customer(); foreach ($res as $row) { $customer = $customerDao->read($row['customerid']); $blog = array('id' => $row['id'], 'face' => Demos_Util_Image::getFaceUrl($customer['face']), 'content' => '<b>' . $customer['name'] . '</b> : ' . $row['content'], 'comment' => '评论(' . $row['commentcount'] . ')', 'picture' => $row['picture'], 'uptime' => $row['uptime']); array_push($list, $blog); } } return $list; }
/** * --------------------------------------------------------------------------------------------- * > 接口说明:用户Club登录接口 * <code> * URL地址:/index/loginClub * 提交方式:POST * 参数#1:name,类型:STRING,必须:YES,示例:admin * 参数#2:pass,类型:STRING,必须:YES,示例:admin * 参数#3:school,类型:STRING,必须:YES,示例:山东大学 * </code> * --------------------------------------------------------------------------------------------- * @title 用户Club登录接口 * @action /index/loginClub * @params school 山东大学 STRING * @params name 计算机学院' STRING * @params pass 123 STRING * @method post */ public function loginClubAction() { // return login customer $school = $this->param('school'); $name = $this->param('name'); $pass = $this->param('pass'); if ($name && $pass) { $customerDao = $this->dao->load('Core_CustomerClub'); $customer = $customerDao->doAuth($school, $name, $pass); if ($customer) { $customer['sid'] = session_id(); $customer['personal'] = 1; $customer['faceUrl'] = Demos_Util_Image::getFaceUrl($customer['face']); $_SESSION['customer'] = $customer; $this->render('10000', 'Login ok', array('CustomerClub' => $customer)); } } // return sid only for client $customer = array('sid' => session_id()); $this->render('14001', 'Login failed', array('CustomerClub' => $customer)); }
/** * Get customer by id * @param int $id */ public function getById($id) { $customer = $this->read($id); $customer['faceUrl'] = Demos_Util_Image::getFaceUrl($customer['face']); return $customer; }