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/www.fpngv.com/application/admin/controller/ZbjStudioId.php
<?php
// +----------------------------------------------------------------------
// | Author: Moli <332287662@qq.com>
// +----------------------------------------------------------------------

// +----------------------------------------------------------------------
// | 直播间ID列表
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\common\controller\Adminbase;
use think\Db;
use think\facade\Session;

class ZbjStudioId extends Adminbase
{
    // 直播间ID列表
    public function index()
    {
        if ($this->request->isAjax()) {
            $data   = $this->request->get('');
            $page = $data['page'];
            $limit = $data['limit'];
            $list = Db::name('zbj_studio_id')->select();
            $_list = Db::name('zbj_studio_id')->page($page, $limit)->order(array('id' => 'DESC'))->select();
            $total = count($list);
            $result = array("code" => 0, 'count' => $total, "data" => $_list);
            return json($result);
        } else {
            return $this->fetch();
        }
    }
    // 添加直播间ID
    public function add()
    {
        if ($this->request->isPost()) {
            // 获取投手
            $userInfo = $this->_userinfo = Session::get('admin');
            $this->assign('userInfo', $this->_userinfo);
            $pitcher = $userInfo['nickname'];

            $data   = $this->request->post('');
            $creattime = date('Y-m-d H:i:s', time());
            $data = ['title' => $data['title'], 'creattime' => $creattime,'pitcher'=>$pitcher];
            $result = Db::name('zbj_studio_id')
                ->data($data)
                ->insert();
            if ($result) {
                $this->success("添加直播间ID成功!", url('admin/zbj_studio_id/index'));
            } else {
                $this->success('添加失败!');
            }
        } else {
            return $this->fetch();
        }
    }
    // 编辑直播间ID
    public function edit()
    {
        if ($this->request->isPost()) {
            $data = $this->request->post('');
            $result = Db::name('zbj_studio_id')
                ->where('id', $data['id'])
                ->data(['title' => $data['title']])
                ->update();
            if ($result) {
                $this->success("修改成功!");
            } else {
                $this->error('修改失败!');
            }
        } else {
            $id = $this->request->param('id/d');
            $ishas = Db::name('zbj_studio_id')->where('id', $id)->find();
            if (empty($ishas)) {
                $this->error('该信息不存在!');
            }
            $this->assign("data", $ishas);
            return $this->fetch();
        }
    }
    // 删除直播间ID
    public function del()
    {
        $id = $this->request->param('id/d');
        if (empty($id)) {
            $this->error('请指定需要删除的直播间ID!');
        }
        $ishas = Db::name('zbj_studio_id')->where('id', $id)->find();
        if ($ishas) {
            Db::name('zbj_studio_id')
                ->where('id', $id)
                ->delete();
            $this->success("删除成功!");
        }
    }
}