本文整理汇总了PHP中dr_json函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_json函数的具体用法?PHP dr_json怎么用?PHP dr_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_json函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: m_notice
/**
* 提醒查看
*/
private function m_notice($type)
{
$name = array(1 => lang('m-356'), 2 => lang('m-357'), 3 => lang('m-358'), 4 => lang('m-359'));
$this->db->where('uid', (int) $this->uid)->where('type', (int) $type)->order_by('inputtime DESC');
if (IS_POST) {
$this->db->where_in('id', $this->input->post('ids'))->delete('member_notice_' . $this->member['tableid']);
exit(dr_json(1, lang('000')));
}
if ($this->input->get('action') == 'more') {
// ajax更多数据
$page = max((int) $this->input->get('page'), 1);
$data = $this->db->limit($this->pagesize, $this->pagesize * ($page - 1))->get('member_notice_' . $this->member['tableid'])->result_array();
if (!$data) {
exit('null');
}
$this->template->assign('list', $data);
$this->template->display('notice_data.html');
} else {
$url = 'index.php?c=' . $this->router->class . '&m=' . $this->router->method . '&action=more';
$this->template->assign(array('list' => $this->db->limit($this->pagesize)->get('member_notice_' . $this->member['tableid'])->result_array(), 'moreurl' => $url, 'searchurl' => $url, 'meta_name' => $name[$type]));
// 更新新提醒
$this->db->where('uid', (int) $this->uid)->where('type', (int) $type)->update('member_notice_' . $this->member['tableid'], array('isnew' => 0));
// 删除新提醒
$this->db->where('uid', (int) $this->uid)->delete('member_new_notice');
$this->template->display('notice_index.html');
}
}
示例2: ajax
public function ajax()
{
$data = $this->input->post('data', TRUE);
$uid = $this->member_model->admin_login($data['username'], $data['password']);
if ($uid > 0) {
set_cookie('finecms-admin-login', $data['username'], 999999);
exit(dr_json(1, 1, 1));
}
if ($uid == -1) {
$error = lang('043');
exit(dr_json(0, $error, 'username'));
} elseif ($uid == -2) {
$error = lang('044');
exit(dr_json(0, $error, 'password'));
} elseif ($uid == -3) {
$error = lang('045');
exit(dr_json(0, $error, 'username'));
} elseif ($uid == -4) {
$error = lang('046');
exit(dr_json(0, $error, 'username'));
} else {
$error = lang('047');
exit(dr_json(0, $error, 'username'));
}
}
示例3: topic
/**
* 话题管理
*/
public function topic()
{
if (IS_POST && $this->input->post('action')) {
// ID格式判断
$ids = $this->input->post('ids', TRUE);
if (!$ids) {
exit(dr_json(0, lang('013')));
}
// 删除
if (!$this->is_auth('member/admin/sns/del')) {
exit(dr_json(0, lang('160')));
}
foreach ($ids as $id) {
$this->sns_model->delete_topic($id);
}
exit(dr_json(1, lang('000')));
}
// 重置页数和统计
if (IS_POST) {
$_GET['page'] = $_GET['total'] = 0;
}
// 根据参数筛选结果
$param = array();
if ($this->input->get('search')) {
$param['search'] = 1;
}
// 数据库中分页查询
list($data, $_param, $_search) = $this->sns_model->topic_limit_page($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
$param = $_param ? $param + $_param : $param;
$field = array('username' => array('fieldname' => 'username', 'name' => lang('html-766')), 'name' => array('fieldname' => 'name', 'name' => lang('html-764'))) + ($field ? $field : array());
$search = $_search ? $param + $_search : $param;
$this->template->assign(array('list' => $data, 'field' => $field, 'param' => $search, 'pages' => $this->get_pagination(dr_url('member/topic/index', $param), $param['total'])));
$this->template->display('sns_topic.html');
}
示例4: index
/**
* 消息管理
*/
public function index()
{
if (IS_POST) {
if ($this->input->post('action') == 'read') {
$this->pm_model->set_read($this->uid, $this->input->post('ids'));
exit(dr_json(1, lang('000')));
} else {
$this->pm_model->deletes($this->uid, $this->input->post('ids'));
exit(dr_json(1, lang('000')));
}
}
if ($this->input->get('action') == 'more') {
// ajax更多数据
list($touid, $list) = $this->pm_model->limit_page($this->uid, max(1, (int) $this->input->get('page')));
if (!$list) {
exit('null');
}
$this->template->assign(array('list' => $list));
$this->template->display('pm_data.html');
exit;
}
$list = $this->pm_model->limit_page($this->uid, max(1, (int) $this->input->get('page')));
$this->template->assign(array('list' => $list, 'searchurl' => 'index.php?c=' . $this->router->class . '&m=' . $this->router->method . '&action=more', 'meta_name' => lang('m-009')));
$this->template->display('pm_index.html');
}
示例5: index
/**
* 管理
*/
public function index()
{
if (IS_POST) {
$ids = $this->input->post('ids', TRUE);
if (!$ids) {
exit(dr_json(0, lang('013')));
}
if (!$this->is_auth('admin/poster2/del')) {
exit(dr_json(0, lang('160')));
}
$this->poster_model->delete('id IN(' . @implode(',', $ids) . ')');
$this->system_log('删除广告【#' . @implode(',', $ids) . '】');
// 记录日志
exit(dr_json(1, lang('000')));
}
$data = array();
$page = max(1, (int) $_GET['page']);
$total = $_GET['total'] ? $_GET['total'] : $this->link->where('sid', $this->sid)->count_all_results($this->table);
$order = isset($_GET['order']) && strpos($_GET['order'], "undefined") !== 0 ? $_GET['order'] : 'id DESC';
if ($total) {
$data = $this->link->where('sid', $this->sid)->order_by($order)->limit(SITE_ADMIN_PAGESIZE, SITE_ADMIN_PAGESIZE * ($page - 1))->get($this->table)->result_array();
}
$param = array('sid' => $this->sid, 'total' => $total, 'order' => $order);
$this->template->assign(array('sid' => $this->sid, 'list' => $data, 'type' => $this->type, 'total' => $param['total'], 'pages' => $this->get_pagination(dr_url('poster2/index', $param), $param['total'])));
$this->template->display('poster2_index.html');
}
示例6: del
/**
* 删除收货地址
*/
public function del()
{
$id = (int) $this->input->get('id');
$this->db->where('id', $id)->where('uid', $this->uid)->delete('member_address');
if (IS_AJAX) {
exit(dr_json(1, lang('000')));
}
$this->member_msg(lang('000'), dr_url('address/index'), 1);
}
示例7: disabled
/**
* 禁用/可用
*/
public function disabled()
{
if ($this->is_auth('admin/application/config')) {
$id = (int) $this->input->get('id');
$_data = $this->db->select('disabled')->where('id', $id)->limit(1)->get('application')->row_array();
$this->db->where('id', $id)->update('application', array('disabled' => $_data['disabled'] == 1 ? 0 : 1));
$this->clear_cache('app');
}
exit(dr_json(1, lang('014')));
}
示例8: copy
/**
* 复制
*/
public function copy()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->limit(1)->get('urlrule')->row_array();
if ($data) {
$this->db->insert('urlrule', array('type' => $data['type'], 'name' => $data['name'] . '_copy', 'value' => $data['value']));
$this->cache(1);
}
exit(dr_json(1, lang('000')));
}
示例9: permission
/**
* 会员权限划分
*/
public function permission()
{
$dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
$file = $this->path . $dir . '/rule.php';
if (IS_POST) {
file_put_contents($file, dr_array2string($this->input->post('data')));
echo dr_json(1, lang('000'));
exit;
}
$this->template->assign('data', is_file($file) ? dr_string2array(file_get_contents($file)) : array());
$this->template->assign('space', $dir);
$this->template->display('space_permission.html');
}
示例10: disabled
/**
* 禁用/可用
*/
public function disabled()
{
if ($this->is_auth('admin/application/config')) {
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->get('application')->row_array();
$value = $data['disabled'] == 1 ? 0 : 1;
$this->db->where('id', $id)->update('application', array('disabled' => $value));
$this->clear_cache('app');
$this->system_log(($value ? '禁用' : '启用') . '应用【' . $data['dirname'] . '】');
// 记录日志
}
exit(dr_json(1, lang('014')));
}
示例11: add
/**
* 充值
*/
public function add()
{
if (IS_POST) {
$data = $this->input->post('data');
$value = intval($data['value']);
if (!$value) {
exit(dr_json(0, lang('131'), 'value'));
}
$this->member_model->update_score(0, $this->userinfo['uid'], $value, '', $data['note']);
$this->member_model->add_notice($this->userinfo['uid'], 1, dr_lang('m-080', SITE_EXPERIENCE, $value, $this->member['username']));
exit(dr_json(1, lang('000')));
}
$this->template->display('score_add.html');
}
示例12: add
/**
* 添加地址
*/
public function add()
{
if (IS_POST) {
$data = $this->validate_filter($this->address_model->get_address_field());
if (isset($data['error'])) {
if (IS_AJAX) {
exit(dr_json(0, $data['msg'], $data['error']));
}
$error = $data['error'];
} else {
$this->address_model->add_address($data[1]);
$this->member_msg(lang('000'), dr_url('address/index'), 1);
}
}
$this->template->assign(array('data' => $data, 'result_error' => $error));
$this->template->display('address_add.html');
}
示例13: index
/**
* 我的订单
*/
public function index()
{
if (IS_POST && $this->input->post('action')) {
$ids = $this->input->post('ids', TRUE);
if (!$ids) {
exit(dr_json(0, lang('013')));
}
if ($this->input->post('action') == 'del') {
if (!$this->is_auth(APP_DIR . 'admin/format/del')) {
exit(dr_json(0, lang('160')));
}
$this->link->where_in('id', $ids)->delete($this->order_model->tablename);
$this->link->where_in('fid', $ids)->delete($this->order_model->dataname);
$this->order_model->cache();
exit(dr_json(1, lang('000')));
} else {
if (!$this->is_auth(APP_DIR . 'admin/format/edit')) {
exit(dr_json(0, lang('160')));
}
$_data = $this->input->post('data');
foreach ($ids as $id) {
$this->link->where('id', $id)->update($this->order_model->tablename, $_data[$id]);
}
$this->order_model->cache();
exit(dr_json(1, lang('000')));
}
} else {
// 执行关闭过期订单操作
$this->order_model->close_order();
}
// 根据参数筛选结果
$param = array();
if ($this->input->get('search')) {
$param['search'] = 1;
}
// 数据库中分页查询
list($data, $param) = $this->order_model->limit_page($param, max((int) $this->input->get('page'), 1), (int) $this->input->get('total'));
if ($this->input->get('search')) {
$_param = $this->cache->file->get($this->order_model->cache_file);
} else {
$_param = $this->input->post('data');
}
$_param = $_param ? $param + $_param : $param;
$this->template->assign(array('list' => $data, 'pages' => $this->get_pagination(dr_url(APP_DIR . '/order/index', $param), $param['total']), 'param' => $_param, 'menu' => $this->get_menu(array(lang('my-31') => APP_DIR . '/admin/order/index')), 'paytype' => $this->order_model->get_pay_type()));
$this->template->display('order_index.html');
}
示例14: index
/**
* 管理
*/
public function index()
{
if (IS_POST) {
$ids = $this->input->post('ids', TRUE);
if (!$ids) {
exit(dr_json(0, lang('013')));
}
if (!$this->is_auth('admin/urlrule/del')) {
exit(dr_json(0, lang('160')));
}
$this->db->where_in('id', $ids)->delete('urlrule');
$this->cache(1);
exit(dr_json(1, lang('000')));
}
$this->template->assign(array('list' => $this->db->get('urlrule')->result_array(), 'color' => array(0 => 'green', 1 => 'blue')));
$this->template->display('urlrule_index.html');
}
示例15: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->link->where('id', $id)->limit(1)->get($this->tablename)->row_array();
if (!$data) {
exit(lang('019'));
}
if (IS_POST) {
$data = $this->validate_filter($this->field);
if (isset($data['error'])) {
exit(dr_json(0, $data['msg'], $data['error']));
}
$this->link->where('id', (int) $id)->update($this->tablename, $data[1]);
$this->cache(1);
exit(dr_json(1, lang('000'), ''));
}
$this->template->assign(array('data' => $data, 'field' => $this->field));
$this->template->display('block_add.html');
}