<?php
/**
*语音回复
**/
class ClassifyAction extends UserAction{
public $fid;
public function _initialize() {
parent::_initialize();
$this->fid=intval($_GET['fid']);
$this->assign('fid',$this->fid);
if ($this->fid){
$thisClassify=M('Classify')->find($this->fid);
$this->assign('thisClassify',$thisClassify);
}
}
public function index(){
$db=D('Classify');
$zid=$db->where(array('id'=>$this->_GET('fid'),'token'=>$this->token))->getField('fid');
$where['token']=session('token');
$where['fid']=intval($_GET['fid']);
$count=$db->where($where)->count();
$page=new Page($count,25);
$info=$db->where($where)->order('sorts desc')->limit($page->firstRow.','.$page->listRows)->select();
$this->assign('page',$page->show());
$this->assign('info',$info);
$this->assign('zid',$zid);
$this->display();
}
//
public function add(){
include('./PigCms/Lib/ORG/index.Tpl.php');
include('./PigCms/Lib/ORG/cont.Tpl.php'); $this->assign('tpl',$tpl);
$this->assign('contTpl',$contTpl); $group_list = explode(',',C('APP_GROUP_LIST'));
if(in_array('Web',$group_list) !== false){
$this->assign('has_website',true);
} $this->display();
}
//
public function edit(){
$id=$this->_get('id','intval');
$info=M('Classify')->find($id);
include('./PigCms/Lib/ORG/index.Tpl.php');
include('./PigCms/Lib/ORG/cont.Tpl.php'); foreach($tpl as $k=>$v){
if($v['tpltypeid'] == $info['tpid']){
$info['tplview'] = $v['tplview'];
}
} foreach($contTpl as $key=>$val){
if($val['tpltypeid'] == $info['conttpid']){
$info['tplview2'] = $val['tplview'];
}
} $this->assign('contTpl',$contTpl);
$this->assign('tpl',$tpl);
$this->assign('info',$info);
$this->display();
} public function del(){
$where['id']=$this->_get('id','intval');
$where['uid']=session('uid');
if(D(MODULE_NAME)->where($where)->delete()){
$fidwhere['fid']=intval($where['id']);
D(MODULE_NAME)->where($fidwhere)->delete();
$this->success('操作成功',U(MODULE_NAME.'/index',array('fid'=>$_GET['fid'])));
}else{
$this->error('操作失败',U(MODULE_NAME.'/index',array('fid'=>$_GET['fid'])));
}
}
//
public function insert(){
$name='Classify';
$db=D($name);
$fid = $this->_post('fid','intval');
// 处理url 2015-05-22
if ($this->dwzQuery(array('tinyurl' => $_POST['url']))) {
$this->error('禁止使用短网址');
}
$_POST['url'] = $this->replaceUrl($_POST['url'], array('query'=>array('wecha_id'=>'{wechat_id}')));
$_POST['info'] = str_replace('&quot;','',$_POST['info']);
if($fid != ''){
$f = $db->field('path')->where("id = $fid")->find();
$_POST['path'] = $f['path'].'-'.$fid; }
if($_POST['pc_show']){
$database_pc_news_category = D('Pc_news_category');
$data_pc_news_category['cat_name'] = $_POST['name'];
$data_pc_news_category['token'] = session('token');
$_POST['pc_cat_id'] = $database_pc_news_category->data($data_pc_news_category)->add();
}
if($db->create()===false){
$this->error($db->getError());
}else{ $id=$db->add();
if($id){
$this->success('操作成功',U(MODULE_NAME.'/index',array('fid'=>$_POST['fid'])));
}else{
$this->error('操作失败',U(MODULE_NAME.'/index',array('fid'=>$_POST['fid'])));
}
}
}
public function upsave(){
// 处理url 2015-05-22
if ($this->dwzQuery(array('tinyurl' => $_POST['url']))) {
$this->error('禁止使用短网址');
}
$_POST['url'] = $this->replaceUrl($_POST['url'], array('query'=>array('wecha_id'=>'{wechat_id}')));
$_POST['info'] = str_replace('&quot;','',$_POST['info']);
$fid = $this->_post('fid','intval');
if($_POST['pc_show']){
$_POST['pc_cat_id'] = 0;
}
if($fid == ''){
$this->all_save();
}else{
$this->all_save('','/index?fid='.$fid);
}
} public function chooseTpl(){ include('./PigCms/Lib/ORG/index.Tpl.php');
include('./PigCms/Lib/ORG/cont.Tpl.php');
$tpl = array_reverse($tpl);
$filter = $this->_get('filter');
if(isset($filter) && $filter !== 'all' && $filter != 'mix'){
foreach ($tpl as $kk => $vv){
if(strpos($vv['attr'],$filter)){
$filterTpl[$kk] = $vv;
}
}
$tpl = $filterTpl;
} $contTpl = array_reverse($contTpl);
$tpid = $this->_get('tpid','intval'); foreach($tpl as $k=>$v){
$sort[$k] = $v['sort'];
$tpltypeid[$k] = $v['tpltypeid']; if($v['tpltypeid'] == $tpid){
$info['tplview'] = $v['tplview'];
$info['tpl_user'] = $v['user'];
}
}
//array_multisort($sort, SORT_DESC , $tpltypeid , SORT_DESC ,$tpl); foreach($contTpl as $key=>$val){
if($val['tpltypeid'] == $tpid){
$info['tplview2'] = $val['tplview'];
$info['cont_user'] = $val['user'];
}
}
$this->assign('info',$info); $this->assign('contTpl',$contTpl);
$this->assign('tpl',$tpl); $this->display();
} public function changeClassifyTpl(){ $tid = $this->_post('tid','intval');
$cid = $this->_post('cid','intval');
M('Classify')->where(array('token'=>$this->token,'id'=>$cid))->setField('tpid',$tid);
echo 200;
} public function changeClassifyContTpl(){ $tid = $this->_post('tid','intval');
$cid = $this->_post('cid','intval');
M('Classify')->where(array('token'=>$this->token,'id'=>$cid))->setField('conttpid',$tid);
echo 200; }
public function flash(){
$tip=$this->_get('tip','intval');
$id=$this->_get('id','intval');
$fid=$this->_get('fid','intval');
if(empty($fid)){
$fid=0;
}
$token=$this->token; $fl=M('Classify')->where(array('token'=>$this->token,'id'=>$id,'fid'=>$fid))->find();
$db=D('Flash'); $where['uid']=session('uid');
$where['token']=session('token');
$where['tip']=$tip;
$where['did']=$id;
$where['fid']=$fid; $count=$db->where($where)->count();
$page=new Page($count,25);
$info=$db->where($where)->limit($page->firstRow.','.$page->listRows)->order('id DESC')->select();
$this->assign('page',$page->show());
$this->assign('fl',$fl);
$this->assign('info',$info);
$this->assign('id',$id);
$this->assign('fid',$fid);
$this->assign('tip',$tip);
$this->display();
} public function addflash(){
$tip=$this->_get('tip','intval');
$id=$this->_get('id','intval');
$fid=$this->_get('fid','intval');
$token=$this->token;
$fl=M('Classify')->where(array('token'=>$this->token,'id'=>$id))->getField('name');
$this->assign('fl',$fl);
$this->assign('tip',$tip);
$this->assign('id',$id);
$this->assign('fid',$fid);
$this->display();
} public function inserts(){
$fid = $this->_get('fid','intval');
if($fid == null){
$fid = 0;
}
$flash=D('Flash');
$arr=array();
$arr['token']=$this->token;
$arr['img']=$this->_post('img');
if ($this->_post('url')){
$arr['url']=$this->_post('url');
}
$arr['info']=$this->_post('info');
$arr['tip']=$this->_get('tip','intval');
$arr['did']=$this->_get('id','intval');
$arr['fid']=$fid;
if(empty($_POST['img'])){
$this->error('请先添加图片');
}
if($flash->add($arr)){
$this->success('操作成功',U(MODULE_NAME.'/flash',array('tip'=>$this->_GET('tip','intval'),'id'=>$this->_get('id'),'fid'=>$this->_get('fid'))));
}else{
$this->error('操作失败');
} } public function editflash(){
$tip=$this->_get('tip','intval');
$where['id']=$this->_get('id','intval');
$where['uid']=session('uid');
$res=D('Flash')->where($where)->find();
$this->assign('info',$res); $this->assign('tip',$tip);
$this->assign('id',$this->_get('id','intval'));
$this->display();
} public function delflash(){
$where['id']=$this->_get('id','intval');
$where['token']=$this->token;
if(D('Flash')->where($where)->delete()){
$this->success('操作成功');
}else{
$this->error('操作失败');
}
} public function updeit(){
$flash=D('Flash');
$id=$this->_get('id','intval');
$tip=$this->_get('tip','intval');
$list=$flash->where(array('id'=>$id))->find();
$arr=array();
$arr['img']=$this->_post('img');
$arr['url']=$this->_post('url');
$arr['info']=$this->_post('info');
$data=$flash->where(array('id'=>$id))->save($arr);
if($data){
$this->success('操作成功',U(MODULE_NAME.'/flash',array('tip'=>$tip,'id'=>$list['did'],'fid'=>$list['fid'])));
}else{
$this->error('操作失败');
} } public function essay(){
$token=$this->token;
$classid=$this->_get('id','intval');
$name=M('Classify')->where(array('id'=>$classid,'token'=>$token))->getField('name');
$essay=M('Img')->where(array('classid'=>$classid,'token'=>$token))->order('usort DESC')->select();
$this->assign('info',$essay);
$this->assign('name',$name);
$this->display();
} public function editUsort(){
$token = $this->_post('token',"htmlspecialchars");
unset($_POST['__hash__']);
foreach($_POST as $k=>$v){
$k = str_replace('usort','',$k);
$data[$k]=$v;
M('Img')->where(array('token'=>$token,'id'=>$k))->setField('usort',$v);
} $this->success('保存成功');
}
}
?>

