本文整理汇总了PHP中AZLib::get_item_vip方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::get_item_vip方法的具体用法?PHP AZLib::get_item_vip怎么用?PHP AZLib::get_item_vip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::get_item_vip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: produc_hot
function produc_hot()
{
if (!User::is_login()) {
echo 'no_login';
exit;
}
if (!User::have_permit(ADMIN_CATEGORY)) {
echo 'no_perm';
exit;
}
$cat_id = AZLib::getParam('cat_id', '0');
$item_ids = AZLib::getParam('item_ids');
$vip_item_ids = AZLib::getParam('vip_item_ids');
if ($item_ids == '' && $vip_item_ids == '') {
//$file = DIR_CACHE."html/product_hot/data_".$cat_id.".js";
//if(@file_exists($file)){
// StaticCache::delCache("product_hot/data_".$cat_id,"js");
//}
$sql = "update configs set conf_val = '' where conf_key = 'product_hot_" . $cat_id . "'";
$sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id;
DB::query($sql);
DB::query($sql_vip);
AZLib::get_item_vip(0, true);
AZLib::get_config(0, true);
exit;
}
// item thuong
$item_array = explode(',', $item_ids);
$items = array();
foreach ($item_array as $item) {
if ($item) {
$items[] = intval($item);
}
}
$id_items_after = '';
$item_ids = join(',', $items);
$sql = "delete from configs where conf_key = 'product_hot_" . $cat_id . "'";
DB::query($sql);
AZLib::get_config(0, true);
if ($item_ids != '') {
$sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t FROM item \r\n\t\t\t\t\t WHERE status = 1 AND id IN({$item_ids})";
$result = DB::query($sql);
$i = 0;
while ($item = mysql_fetch_array($result)) {
if (isset($item['id'])) {
$id_items[$i] = $item['id'];
$i++;
}
}
$id_items_after = '';
for ($i = 0; $i < count($item_array); $i++) {
for ($j = 0; $j < count($id_items); $j++) {
if ($item_array[$i] == $id_items[$j]) {
$id_items_after .= $id_items[$j] . ",";
}
}
}
if ($id_items_after != '') {
$id_items_after = substr($id_items_after, 0, -1);
}
$sql_check = "SELECT id FROM configs WHERE conf_key = 'product_hot_" . $cat_id . "'";
DB::query($sql_check);
$row = DB::fetch_row();
if ($row['id'] != '') {
$sql = "UPDATE configs SET conf_val = '" . $id_items_after . "' WHERE conf_key = 'product_hot_" . $cat_id . "'";
DB::query($sql);
AZLib::get_config(0, true);
// xoa cache config
} else {
$sql = "INSERT INTO configs (`conf_key`,`conf_val`) values ('product_hot_" . $cat_id . "','" . $id_items_after . "')";
DB::query($sql);
AZLib::get_config(0, true);
// xoa cache config
}
}
//item vip
$vip_item_array = explode(',', $vip_item_ids);
$vip_items = array();
foreach ($vip_item_array as $vip_item) {
if ($vip_item) {
$vip_items[] = intval($vip_item);
}
}
$vip_id_items_after = '';
$vip_item_ids = join(',', $vip_items);
$sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id;
DB::query($sql_vip);
AZLib::get_item_vip(0, true);
if ($vip_item_ids != '') {
$sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t FROM item \r\n\t\t\t\t\t WHERE status > 0 AND id IN({$vip_item_ids})";
$result = DB::query($sql);
while ($item = mysql_fetch_array($result)) {
if (isset($item['id'])) {
$vip_id_items_after .= $item['id'] . ",";
$sql_check = "select count(*) AS total from item_vip where item_id = " . $item['id'] . " And product_hot_cat_id=" . $cat_id;
DB::query($sql_check);
$row = DB::fetch_row();
if ($row['total'] == 0) {
$sql = "insert into item_vip (`item_id`,`product_hot_cat_id`) values (" . $item['id'] . "," . $cat_id . ")";
DB::query($sql);
//.........这里部分代码省略.........