test
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.
 
 
 
 
 
 

59 lines
1.9 KiB

<?php
defined('IN_IA') or exit('Access Denied');
class Userlabel_WeliamController {
public function labellist() {
global $_W, $_GPC;
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$where['uniacid'] = $_W['uniacid'];
if ($_GPC['keyword']) {
$where['name@'] = trim($_GPC['keyword']);
}
$list = Util::getNumData('*', 'wlmerchant_userlabel', $where, 'sort DESC', $pindex, $psize, 1);
$pager = $list[1];
$list = $list[0];
include wl_template('member/labellist');
}
public function add() {
global $_W, $_GPC;
$data['name'] = trim($_GPC['name']);
$data['sort'] = trim($_GPC['sort']);
$data['status'] = trim($_GPC['status']);
$data['uniacid'] = $_W['uniacid'];
$data['createtime'] = time();
if (empty($data['name'])) {
show_json(0, '标签名称为空!');
}
$res = pdo_insert('wlmerchant_userlabel', $data);
if ($res) {
show_json(1);
} else {
show_json(0, '保存失败,请重试');
}
}
public function changelabel() {
global $_W, $_GPC;
$id = $_GPC['id'];
$type = $_GPC['type'];
$newvalue = trim($_GPC['value']);
if ($type == 1) {
$res = pdo_update('wlmerchant_userlabel', array('name' => $newvalue), array('id' => $id));
} elseif ($type == 2) {
$res = pdo_update('wlmerchant_userlabel', array('sort' => $newvalue), array('id' => $id));
} elseif ($type == 3) {
$res = pdo_update('wlmerchant_userlabel', array('status' => $newvalue), array('id' => $id));
} else if ($type == 4) {
$res = pdo_delete('wlmerchant_userlabel', array('id' => $id));
}
if ($res) {
show_json(1, '修改成功');
} else {
show_json(0, '修改失败,请重试');
}
}
}