You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
78 lines
2.4 KiB
<?php
|
|
defined('IN_IA') or exit('Access Denied');
|
|
|
|
class ruleCenter_WeliamController
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$where = [];
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
$memberData = Util::getNumData("*", PDO_NAME . 'rule_center', $where, 'sort desc', $pindex, $psize, 1);
|
|
$list = $memberData[0];
|
|
$pager = $memberData[1];
|
|
|
|
include wl_template('dashboard/rule_center/index');
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$id = $_GPC['id'];
|
|
if (checksubmit('submit')) {
|
|
$data = $_GPC['data'];
|
|
|
|
if (empty($data['img'])) wl_message('请上传规则图片', referer(), 'error');
|
|
|
|
$arr = [
|
|
'uniacid' => $_W['uniacid'],
|
|
'img' => $data['img'],
|
|
'sort' => $data['sort'],
|
|
'status' => $data['status']
|
|
];
|
|
|
|
if (!empty($id)) {
|
|
$result = pdo_update(PDO_NAME . 'rule_center',$arr,['id' => $id]);
|
|
} else {
|
|
$arr['create_time'] = time();
|
|
$result = pdo_insert(PDO_NAME . 'rule_center',$arr);
|
|
}
|
|
|
|
if ($result) wl_message('保存成功', web_url('dashboard/ruleCenter/index'), 'success');
|
|
wl_message('保存失败', referer(), 'error');
|
|
}
|
|
|
|
if ($id) {
|
|
$data = pdo_get(PDO_NAME . 'rule_center',['id' => $id]);
|
|
}
|
|
|
|
include wl_template('dashboard/rule_center/edit');
|
|
}
|
|
|
|
public function changeStatus()
|
|
{
|
|
global $_W, $_GPC;
|
|
#1、获取参数信息
|
|
$id = $_GPC['id'] or Commons::sRenderError('缺少参数:导航id');
|
|
$status = $_GPC['status'] ?: 0;
|
|
#1、修改操作
|
|
$res = pdo_update(PDO_NAME . "rule_center", ['status' => $status], ['id' => $id]);
|
|
if ($res) Commons::sRenderSuccess('修改成功');
|
|
else Commons::sRenderError('修改失败,请刷新重试!');
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
global $_W, $_GPC;
|
|
$id = $_GPC['id'];
|
|
if (empty($id) || !is_numeric($id)) wl_message('缺少id参数', referer(), 'error');
|
|
$deleteRes = pdo_delete(PDO_NAME . "rule_center",['id' => $id]);
|
|
if ($deleteRes) wl_message('删除成功', web_url('dashboard/ruleCenter/index'), 'success');
|
|
wl_message('删除失败', referer(), 'error');
|
|
}
|
|
}
|