小猪cms ClassifyAction.class.php的更多相关文章

  1. 小猪cms微信二次开发之怎样分页

    $db=D('Classify'); $zid=$db->where(array('id'=>$this->_GET('fid'),'token'=>$this->tok ...

  2. 《小猪CMS(PigCms)多用户微信营销服务平台系统V6.1完美破解至尊版带微用户管理CRM+微信支付》

    <小猪CMS(PigCms)多用户微信营销服务平台系统V6.1完美破解至尊版带微用户管理CRM+微信支付> 之前发布了不少微赢的多用户微信网站源码,今天为我的小伙伴们准备的是功能非常强悍, ...

  3. 小猪cms之怎样查询绑定的微网站模板

    微网站内容页面url g=Wap&m=Index&a=content (g=Wap)模块路径对应路径:\PigCms\Lib\Action\Wap (m=Index)控制文件对应文件: ...

  4. 小猪cms命名规则整理

    1.模板命名规则: 类名+函数名称+.html 2.Model命名规则: 数据库表名:cms_user_data 文件名称命名: UserDataModel.class.php <?php cl ...

  5. 小猪cms模块继承

    TextAction  继承 UserAction 继承 BaseAction 继承 Action TextAction 路径 PigCms\Lib\Action\User UserAction 路径 ...

  6. 怎么样修改小猪cms(从功能库添加)模块关键字

    需求:修改或者添加从功能库添加中的关键字 这里以添加咨询投诉为列: 找到wwwroot\PigCms\Lib\Action\User目录下的LinkAction.class.php文件(手动找不到直接 ...

  7. 《pigcms v6.2最新完美至尊版无任何限制,小猪微信源码多用户微信营销服务平台系统》

    <pigcms v6.2最新完美至尊版无任何限制,小猪微信源码多用户微信营销服务平台系统> 前两天分享了套小猪CMS(PigCms)多用户微信营销服务平台系统V6.1完美破解至尊版带微用户 ...

  8. DOM 之通俗易懂讲解

    DOM是所有前端开发每天打交道的东西,但是随着jQuery等库的出现,大大简化了DOM操作,导致大家慢慢的“遗忘”了它的本来面貌.不过,要想深入学习前端知识,对DOM的了解是不可或缺的,所以本文力图系 ...

  9. CMS模板应用调研问卷

    截止目前,已经有数十家网站与我们合作,进行了MIP化改造,在搜索结果页也能看到"闪电标"的出现.除了改造方面的问题,MIP项目组被问到最多的就是:我用了wordpress,我用了织 ...

随机推荐

  1. JSON总结(二)——google-gson

    gson是一个google的开源项目,支持多种JSON方法,这里主要讲解如何使用gson将json转换成javaBean. maven坐标 <dependency> <groupId ...

  2. Tomcat数据源(DataSource)简介

    JDBC2.0提供了javax.sql.DataSource接口,它负责建立与数据库的连接,在应用程序中访问数据库时不必编写连接数据库的代码,可以直接从数据源获得数据库连接 1.数据库和连接池 在Da ...

  3. vs2013\2015UML系列之-类图

    1.UML简介Unified Modeling Language (UML)又称统一建模语言或标准建模语言. 简单说就是以图形方式表现模型,根据不同模型进行分类,在UML 2.0中有13种图,以下是他 ...

  4. Jquery元素选取、常用方法

    一:常用的选择器:(李昌辉) 基本选择器 $("#myDiv") //匹配唯一的具有此id值的元素 $("div") //匹配指定名称的所有元素 $(" ...

  5. Java名字的由来

    Java语言的历程丰富多彩,被现在众多程序员和企业广泛使用,不用质疑这是Java的领先技术的结果. Java是Sun公司开发的一种编程语言,Sun公司最初的方向是让Java来开发一些电器装置程序,如: ...

  6. win7 由ie8升级ie11时安装不成功的一个原因

    纯净win7系统更新好补丁好 升级ie一直提示不成功,之前重来没有遇到过.官方提示的解决办法: https://support.microsoft.com/zh-cn/kb/2872074 根据内容初 ...

  7. AlloyTouch与three.js 3D模型交互

    如你所见,上面的cube的旋转.加速.减速停止都是通过AlloyTouch去实现的. 演示 代码 <script src="asset/three.js"></s ...

  8. CSS选择器的权重与优先规则?

    我们做项目的时候,经常遇到样式层叠问题,被其他的样式覆盖,或者写的权重不高没效果,对权重没有具体的分析,做了一个总结. css继承是从一个元素向其后代元素传递属性值所采用的机制.确定应当向一个元素应用 ...

  9. 基于Python+Django的Kubernetes集群管理平台

    ➠更多技术干货请戳:听云博客 时至今日,接触kubernetes也有一段时间了,而我们的大部分业务也已经稳定地运行在不同规模的kubernetes集群上,不得不说,无论是从应用部署.迭代,还是从资源调 ...

  10. SQL优化技术分析-1:操作符优化

    1.IN 操作符 用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格.但是用IN的SQL 性能总是比较低的,从Oracle执行的步骤来分析用IN的SQL与不用IN的SQL有 ...