Esempio n. 1
0
 public function thread()
 {
     if ($_GET["articleid"]) {
         $map['id'] = $_GET['articleid'];
     } else {
         $this->error("访问错误", 'index', 5);
         return;
     }
     //如果用户已经登录,将当前的文章id保存到session中
     $user = session('user');
     if ($user) {
         $user['articleid'] = $_GET['articleid'];
         session('user', $user);
     }
     //读取文章数据
     $model = M('article');
     //更新查看数量
     $model->where($map)->setInc('reviewnum');
     $article = $model->where($map)->select();
     if (!$article) {
         $this->error("服务器错误");
         return;
     }
     $article = $article[0];
     $this->assign("article", $article);
     $th['reply_num'] = $article['replynum'];
     $th['review_num'] = $article['reviewnum'];
     //读取作者用户数据
     $vip = M('vip');
     $query['id'] = $article['authorid'];
     $user = $vip->where($query)->select();
     if (!$user) {
         $this->error("服务器错误");
         return;
     }
     $user = $user[0];
     //读取作者的主题数据
     $query = [];
     $query['authorid'] = $article['authorid'];
     $user['thnum'] = $model->where($query)->count();
     //读取作者的帖子数据
     $review = M('review');
     $query = [];
     $query['reviewerid'] = $article['authorid'];
     $user['replynum'] = $review->where($query)->count();
     //生成vip地址
     if ($user["viplevel"] < 1) {
         $user["viplevel"] = 1;
     }
     if ($user["viplevel"] > 5) {
         $user["viplevel"] = 5;
     }
     $user['lvimg'] = __ROOT__ . '' . '/Application/Home/View/resource/img/' . '' . $user['viplevel'] . '' . 'zuan.gif';
     $user['desc'] = $user['viplevel'] . '' . '钻会员';
     /////////////////////////////////////////////////////////////////////////////
     //读取评论数据
     $th['articleid'] = $article['id'];
     if ($_GET['page']) {
         $th['cur_page'] = (int) $_GET['page'];
     } else {
         $th['cur_page'] = 1;
     }
     $th["per_page_num"] = 5;
     //每页评论数量
     $th["menu_num"] = 6;
     //每页页码数量
     $query = [];
     $query['articleid'] = $article['id'];
     $th['reply_num'] = $review->where($query)->count();
     $th['page_total'] = intval($th['reply_num']) / $th["per_page_num"];
     if (floor($th['page_total']) < $th['page_total']) {
         $th['page_total'] = (int) floor($th['page_total']);
         $th['page_total']++;
     }
     $th = paged($th);
     $limit['articleid'] = $article['id'];
     $query = $th["cur_page"] . "," . $th["per_page_num"];
     $replyer = $review->where($limit)->page($query)->select();
     //拉取评论者的统计数据
     $vip = M("vip");
     foreach ($replyer as $key => $value) {
         //读取评论者的vip用户数据
         $query = [];
         $query['id'] = $value['reviewerid'];
         $u = $vip->where($query)->select();
         $value['user'] = $u[0];
         //读取评论者的主题数据
         $query = [];
         $query['authorid'] = $value['reviewerid'];
         $value['user']['thnum'] = $model->where($query)->count();
         //读取评论者的帖子数据
         $query = [];
         $query['reviewerid'] = $value['reviewerid'];
         $value['user']['replynum'] = $review->where($query)->count();
         //生成评论者生成vip地址
         if ($user["viplevel"] < 1) {
             $user["viplevel"] = 1;
         }
         if ($user["viplevel"] > 5) {
             $user["viplevel"] = 5;
         }
         $value['user']['lvimg'] = __ROOT__ . '' . '/Application/Home/View/resource/img/' . '' . $user['viplevel'] . '' . 'zuan.gif';
         $value['user']['desc'] = $user['viplevel'] . '' . '钻会员';
         $replyer[$key] = $value;
     }
     //生成网站索引
     $url = "theme.html?" . '' . "category=" . '' . $article['categoryid'];
     $query = [];
     $query['id'] = $article['categoryid'];
     $cate = M("category");
     $c = $cate->where($query)->select();
     set_path($url, $c[0]['name'], 1);
     $url = "thread.html?" . '' . "articleid=" . '' . $article['id'];
     set_path($url, $article['title'], 2);
     $this->assign('path', get_path(2));
     $the = 'newth.html?categoryid=' . '' . $article['categoryid'];
     $this->assign('newth', $the);
     $this->assign('paged', $th);
     $this->assign('replyer', $replyer);
     $this->assign('author', $user);
     $this->assign('user', session('user'));
     $this->show();
 }
function printLea($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($f_day, "num", 1, 2, "Invalid from Date day.");
    $v->isOk($f_month, "num", 1, 2, "Invalid from Date month.");
    $v->isOk($f_year, "num", 1, 4, "Invalid from Date Year.");
    $v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
    # mix dates
    $fromdate = $f_year . "-" . $f_month . "-" . $f_day;
    $todate = $to_year . "-" . $to_month . "-" . $to_day;
    $v->isOk($fromdate, "date", 1, 1, "Invalid from date.");
    $v->isOk($todate, "date", 1, 1, "Invalid to date.");
    if ($v->isError()) {
        $err = $v->genErrors();
        return $err;
    }
    if (isset($empnum)) {
        $OUTPUT = genslip($empnum, $fromdate, $todate);
    } else {
        $OUTPUT = "";
        $qry = new dbSelect("employees", "cubit", grp(m("cols", "empnum"), m("where", "div='" . USER_DIV . "'")));
        $qry->run();
        while ($row = $qry->fetch_array()) {
            $OUTPUT .= paged(genslip($row["empnum"], $fromdate, $todate));
        }
    }
    require "../tmpl-print.php";
}
Esempio n. 3
0
 public function sd_search()
 {
     $key = $_POST["key"];
     $model = M("sd");
     $vip = M('vip');
     //计算分页数据
     $th["per_page_num"] = $key['per_page_num'];
     //每页条数
     $th["menu_num"] = $key['menu_num'];
     //每页页码数量
     $th["cur_page"] = $key['cur_page'];
     //每页页码数量
     $th['data_count'] = $model->count();
     $th = paged($th);
     $str = $key['cur_page'] . ',' . $key['per_page_num'];
     $res = $model->order('endtime DESC')->page($str)->select();
     if ($res) {
         //查询到数据后。读取刷单者信息
         foreach ($res as $key => $value) {
             $query = [];
             $query['id'] = $value['czid'];
             $auth = $vip->where($query)->select();
             if ($auth) {
                 $value['czname'] = $auth[0]['name'];
             }
             $query['id'] = $value['gxid'];
             $auth = $vip->where($query)->select();
             if ($auth) {
                 $value['gxname'] = $auth[0]['name'];
             }
             $res[$key] = $value;
         }
         $res = sd_format($res);
         $ret["sd"] = $res;
         $ret['paged'] = $th;
         $ret["status"] = 1;
     } else {
         $ret["status"] = 0;
     }
     $this->ajaxReturn($ret);
 }