文件
mashangyoujiu/Application/Super/Controller/HelpsController.class.php

97 行
3.3 KiB
PHP
可执行文件

<?php
namespace Super\Controller;
use Think\Controller;
//[1.4.14]
class HelpsController extends Controller
{
public function index()
{
$this->display();
}
public function MetInfo(){
$id = I('get.id');
$types = I('get.types');
if(!empty($id)){
$info = M('content')->where(array('hid' => $id))->find();
$info['content'] = htmlspecialchars_decode($info['content']);
$title = M('help')->where(array('id' => $id))->find();
$infos = M('help')->where(array('id' => $title['cuid']))->find();
$str['cuid'] = array('neq', 0);
$str['heid'] = array('eq',1);
$data = M('help')->where($str)->order('addtime asc')->select();
$data = array_slice($data, -10);
// dump($data);exit();
$types = 0;
$this->assign('id', $id);
$this->assign('data', $data);
$this->assign('infos', $infos);
$this->assign('title', $title);
$this->assign('info', $info);
}
$helps = M('help')->where(array('cuid' => 0,'heid'=>1))->order('id asc')->select();
$help = M('help')->where(array('heid'=>1))->select();
foreach ($helps as $ks => $vals) {
$i = 0;
$content[$ks]['name'] = $vals['name'];
$content[$ks]['id'] = $vals['id'];
foreach ($help as $k => $val) {
if ($val['cuid'] == $vals['id']) {
$content[$ks]['text'][$i++] = $val;
}
}
$content[$ks]['length'] = $i;
}
$logos = M('help_t')->where(array('id'=>1))->find();
$this->assign('logos',$logos);
$this->assign('types',$types);
$this->assign('content', $content);
$this->display();
}
public function Comproblem(){
$id = I('get.ids');
$types = I('get.types');
if(!empty($id)){
$problem=M('help')->where(array('cuid'=>$id))->order('id desc')->select();
foreach ($problem as &$val){
$val['addtime'] = date('Y-m-d',$val['addtime']);
}
$types = 0;
$this->assign('problem',$problem);
}
$helps = M('help')->where(array('cuid' => 0,'heid'=>2))->order('id asc')->select();
if($types == 1){
$where['heid'] = 2;
$where['cuid'] = array('neq',0);
$problem = M('help')->where($where)->order('addtime desc')->select();
foreach ($problem as &$val){
$val['addtime'] = date('Y-m-d',$val['addtime']);
}
$this->assign('problem',$problem);
// dump($problem);
}
$logos = M('help_t')->where(array('id'=>2))->find();
$this->assign('logos',$logos);
$this->assign('content', $helps);
$this->display();
}
public function Amendproblem(){
$id = I('get.id');
$titles = I('get.titles');
$amend = M('content')->where(array('id'=>$id))->find();
if ($titles) {
$amend = M('content')->where(array('titles'=>$titles))->find();
}
$amend['content'] = htmlspecialchars_decode($amend['content']);
$this->assign('amend',$amend);
$this->display();
}
}