提交 66c52e77 authored 作者: wangkr's avatar wangkr

init push

上级
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 轮回 <864491238@qq.com>
// +----------------------------------------------------------------------
return array (
'LOAD_EXT_CONFIG' => 'sdk_config',//扩展第三方登录配置文件
'DB_CALLURL'=> 'http://localhost:8090/outeng', // 网址
'DB_PAGENUM'=> 5,//后台每页显示条数
'TMPL_ACTION_ERROR'=>'Public:dispatch_jump',//error错误提示页面
'DB_PATH_NAME'=> 'Data', //备份目录名称,主要是为了创建备份目录
'DB_PATH' => './Public/Data/', //数据库备份路径必须以 / 结尾;
'DB_PART' => '20971520', //该值用于限制压缩后的分卷最大长度。单位:B;建议设置20M
'DB_COMPRESS' => '1', //压缩备份文件需要PHP环境支持gzopen,gzwrite函数 0:不压缩 1:启用压缩
'DB_LEVEL' => '9', //压缩级别 1:普通 4:一般 9:最高
'MAIL_CHARSET' =>'utf-8',//设置邮件编码
'MAIL_ISHTML' =>TRUE, // 是否HTML格式邮件
'AUTH_CONFIG' => array(
'AUTH_ON' => TRUE, //是否开启权限
'AUTH_TYPE' => 1, //
'AUTH_GROUP' => 'lh_auth_group', //用户组
'AUTH_GROUP_ACCESS' => 'lh_auth_group_access', //用户组规则
'AUTH_RULE' => 'lh_auth_rule', //规则中间表
'AUTH_USER' => 'lh_admin'// 管理员表
),
);
return array_merge(include './Conf/config.php', $config);
?>
\ No newline at end of file
差异被折叠。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
class AjaxController extends Controller{
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
佛祖保佑 永无BUG
*/
public function getRegion(){
// $Region=M("region");
// $map['pid']=$_REQUEST["pid"];
// $map['type']=$_REQUEST["type"];
// $list=$Region->where($map)->select();
// echo json_encode($list);
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class BannerController extends AuthController {
public function banner_list()
{
$admin=M('banner');
$count= $admin->order("id desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('banner_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function banner_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$obj=M('banner');
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
$data['banner']='/Uploads'.trim(I('post.banner', '', 'htmlspecialchars'));
$data['content']='/Uploads'.trim(I('post.content', '', 'htmlspecialchars'));
if($id=$obj->add($data)){
detailedlog('banner',session('admin_username'),'轮播管理','添加',"$id",1);
$this->success('添加成功',U('banner_list'),1);
}
}
}
//轮播编辑
public function banner_edit(){
if (!IS_AJAX){
$admin=M('banner')->where(array('id'=>I('id')))->find();
$this->assign('list',$admin);
$this->display();
}else{
$obj=M('banner');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
$list=$obj->where("id={$data['id']}")->find();
if($banner=trim(I('post.banner', '', 'htmlspecialchars'))){
$data['banner']='/Uploads'.$banner;
$delbanner=$list['banner'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$delbanner;
if(!empty($filepathOne)){
unlink($filepathOne);
}
}
if($content=trim(I('post.content', '', 'htmlspecialchars'))){
$delcontent=$list['content'];
$filepathTwo=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$delcontent;
if(!empty($filepathTwo)){
unlink($filepathTwo);
}
$data['content']='/Uploads'.$content;
}
$obj->save($data);
detailedlog('banner',session('admin_username'),'轮播管理','编辑',"{$data['id']}",1);
$this->success('修改成功',U('banner_list'),1);
}
}
public function banner_del()
{
$id=$_REQUEST['id'];
$admin=M('banner');
$list=$admin->where("id='$id'")->find();
$banner=$list['banner'];
$content=$list['content'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$banner;
$filepathTwo=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$content;
if(!empty($filepathOne) && !empty($filepathTwo)){
unlink($filepathOne);
unlink($filepathTwo);
}
$banner =$admin->where(array('id'=>$id))->delete();
detailedlog('banner',session('admin_username'),'轮播管理','删除',"$id",1);
$this->redirect('banner_list');
}
public function startup_list()
{
$admin=M('startup');
$count= $admin->order("id desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('startup_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function startup_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$obj=M('startup');
$data['create_time']=time();
$data['startupimg']='/Uploads'.trim(I('post.startupimg', '', 'htmlspecialchars'));
if($id=$obj->add($data)){
detailedlog('startup',session('admin_username'),'轮播管理','启动页添加',"$id",1);
$this->success('添加成功',U('startup_list'),1);
}
}
}
public function startup_edit(){
if (!IS_AJAX){
$admin=M('startup')->where(array('id'=>I('id')))->find();
$this->assign('list',$admin);
$this->display();
}else{
$obj=M('startup');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$list=$obj->where("id={$data['id']}")->find();
if($startupimg=trim(I('post.startupimg', '', 'htmlspecialchars'))){
$data['startupimg']='/Uploads'.$startupimg;
$delbanner=$list['startupimg'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$delbanner;
if(!empty($filepathOne)){
unlink($filepathOne);
}
}
$obj->save($data);
detailedlog('banner',session('admin_username'),'轮播管理','启动页编辑',"{$data['id']}",1);
$this->success('修改成功',U('startup_list'),1);
}
}
public function startup_del()
{
$id=$_REQUEST['id'];
$admin=M('startup');
$list=$admin->where("id='$id'")->find();
$startupimg=$list['startupimg'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$startupimg;
if(!empty($filepathOne)){
unlink($filepathOne);
}
$startupdel=$admin->where(array('id'=>$id))->delete();
$this->redirect('startup_list');
}
}
差异被折叠。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class CategoryController extends AuthController {
public function cate_list()
{
$admin=M('cate');
$val=I('get.val');
$this->assign('testval',$val);
if($val){
$map['cate_name']= array('like',"%".$val."%");
}
$count= $admin->where($map)->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->where($map)->order('id')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('cate_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function cate_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$admin=M('cate');
$sldata=array(
'cate_name'=>I('cate_name'),
'auth'=>session('admin_username'),
'addtime'=>time(),
'status'=>I('status'),
);
$admin->add($sldata);
$this->success('分类添加成功',U('cate_list'),1);
}
}
public function cate_edit()
{
if(!IS_AJAX)
{
$list=M('cate')->where(array('id'=>I('id')))->find();
$this->assign('list',$list);
$this->display();
}
else
{
$obj=M('cate');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['cate_name']=I('post.cate_name');
$data['status']=I('post.status');
$data['auth']=session('admin_username');
$obj->save($data);
$this->success('修改成功',U('cate_list'),1);
}
}
public function cate_del()
{
$id=$_REQUEST['id'];
$list = M('cate')->where(array('id'=>$id))->delete();
if($list){
$this->redirect('cate_list');
}else{
$this->redirect('cate_list');
}
}
}
差异被折叠。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class DatacateController extends AuthController {
public function datacate_list()
{
$admin=M('datacate');
$val=I('get.val');
$this->assign('testval',$val);
if($val){
$map['catename']= array('like',"%".$val."%");
}
$count= $admin->where($map)->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->where($map)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('datacate_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function datacate_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$admin=M('datacate');
$sldata=array(
'catename'=>I('catename'),
'addtime'=>time(),
'status'=>I('status'),
);
$admin->add($sldata);
$this->success('分类添加成功',U('datacate_list'),1);
}
}
public function datacate_edit()
{
if(!IS_AJAX)
{
$list=M('datacate')->where(array('id'=>I('id')))->find();
$this->assign('list',$list);
$this->display();
}
else
{
$obj=M('datacate');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['catename']=I('post.catename');
$data['status']=I('post.status');
$obj->save($data);
$this->success('修改成功',U('datacate_list'),1);
}
}
public function datacate_del()
{
$id=$_REQUEST['id'];
$list = M('datacate')->where(array('id'=>$id))->delete();
if($list){
$this->redirect('datacate_list');
}else{
$this->redirect('datacate_list');
}
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class DatalistController extends AuthController {
public function data_list()
{
$admin=M('data');
$val=I('get.val');
$this->assign('testval',$val);
if($val){
$map['title']= array('like',"%".$val."%");
}
$count= $admin->where($map)->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->where($map)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('data_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function data_add(){
if(!IS_AJAX)
{
$datacate=M('datacate')->select();
$this->assign('datacate',$datacate);
$cate=M('cate')->select();
$this->assign('cate',$cate);
$where['pid']=0;
$where['lever']=1;
$datal=M('data')->where($where)->order("id desc")->select();
$this->assign('datal',$datal);
$this->display();
}
else
{
$obj=M('data');
$data['pid']=trim(I('post.pid', '', 'htmlspecialchars'));
$data['lever']=trim(I('post.lever', '', 'htmlspecialchars'));
//分类
$data['cid']=trim(I('post.group_id', '', 'htmlspecialchars'));
//类型
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
//标题
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
//简介
$data['introduction']=trim(I('post.introduction', '', 'htmlspecialchars'));
//关键字
$data['keyword']=trim(I('post.keyword', '', 'htmlspecialchars'));
//小图
$data['smallimg']='/Uploads'.trim(I('post.smallimg', '', 'htmlspecialchars'));
//中
$data['middleimg']='/Uploads'.trim(I('post.middleimg', '', 'htmlspecialchars'));
//大图
$data['bigimg']='/Uploads'.trim(I('post.bigimg', '', 'htmlspecialchars'));
//视频
$data['path']='/Uploads'.trim(I('post.path', '', 'htmlspecialchars'));
//必修推荐
//$data['required']=trim(I('post.required', '', 'htmlspecialchars'));
//选修推荐
//$data['elective']=trim(I('post.elective', '', 'htmlspecialchars'));
//必修
$data['is_required']=trim(I('post.is_required', '', 'htmlspecialchars'));
//选修
$data['is_elective']=trim(I('post.is_elective', '', 'htmlspecialchars'));
$data['is_base']=trim(I('post.is_base', '', 'htmlspecialchars'));
$data['source']=trim(I('post.source', '', 'htmlspecialchars'));
$data['auth']=trim(I('post.auth', '', 'htmlspecialchars'));
$data['addtime']=time();
$dataList=$obj->add($data);
$adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
$cpp=array();
$cpp['v_id']=$dataList;
foreach ($adminRow as $key => $val) {
$cpp['u_id']=$val['admin_id'];
$coursepp=M("coursepp");
$coursepp->add($cpp);
}
if($data['is_required']==1 || $data['is_elective']==1 ){
$c=array();
$c['v_id']=$dataList;
// $adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
foreach ($adminRow as $key => $b) {
$c['u_id']=$b['admin_id'];
$course=M("course");
$course->add($c);
}
}
detailedlog('datal',session('admin_username'),'数据管理','添加',"$dataList",1);
$this->success('添加成功',U('data_list'),1);
}
}
public function data_edit(){
if(!IS_AJAX)
{
$cate=M('cate')->select();
$this->assign('cate',$cate);
$where['pid']=0;
$where['lever']=1;
//课程归类
$datal=M('data')->where($where)->order("id desc")->select();
$datacate=M('datacate')->select();
$this->assign('datacate',$datacate);
$this->assign('datal',$datal);
$list=M('data')->where(array("id"=>I('id')))->find();
$this->assign('list',$list);
$this->display();
}
else
{
$obj=M('data');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['pid']=trim(I('post.pid', '', 'htmlspecialchars'));
$data['lever']=trim(I('post.lever', '', 'htmlspecialchars'));
//分类
$data['cid']=trim(I('post.group_id', '', 'htmlspecialchars'));
//类型
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
//标题
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
//简介
$data['introduction']=trim(I('post.introduction', '', 'htmlspecialchars'));
//关键字
$data['keyword']=trim(I('post.keyword', '', 'htmlspecialchars'));
//小图
if($smallimg=trim(I('post.smallimg', '', 'htmlspecialchars'))){
$data['smallimg']='/Uploads'.$smallimg;
}
//中
if($middleimg=trim(I('post.middleimg', '', 'htmlspecialchars'))){
$data['middleimg']='/Uploads'.$middleimg;
}
//大图
if($bigimg=trim(I('post.bigimg', '', 'htmlspecialchars'))){
$data['bigimg']='/Uploads'.$bigimg;
}
//视频
if($path=trim(I('post.path', '', 'htmlspecialchars'))){
$data['path']='/Uploads'.$path;
}
//必修推荐
$data['required']=trim(I('post.required', '', 'htmlspecialchars'));
//选修推荐
$data['elective']=trim(I('post.elective', '', 'htmlspecialchars'));
//必修
$data['is_required']=trim(I('post.is_required', '', 'htmlspecialchars'));
//选修
$data['is_elective']=trim(I('post.is_elective', '', 'htmlspecialchars'));
$data['is_base']=trim(I('post.is_base', '', 'htmlspecialchars'));
//来源
$data['source']=trim(I('post.source', '', 'htmlspecialchars'));
$data['auth']=trim(I('post.auth', '', 'htmlspecialchars'));
$data['addtime']=time();
$obj->save($data);
if($data['is_required']==1 || $data['is_elective']==1 ){
$c=array();
$c['v_id']=$data['id'];
$adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
foreach ($adminRow as $key => $b) {
$c['u_id']=$b['admin_id'];
$course=M("course");
$course1=$course->where($c)->select();
if($course1)
{
detailedlog('datal',session('admin_username'),'数据管理','编辑',"{$data['id']}",1);
$this->success('修改成功',U('data_list'),1);
}
else
{
$course->add($c);
}
}
}
$this->success('修改成功',U('data_list'),1);
}
}
public function datalist_del(){
$id=I('id');
if(empty($id)){
$this->error('必须选择一个产品,才可以删除!');
}
$ids="(".rtrim($id,',').")";
$res =M('data')->where('id in '.$ids)->delete();
if($res)
{
detailedlog('datal',session('admin_username'),'数据管理','批量删除',"$id",1);
$this->success('删除成功');
}
else
{
$this->error('删除失败');
}
}
public function data_del(){
$id=$_REQUEST['id'];
$datal=M('data')->where("id='$id'")->find();
$smallimg=$datal['smallimg'];
$middleimg=$datal['middleimg'];
$bigimg=$datal['bigimg'];
$path=$datal['path'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$smallimg;
$filepathTwo=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$middleimg;
$filepathThree=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$bigimg;
$filepathFour=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$path;
if(!empty($filepathOne) && !empty($filepathTwo) && !empty($filepathThree) && !empty($filepathFour)){
unlink($filepathOne);
unlink($filepathTwo);
unlink($filepathThree);
unlink($filepathFour);
}
$list = M('data')->where(array('id'=>$id))->delete();
$course = M('course')->where(array('v_id'=>$id))->delete();
$course = M('coursepp')->where(array('v_id'=>$id))->delete();
detailedlog('data',session('admin_username'),'数据管理','删除',"$id",1);
$this->redirect('data_list');
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class DatalistController extends AuthController {
public function data_list()
{
$admin=M('datal');
$val=I('get.val');
$this->assign('testval',$val);
if($val){
$map['title']= array('like',"%".$val."%");
}
$count= $admin->where($map)->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->where($map)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('data_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function data_add(){
if(!IS_AJAX)
{
$datacate=M('datacate')->select();
$this->assign('datacate',$datacate);
$cate=M('cate')->select();
$this->assign('cate',$cate);
$where['pid']=0;
$where['lever']=1;
$datal=M('datal')->where($where)->order("id desc")->select();
$this->assign('datal',$datal);
$this->display();
}
else
{
$obj=M('datal');
$data['pid']=trim(I('post.pid', '', 'htmlspecialchars'));
$data['lever']=trim(I('post.lever', '', 'htmlspecialchars'));
//分类
$data['cid']=trim(I('post.group_id', '', 'htmlspecialchars'));
//类型
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
//标题
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
//简介
$data['introduction']=trim(I('post.introduction', '', 'htmlspecialchars'));
//关键字
$data['keyword']=trim(I('post.keyword', '', 'htmlspecialchars'));
//小图
$data['smallimg']='/Uploads'.trim(I('post.smallimg', '', 'htmlspecialchars'));
//中
$data['middleimg']='/Uploads'.trim(I('post.middleimg', '', 'htmlspecialchars'));
//大图
$data['bigimg']='/Uploads'.trim(I('post.bigimg', '', 'htmlspecialchars'));
//视频
$data['path']='/Uploads'.trim(I('post.path', '', 'htmlspecialchars'));
//必修推荐
//$data['required']=trim(I('post.required', '', 'htmlspecialchars'));
//选修推荐
//$data['elective']=trim(I('post.elective', '', 'htmlspecialchars'));
//必修
$data['is_required']=trim(I('post.is_required', '', 'htmlspecialchars'));
//选修
$data['is_elective']=trim(I('post.is_elective', '', 'htmlspecialchars'));
$data['is_base']=trim(I('post.is_base', '', 'htmlspecialchars'));
$data['source']=trim(I('post.source', '', 'htmlspecialchars'));
$data['auth']=trim(I('post.auth', '', 'htmlspecialchars'));
$data['addtime']=time();
$dataList=$obj->add($data);
$adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
$cpp=array();
$cpp['v_id']=$dataList;
foreach ($adminRow as $key => $val) {
$cpp['u_id']=$val['admin_id'];
$coursepp=M("coursepp");
$coursepp->add($cpp);
}
if($data['is_required']==1 || $data['is_elective']==1 ){
$c=array();
$c['v_id']=$dataList;
// $adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
foreach ($adminRow as $key => $b) {
$c['u_id']=$b['admin_id'];
$course=M("course");
$course->add($c);
}
}
detailedlog('datal',session('admin_username'),'数据管理','添加',"$dataList",1);
$this->success('添加成功',U('data_list'),1);
}
}
public function data_edit(){
if(!IS_AJAX)
{
$cate=M('cate')->select();
$this->assign('cate',$cate);
$where['pid']=0;
$where['lever']=1;
//课程归类
$datal=M('datal')->where($where)->order("id desc")->select();
$datacate=M('datacate')->select();
$this->assign('datacate',$datacate);
$this->assign('datal',$datal);
$list=M('datal')->where(array("id"=>I('id')))->find();
$this->assign('list',$list);
$this->display();
}
else
{
$obj=M('datal');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['pid']=trim(I('post.pid', '', 'htmlspecialchars'));
$data['lever']=trim(I('post.lever', '', 'htmlspecialchars'));
//分类
$data['cid']=trim(I('post.group_id', '', 'htmlspecialchars'));
//类型
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
//标题
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
//简介
$data['introduction']=trim(I('post.introduction', '', 'htmlspecialchars'));
//关键字
$data['keyword']=trim(I('post.keyword', '', 'htmlspecialchars'));
//小图
if($smallimg=trim(I('post.smallimg', '', 'htmlspecialchars'))){
$data['smallimg']='/Uploads'.$smallimg;
}
//中
if($middleimg=trim(I('post.middleimg', '', 'htmlspecialchars'))){
$data['middleimg']='/Uploads'.$middleimg;
}
//大图
if($bigimg=trim(I('post.bigimg', '', 'htmlspecialchars'))){
$data['bigimg']='/Uploads'.$bigimg;
}
//视频
if($path=trim(I('post.path', '', 'htmlspecialchars'))){
$data['path']='/Uploads'.$path;
}
//必修推荐
$data['required']=trim(I('post.required', '', 'htmlspecialchars'));
//选修推荐
$data['elective']=trim(I('post.elective', '', 'htmlspecialchars'));
//必修
$data['is_required']=trim(I('post.is_required', '', 'htmlspecialchars'));
//选修
$data['is_elective']=trim(I('post.is_elective', '', 'htmlspecialchars'));
$data['is_base']=trim(I('post.is_base', '', 'htmlspecialchars'));
//来源
$data['source']=trim(I('post.source', '', 'htmlspecialchars'));
$data['auth']=trim(I('post.auth', '', 'htmlspecialchars'));
$data['addtime']=time();
$obj->save($data);
if($data['is_required']==1 || $data['is_elective']==1 ){
$c=array();
$c['v_id']=$data['id'];
$adminRow=M('admin')->field('admin_id')->order('admin_id asc')->select();
foreach ($adminRow as $key => $b) {
$c['u_id']=$b['admin_id'];
$course=M("course");
$course1=$course->where($c)->select();
if($course1)
{
detailedlog('datal',session('admin_username'),'数据管理','编辑',"{$data['id']}",1);
$this->success('修改成功',U('data_list'),1);
}
else
{
$course->add($c);
}
}
}
$this->success('修改成功',U('data_list'),1);
}
}
public function datalist_del(){
$id=I('id');
if(empty($id)){
$this->error('必须选择一个产品,才可以删除!');
}
$ids="(".rtrim($id,',').")";
$res =M('datal')->where('id in '.$ids)->delete();
if($res)
{
detailedlog('datal',session('admin_username'),'数据管理','批量删除',"$id",1);
$this->success('删除成功');
}
else
{
$this->error('删除失败');
}
}
public function data_del(){
$id=$_REQUEST['id'];
$datal=M('datal')->where("id='$id'")->find();
$smallimg=$datal['smallimg'];
$middleimg=$datal['middleimg'];
$bigimg=$datal['bigimg'];
$path=$datal['path'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$smallimg;
$filepathTwo=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$middleimg;
$filepathThree=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$bigimg;
$filepathFour=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$path;
if(!empty($filepathOne) && !empty($filepathTwo) && !empty($filepathThree) && !empty($filepathFour)){
unlink($filepathOne);
unlink($filepathTwo);
unlink($filepathThree);
unlink($filepathFour);
}
$list = M('datal')->where(array('id'=>$id))->delete();
$course = M('course')->where(array('v_id'=>$id))->delete();
$course = M('coursepp')->where(array('v_id'=>$id))->delete();
detailedlog('datal',session('admin_username'),'数据管理','删除',"$id",1);
$this->redirect('data_list');
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
class EmptyController extends Controller{
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
佛祖保佑 永无BUG
*/
function _empty(){
header( "HTTP/1.0 404 Not Found" );
$this->display( 'Public:404' );
}
function index(){
header( "HTTP/1.0 404 Not Found" );
$this->display( 'Public:404' );
}
}
\ No newline at end of file
差异被折叠。
差异被折叠。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
class HelpController extends AuthController {
public function soft(){
$this->display();
}
}
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
class IndexController extends AuthController {
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
佛祖保佑 永无BUG
*/
public function index(){
if (empty($_SESSION['aid'])){
$this->redirect('Login/login');
}
$where['time']=date("Y-m-d",mktime(0,0,0,date('m'),date('d'),date('Y')));
$signList=M("sign")->where($where)->count();
$info = array(
'PCTYPE'=>PHP_OS,
'RUNTYPE'=>$_SERVER["SERVER_SOFTWARE"],
'ONLOAD'=>ini_get('upload_max_filesize'),
'ThinkPHPTYE'=>THINK_VERSION,
'sign'=>$signList,
);
$this->assign('info',$info);
$this->display();
}
public function NumberStatistics(){
$yue=$_REQUEST['yue'];
$data=self::mFristAndLast('',$yue);
$thismonth_start=$data['firstday'];
$thismonth_end=$data['lastday'];
$where['deltime'] = array('between',"$thismonth_start,$thismonth_end");
$where['admin_status']=0;
$delCount = M('admin')->where($where)->count();
$addwhere['createtime'] = array('between',"$thismonth_start,$thismonth_end");
$addCount = M('admin')->where($addwhere)->count();
echo $delCount.','.$addCount;
}
static function mFristAndLast($y = "", $m = ""){
if ($y == "") $y = date("Y");
if ($m == "") $m = date("m");
$m = sprintf("%02d", intval($m));
//填充字符串长度
$y = str_pad(intval($y), 4, "0", STR_PAD_RIGHT);
$m > 12 || $m < 1 ? $m = 1 : $m = $m;
$firstday = strtotime($y . $m . "01000000");
$firstdaystr = date("Y-m-01", $firstday);
$lastday = strtotime(date('Y-m-d 23:59:59', strtotime("$firstdaystr +1 month -1 day")));
return array(
"firstday" => $firstday,
"lastday" => $lastday
);
}
}
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use LT\ThinkSDK\ThinkOauth;
use Event\TypeEvent;
use Org\Util\GeetestLib;
class LoginController extends Controller {
public function login(){
$this->display();
}
// public function verify() {
// ob_clean();
// $Verify = new \Think\Verify();
// $Verify -> fontSize = 28;
// $Verify -> length = 4;
// $Verify -> useNoise = false;
// $Verify -> codeSet = '0123456789';
// $Verify -> imageW = 0;
// $Verify -> imageH = 0;
// //$Verify->expire = 600;
// $Verify -> entry();
// }
public function getVerify(){
$GtSdk = new GeetestLib(C('GEE_ID'), C('GEE_KEY'));
$user_id = "web";
$status = $GtSdk->pre_process($user_id);
session('gtserver',$status);
session('user_id',$user_id);
echo $GtSdk->get_response_str();
}
//登录验证
public function runlogin(){
if (!IS_AJAX){
$this->error("提交方式错误!",0,0);
}else{
$admin_username=I('post.admin_username');
$admin_pwd=md5(I('post.admin_pwd'));
$yzm = I('post.code');
$admin=M('login')->where(array('admin_username'=>$admin_username,'admin_pwd'=>$admin_pwd))->find();
if (!$admin)
{
$this->error('用户名或者密码错误,请重新输入',0,0);
}
else
{
if($admin['admin_open'] == 0){
$this->error('该账户当前禁用,请联系管理员开启',0,0);
}
$GtSdk = new GeetestLib(C('GEE_ID'), C('GEE_KEY'));
$user_id = session('user_id');
if ($_SESSION['gtserver'] == 1) {
$result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $user_id);
if ($result) {
//$this->success('登录成功');
} else{
$this->error('请先拖动验证码到相应位置');
}
}else{
if ($GtSdk->fail_validate($_POST['geetest_challenge'],$_POST['geetest_validate'],$_POST['geetest_seccode'])) {
//$this->success('登录成功');
}else{
$this->error('请先拖动验证码到相应位置');
}
}
//登录后更新登录IP,登录次数,登录时间
$data=array(
'admin_ip'=>get_client_ip(),
);
M('login')->where(array('admin_username'=>$admin_username))->setInc('admin_hits',1);
M('login')->where(array('admin_username'=>$admin_username))->save($data);
//显示当前用户所属的会员组
$admin_group=M('login as a')->where(array('admin_username'=>$admin_username))->join('lh_auth_group_access as b ON a.admin_id=b.uid')->join('lh_auth_group as c ON b.group_id=c.id')->field('c.title')->find();
session('aid',$admin['admin_id']);
session('admin_username',$admin['admin_username']);
session('admin_realname',$admin['admin_realname']);
session('admin_img',$admin['admin_img']);
session('admin_group',$admin_group);
loginlog($admin['admin_id'],$admin['admin_username'],'用户登录',1);
$this->success('恭喜您,登陆成功',U('Index/index'),1);
}
}
}
/*
* 验证注册
*/
public function reg(){
if (!IS_AJAX){
$this->error("提交方式错误!",0,0);
}else{
$admin=M('login');
$vername=$admin->where(array('admin_username'=>I('admin_username')))->find();
if ($vername){
$this->error('账号已存在,请重新输入',0,0);
}else{
$info=array(
'admin_email'=>I('admin_email'),
'admin_username'=>I('admin_username'),
'admin_pwd'=>md5(I('admin_pwd')),
'admin_tel'=>I('admin_tel'),
'admin_realname'=>I('admin_realname'),
'admin_addtime'=>time(),
);
$result=$admin->add($info);
$admin_access=M('auth_group_access');
$accdata=array(
'uid'=>$result,
'group_id'=>7,
);
$admin_access->add($accdata);
$this->success('恭喜您,注册成功,请等待审核',U('login'),1);
}
}
}
/*
* 退出登录
*/
public function logout(){
session(null);
$this->redirect('Login/login');
}
/*
* 邮件发送类
*/
public function runemail(){
$emailsys=M('sys')->where(array('sys_id'=>1))->find();
$config = array(
'MAIL_FROM'=>$emailsys['email_name'],
'MAIL_HOST'=>$emailsys['email_smtpname'],
'MAIL_USERNAME'=>$emailsys['email_emname'],
'MAIL_FROMNAME'=>$emailsys['email_rename'],
'MAIL_PASSWORD'=>$emailsys['email_pwd'],
);
if ($emailsys['email_open']==1){//邮件发送开关
$config['MAIL_SMTPAUTH'] = TRUE ;
}else{
$config['MAIL_SMTPAUTH'] = FALSE ;
}
C($config);
$callurl=C('DB_CALLURL');
$admin=M('admin')->where(array('admin_email'=>I('email')))->find();
if(!$admin){
$this->error('邮件不存在,请重新输入',0,0);
}
$oldnum=rand(10000,99999);//获取一串随机数
$num=md5($oldnum);//对随机数进行加密后传递
$emailpwd=M('admin')->where(array('admin_email'=>I('email')))->setField('admin_mdemail',$num);//更新数据库
$content="尊敬的用户,您好:<br>您当前的操作为找回密码,请点击以下链接重新设置密码<br><a href=$callurl/index.php/Admin/Login/checkpwd/emailpwd/$num.html>$callurl/index.php/Admin/Login/checkpwd/emailpwd/$num.html</a>";
if(SendMail($_POST['email'],'找回密码服务',$content)){
$this->success('邮件发送成功!,打开邮件重新设置密码',1,1);
}
else{
$this->error('邮件发送失败',0,0);
}
}
//打开修改密码页面
public function checkpwd(){
$admin_mdemail=I('emailpwd');
if (!$admin_mdemail){
$this->error('参数错误',U('login'),0);
}else{
$this->assign('admin_mdemail',$admin_mdemail);
$this->display();
}
}
//修改密码操作
public function runcheckpwd(){
if (!IS_AJAX){
$this->error("提交方式错误!",0,0);
}else{
$admin_mdemail=I('admin_mdemail');//获取加密过后的随机值
$admin_pwd=I('admin_pwd','','md5');//获取新密码,并且加密
$checkadmin=M('login')->where(array('admin_mdemail'=>$admin_mdemail))->find();//验证用户是否存在
if(!$checkadmin){
$this->error('邮箱不存在,请重新输入',0,0);
}else{
$admin=M('login')->where(array('admin_mdemail'=>$admin_mdemail))->setField('admin_pwd',$admin_pwd);
$this->success('恭喜您,密码修改成功',U('login'),1);
}
}
}
/*
* 第三方登录
*/
public function bing_login($type = null) {
empty($type) && $this->error('参数错误');
$sns = ThinkOauth::getInstance($type);
redirect($sns->getRequestCodeURL());
}
//授权回调地址
public function callback($type = null, $code = null)
{
(empty($type) || empty($code)) && $this->error('参数错误');
//加载ThinkOauth类并实例化一个对象
$sns = ThinkOauth::getInstance($type);
//腾讯微博需传递的额外参数
$extend = null;
if ($type == 'tencent') {
$extend = array('openid' => $this->_get('openid'), 'openkey' => $this->_get('openkey'));
}
//请妥善保管这里获取到的Token信息,方便以后API调用
//调用方法,实例化SDK对象的时候直接作为构造函数的第二个参数传入
//$qq = ThinkOauth::getInstance('qq', $token);
$token = $sns->getAccessToken($code,$extend);
//获取当前登录用户信息
if (is_array($token)) {
$user_info = A('Type','Event')->$type($token);
if (!$user_info){//登录失败
$this->error('第三方登录失败,请重新登录',U('login'),1);
}else{//登录成功
}
}
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2016 http://ilunhui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
class LogsController extends AuthController {
//详细日志
public function logs_detailed(){
$key=I('key');
if($key&&$key!=""){
$map = array(
'admin_name' =>array('like', $key),
'description'=>array('like', $key),
'_logic' =>'or',
);
}
$sldate=urldecode(I('reservation',''));//获取格式 2015-11-12 - 2015-11-18
$arr = explode(" - ",$sldate);//转换成数组
$arrdateone=strtotime($arr[0]);
$arrdatetwo=strtotime($arr[1].' 23:55:55');
if($arrdateone && $arrdatetwo){
$map['add_time'] = array(array('egt',$arrdateone),array('elt',$arrdatetwo),'AND');
}
$count= M('detailed')->where($map)->count();// 查询满足要求的总记录数
$p= getpage($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
$p->parameter=I('param.');
$show= $p->show();// 分页显示输出
$list=D('detailed')->where($map)->limit($p->firstRow.','.$p->listRows)->order('log_id desc')->select();
$this->assign('s',$sldate);
$this->assign('list',$list);
$this->assign('page',$show);
$this->assign('val',$key);
$this->display();
}
//操作日志
public function logs_list(){
$key=I('key');
if($key&&$key!=""){
$map = array(
'admin_name' =>array('like', $key),
'description'=>array('like', $key),
'_logic' =>'or',
);
}
$sldate=urldecode(I('reservation',''));//获取格式 2015-11-12 - 2015-11-18
$arr = explode(" - ",$sldate);//转换成数组
$arrdateone=strtotime($arr[0]);
$arrdatetwo=strtotime($arr[1].' 23:55:55');
if($arrdateone && $arrdatetwo){
$map['add_time'] = array(array('egt',$arrdateone),array('elt',$arrdatetwo),'AND');
}
$count= M('Log')->where($map)->count();// 查询满足要求的总记录数
$p= getpage($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
$p->parameter=I('param.');
$show= $p->show();// 分页显示输出
$list=D('Log')->where($map)->limit($p->firstRow.','.$p->listRows)->order('log_id desc')->select();
$this->assign('s',$sldate);
$this->assign('list',$list);
$this->assign('page',$show);
$this->assign('val',$key);
$this->display();
}
//访客日志
public function visitor_list(){
$keytype=I('keytype',admin_name);
$key=I('key');
$datatype_id=I('datatype_id');
$map[$keytype]= array('like',"%".$key."%");
$sldate=I('reservation','');//获取格式 2015-11-12 - 2015-11-18
$arr = explode(" - ",$sldate);//转换成数组
$arrdateone=strtotime($arr[0]);
$arrdatetwo=strtotime($arr[1].' 23:55:55');
$map['add_time'] = array(array('egt',$arrdateone),array('elt',$arrdatetwo),'AND');
$count= M('visitor_logs')->where($map)->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
$show= $Page->show();// 分页显示输出
$list=D('visitor_logs')->where($map)->limit($Page->firstRow.','.$Page->listRows)->order('c_id desc')->select();
//var_dump($list);exit;
$this->assign('list',$list);
$this->assign('page',$show);
$this->assign('val',$key);
$this->display();
}
}
\ No newline at end of file
差异被折叠。
<?php
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Vendor\ThinkImage\ThinkImage;
//导航
class NavController extends Controller{
//查询导航
public function nav_list(){
$list=M('nav')->select();
$this->assign('list',$list);
$this->display();
}
//添加导航
public function nav_add(){
if(!IS_POST)
{
$this->display();
}
else
{
$obj=M('nav');
$data['n_name']=trim(I('post.n_name', '', 'htmlspecialchars'));
$data['item_type']=trim(I('post.type', '', 'htmlspecialchars'));
$data['url']=trim(I('post.url', '', 'htmlspecialchars'));
$data['is_show']=I('post.is_show');
$obj->add($data);
if (trim(I('post.type'))=='top' || trim(I('post.type'))== 'middle' || trim(I('post.type'))=='bottom') {
$this->success('添加成功');
}else{
$this->error('请按要求填写');
}
}
}
//删除导航
public function delcate(){
$id=I('get.id');
$list = M('nav')->where(array('n_id'=>$id))->delete();
if($list){
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}
//修改
public function save(){
if(IS_POST){
$nav=M('nav');
$id=I('post.id');
$data['n_name']=trim(I('post.n_name', '', 'htmlspecialchars'));
$data['is_show']=trim(I('post.is_show'));
$data['item_type']=trim(I('post.type', '', 'htmlspecialchars'));
$data['url']=trim(I('post.url', '', 'htmlspecialchars'));
if($nav->where(array('n_id'=>$id))->save($data)){
$this->success('修改成功');
}else{
$this->error('修改失败');
}
}
$list=M('nav')->where(array('n_id'=>I('id')))->find();
$this->assign('list',$list);
$this->display();
}
}
?>
\ No newline at end of file
差异被折叠。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class QuestionController extends AuthController {
//题目列表
public function question_list()
{
$admin=M('question');
$count= $admin->order("id desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('question_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
//答案列表
public function answer_list()
{
$admin=M('answer');
$count= $admin->order("aid desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->order('aid desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('answer_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
//添加题目
public function question_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$obj=M('question');
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
$data['create_time']=time();
if($id=$obj->add($data)){
detailedlog('question',session('admin_username'),'试题列表','添加',"$id",1);
$this->success('添加成功',U('Question/question_list'),1);
}
}
}
//添加答案
public function answer_add()
{
if(!IS_AJAX)
{
$where['type']=1;
$question=M('question')->where($where)->order("id desc")->select();
$this->assign('question',$question);
$this->display("answer_add");
}
else
{
$obj=M('answer');
$data['question_id']=trim(I('post.question_id', '', 'htmlspecialchars'));
$data['answer']=trim(I('post.answer', '', 'htmlspecialchars'));
$data['create_time']=time();
if($id=$obj->add($data)){
detailedlog('answer',session('admin_username'),'答案列表','添加',"$id",1);
$this->success('添加成功',U('Question/answer_list'));
}
}
}
//题目编辑
public function question_edit(){
if (!IS_AJAX){
$admin=M('question')->where(array('id'=>I('id')))->find();
$this->assign('list',$admin);
$this->display();
}else{
$obj=M('question');
$data['id']=trim(I('post.id', '', 'htmlspecialchars'));
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
$data['type']=trim(I('post.type', '', 'htmlspecialchars'));
$obj->save($data);
detailedlog('question',session('admin_username'),'题目列表','编辑',"{$data['id']}",1);
$this->success('修改成功',U('question_list'),1);
}
}
//答案编辑
public function answer_edit(){
if (!IS_AJAX){
$where['type']=1;
$question=M('question')->where($where)->order("id desc")->select();
$admin=M('answer')->where(array('aid'=>I('id')))->find();
$this->assign('list',$admin);
$this->assign('question',$question);
$this->display();
}else{
$obj=M('answer');
$data['aid']=trim(I('post.id', '', 'htmlspecialchars'));
$data['answer']=trim(I('post.answer', '', 'htmlspecialchars'));
$data['question_id']=trim(I('post.question_id', '', 'htmlspecialchars'));
$obj->save($data);
detailedlog('answer',session('admin_username'),'答案列表','编辑',"{$data['id']}",1);
$this->success('修改成功',U('answer_list'),1);
}
}
public function question_del()
{
$id=$_REQUEST['id'];
$question=M('question');
$answer=M('answer');
$question =$question->where(array('id'=>$id))->delete();
$answer =$answer->where(array('question_id'=>$id))->delete();
detailedlog('question',session('admin_username'),'试题管理','删除',"$id",1);
$this->redirect('question_list');
}
public function answer_del()
{
$id=$_REQUEST['id'];
$answer=M('answer');
$answer =$answer->where(array('aid'=>$id))->delete();
detailedlog('answer',session('admin_username'),'试题管理','删除',"$id",1);
$this->redirect('answer_list');
}
}
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class ShareController extends AuthController {
public function shareList()
{
$admin= M("share");
$count= $admin->alias('s')->join('lh_admin a on s.uid=a.admin_id','left')->order("id desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->alias('s')->join('lh_admin a on s.uid=a.admin_id','left')->order("id desc")->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('sharelist',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function share_del(){
$id=$_REQUEST['id'];
$share=M('share');
$list=$share->where("id='$id'")->find();
$listimg=$list['path'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$listimg;
if(!empty($filepathOne)){
unlink($filepathOne);
}
$share =$share->where(array('id'=>$id))->delete();
detailedlog('share',session('admin_username'),'分享管理','删除',"$id",1);
$this->redirect('shareList');
}
}
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://gonn0101.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 网蝈蝈 <245539558@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;
use Think\Model;
use Think\Db;
use OT\Database;
class ShijiudaController extends AuthController {
public function shijiuda_list()
{
$admin=M('noticeimg');
$count= $admin->alias('d')->join('lh_notice n on d.id=n.id','right')->order("n.id desc")->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
foreach($map as $key=>$val) {
$Page->parameter[$key]=urlencode($val);
}
$show= $Page->show();// 分页显示输出
$admin_list=$admin->alias('d')->join('lh_notice n on d.id=n.id','right')->order('n.id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('shijiuda_list',$admin_list);
$this->assign('page',$show);
$this->display();
}
public function shijiuda_add()
{
if(!IS_AJAX)
{
$this->display();
}
else
{
$obj=M('notice');
$data['title']=trim(I('post.title', '', 'htmlspecialchars'));
if($id=$obj->add($data)){
$datal['id']=$id;
$datal['linkurl']=trim(I('post.linkurl', '', 'htmlspecialchars'));
$datal['listimg']='/Uploads'.trim(I('post.shijiuda', '', 'htmlspecialchars'));
$datal['time']=date('Y'..'m'..'d'.);
$noticeimg=M('noticeimg');
if($id=$noticeimg->add($datal)){
detailedlog('notice和noticeimg',session('admin_username'),'十九大管理','添加',"$id",1);
$this->success('添加成功',U('shijiuda_list'),1);
}
}
}
}
public function shijiuda_state()
{
$id=I('x');
$statusone=M('noticeimg')->where(array('id'=>$id))->getField('status');//判断当前状态情况
if($statusone==1)
{
$statedata = array('status'=>0);
$auth_group=M('noticeimg')->where(array('id'=>$id))->setField($statedata);
$this->success('状态禁止',1,1);
}
else
{
$statedata = array('status'=>1);
$auth_group=M('noticeimg')->where(array('id'=>$id))->setField($statedata);
$this->success('状态开启',1,1);
}
}
public function shijiuda_del()
{
$id=$_REQUEST['id'];
$admin=M('noticeimg');
$list=$admin->where("id='$id'")->find();
$listimg=$list['listimg'];
$filepathOne=$_SERVER['DOCUMENT_ROOT'].__ROOT__.$listimg;
if(!empty($filepathOne)){
unlink($filepathOne);
}
$noticeimg =$admin->where(array('id'=>$id))->delete();
$notice = M('notice')->where(array('id'=>$id))->delete();
detailedlog('notice和noticeimg',session('admin_username'),'十九大管理','删除',"$id",1);
$this->redirect('shijiuda_list');
}
}
<?php
namespace Admin\Controller;
use Think\Controller;
class ShopController extends Controller {
public function add(){
$this->display();
}
public function upload(){
$upload = new \Think\Upload();// 实例化上传类
// $upload->maxSize = 0 ;// 设置附件上传大小
$upload->exts = array('wmv','mp4','jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
$upload->rootPath = './Public/'; // 设置附件上传根目录
$upload->savePath = './Uploads/'; // 设置附件上传(子)目录
// 上传文件
$info = $upload->upload();
if(!$info) {// 上传错误提示错误信息
$this->error($upload->getError());
}else{// 上传成功
var_dump($info);die;
$this->success('上传成功!');
}
}
}
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论