コード例 #1
0
ファイル: batchmod.inc.php プロジェクト: pan289091315/Discuz
        }
        gradechange($items, $opcheck, $_POST['check_txt'], $mname);
        cpmsg('message_success', $cookie_referer);
        break;
    default:
        cpmsg('no_operation', '', '', '', true, true);
        break;
}
if (!empty($opsql) && !empty($wheresql)) {
    // 如果是批量移動所屬店舖,更新店舖中的計數,需要在模型的店舖沒有變之前先更新,
    if ($_REQUEST['operation'] == "moveshop") {
        foreach ($itemarr as $v) {
            if ($mname == "album" && is_album_from_bbs($v)) {
                continue;
            }
            $old_shopid = shop::get_shopid_by_itemid($mname, $v);
            // 多選的情況下有可能轉到一個店舖中
            if ($old_shopid != $_POST['opshopid']) {
                shop::update_item_num($mname, $old_shopid, -1);
                shop::update_item_num($mname, $_POST['opshopid'], 1);
            }
        }
    }
    DB::query($opsql . ' WHERE ' . $wheresql);
    //選擇相冊移動店舖時,同時更改圖片的所屬店舖
    if ($_REQUEST['operation'] == 'moveshop' && $mname == 'album') {
        $opsql_photo = str_replace('albumitems ', 'photoitems ', $opsql);
        $wheresql_photo = str_replace(' itemid IN', ' albumid IN', $wheresql);
        DB::query($opsql_photo . ' WHERE ' . $wheresql_photo);
    }
}