/* 代码增加 by www.68ecshop.com end */ if (!defined('IN_CTRL')) { die('Hacking attempt'); } require ROOT_PATH . 'includes/lib_comment.php'; if ((DEBUG_MODE & 2) != 2) { $smarty->caching = true; } $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $smarty->assign('affiliate', $affiliate); /* 代码增加_start By www.ecshop68.com */ if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'get_pickup_info') { $province = $_REQUEST['province']; $city = $_REQUEST['city']; $district = $_REQUEST['district']; $city_info = get_city_info($province, $city, $district); $where = 'where 1=1'; if ($city_info['province_id'] > 0 && $city_info['city_id'] > 0) { $where .= ' and province_id=' . $city_info['province_id'] . ' and city_id=' . $city_info['city_id']; $sql = 'select * from ' . $GLOBALS['ecs']->table('pickup_point') . $where; $pickup_point_list = $GLOBALS['db']->getAll($sql); die(json_encode(array('error' => 0, 'result' => $pickup_point_list, 'city_info' => $city_info))); } else { die(json_encode(array('error' => 1))); } } elseif (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'get_area_list') { $parent_id = $_REQUEST['parent_id']; $sql = 'select region_id, region_name, region_type from ' . $GLOBALS['ecs']->table('region') . ' where parent_id=' . $parent_id; $area_list = $GLOBALS['db']->getAll($sql); die(json_encode($area_list)); } elseif (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'get_pickup_point_list') {
$default_value = array('shop_name' => '', 'address' => '', 'contact' => '', 'phone' => '', 'province_id' => 0, 'city_id' => 0, 'district_id' => 0); /* 字段列表 */ $field_list = array_keys($_LANG['upload_pickup_point']); /* 获取商品good id */ $max_id = $db->getOne("SELECT MAX(id) + 1 FROM " . $ecs->table('pickup_point')); /* 循环插入商品数据 */ foreach ($_POST['checked'] as $key => $value) { foreach ($field_list as $field) { // 转换编码 $field_value = isset($_POST[$field][$value]) ? $_POST[$field][$value] : ''; if (in_array($field, array('shop_name', 'address', 'contact', 'phone'))) { // 如果字段值为空,且有默认值,取默认值 $field_arr[$field] = !isset($field_value) && isset($default_value[$field]) ? $default_value[$field] : $field_value; } } $city_info = get_city_info($_POST['province'][$value], $_POST['city'][$value], $_POST['district'][$value]); $field_arr['province_id'] = $city_info['province_id'] > 0 ? $city_info['province_id'] : 0; $field_arr['city_id'] = $city_info['city_id'] > 0 ? $city_info['city_id'] : 0; $field_arr['district_id'] = $city_info['district_id'] > 0 ? $city_info['district_id'] : 0; $db->autoExecute($ecs->table('pickup_point'), $field_arr, 'INSERT'); $max_id = $db->insert_id() + 1; } } // 记录日志 admin_log('', 'batch_upload', 'pickup_point'); /* 显示提示信息,返回商品列表 */ $link[] = array('href' => 'pickup_point.php?act=list', 'text' => $_LANG['pickup_point_list']); sys_msg($_LANG['batch_upload_ok'], 0, $link); } /* 获得自提点列表 */ function get_pickup_point_list()