Ejemplo n.º 1
0
 /**
  *上传活动封面图
  *
  */
 public function upload()
 {
     $userinfo = ACPopedom::getUserInfo();
     $subName = substr(md5($userinfo['userid']), -1);
     $result = UploadFile($subName, "/Attachment/", 'upload/');
     $this->ajaxReturn($result);
 }
Ejemplo n.º 2
0
 /**
  * 点赞一条feed
  */
 public function praise()
 {
     $feedid = intval(I('post.feedid', ''));
     \Predis\Autoloader::register();
     $redis = new \Predis\Client();
     if ($redis->zscore('feed:' . $feedid . ':praise', ACPopedom::getID())) {
         $res = $redis->zrem('feed:' . $feedid . ':praise', ACPopedom::getID());
         $rs = $redis->hincrby('feed:' . $feedid, 'praise', -1);
         $this->ajaxReturn($res && $rs ? array('status' => true) : array('status' => false, 'message' => '由于服务器君罢工,取消点赞失败失败啦..'));
     } else {
         $rs = $redis->zadd('feed:' . $feedid . ':praise', time(), ACPopedom::getID());
         $result = $redis->hincrby('feed:' . $feedid, 'praise', 1);
         $this->ajaxReturn($result && $rs ? array('status' => true, 'message' => '点赞成功了,么么哒') : array('status' => false, 'message' => '由于服务器君罢工,点赞失败失败啦..'));
     }
 }
 public function index()
 {
     \Predis\Autoloader::register();
     $redis = new \Predis\Client();
     $feedList = M('Feed')->alias('f')->field('f.feedid,f.posttime,f.show,f.content,f.picpath,f.appid,u.avator,u.nickname')->join(array('__USERS__ AS u ON f.userid =  u.userid '))->where('f.userid = ' . ACPopedom::getID())->select();
     foreach ($feedList as $key => $value) {
         $feedList[$key]['posttime'] = beforeTime($value['posttime']);
         if ($value['picpath']) {
             $feedList[$key]['picpath'] = explode('#$', $value['picpath']);
             $feedList[$key]['pic-col'] = count($feedList[$key]['picpath']) > 4 ? 3 : 12 / count($feedList[$key]['picpath']);
         }
         //取出点赞数
         $praise = $redis->hget('feed:' . $value['feedid'], 'praise');
         $feedList[$key]['praise'] = $praise ? $praise : 0;
     }
     //var_dump($feedList);
     $this->assign('feedlist', $feedList);
     $this->assign('userinfo', ACPopedom::getUserInfo());
     $this->display();
 }
Ejemplo n.º 4
0
 /**
  *
  */
 public function getbackPasswd()
 {
     if (IS_POST) {
         $data['captcha'] = I('post.captcha', '');
         $data['email'] = I('post.email', '');
         $verify = new Verify();
         $checkRs = $verify->check($data['captcha']);
         if (!$checkRs) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:验证码不正确'));
         }
         if (!Validation::IsEmailAdress($data['email'])) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:邮箱地址不合法'));
         }
         $rs = M('Users')->where("email = '" . $data['email'] . "'")->find();
         if (!$rs) {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:该账号不存在'));
         }
         $token = authcode($rs['userid'] . ',' . time() . ',' . $data['email'], "ENCODE", SESSION_AUTH);
         $this->assign('url', SITE_URL . '/Web/Login/modifyPasswd?token=' . base64_encode($token));
         $this->assign('username', $rs['nickname']);
         $res = ACPopedom::sendEmail($data['email'], $rs['nickname'], '旅之沙修改密码邮件', $this->fetch('modifyPasswdEmailContent'));
         if ($res) {
             cookie('__getback__', authcode($rs['userid'] . ',' . time() . ',' . $data['email'], "ENCODE", SESSION_AUTH), C('ACTIVATION_TIME'));
             $this->ajaxReturn(array('status' => true, 'message' => '提示:邮件发送成功', 'url' => SITE_URL . U('Web/Login/gbStep2')));
         } else {
             $this->ajaxReturn(array('status' => false, 'message' => '提示:发送邮件失败'));
         }
     }
     $this->display('getbackPasswdStep1');
 }
Ejemplo n.º 5
0
 /**
  *
  * 退出登陆
  */
 public function logout()
 {
     ACPopedom::logout();
     $this->redirect("Web/Login/index");
 }
Ejemplo n.º 6
0
 public function test()
 {
     $this->assign('userinfo', ACPopedom::getUserInfo());
     $this->display('Public:nav');
 }
Ejemplo n.º 7
0
 function _initialize()
 {
     if (!ACPopedom::isLogin()) {
         $this->redirect('Web/Login/index');
     }
 }