function address() { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $r_data = get_consignee_list($_SESSION['user_id']); return $r_data; break; case 'DELETE': $consignee_id = intval($_GET['id']); if (drop_consignee($consignee_id)) { $r_data = 'Delete Address Success!'; } else { $r_data = 'Delete Address Failed!'; } return $r_data; break; case 'POST': $address = array('user_id' => $_SESSION['user_id'], 'address_id' => intval($_POST['address_id']), 'country' => isset($_POST['country']) ? intval($_POST['country']) : 0, 'province' => isset($_POST['province']) ? intval($_POST['province']) : 0, 'city' => isset($_POST['city']) ? intval($_POST['city']) : 0, 'district' => isset($_POST['district']) ? intval($_POST['district']) : 0, 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'tel' => isset($_POST['tel']) ? compile_str(make_semiangle(trim($_POST['tel']))) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(make_semiangle(trim($_POST['mobile']))) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : ''); if (update_address($address)) { $r_data = 'Update Address Success!'; } else { $r_data = 'Update Address Failed!'; } return $r_data; break; default: return 'This API can not support ' . $_SERVER['REQUEST_METHOD'] . ' method'; break; } }
function get_search_engine(&$keyword, $url = null) { global $db; if (is_null($url)) { $url = $_SERVER['HTTP_REFERER']; } $url = urldecode($url); $url = make_semiangle($url); $parsed_url = @parse_url($url); if (!isset($parsed_url['host'])) { return false; } /* * if (!isset($parsed_url['query'])) { $google = 'google.co.jp'; if (stripos($url, $google) !== false) return true; else return false; } */ $filter_keywords = FILTER_SEARCH_KEYWORDS; $filter_keywords = !empty($filter_keywords) ? explode(',', $filter_keywords) : array(); $result = $db->Execute('SELECT `server`, `getvar` FROM `' . DB_PREFIX . 'search_engine`', false, true); while (!$result->EOF) { $host =& $result->fields['server']; $varname =& $result->fields['getvar']; if (strstr($parsed_url['host'], $host)) { $k = array(); $key_string = $parsed_url['query']; if (empty($key_string) && isset($parsed_url['fragment']) && !empty($parsed_url['fragment'])) { $key_string = $parsed_url['fragment']; } preg_match('/' . $varname . '=.+\\&' . '/U', $key_string, $k); if (!isset($k[0]) || empty($k[0])) { preg_match('/' . $varname . '=.+$' . '/', $key_string, $k); } $keyword = urldecode(str_replace('+', ' ', $k[0])); if (strpos($keyword, '&') !== false) { $keyword = substr($keyword, 0, strpos($keyword, '&')); } $keyword = ltrim($keyword, $varname . '='); $keyword = str_ireplace('¤', '', $keyword); $keyword = str_ireplace('|', '', $keyword); $keyword = trim($keyword); if (empty($keyword) && stripos($parsed_url['host'], $host) !== false) { return true; // no keyword and host pass } // filter keyword foreach ($filter_keywords as $key) { if (stripos($keyword, trim($key)) !== false) { return false; } } return true; } $result->MoveNext(); } return false; }
public function act_edit_address (){ checkLogin(); include_once(RPC_ROOT . 'includes/lib_transaction_ec.php'); $user_id = intval($_SESSION['user_id']); $address = array( 'user_id' => $user_id, 'address_id' => intval($_GET['address_id']), 'country' => isset($_GET['country']) ? intval($_GET['country']) : 0, 'province' => isset($_GET['province']) ? intval($_GET['province']) : 0, 'city' => isset($_GET['city']) ? intval($_GET['city']) : 0, 'district' => isset($_GET['district']) ? intval($_GET['district']) : 0, 'email' => isset($_GET['email']) ? trim($_GET['email']) : '', 'tel' => isset($_GET['tel']) ? make_semiangle(trim($_GET['tel'])) : '', 'mobile' => isset($_GET['mobile']) ? make_semiangle(trim($_GET['mobile'])) : '', 'best_time' => isset($_GET['best_time']) ? trim($_GET['best_time']) : '', 'zipcode' => isset($_GET['zipcode']) ? make_semiangle(trim($_GET['zipcode'])) : '', ); if(EC_CHARSET == 'utf-8'){ $address['address'] = isset($_GET['address']) ? gbktoutf8(trim($_GET['address'])) : ''; $address['consignee'] = isset($_GET['consignee']) ? gbktoutf8(trim($_GET['consignee'])) : ''; $address['sign_building'] = isset($_GET['sign_building']) ? gbktoutf8(trim($_GET['sign_building'])) : ''; }else{ $address['address'] = isset($_GET['address']) ? utf8togbk(trim($_GET['address'])) : ''; $address['consignee'] = isset($_GET['consignee']) ? utf8togbk(trim($_GET['consignee'])) : ''; $address['sign_building'] = isset($_GET['sign_building']) ? utf8togbk(trim($_GET['sign_building'])) : ''; } $default = isset($_GET['default']) ? trim($_GET['default']) : false; if (update_address($address,$default)) { $msg = rpcLang('user.php', 'address_update_success'); $code = '0'; }else { $msg = rpcLang('user.php', 'address_update_failure'); $code = '1'; } jsonExit("{\"status\":\"$msg\",\"code\":\"$code\"}"); }
/* 跳转 */ ecs_header("Location: user.php?act=order_detail&order_id=$order_id\n"); exit; } /* 保存订单详情收货地址 */ elseif ($action == 'save_order_address') { include_once(ROOT_PATH .'includes/lib_transaction.php'); $address = array( 'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '', 'tel' => isset($_POST['tel']) ? compile_str(trim($_POST['tel'])) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(trim($_POST['mobile'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0 ); if (save_order_address($address, $user_id)) { ecs_header('Location: user.php?act=order_detail&order_id=' .$address['order_id']. "\n"); exit; } else { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list'); }
/* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); /* 更新描述 */ $exc->edit("shipping_desc = '{$val}'", $id); make_json_result(stripcslashes($val)); } elseif ($_REQUEST['act'] == 'edit_insure') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); if (empty($val)) { $val = 0; } else { $val = make_semiangle($val); //全角转半角 if (strpos($val, '%') === false) { $val = floatval($val); } else { $val = floatval($val) . '%'; } } /* 检查该插件是否支持保价 */ $set_modules = true; include_once ROOT_PATH . 'includes/modules/shipping/' . $id . '.php'; if (isset($modules[0]['insure']) && $modules[0]['insure'] === false) { make_json_error($_LANG['not_support_insure']); } /* 更新保价费用 */ $exc->edit("insure = '{$val}'", $id);
/** * 更新购物车中的商品数量 * * @access public * @param array $arr * @return void */ function flow_update_cart($arr) { foreach ($arr as $key => $val) { $val = intval(make_semiangle($val)); if ($val <= 0) { continue; } $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; $goods = $GLOBALS['db']->getRow($sql); /* 系统启用了库存,检查输入的商品数量是否有效 */ if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') { $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'"; $row = $GLOBALS['db']->getRow($sql); if ($row['goods_number'] < $val) { show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], $row['goods_number'], $row['goods_number'])); exit; } } /* 检查该项是否为基本件以及有没有配件存在 */ $sql = "SELECT a.goods_number, a.rec_id FROM " . $GLOBALS['ecs']->table('cart') . " AS b " . "LEFT JOIN " . $GLOBALS['ecs']->table('cart') . " AS a " . "ON a.parent_id = b.goods_id AND a.session_id = '" . SESS_ID . "' AND a.extension_code <> 'package_buy'" . "WHERE b.rec_id = '{$key}'"; $fittings = $GLOBALS['db']->getAll($sql); if ($val > 0) { foreach ($fittings as $k => $v) { if ($v['goods_number'] != null && $v['rec_id'] != null) { /* 该商品有配件,更新配件的商品数量 */ $num = $v['goods_number'] > $val ? $val : $v['goods_number']; $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$num}' WHERE rec_id = {$v['rec_id']}"; $GLOBALS['db']->query($sql); } } if ($goods['extension_code'] == 'package_buy') { /* 更新购物车中的商品数量 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } else { $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']); $goods_price = get_final_price($goods['goods_id'], $val, true, $attr_id); /* 更新购物车中的商品数量 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } } else { if (is_object($fittings) && $fittings->goods_number != null && $fittings->rec_id != null) { $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id={$fittings['rec_id']}"; $GLOBALS['db']->query($sql); } $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } $GLOBALS['db']->query($sql); } /* 删除所有赠品 */ $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; $GLOBALS['db']->query($sql); }
make_json_result(stripcslashes($desc)); } elseif ($_REQUEST['act'] == 'edit_order') { /* 检查权限 */ check_authz_json('payment'); /* 取得参数 */ $code = json_str_iconv(trim($_POST['id'])); $order = intval($_POST['val']); /* 更新排序 */ $exc->edit("pay_order = '{$order}'", $code); make_json_result(stripcslashes($order)); } elseif ($_REQUEST['act'] == 'edit_pay_fee') { /* 检查权限 */ check_authz_json('payment'); /* 取得参数 */ $code = json_str_iconv(trim($_POST['id'])); $pay_fee = json_str_iconv(trim($_POST['val'])); if (empty($pay_fee)) { $pay_fee = 0; } else { $pay_fee = make_semiangle($pay_fee); //全角转半角 if (strpos($pay_fee, '%') === false) { $pay_fee = floatval($pay_fee); } else { $pay_fee = floatval($pay_fee) . '%'; } } /* 更新支付费用 */ $exc->edit("pay_fee = '{$pay_fee}'", $code); make_json_result(stripcslashes($pay_fee)); }
/** * @Author: 段涛 * @添加保存招聘信息 * @function name saveStudentJob */ public function saveStudentJob() { if (IS_POST) { $this->hotCompany(); $company = M('business_info')->field('industry,id')->where(array('uid' => session('userID')))->find(); $jobID = I('post.jobID'); $data['companyName'] = $companyName = I('post.companyName'); $data['jobName'] = $jobName = I('post.jobName'); $data['needPeople'] = $needPeople = I('post.needPeople'); $data['text'] = $text = $_POST['text']; $data['work_price'] = $workPrice = I('post.work_price'); $data['unit'] = I('post.unit'); $data['work_time_type'] = $workTimeType = I('post.work_time_type'); $data['welfare'] = $welfare = I('post.welfare'); $data['email'] = $email = I('post.email'); $data['phone'] = $telephone = I('post.telephone'); $data['linkman'] = $linkMan = I('post.linkman'); $data['education'] = $education = I('post.education'); $data['work_year'] = $workYear = I('post.work_year'); $data['cityID'] = $city = I('post.city'); $data['userID'] = session('userID'); $data['natureID'] = $company['industry']; $data['business_infoID'] = $company['id']; $data['visits'] = 0; $data['creat_time'] = time(); $data = make_semiangle($data); //数据安全校正 if ($companyName == '' || $jobName == '' || $workPrice == '' || $email == '' || $telephone == '' || $linkMan == '' || $city == '') { $this->error('数据不合法!'); } //todo //验证邮箱规则 if (isset($jobID) && $jobID != '') { $data['id'] = $jobID; //数据安全校正 $isOK = M('stu_job')->where(array('userID' => session('userID'), 'id' => $jobID))->find(); if (!$isOK) { $this->error('非法操作!'); } else { $status = M('stu_job')->save($data); } } else { $status = M('stu_job')->add($data); } if ($status) { $this->success('保存成功!', U('/Home/Student/manager/companyID/' . $company['id']), 1); } else { $this->error('保存失败!'); } } else { $this->error('非法操作!'); } }
function action_save_order_address() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_transaction.php'; $address = array('consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '', 'tel' => isset($_POST['tel']) ? compile_str(trim($_POST['tel'])) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(trim($_POST['mobile'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0); if (save_order_address($address, $user_id)) { ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n"); exit; } else { $err = $GLOBALS['err']; if (empty($address['order_id'])) { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list'); } else { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_detail&order_id=' . $address['order_id']); } } }
if (empty($_POST['tel'])) { echo '<script language=javascript>alert("联系电话不可为空!");history.go(-1);</script>'; exit; } if (empty($_POST['mobile'])) { echo '<script language=javascript>alert("联系手机不可为空!");history.go(-1);</script>'; exit; } if (empty($_POST['email'])) { echo '<script language=javascript>alert("电子邮箱不可为空!");history.go(-1);</script>'; exit; } /* * 保存收货人信息 */ $consignee = array('user_id' => $_SESSION['user_id'], 'address_id' => empty($_POST['address_id']) ? 0 : intval($_POST['address_id']), 'consignee' => empty($_POST['consignee']) ? '' : trim($_POST['consignee']), 'country' => empty($_POST['country']) ? '' : $_POST['country'], 'province' => empty($_POST['province']) ? '' : $_POST['province'], 'city' => empty($_POST['city']) ? '' : $_POST['city'], 'district' => empty($_POST['district']) ? '' : $_POST['district'], 'email' => empty($_POST['email']) ? '' : $_POST['email'], 'address' => empty($_POST['address']) ? '' : $_POST['address'], 'zipcode' => empty($_POST['zipcode']) ? '' : make_semiangle(trim($_POST['zipcode'])), 'tel' => empty($_POST['tel']) ? '' : make_semiangle(trim($_POST['tel'])), 'mobile' => empty($_POST['mobile']) ? '' : make_semiangle(trim($_POST['mobile'])), 'sign_building' => empty($_POST['sign_building']) ? '' : $_POST['sign_building'], 'best_time' => empty($_POST['best_time']) ? '' : $_POST['best_time']); $result = update_address($consignee); if ($result) { echo '<script language=javascript>alert("增加收货地址成功");location.href="user.php?act=address_list";</script>'; } else { echo '<script language=javascript>alert("增加收货地址失败");history.go(-1);</script>'; } if ($_SESSION['user_id'] > 0) { $smarty->assign('user_name', $_SESSION['user_name']); } } elseif ($act == 'drop_address') { include_once 'includes/lib_transaction.php'; $consignee_id = intval($_GET['id']); if (drop_consignee($consignee_id)) { ecs_header("Location: user.php?act=address_list\n"); exit;
} $config = array(); foreach ($modules[0]['configure'] as $key => $val) { $config[$key]['name'] = $val['name']; $config[$key]['value'] = $_POST[$val['name']]; } $count = count($config); $config[$count]['name'] = 'free_money'; $config[$count]['value'] = empty($_POST['free_money']) ? '' : $_POST['free_money']; $count++; $config[$count]['name'] = 'fee_compute_mode'; $config[$count]['value'] = empty($_POST['fee_compute_mode']) ? '' : $_POST['fee_compute_mode']; if ($modules[0]['cod']) { $count++; $config[$count]['name'] = 'pay_fee'; $config[$count]['value'] = make_semiangle(empty($_POST['pay_fee']) ? '' : $_POST['pay_fee']); } $sql = "UPDATE " . $ecs->table('shipping_area') . " SET shipping_area_name='{$_POST['shipping_area_name']}', " . "configure='" . serialize($config) . "' " . "WHERE shipping_area_id='{$_POST['id']}'"; $db->query($sql); admin_log($_POST['shipping_area_name'], 'edit', 'shipping_area'); /* 过滤掉重复的region */ $selected_regions = array(); if (isset($_POST['regions'])) { foreach ($_POST['regions'] as $region_id) { $selected_regions[$region_id] = $region_id; } } // 查询所有区域 region_id => parent_id $sql = "SELECT region_id, parent_id FROM " . $ecs->table('region'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) {
/** * 更新购物车中的商品数量 * * @access public * @param array $arr * @return void */ function flow_update_cart($arr) { /* 处理 */ foreach ($arr as $key => $val) { $val = intval(make_semiangle($val)); if ($val <= 0 || !is_numeric($key)) { continue; } //查询: $sql = "SELECT `goods_id`, `goods_attr_id`, `product_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; $goods = $GLOBALS['db']->getRow($sql); $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'"; $row = $GLOBALS['db']->getRow($sql); //查询:系统启用了库存,检查输入的商品数量是否有效 if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') { if ($row['goods_number'] < $val) { GZ_Api::outPut(10008); exit; } /* 是货品 */ $goods['product_id'] = trim($goods['product_id']); if (!empty($goods['product_id'])) { $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $goods['product_id'] . "'"; $product_number = $GLOBALS['db']->getOne($sql); if ($product_number < $val) { GZ_Api::outPut(10008); exit; } } } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') { if (judge_package_stock($goods['goods_id'], $val)) { GZ_Api::outPut(10008); exit; } } /* 查询:检查该项是否为基本件 以及是否存在配件 */ /* 此处配件是指添加商品时附加的并且是设置了优惠价格的配件 此类配件都有parent_id goods_number为1 */ $sql = "SELECT b.goods_number, b.rec_id\n FROM " . $GLOBALS['ecs']->table('cart') . " a, " . $GLOBALS['ecs']->table('cart') . " b\n WHERE a.rec_id = '{$key}'\n AND a.session_id = '" . SESS_ID . "'\n AND a.extension_code <> 'package_buy'\n AND b.parent_id = a.goods_id\n AND b.session_id = '" . SESS_ID . "'"; $offers_accessories_res = $GLOBALS['db']->query($sql); //订货数量大于0 if ($val > 0) { /* 判断是否为超出数量的优惠价格的配件 删除*/ $row_num = 1; while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) { if ($row_num > $val) { $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1"; $GLOBALS['db']->query($sql); } $row_num++; } /* 处理超值礼包 */ if ($goods['extension_code'] == 'package_buy') { //更新购物车中的商品数量 $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } else { $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']); $goods_price = get_final_price($goods['goods_id'], $val, true, $attr_id); //更新购物车中的商品数量 $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } } else { /* 如果是基本件并且有优惠价格的配件则删除优惠价格的配件 */ while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) { $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1"; $GLOBALS['db']->query($sql); } $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; } $GLOBALS['db']->query($sql); } /* 删除所有赠品 */ $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; $GLOBALS['db']->query($sql); }
/** * 举报分类信息. * * @access public * @return void */ public function reportAction() { $id = (int) I('post.id', ''); // 分类信息 ID. $content = (string) I('post.content', ''); // 举报的内容. $other = (string) I('post.other', ''); if (empty($content)) { $this->setAjaxData(Message::FAILED, '举报内容不能为空')->myAjaxReturn(); } if ($id < 1) { $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn(); } // 数据库检查该信息是否有效. $modelCtgData = new CtgDataModel(); $resCheck = $modelCtgData->checkInfo($id); if (FALSE === $resCheck) { $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn(); } unset($modelCtgData, $resCheck); $loginedInfo = $this->getLoginedUserInfo(); // 登录的用户信息. $data = ['userID' => $loginedInfo['uid'], 'dataID' => $id, 'reportTxt' => $content . $other, 'creatTime' => time(), 'status' => 0, 'reportName' => $loginedInfo['userName'], 'checkTime' => 0, 'mailToOwner' => '', 'mailToReporter' => '', 'checkUserName' => '']; $data = make_semiangle($data); // 全角字符转半角. $modelReport = new ReportModel(); // 实例化 Report 模型. // 检查是否已举报过. // $isReported = $modelReport->checkIsReported($id, $loginedInfo['uid']); // if($isReported) { // $this->setAjaxData(Message::FAILED, '您已举报了该条信息!')->myAjaxReturn(); // } if ($modelReport->addInfo($data)) { $this->setAjaxData(Message::SUCCESS, '举报成功')->myAjaxReturn(); } $this->setAjaxData(Message::FAILED, '举报失败')->myAjaxReturn(); }
public function addReport() { if (IS_POST) { $yzm = I('post.yzm'); //验证验证码 if (check_verify($yzm) == false) { $this->error(L('VerificationCodeError'), $_SERVER['HTTP_REFERER'], 3); } $data['reportTxt'] = $ReportTxt = I('post.ReportTxt'); $data['dataID'] = $dataID = I('post.dataID'); $data['reportName'] = session('userName'); $data['creatTime'] = time(); $data['type'] = I('post.type', 0, 'intval'); $data = make_semiangle($data); if ($ReportTxt == '' || $dataID == "") { $this->error(L('ContNotToDo'), U('Home/Class/index'), 3); } $report = M('Report'); if ($report->add($data)) { $this->success('举报成功!', $_SERVER['HTTP_REFERER'], 1); } else { $this->error('保存失败', $_SERVER['HTTP_REFERER'], 3); } } else { $this->error(L('ContNotToDo'), U('Home/Class/index'), 3); } }
/** * 格式化费用:可以输入数字或百分比的地方 * * @param string $fee 输入的费用 */ function format_fee($fee) { $fee = make_semiangle($fee); if (strpos($fee, '%') === false) { return floatval($fee); } else { return floatval($fee) . '%'; } }
} $config = array(); foreach ($modules[0]['configure'] as $key => $val) { $config[$key]['name'] = $val['name']; $config[$key]['value'] = $_POST[$val['name']]; } $count = count($config); $config[$count]['name'] = 'free_money'; $config[$count]['value'] = $_POST['free_money']; $count++; $config[$count]['name'] = 'fee_compute_mode'; $config[$count]['value'] = $_POST['fee_compute_mode']; if ($modules[0]['cod']) { $count++; $config[$count]['name'] = 'pay_fee'; $config[$count]['value'] = make_semiangle($_POST['pay_fee']); } $sql = "UPDATE " . $ecs->table('shipping_area') . " SET shipping_area_name='{$_POST['shipping_area_name']}', " . "configure='" . serialize($config) . "' " . "WHERE shipping_area_id='{$_POST['id']}'"; $db->query($sql); admin_log($_POST['shipping_area_name'], 'edit', 'shipping_area'); /* 过滤掉重复的region */ $selected_regions = array(); if (isset($_POST['regions'])) { foreach ($_POST['regions'] as $region_id) { $selected_regions[$region_id] = $region_id; } } // 查询所有区域 region_id => parent_id $sql = "SELECT region_id, parent_id FROM " . $ecs->table('region'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) {
function check_goods_store($rec_id, $num) { $return = array('mes' => '', 'number' => 1); $num = intval(make_semiangle($num)); $rec_id = intval($rec_id); if ($num <= 0 && !is_numeric($num)) { $return['mes'] = '所填数字必须是正整数!'; return $return; } if ($rec_id <= 0) { $return['mes'] = '参数错误!'; return $return; } //查询: $sql = "SELECT `goods_id`, `goods_attr_id`, `product_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$rec_id}' AND session_id='" . SESS_ID . "'"; $goods = $GLOBALS['db']->getRow($sql); $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$rec_id}'"; $row = $GLOBALS['db']->getRow($sql); //查询:系统启用了库存,检查输入的商品数量是否有效 if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') { if ($row['goods_number'] < $num) { $return['mes'] = "非常抱歉,您选择的商品" . $row['goods_name'] . " 的库存数量不足 , 您最多只能购买 " . $row['goods_number'] . " 件。"; $return['number'] = $row['goods_number']; return $return; } /* 是货品 */ $goods['product_id'] = trim($goods['product_id']); if (!empty($goods['product_id'])) { $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $goods['product_id'] . "'"; $product_number = $GLOBALS['db']->getOne($sql); if ($product_number < $num) { $return['mes'] = "非常抱歉,您选择的商品" . $row['goods_name'] . " 的库存数量只有 " . $row['product_number'] . ",您最多只能购买 " . $row['product_number'] . " 件。"; $return['number'] = $row['product_number']; return $return; } } } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') { if (judge_package_stock($goods['goods_id'], $num)) { $return['mes'] = "非常抱歉,库存数量不足,请减少购买数购买。"; return $return; } } return $return; }
/** * 检查订单中商品库存 * * @access public * @param array $arr * * @return void */ function flow_cart_stock($arr) { foreach ($arr as $key => $val) { $val = intval(make_semiangle($val)); if ($val <= 0) { continue; } $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; $goods = $GLOBALS['db']->getRow($sql); $sql = "SELECT g.goods_name, g.goods_number, c.product_id " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'"; $row = $GLOBALS['db']->getRow($sql); //系统启用了库存,检查输入的商品数量是否有效 if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') { if ($row['goods_number'] < $val) { show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], $row['goods_number'], $row['goods_number'])); exit; } /* 是货品 */ $row['product_id'] = trim($row['product_id']); if (!empty($row['product_id'])) { $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $row['product_id'] . "'"; $product_number = $GLOBALS['db']->getOne($sql); if ($product_number < $val) { show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], $row['goods_number'], $row['goods_number'])); exit; } } } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') { if (judge_package_stock($goods['goods_id'], $val)) { show_message($GLOBALS['_LANG']['package_stock_insufficiency']); exit; } } } }
public function mod() { $id = (int) $this->getUrlVar('id'); $param['id'] = intval($id); $res = DBproxy::getProcedure('Manage')->setDimension(2)->getPeiSongList($param); if (empty($res)) { $this->alert('data error'); die; } if ($this->isAjax() && $_POST) { $v = Doo::loadHelper('DooValidator', true); $success = true; $errors = array(); $rules = $this->_getFormRule(); // 验证数据 if ($errors = $v->validate($_POST, $rules)) { $success = false; } //数据处理 $param['cityid'] = intval($_POST['city']); $param['shopname'] = trim($_POST['shopname']); $param['shopNamePhone'] = make_semiangle(trim($_POST['shopNamePhone'])); $param['peisongPhone'] = make_semiangle(trim($_POST['peisongPhone'])); $list = DBproxy::getProcedure('Manage')->setDimension(2)->getPeiSongIU('u', $param, $param['id']); if ($list['status'] != 0) { $success = false; $errors[] = L('添加失败!DB异常!'); } // 处理返回路径 if ($success) { if (isset($_POST['saveAndReutrn'])) { $errors = PeiSongController::$dataTableUrl; } else { $errors = PeiSongController::$addUrl; } } // 处理表单位提交 $this->ajaxFormResult($success, $errors); } else { // 显示生成表单 Doo::loadClassAt('html/DooFormExt', 'default'); $form = new DooFormExt($this->_getFormConfig(false, $res[0])); $btn = '<a class="btn green-stripe" href="' . PeiSongController::$dataTableUrl . '"><i class="icon-backward"> </i>' . L('列表') . '</a>'; // 显示模版 $this->contentlayoutRender($btn . $form->render()); } }
/** * 获得订单打印的详细信息 * * @access private * @param * @return array */ function get_order_print_info($order_id) { if (!check_priviege()) { exit; } $sql = "SELECT consignee, address, tel, mobile, order_amount, shipping_id, shipping_name, pay_name, zipcode, to_buyer " . " FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}' LIMIT 1 "; $res = $GLOBALS['db']->getRow($sql); $shipping_id = $res['shipping_id']; $res['consignee'] = str_replace("[", "['[", $res['consignee']); $res['consignee'] = str_replace("]", "]']", $res['consignee']); $sql = "SELECT g.goods_brief, og.goods_number FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('goods') . " AS g " . " WHERE og.order_id = '{$order_id}' AND og.goods_id = g.goods_id "; $goods = $GLOBALS['db']->getAll($sql); $contentname = ''; $CRLF = ''; foreach ($goods as $key => $value) { if ($key > 0) { $CRLF = ","; } $contentname .= $CRLF . $goods[$key]['goods_brief'] . ($goods[$key]['goods_number'] > 1 ? "(数量:" . $goods[$key]['goods_number'] . ")" : ''); } $sql = "SELECT shipping_code FROM " . $GLOBALS['ecs']->table('shipping') . " WHERE shipping_id = '{$shipping_id}' "; $shipping_code = $GLOBALS['db']->getOne($sql); $arr = array(); //寄件人信息 $arr['sendername'] = '广州'; $arr['senderaddress'] = '广州市东风东路xxxx'; $arr['senderphone'] = '4008-888-888'; $arr['senderzipcode'] = '510000'; //收件人信息 $arr['recipientname'] = $res['consignee']; $arr['recipientaddress'] = $res['address']; $arr['recipientzipcode'] = $res['zipcode']; $arr['recipientphone'] = make_semiangle($res['tel']); $arr['recipientmobile'] = $res['tel'] == $res['mobile'] ? '' : make_semiangle($res['mobile']); $arr['payamount_small'] = price_format($res['order_amount']); $arr['payamount_big'] = $res['order_amount']; $arr['contentname'] = $contentname; $arr['payment'] = '√月结'; $arr['shipping_code'] = $shipping_code; $arr['to_buyer'] = $res['to_buyer']; return $arr; }
/* 跳转 */ ecs_header("Location: user.php?act=order_detail&order_id=$order_id\n"); exit; } /* 保存订单详情收货地址 */ elseif ($action == 'save_order_address') { include_once(ROOT_PATH .'includes/lib_transaction.php'); $address = array( 'consignee' => isset($_POST['consignee']) ? trim($_POST['consignee']) : '', 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'address' => isset($_POST['address']) ? trim($_POST['address']) : '', 'zipcode' => isset($_POST['zipcode']) ? make_semiangle(trim($_POST['zipcode'])) : '', 'tel' => isset($_POST['tel']) ? trim($_POST['tel']) : '', 'mobile' => isset($_POST['mobile']) ? trim($_POST['mobile']) : '', 'sign_building' => isset($_POST['sign_building']) ? trim($_POST['sign_building']) : '', 'best_time' => isset($_POST['best_time']) ? trim($_POST['best_time']) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0 ); if (save_order_address($address, $user_id)) { ecs_header('Location: user.php?act=order_detail&order_id=' .$address['order_id']. "\n"); exit; } else { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list'); }
/** * 检查订单中商品库存 * * @access public * @param array $arr * * @return void */ function flow_cart_stock($arr) { foreach ($arr as $key => $val) { $val = intval(make_semiangle($val)); if ($val <= 0 || !is_numeric($key)) { continue; } $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM " . $this->pre . "cart WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'"; $goods = $this->row($sql); $sql = "SELECT g.goods_name, g.goods_number, c.product_id " . "FROM " . $this->pre . "goods AS g, " . $this->pre . "cart AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'"; $row = $this->row($sql); //系统启用了库存,检查输入的商品数量是否有效 if (intval(C('use_storage')) > 0 && $goods['extension_code'] != 'package_buy') { if ($row['goods_number'] < $val) { show_message(sprintf(L('stock_insufficiency'), $row['goods_name'], $row['goods_number'], $row['goods_number'])); exit; } /* 是货品 */ $row['product_id'] = trim($row['product_id']); if (!empty($row['product_id'])) { $sql = "SELECT product_number FROM " . $this->pre . "products WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $row['product_id'] . "'"; $res = $this->row($sql); $product_number = $res['product_number']; if ($product_number < $val) { show_message(sprintf(L('stock_insufficiency'), $row['goods_name'], $row['goods_number'], $row['goods_number'])); exit; } } } elseif (intval(C('use_storage')) > 0 && $goods['extension_code'] == 'package_buy') { if (model('Order')->judge_package_stock($goods['goods_id'], $val)) { show_message(L('package_stock_insufficiency')); exit; } } } }
$sql = "SELECT shipping_area_id FROM " . $ecs->table("shipping_area") . " WHERE shipping_id='{$shipping_id}' AND shipping_area_name='{$area_name}'"; $area_id = $db->getOne($sql); if ($area_id <= 0) { $config = array(); foreach ($modules[0]['configure'] as $key => $val) { $config[$key]['name'] = $val['name']; $config[$key]['value'] = $val['value']; } $count = count($config); $config[$count]['name'] = 'free_money'; $config[$count]['value'] = 0; /* 如果支持货到付款,则允许设置货到付款支付费用 */ if ($modules[0]['cod']) { $count++; $config[$count]['name'] = 'pay_fee'; $config[$count]['value'] = make_semiangle(0); } $sql = "INSERT INTO " . $ecs->table('shipping_area') . " (shipping_area_name, shipping_id, configure) " . "VALUES" . " ('{$area_name}', '{$shipping_id}', '" . serialize($config) . "')"; $db->query($sql); $area_id = $db->insert_Id(); } $region_id = empty($_POST['shipping_country']) ? 1 : intval($_POST['shipping_country']); $region_id = empty($_POST['shipping_province']) ? $region_id : intval($_POST['shipping_province']); $region_id = empty($_POST['shipping_city']) ? $region_id : intval($_POST['shipping_city']); $region_id = empty($_POST['shipping_district']) ? $region_id : intval($_POST['shipping_district']); /* 添加选定的城市和地区 */ $sql = "REPLACE INTO " . $ecs->table('area_region') . " (shipping_area_id, region_id) VALUES ('{$area_id}', '{$region_id}')"; $db->query($sql); } } unset($modules);
/** * 收货信息 */ public function consignee() { if ($_SERVER['REQUEST_METHOD'] == 'GET') { /* 取得购物类型 */ $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; //收货人信息填写界面 if (isset($_REQUEST['direct_shopping'])) { $_SESSION['direct_shopping'] = 1; } /* 取得国家列表、商店所在国家、商店所在国家的省列表 */ $this->assign('country_list', model('RegionBase')->get_regions()); $this->assign('shop_country', C('shop_country')); $this->assign('shop_province_list', model('RegionBase')->get_regions(1, C('shop_country'))); /* 获得用户所有的收货人信息 */ if ($_SESSION['user_id'] > 0) { $addressId = I('get.id'); if ($addressId > 0) { $consignee_list[] = model('Users')->get_consignee_list($_SESSION['user_id'], $addressId); } else { $consignee_list[] = array('country' => C('shop_country')); } } else { if (isset($_SESSION['flow_consignee'])) { $consignee_list = array($_SESSION['flow_consignee']); } else { $consignee_list[] = array('country' => C('shop_country')); } } $this->assign('name_of_region', array(C('name_of_region_1'), C('name_of_region_2'), C('name_of_region_3'), C('name_of_region_4'))); $this->assign('consignee_list', $consignee_list); /* 取得每个收货地址的省市区列表 */ $city_list = array(); $district_list = array(); foreach ($consignee_list as $region_id => $consignee) { $consignee['country'] = isset($consignee['country']) ? intval($consignee['country']) : 0; $consignee['province'] = isset($consignee['province']) ? intval($consignee['province']) : 0; $consignee['city'] = isset($consignee['city']) ? intval($consignee['city']) : 0; $city_list[$region_id] = model('RegionBase')->get_regions(2, $consignee['province']); $district_list[$region_id] = model('RegionBase')->get_regions(3, $consignee['city']); } $this->assign('province_list', model('RegionBase')->get_regions(1, $consignee['country'])); $this->assign('city_list', $city_list); $this->assign('district_list', $district_list); /* 返回收货人页面代码 */ $this->assign('real_goods_count', model('Order')->exist_real_goods(0, $flow_type) ? 1 : 0); } else { /* 保存收货人信息 */ $consignee = array('address_id' => empty($_POST['address_id']) ? 0 : intval($_POST['address_id']), 'consignee' => empty($_POST['consignee']) ? '' : I('post.consignee'), 'country' => empty($_POST['country']) ? '' : intval($_POST['country']), 'province' => empty($_POST['province']) ? '' : intval($_POST['province']), 'city' => empty($_POST['city']) ? '' : intval($_POST['city']), 'district' => empty($_POST['district']) ? '' : intval($_POST['district']), 'address' => empty($_POST['address']) ? '' : I('post.address'), 'mobile' => empty($_POST['mobile']) ? '' : make_semiangle(I('post.mobile'))); if ($_SESSION['user_id'] > 0) { /* 如果用户已经登录,则保存收货人信息 */ $consignee['user_id'] = $_SESSION['user_id']; model('Users')->save_consignee($consignee, true); } /* 保存到session */ $_SESSION['flow_consignee'] = stripslashes_deep($consignee); ecs_header("Location: " . url('flow/checkout') . "\n"); } $this->assign('currency_format', C('currency_format')); $this->assign('integral_scale', C('integral_scale')); $this->assign('step', ACTION_NAME); $this->assign('title', L('consignee_info')); $this->display('flow.dwt'); }
/* 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变*/ if ($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id) { ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n"); exit; } $order_amount = $order['order_amount'] - $order['pay_fee']; $pay_fee = pay_fee($pay_id, $order_amount); $order_amount += $pay_fee; $sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}'" . " WHERE order_id = '{$order_id}'"; $db->query($sql); /* 跳转 */ ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n"); exit; } elseif ($action == 'save_order_address') { include_once ROOT_PATH . 'includes/lib_transaction.php'; $address = array('consignee' => isset($_POST['consignee']) ? trim($_POST['consignee']) : '', 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'address' => isset($_POST['address']) ? trim($_POST['address']) : '', 'zipcode' => isset($_POST['zipcode']) ? make_semiangle(trim($_POST['zipcode'])) : '', 'tel' => isset($_POST['tel']) ? trim($_POST['tel']) : '', 'mobile' => isset($_POST['mobile']) ? trim($_POST['mobile']) : '', 'sign_building' => isset($_POST['sign_building']) ? trim($_POST['sign_building']) : '', 'best_time' => isset($_POST['best_time']) ? trim($_POST['best_time']) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0); if (save_order_address($address, $user_id)) { ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n"); exit; } else { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list'); } } elseif ($action == 'bonus') { include_once ROOT_PATH . 'includes/lib_transaction.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('user_bonus') . " WHERE user_id = '{$user_id}'"); $pager = get_pager('user.php', array('act' => $action), $record_count, $page); $bonus = get_user_bouns_list($user_id, $pager['size'], $pager['start']); $smarty->assign('pager', $pager); $smarty->assign('bonus', $bonus); $smarty->display('user_transaction.dwt');
$smarty->assign('city_list', $city_list); $smarty->assign('district_list', $district_list); $smarty->assign('common_header_title', '收货地址'); $smarty->display('address_add.dwt'); } elseif ($act == 'act_edit_address') { include_once ROOT_PATH . 'includes/lib_transaction.php'; $address_id = isset($_REQUEST['address_id']) ? intval($_REQUEST['address_id']) : ''; $re_url = isset($_REQUEST['re_url']) ? $_REQUEST['re_url'] : ''; if (!empty($address_id)) { $sql = 'SELECT * FROM ' . $ecs->table('user_address') . " WHERE `address_id`= {$address_id} AND `user_id`=" . $_SESSION['user_id']; $consignee = $db->getRow($sql); if (empty($consignee)) { mobile_error('返回用户中心', $url = 'user.php?act=address_list&re_url=' . $re_url, '配送地址不存在'); } } $address = array('user_id' => $_SESSION['user_id'], 'address_id' => isset($_POST['address_id']) ? intval($_POST['address_id']) : 0, 'country' => isset($_POST['country']) ? intval($_POST['country']) : 0, 'province' => isset($_POST['province']) ? intval($_POST['province']) : 0, 'city' => isset($_POST['city']) ? intval($_POST['city']) : 0, 'district' => isset($_POST['district']) ? intval($_POST['district']) : 0, 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'tel' => isset($_POST['tel']) ? compile_str(make_semiangle(trim($_POST['tel']))) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(make_semiangle(trim($_POST['mobile']))) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '', 'default' => !empty($re_url) ? 1 : 0); if (update_address($address)) { if (empty($re_url)) { mobile_error('返回用户中心', $url = 'user.php?act=address_list', '修改配送地址成功'); } else { if ($re_url == 'flow') { mobile_error('返回订单', $url = 'flow.php?act=add_order', '已经使用该地址'); } else { mobile_error('返回用户中心', $url = 'user.php?act=address_list', '修改配送地址成功'); } } } else { mobile_error('返回用户中心', $url = 'user.php?act=address_list&re_url=' . $re_url, '修改配送地址失败'); } } elseif ($act == 'drop_consignee') { $address_id = isset($_REQUEST['address_id']) ? intval($_REQUEST['address_id']) : '';