コード例 #1
0
 public function index()
 {
     $uid = session('user.id');
     getMsgStatu($uid);
     $post = I('post.');
     //dump($post);
     $order = "updatetime desc";
     //排序方式
     $project = D('project');
     if (!empty($post['search'])) {
         //搜索
         $search = '%' . $post['search'] . "%";
         //搜索条件1
         $where['pname|intro'] = array('like', $search);
         //搜索条件2
         $count = $project->where($where)->order($order)->count();
         $page = PAGE($count);
         $show = $page->show();
         $data = $project->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         for ($i = 0; $i != count($data); $i++) {
             //改变搜索结果颜色
             $data[$i]['intro'] = str_replace($post['search'], "<span style='color:red'>{$post['search']}</span>", $data[$i]['intro']);
         }
         //dump($data);
         // }  elseif (!empty($post['ptype'])) {  //筛选
     } elseif (!empty($post['stage'])) {
         //筛选
         $where = array();
         if ($post['ptype'] !== "热门" && !empty($post['ptype'])) {
             $where['ptype'] = $post['ptype'];
         }
         if ($post['province'] !== "不限") {
             $where['location'] = $post['province'] . ' ' . $post['city'];
         }
         if ($post['stage'] !== "不限") {
             $where['stage'] = $post['stage'];
         }
         $count = $project->where($where)->order($order)->count();
         $page = PAGE($count);
         $show = $page->show();
         $data = $project->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         //dump($data);
     } else {
         //全部
         $count = $project->order($order)->count();
         $page = PAGE($count);
         $show = $page->show();
         $data = $project->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         //dump($data);
     }
     for ($i = 0; $i != count($data); $i++) {
         //添加年龄段
         $data[$i]['updatetime'] = $this->createTime(strtotime($data[$i]['updatetime']));
         //创建日期转换
     }
     $this->assign('project', $data);
     $this->assign('page', $show);
     // 赋值分页输出
     $this->display();
 }
コード例 #2
0
 public function index()
 {
     $uid = session('user.id');
     getMsgStatu($uid);
     $rightnum = 5;
     //右侧显示条数
     $type = I('get.type', 'topic');
     $this->assign('active', $type);
     $frag = 'frag' . $type;
     if ($type == 'topic') {
         $this->getTopics();
         //热门话题
         $hotData = M("topic")->field("id,content,uid")->order("rise desc,view desc")->limit("0," . $rightnum)->select();
         $this->assign("hottopic", $hotData);
         //最新话题
         $newData = M("topic")->field("id,content,uid")->order("posttime desc")->limit("0," . $rightnum)->select();
         $this->assign("newtopic", $newData);
     } else {
         if ($type == 'blog') {
             $this->getBlogs();
             //热门博客
             $hotData = M("blog")->field("id,title,uid")->order("rise desc,view desc")->limit("0," . $rightnum)->select();
             $this->assign("hotblog", $hotData);
             //最新博客
             $newData = M("blog")->field("id,title,uid")->order("posttime desc")->limit("0," . $rightnum)->select();
             $this->assign("newblog", $newData);
         }
     }
     $this->assign('frag', $frag);
     $this->display();
 }
コード例 #3
0
 public function index()
 {
     $uid = session('user.id');
     getMsgStatu($uid);
     $pid = I('get.id');
     $article = D('article');
     $data = $article->getDataPid($pid);
     //全部
     $RecommendData = $article->getDataPidRecommend($pid, 4);
     //推荐文章
     $hotData = $article->getDataPidHot($pid, 4);
     //热点文章
     $theme = M('subject')->where(array('id' => $pid))->find();
     //模板
     if ($pid = "19") {
         $data1 = $article->field("id,title")->where(array("pid" => $pid, "classname" => "创业政策"))->select();
         $data2 = $article->field("id,title")->where(array("pid" => $pid, "classname" => "法务信息"))->select();
         $this->assign("cyzc", $data1);
         $this->assign("fwxx", $data2);
     }
     $this->assign("recommendarticle", $RecommendData);
     $this->assign("hotarticle", $hotData);
     $this->assign("theme", $theme['theme']);
     $this->assign("article", $data);
     $this->display();
 }
