コード例 #1
0
 /**
  * 登录页面 , 登录提交接口
  * @param string $account 帐号
  * @param string $password 密码
  * @param string $verify 验证码
  */
 public function login($account = null, $password = null, $verify = null)
 {
     if (IS_POST) {
         //登录提交
         if (empty($account)) {
             $this->error('帐号错误!');
         } elseif (empty($password)) {
             $this->error('密码必须!');
         }
         /* 检测验证码
         			$verify = new Verify();
         			if (!$verify->check($code, 1)) {//验证码编号为1
         				$this->error('验证码输入错误!');
         			}
         			*/
         //验证用户
         $map = array();
         $map['account'] = $account;
         $map["status"] = 1;
         //-1:删除 0:禁用 1:正常
         $map['password'] = $password;
         $User = new MemberModel();
         if (!$User->login($map)) {
             $this->error($User->getError());
             //登录验证失败
         }
         $this->success('登录成功', U('Index/index'));
     } else {
         //登录页面
         if (is_login()) {
             $this->redirect('Index/index');
         } else {
             $this->display();
         }
     }
 }
コード例 #2
0
 /**
  * 正在进行的活动
  * @author JunhaoHo
  */
 public function activityUnderway()
 {
     $activities = D('Activity')->getActivitiesUnderway();
     $activityMemberD = new ActivityMemberModel();
     $memberD = new MemberModel();
     foreach ($activities as &$activity) {
         $activity['category_name'] = $this->getCategoryName($activity['category']);
         $activity['friendly_date'] = friendlyDate($activity['starttime']);
         $members = $activityMemberD->getActivityMembersByAid($activity['aid']);
         $member_uids = array();
         foreach ($members as $member) {
             $member_uids[] = $member['uid'];
         }
         $member_avatars = $memberD->getAvatarsByUids($member_uids);
         foreach ($members as &$_member) {
             $_member['avatar'] = $member_avatars[$_member['uid']];
         }
         $activity['members'] = $members;
         $activity['members_num'] = count($members);
     }
     $this->assign("activities", $activities);
     $this->display();
 }
コード例 #3
0
 /**
  * 自动登录, 首次登录则生成会员
  * @param string $tk 令牌
  */
 public function bulidMem($tk, $mid = null)
 {
     if ($this->_idtoken($tk)) {
         //验证成功
         $member_M = new MemberModel();
         $newid = $member_M->bulidNew($mid);
         if (false === $newid) {
             $this->error($member_M->getError());
         }
         $this->success($newid);
     } else {
         //验证失败
         $this->error("非法操作!!!");
     }
 }