public function search() { $cid = intval($_REQUEST['cid']); $sid = intval($_REQUEST['sid']); $key = trim($_REQUEST['key']); $type = intval($_REQUEST['type']); $tag_name = trim($_REQUEST['tag_name']); $custom_tags = trim($_REQUEST['custom_tags']); $where = ''; if (!empty($key)) { $where .= ' AND tag_name LIKE \'%' . mysqlLikeQuote($key) . '%\''; } if ($cid > 0) { $cids = D('GoodsCategoryTags')->getTagIDs($cid); if (count($cids) > 0) { $where .= ' AND tag_id NOT IN (' . implode(',', $cids) . ')'; } } if ($sid > 0) { $sids = D('StyleCategoryTags')->getTagIDs($sid); if (count($cids) > 0) { $where .= ' AND tag_id NOT IN (' . implode(',', $sids) . ')'; } } $tag_names = array(); if (!empty($tag_name)) { $tag_name = explode(' ', $tag_name); foreach ($tag_name as $name) { $tag_names[] = addslashes($name); } } if (!empty($custom_tags)) { $custom_tags = explode(',', $custom_tags); foreach ($custom_tags as $custom) { $custom = explode('|', $custom); $tag_names[] = addslashes($custom[0]); } } if (count($tag_names) > 0) { $where .= ' AND tag_name NOT ' . createIN($tag_names); } $list = array(); if (empty($where)) { $list = D('GoodsTags')->limit('0,60')->order('sort ASC,tag_id ASC')->findAll(); } else { $list = D('GoodsTags')->where('1' . $where)->limit('0,60')->order('sort ASC,tag_id ASC')->findAll(); } if ($type == 1) { echo json_encode($list); } else { $this->assign("tag_list", $list); echo $this->fetch('GoodsTags:tags'); } }
public function delByMlid() { //删除指定记录 $result = array('isErr' => 0, 'content' => ''); $id = $_REQUEST['id']; if (!empty($id)) { $condition = createIN(explode(',', $id)); M()->query("DELETE FROM " . D('UserMsg')->getTablaName($mlid) . " WHERE mlid {$condition}"); M()->query("DELETE FROM " . C("DB_PREFIX") . "user_msg_list WHERE mlid {$condition}"); M()->query("DELETE FROM " . C("DB_PREFIX") . "user_msg_member WHERE mlid {$condition}"); M()->query("DELETE FROM " . C("DB_PREFIX") . "user_msg_index WHERE mlid {$condition}"); } else { $result['isErr'] = 1; $result['content'] = L('ACCESS_DENIED'); } die(json_encode($result)); }