comment.inc.php
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu2();
$storeid=$_COOKIE["storeid"];
$cur_store = $this->getStoreById($storeid);
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$where=" WHERE a.store_id=".$storeid;
if($_GPC['type']==2){
$where.=" and a.state=1";
}
$sql="select a.*,b.name ,b.img as user_img,c.name as store_name from " . tablename("cjdc_assess") . " a" . " left join " . tablename("cjdc_user") . " b on b.id=a.user_id " . " left join " . tablename("cjdc_store") . " c on c.id=a.store_id ".$where." order by a.id DESC";
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql);
$total=pdo_fetchcolumn("select count(*) from " . tablename("cjdc_assess") . " a" . " left join " . tablename("cjdc_user") . " b on b.id=a.user_id " . " left join " . tablename("cjdc_store") . " c on c.id=a.store_id ".$where);
$pager = pagination($total, $pageindex, $pagesize);
for($i=0;$i<count($list);$i++){
if($list[$i]['img']){
if(strpos($list[$i]['img'],',')){
$list[$i]['img']= explode(',',$list[$i]['img']);
}else{
$list[$i]['img']=array(
0=>$list[$i]['img']
);
}
}
}
if(checksubmit('submit')){
$data['state']=2;
$data['hf']=$_GPC['con'];
$data['hf_time']=date("Y-m-d H:i:s");
$res=pdo_update('cjdc_assess',$data,array('id'=>$_GPC['id']));
if($res){
message('回复成功!', $this->createWebUrl('comment',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
}else{
message('回复失败!','','error');
}
}
$qb=pdo_getall('cjdc_assess',array('store_id'=>$storeid));
$whf=pdo_getall('cjdc_assess',array('store_id'=>$storeid,'state'=>1));
include $this->template('web/comment');