$sql = $sql . "ALTER TABLE " . table('shop_goods') . " ADD COLUMN `isfirst` int(1) DEFAULT '0' COMMENT '首发';"; } if (!mysqld_fieldexists('shop_goods', 'isjingping')) { $sql = $sql . "ALTER TABLE " . table('shop_goods') . " ADD COLUMN `isjingping` int(1) DEFAULT '0' COMMENT '精品';"; } if (!mysqld_fieldexists('shop_order', 'hasbonus')) { $sql = $sql . "ALTER TABLE " . table('shop_order') . " ADD COLUMN `hasbonus` int(1) DEFAULT '0' COMMENT '是否使用优惠券';"; } if (!mysqld_fieldexists('shop_order', 'bonusprice')) { $sql = $sql . "ALTER TABLE " . table('shop_order') . " ADD COLUMN `bonusprice` decimal(10,2) DEFAULT '0.00' COMMENT '优惠券抵消金额';"; } if (!mysqld_fieldexists('member_paylog', 'account_fee')) { $sql = $sql . "ALTER TABLE " . table('member_paylog') . " ADD COLUMN `account_fee` decimal(10,2) NOT NULL COMMENT '账户剩余积分或余额';"; } mysqld_batch($sql); clear_theme_cache(); if (intval(SYSTEM_VERSION) <= 20150724) { mysqld_update('shop_dispatch', array('express' => 'cac'), array('sendtype' => 1, 'express' => '')); $shop_dispatchs = mysqld_selectall("select * from " . table('shop_dispatch') . " group by express"); foreach ($shop_dispatchs as $shop_dispatch) { $express_code = $shop_dispatch['express']; $shop_dispatch_area = mysqld_select("SELECT * FROM " . table('shop_dispatch_area') . " WHERE dispatchid=:dispatchid and provance=:provance and city=:city and area=:area limit 1", array('dispatchid' => $shop_dispatch['id'], 'country' => '中国', 'provance' => $shop_dispatch['provance'], 'city' => $shop_dispatch['city'], 'area' => $shop_dispatch['area'])); if (empty($shop_dispatch_area['id'])) { mysqld_insert("shop_dispatch_area", array('dispatchid' => $shop_dispatch['id'], 'country' => '中国', 'provance' => $shop_dispatch['provance'], 'city' => $shop_dispatch['city'], 'area' => $shop_dispatch['area'])); } $dispatch = mysqld_select("SELECT * FROM " . table('dispatch') . " WHERE code=:code limit 1", array(':code' => $express_code)); if (empty($dispatch['id'])) { if (file_exists(WEB_ROOT . '/system/modules/plugin/dispatch/' . $express_code . '/lang.php')) { require WEB_ROOT . '/system/modules/plugin/dispatch/' . $express_code . '/lang.php'; $data = array('code' => $express_code, 'name' => $_LANG['dispatch_' . $express_code . '_name'], 'desc' => $_LANG['dispatch_' . $express_code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $express_code . '_sendtype']); mysqld_insert('dispatch', $data);
function clear_theme_cache($path = '', $isdir = false) { if ($isdir == false) { $path = WEB_ROOT . '/cache/' . $path; } if (is_dir($path)) { $file_list = scandir($path); foreach ($file_list as $file) { if ($file != '.' && $file != '..') { if ($file != 'qrcode') { clear_theme_cache($path . '/' . $file, true); } } } if ($path != WEB_ROOT . '/cache/') { @rmdir($path); } } else { @unlink($path); } }