HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bb.cwoyt.com/Application/Admin/Controller/ActionController.class.php
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: huajie <2233759493@qq.com>
// +----------------------------------------------------------------------

namespace Admin\Controller;

/**
 * 行为控制器
 * @author huajie <2233759493@qq.com>
 */

class ActionController extends AdminController {

    static protected $allow = array();

    /**
     * 用户管理首页
     * @author 赛脑 <2233759493@qq.com>
     */
    public function index(){
    	$nickname = I('nickname');
    	$map = array('status'=>array('egt',0));
    	if(isset($nickname)){
    		if(intval($nickname) !== 0){
    			$map['uid'] = intval($nickname);
    		}else{
    			$map['nickname']  = array('like', '%'.(string)$nickname.'%');
    		}
    	}
        $list   = $this->lists('Member', $map);
        int_to_string($list);
        $this->assign('_list', $list);
        $this->meta_title = '用户信息';
        $this->display();
    }


    /**
     * 行为日志列表
     * @author huajie <2233759493@qq.com>
     */
    public function actionLog(){
        //获取列表数据
        $map = array('status'=>array('gt', -1));
        $list   = $this->lists('ActionLog', $map);
		$count  = M('ActionLog')->count();
        int_to_string($list);
        foreach ($list as $key=>$value){
        	$model_id = get_document_field($value['model'],"name","id");
        	$list[$key]['model_id'] = $model_id ? $model_id : 0;
        }
		
		$nav_type = 'system';
		$nav_type_li = 'actionlog';
		$this->assign('nav_type', $nav_type);
		$this->assign('nav_type_li', $nav_type_li);
        $this->assign('_list', $list);
		$this->assign('count', $count);
        $this->meta_title = '行为日志';
        $this->display();
    }

    /**
     * 查看行为日志
     * @author huajie <2233759493@qq.com>
     */
	public function edit($id = 0){
		empty($id) && $this->error('参数错误!');

        $info = M('ActionLog')->field(true)->find($id);
		$nav_type = 'system';
		$nav_type_li = 'actionlog';
		$this->assign('nav_type', $nav_type);
		$this->assign('nav_type_li', $nav_type_li);
        $this->assign('info', $info);
        $this->meta_title = '查看行为日志';
        $this->display();
    }

    /**
     * 删除日志
     * @param number $ids
     * @author huajie <2233759493@qq.com>
     */
    public function remove($ids = 0){
    	empty($ids) && $this->error('参数错误!');
    	if(is_array($ids)){
            $map['id'] = array('in', implode(',', $ids));
        }elseif (is_numeric($ids)){
            $map['id'] = $ids;
        }
        $res = M('ActionLog')->where($map)->delete();
        if($res !== false){
        	$this->success('删除成功!');
        }else {
        	$this->error('删除失败!');
        }
    }
	
	public function del(){
		 $map['status'] = 1;
        $res = M('ActionLog')->where($map)->delete();
        if($res !== false){
        	$this->success('删除成功!');
        }else {
        	$this->error('删除失败!');
        }
    }
	

    /**
     * 设置一条或者多条数据的状态
     * @author huajie <2233759493@qq.com>
     */
    public function setStatus(){
        /*参数过滤*/
        $ids = I('request.ids');
        $status = I('request.status');
        if(empty($ids) || !isset($status)){
            $this->error('请选择要操作的数据');
        }

        /*拼接参数并修改状态*/
        $Model = 'Action';
        $map = array();
        if(is_array($ids)){
            $map['id'] = array('in', implode(',', $ids));
        }elseif (is_numeric($ids)){
            $map['id'] = $ids;
        }
        switch ($status){
            case -1 : $this->delete($Model, $map, array('success'=>'删除成功','error'=>'删除失败'));break;
            case 0 : $this->forbid($Model, $map, array('success'=>'禁用成功','error'=>'禁用失败'));break;
            case 1 : $this->resume($Model, $map, array('success'=>'启用成功','error'=>'启用失败'));break;
            default : $this->error('参数错误');break;
        }
    }

}