コード例 #4
0
 public function index()
 {
     $uid = session('user.id');
     getMsgStatu($uid);
     $post = I('post.');
     $order = "posttime desc";
     //排序方式
     $field = "id,name,logo,rise,province,city,type,favourpolicy,condition";
     $incubator = D("incubator");
     if (!empty($post['search'])) {
         //搜索
         $search = '%' . $post['search'] . "%";
         //搜索条件1
         $where['name|address|city|province'] = array('like', $search);
         //搜索条件2
         $count = $incubator->where($where)->count();
         // 查询满足要求的总记录数
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = $incubator->field($field)->where($where)->limit($page->firstRow . ',' . $page->listRows)->order($order)->select();
         $cou = count($data);
         for ($i = 0; $i != $cou; $i++) {
             //改变搜索结果颜色
             $data[$i]['name'] = str_replace($post['search'], "<span style='color:red'>{$post['search']}</span>", $data[$i]['name']);
         }
     } elseif (!empty($post['type'])) {
         //筛选
         $where = array();
         if ($post['type'] !== "不限") {
             $where['type'] = $post['type'];
         }
         if ($post['province'] !== "不限") {
             $where['province'] = $post['province'];
         }
         if ($post['city'] !== "不限") {
             $where['city'] = $post['city'];
         }
         $count = $incubator->where($where)->count();
         // 查询满足要求的总记录数
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = $incubator->field($field)->where($where)->limit($page->firstRow . ',' . $page->listRows)->order($order)->select();
     } else {
         $count = $incubator->field($field)->count();
         // 查询满足要求的总记录数
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = $incubator->field($field)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
     }
     $this->assign("page", $show);
     $this->assign("incubator", $data);
     $this->display();
 }
コード例 #5
0
 public function _initialize()
 {
     $this->user = session('user');
     if (empty($this->user)) {
         $this->error("请先登录", U("Index/login"), 3);
     }
     if (empty($this->user['realname']) || empty($this->user['identity'])) {
         session('reg.step', 1);
         $this->success("你需要先补全信息", U('Reg/reg'));
         exit;
     } else {
         if (empty($this->user['headpic'])) {
             session('reg.step', 2);
             $this->success("你需要先选择偏好信息", U('Reg/reg'));
             exit;
         }
     }
     getMsgStatu($this->user['id']);
 }
コード例 #6
0
 public function index()
 {
     $uid = session('user.id');
     getMsgStatu($uid);
     $post = I('post.');
     $order = "user.last_login_time desc";
     //排序方式
     if (!empty($post['search'])) {
         //搜索
         $search = '%' . $post['search'] . "%";
         //搜索条件1
         $where['user.username|founder.intro'] = array('like', $search);
         //搜索条件2
         $count = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->where($where)->count();
         // 查询满足要求的总记录数
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->where($where)->limit($page->firstRow . ',' . $page->listRows)->order($order)->select();
         for ($i = 0; $i != count($data); $i++) {
             //改变搜索结果颜色
             $data[$i]['intro'] = str_replace($post['search'], "<span style='color:red'>{$post['search']}</span>", $data[$i]['intro']);
         }
         //dump($data);
     } elseif (!empty($post['type'])) {
         //筛选
         $where = array();
         if ($post['type'] !== "不限") {
             $where['founder.type'] = $post['type'];
         }
         if ($post['province'] !== "不限") {
             $where['user.province'] = $post['province'];
         }
         if ($post['city'] !== "不限") {
             $where['user.city'] = $post['city'];
         }
         if ($post['agegroup'] !== "不限") {
             $date = ageGroupReverse($post['agegroup']);
             $where['birthday_time'] = array("between", "{$date['start']},{$date['end']}");
         }
         $count = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->where($where)->count();
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         //dump($data);
     } else {
         //全部
         $count = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->order($order)->count();
         $page = PAGE($count);
         // 实例化分页类 传入总记录数和每页显示的记录数
         $show = $page->show();
         // 分页显示输出
         $data = M()->table('user user,user_founder founder')->where("user.id = founder.uid")->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         //dump($data);
     }
     for ($i = 0; $i != count($data); $i++) {
         $data[$i]['agegroup'] = ageGroup($data[$i]['birthday_time']);
         //年龄转换
         $data[$i]['reg_time'] = regTime($data[$i]['reg_time']);
         //注册时间转换
         $data[$i]['last_login_time'] = loginTime($data[$i]['last_login_time']);
         //登录时间转换
         if (strlen($data[$i]['username']) >= 12) {
             // 用户名判断截取
             $data[$i]['username'] = substr($data[$i]['username'], 0, 10) . '..';
         }
     }
     $this->assign('founder', $data);
     $this->assign('page', $show);
     // 赋值分页输出
     $this->display();
 }