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//cs.wgegeghx.com/application/cms/controller/Publish.php
<?php





// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )





// | 稿件管理

namespace app\cms\controller;

use app\cms\model\Cms as Cms_Model;
use app\common\controller\Adminbase;
use app\member\model\MemberContent as Member_Content_Model;
use think\Db;

class Publish extends Adminbase
{
    protected function initialize()
    {
        parent::initialize();
        $this->Cms_Model = new Cms_Model;
        //$this->Member_Content_Model = new Member_Content_Model;
    }

    public function index()
    {
        if ($this->request->isAjax()) {
            $limit = $this->request->param('limit/d', 10);
            $page  = $this->request->param('page/d', 10);

            $total = Member_Content_Model::count();
            $_list = Member_Content_Model::page($page, $limit)->order(array("id" => "DESC"))->select();

            foreach ($_list as $k => $v) {
                $modelid   = getCategory($v['catid'], 'modelid');
                $tablename = ucwords(getModel($modelid, 'tablename'));
                $info      = Db::name($tablename)->where(array("id" => $v['content_id'], "sysadd" => 0))->find();
                if ($info) {
                    $_list[$k]['url']     = buildContentUrl($v['catid'], $v['content_id'], $info['url']);
                    $_list[$k]['title']   = $info['title'];
                    $_list[$k]['catname'] = getCategory($v['catid'], 'catname');
                }
            }
            $result = array("code" => 0, "count" => $total, "data" => $_list);

            return json($result);
        }
        return $this->fetch();
    }

    //删除
    public function del()
    {
        $ids = $this->request->param('ids/a', null);
        if (empty($ids)) {
            $this->error('请指定需要删除的信息!');
        }
        if (!is_array($ids)) {
            $ids = array(0 => $ids);
        }
        foreach ($ids as $id) {
            //信息
            $info = Member_Content_Model::where('id', $id)->find();
            //取得栏目信息
            $category = getCategory($info['catid']);
            if (!$category) {
                $this->success('栏目不存在!');
            }
            try {
                $this->Cms_Model->deleteModelData($category['modelid'], $info['content_id']);
            } catch (\Exception $ex) {
                $this->error($ex->getMessage());
            }
        }
        $this->success('删除成功!');
    }

    //通过审核
    public function pass()
    {
        $ids = $this->request->param('ids/a', null);
        if (empty($ids)) {
            $this->error('请指定需要操作的信息!');
        }
        if (!is_array($ids)) {
            $ids = array(0 => $ids);
        }
        foreach ($ids as $id) {
            $info         = Member_Content_Model::get($id);
            $info->status = 1;
            $info->save();

            $modelid     = getCategory($info['catid'], 'modelid');
            $model_cache = cache("Model");
            $tablename   = ucwords($model_cache[$modelid]['tablename']);
            Db::name($tablename)->where('id', $info['content_id'])->setField('status', 1);
        }
        $this->success('操作成功!');

    }

    //退稿
    public function reject()
    {
        $ids = $this->request->param('ids/a', null);
        if (empty($ids)) {
            $this->error('请指定需要操作的信息!');
        }
        if (!is_array($ids)) {
            $ids = array(0 => $ids);
        }
        foreach ($ids as $id) {
            $info         = Member_Content_Model::get($id);
            $info->status = -1;
            $info->save();

            $modelid     = getCategory($info['catid'], 'modelid');
            $model_cache = cache("Model");
            $tablename   = ucwords($model_cache[$modelid]['tablename']);
            Db::name($tablename)->where('id', $info['content_id'])->setField('status', 0);
        }
        $this->success('操作成功!');

    }

}