Example #1
0
 public function save_consignee()
 {
     $ajax = 1;
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])) > 10) {
         showErr("每个会员只能预设10个配送地址", $ajax, "");
     }
     $id = intval($_REQUEST['id']);
     $consignee = strim($_REQUEST['consignee']);
     $province = strim($_REQUEST['province']);
     $city = strim($_REQUEST['city']);
     $address = strim($_REQUEST['address']);
     $zip = strim($_REQUEST['zip']);
     $mobile = strim($_REQUEST['mobile']);
     if ($consignee == "") {
         showErr("请填写收货人姓名", $ajax, "");
     }
     if ($province == "") {
         showErr("请选择省份", $ajax, "");
     }
     if ($city == "") {
         showErr("请选择城市", $ajax, "");
     }
     if ($address == "") {
         showErr("请填写详细地址", $ajax, "");
     }
     if (!check_postcode($zip)) {
         showErr("请填写正确的邮编", $ajax, "");
     }
     if ($mobile == "") {
         showErr("请填写收货人手机号码", $ajax, "");
     }
     if (!check_mobile($mobile)) {
         showErr("请填写正确的手机号码", $ajax, "");
     }
     $data = array();
     $data['consignee'] = $consignee;
     $data['province'] = $province;
     $data['city'] = $city;
     $data['address'] = $address;
     $data['zip'] = $zip;
     $data['mobile'] = $mobile;
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     if (isset($_REQUEST['isdefault'])) {
         $data['is_default'] = $_REQUEST['isdefault'] ? 1 : 0;
         //新地址设为默认地址时将其它地址更新为非默认地址
         $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "user_consignee SET is_default = 0 where (user_id = " . intval($GLOBALS['user_info']['id']) . " and is_default = 1)");
     }
     if (!check_ipop_limit(get_client_ip(), "setting_save_consignee", 5)) {
         showErr("提交太频繁", $ajax, "");
         exit;
     }
     //id 是用来更新地址的
     if ($id > 0) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data, "UPDATE", "id=" . $id);
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
     }
     showSuccess("保存成功", $ajax, get_gopreview_wap());
     //$res = save_user($user_data);
 }
 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])) > 10) {
             $root['info'] = '每个会员只能预设10个配送地址';
         }
         $id = intval($_REQUEST['id']);
         $consignee = strim($_REQUEST['consignee']);
         $province = strim($_REQUEST['province']);
         $city = strim($_REQUEST['city']);
         $address = strim($_REQUEST['address']);
         $zip = strim($_REQUEST['zip']);
         $mobile = strim($_REQUEST['mobile']);
         if ($consignee == "") {
             $root['info'] = '请填写收货人姓名';
         }
         if ($province == "") {
             $root['info'] = '请选择省份';
         }
         if ($city == "") {
             $root['info'] = '请选择城市';
         }
         if ($address == "") {
             $root['info'] = '请填写详细地址';
         }
         if (!check_postcode($zip)) {
             $root['info'] = '请填写正确的邮编';
         }
         if ($mobile == "") {
             $root['info'] = '请填写收货人手机号码';
         }
         if (!check_mobile($mobile)) {
             $root['info'] = '请填写正确的手机号码';
         }
         $data = array();
         $data['consignee'] = $consignee;
         $data['province'] = $province;
         $data['city'] = $city;
         $data['address'] = $address;
         $data['zip'] = $zip;
         $data['mobile'] = $mobile;
         $data['user_id'] = intval($GLOBALS['user_info']['id']);
         if (!check_ipop_limit(get_client_ip(), "setting_save_consignee", 5)) {
             $root['info'] = '提交太频繁';
         }
         if ($id > 0) {
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data, "UPDATE", "id=" . $id);
         } else {
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
             $root['response_code'] = 1;
             $root['info'] = '保存成功';
         }
         //$root['info']='保存成功';
         //showSuccess("保存成功",$ajax,get_gopreview());
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Example #3
0
 public function save_consignee()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url("user#login"));
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])) > 10) {
         showErr("每个会员只能预设10个配送地址", $ajax, "");
     }
     $id = intval($_REQUEST['id']);
     $consignee = strim($_REQUEST['consignee']);
     $province = strim($_REQUEST['province']);
     $city = strim($_REQUEST['city']);
     $address = strim($_REQUEST['address']);
     $zip = strim($_REQUEST['zip']);
     $mobile = strim($_REQUEST['mobile']);
     if ($consignee == "") {
         showErr("请填写收货人姓名", $ajax, "");
     }
     if ($province == "") {
         showErr("请选择省份", $ajax, "");
     }
     if ($city == "") {
         showErr("请选择城市", $ajax, "");
     }
     if ($address == "") {
         showErr("请填写详细地址", $ajax, "");
     }
     if (!check_postcode($zip)) {
         showErr("请填写正确的邮编", $ajax, "");
     }
     if ($mobile == "") {
         showErr("请填写收货人手机号码", $ajax, "");
     }
     if (!check_mobile($mobile)) {
         showErr("请填写正确的手机号码", $ajax, "");
     }
     $data = array();
     $data['consignee'] = $consignee;
     $data['province'] = $province;
     $data['city'] = $city;
     $data['address'] = $address;
     $data['zip'] = $zip;
     $data['mobile'] = $mobile;
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     if (!check_ipop_limit(get_client_ip(), "setting_save_consignee", 5)) {
         showErr("提交太频繁", $ajax, "");
     }
     if ($id > 0) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data, "UPDATE", "id=" . $id);
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
     }
     showSuccess("保存成功", $ajax, get_gopreview());
 }
 public function check()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url("user#login"));
     }
     $id = intval($_REQUEST['id']);
     $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id);
     if (!$deal_item) {
         showErr("", $ajax, url("index"));
     } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) {
         showErr("", $ajax, url("deal#show", array("id" => $deal_item['deal_id'])));
     }
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']);
     if (!$deal_info) {
         showErr("", $ajax, url("index"));
     } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) {
         showErr("", $ajax, url("deal#show", array("id" => $deal_item['deal_id'])));
     }
     if ($deal_item['is_delivery'] == 1) {
         $consignee_id = intval($_REQUEST['consignee_id']);
         if ($consignee_id == 0) {
             $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id']));
             if ($consignee_list) {
                 showErr("请选择配送方式", $ajax);
             } else {
                 $consignee = strim($_REQUEST['consignee']);
                 $province = strim($_REQUEST['province']);
                 $city = strim($_REQUEST['city']);
                 $address = strim($_REQUEST['address']);
                 $zip = strim($_REQUEST['zip']);
                 $mobile = strim($_REQUEST['mobile']);
                 if ($consignee == "") {
                     showErr("请填写收货人姓名", $ajax, "");
                 }
                 if ($province == "") {
                     showErr("请选择省份", $ajax, "");
                 }
                 if ($city == "") {
                     showErr("请选择城市", $ajax, "");
                 }
                 if ($address == "") {
                     showErr("请填写详细地址", $ajax, "");
                 }
                 if (!check_postcode($zip)) {
                     showErr("请填写正确的邮编", $ajax, "");
                 }
                 if ($mobile == "") {
                     showErr("请填写收货人手机号码", $ajax, "");
                 }
                 if (!check_mobile($mobile)) {
                     showErr("请填写正确的手机号码", $ajax, "");
                 }
                 $data = array();
                 $data['consignee'] = $consignee;
                 $data['province'] = $province;
                 $data['city'] = $city;
                 $data['address'] = $address;
                 $data['zip'] = $zip;
                 $data['mobile'] = $mobile;
                 $data['user_id'] = intval($GLOBALS['user_info']['id']);
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
                 $consignee_id = $GLOBALS['db']->insert_id();
             }
         }
     }
     if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) {
         showErr("请选择配送方式", $ajax, "");
     } else {
         $memo = strim($_REQUEST['memo']);
         if ($memo != "" && $memo != "在此填写关于回报内容的具体选择或者任何你想告诉项目发起人的话") {
             es_session::set("cart_memo_" . intval($id), $memo);
         }
         if ($deal_item['type'] == 1) {
             $pay_money = floatval($_REQUEST['pay_money']);
             if ($pay_money <= 0) {
                 showErr("您输入的金额错误", 1);
             } else {
                 showSuccess("", $ajax, url("cart#pay", array("id" => $id, 'pay_money' => $pay_money)));
             }
         } else {
             if ($deal_item['is_delivery'] == 0) {
                 showSuccess("", $ajax, url("cart#pay", array("id" => $id)));
             } else {
                 showSuccess("", $ajax, url("cart#pay", array("id" => $id, "did" => $consignee_id)));
             }
         }
     }
 }
 public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     $root = array();
     $root['response_code'] = 1;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $id = intval($_REQUEST['id']);
         $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id);
         if (!$deal_item) {
             $root['addr'] = url("index");
             //showErr("",$ajax,url("index"));
         } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) {
             $root['addr'] = url("deal#show", array("id" => $deal_item['deal_id']));
             //showErr("",$ajax,url("deal#show",array("id"=>$deal_item['deal_id'])));
         }
         $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']);
         if (!$deal_info) {
             $root['addr'] = url("index");
             //showErr("",$ajax,url("index"));
         } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) {
             $root['addr'] = url("deal#show", array("id" => $deal_item['deal_id']));
             //showErr("",$ajax,url("deal#show",array("id"=>$deal_item['deal_id'])));
         }
         if ($deal_item['is_delivery'] == 1) {
             $consignee_id = intval($_REQUEST['consignee_id']);
             if ($consignee_id == 0) {
                 $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id']));
                 if ($consignee_list) {
                     $root['info'] = "请选择配送方式";
                     //showErr("请选择配送方式",$ajax);
                 } else {
                     $consignee = strim($_REQUEST['consignee']);
                     $province = strim($_REQUEST['province']);
                     $city = strim($_REQUEST['city']);
                     $address = strim($_REQUEST['address']);
                     $zip = strim($_REQUEST['zip']);
                     $mobile = strim($_REQUEST['mobile']);
                     if ($consignee == "") {
                         $root['info'] = "请填写收货人姓名";
                         //showErr("请填写收货人姓名",$ajax,"");
                     }
                     if ($province == "") {
                         $root['info'] = "请选择省份";
                         //showErr("请选择省份",$ajax,"");
                     }
                     if ($city == "") {
                         $root['info'] = "请选择城市";
                         //showErr("请选择城市",$ajax,"");
                     }
                     if ($address == "") {
                         $root['info'] = "请填写详细地址";
                         //showErr("请填写详细地址",$ajax,"");
                     }
                     if (!check_postcode($zip)) {
                         $root['info'] = "请填写正确的邮编";
                         //showErr("请填写正确的邮编",$ajax,"");
                     }
                     if ($mobile == "") {
                         $root['info'] = "请填写收货人手机号码";
                         //showErr("请填写收货人手机号码",$ajax,"");
                     }
                     if (!check_mobile($mobile)) {
                         $root['info'] = "请填写正确的手机号码";
                         //showErr("请填写正确的手机号码",$ajax,"");
                     }
                     $data = array();
                     $data['consignee'] = $consignee;
                     $data['province'] = $province;
                     $data['city'] = $city;
                     $data['address'] = $address;
                     $data['zip'] = $zip;
                     $data['mobile'] = $mobile;
                     $data['user_id'] = intval($GLOBALS['user_info']['id']);
                     $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
                     $consignee_id = $GLOBALS['db']->insert_id();
                 }
             }
         }
         if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) {
             $root['info'] = "请选择配送方式";
             //showErr("请选择配送方式",$ajax,"");
         } else {
             $memo = strim($_REQUEST['memo']);
             if ($memo != "" && $memo != "在此填写关于回报内容的具体选择或者任何你想告诉项目发起人的话") {
                 es_session::set("cart_memo_" . intval($id), $memo);
             }
             if ($deal_item['is_delivery'] == 0) {
                 //	$root['addr'] =url("cart#pay",array("id"=>$id));
                 //	showSuccess("",$ajax,url("cart#pay",array("id"=>$id)));
             } else {
                 $root['did'] = $consignee_id;
                 //  showSuccess("",$ajax,url("cart#pay",array("id"=>$id,"did"=>$consignee_id)));
             }
         }
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
 public function validate()
 {
     $this->language->load('onepage/checkout');
     $json = array();
     // Validate if customer is logged in.
     if (!$this->customer->isLogged()) {
         $json['redirect'] = $this->url->link('onepage/checkout', '', 'SSL');
     }
     // Validate cart has products and has stock.
     if (!$this->cart->hasProducts() && empty($this->session->data['vouchers']) || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $json['redirect'] = $this->url->link('onepage/cart');
     }
     // Validate minimum quantity requirments.
     $products = $this->cart->getProducts();
     foreach ($products as $product) {
         $product_total = 0;
         foreach ($products as $product_2) {
             if ($product_2['product_id'] == $product['product_id']) {
                 $product_total += $product_2['quantity'];
             }
         }
         if ($product['minimum'] > $product_total) {
             $json['redirect'] = $this->url->link('onepage/cart');
             break;
         }
     }
     if (!$json) {
         if (isset($this->request->post['payment_address']) && $this->request->post['payment_address'] == 'existing') {
             $this->load->model('account/address');
             if (empty($this->request->post['address_id'])) {
                 $json['error']['warning'] = $this->language->get('error_address');
             } elseif (!in_array($this->request->post['address_id'], array_keys($this->model_account_address->getAddresses()))) {
                 $json['error']['warning'] = $this->language->get('error_address');
             } else {
                 // Default Payment Address
                 $this->load->model('account/address');
                 $address_info = $this->model_account_address->getAddress($this->request->post['address_id']);
                 if ($address_info) {
                     $this->load->model('account/customer_group');
                     $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
                     // Company ID
                     if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && !$address_info['company_id']) {
                         $json['error']['warning'] = $this->language->get('error_company_id');
                     }
                     // Tax ID
                     if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && !$address_info['tax_id']) {
                         $json['error']['warning'] = $this->language->get('error_tax_id');
                     }
                 }
             }
             if (!$json) {
                 $this->session->data['payment_address_id'] = $this->request->post['address_id'];
                 if ($address_info) {
                     $this->session->data['payment_country_id'] = $address_info['country_id'];
                     $this->session->data['payment_zone_id'] = $address_info['zone_id'];
                 } else {
                     unset($this->session->data['payment_country_id']);
                     unset($this->session->data['payment_zone_id']);
                 }
                 unset($this->session->data['payment_method']);
                 unset($this->session->data['payment_methods']);
             }
         } else {
             if (utf8_strlen($this->request->post['firstname']) < 1 || utf8_strlen($this->request->post['firstname']) > 32) {
                 $json['error']['firstname'] = $this->language->get('error_firstname');
             }
             if (utf8_strlen($this->request->post['lastname']) < 1 || utf8_strlen($this->request->post['lastname']) > 32) {
                 $json['error']['lastname'] = $this->language->get('error_lastname');
             }
             // Customer Group
             $this->load->model('account/customer_group');
             $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
             if ($customer_group_info) {
                 // Company ID
                 if ($customer_group_info['company_id_display'] && $customer_group_info['company_id_required'] && empty($this->request->post['company_id'])) {
                     $json['error']['company_id'] = $this->language->get('error_company_id');
                 }
                 // Tax ID
                 if ($customer_group_info['tax_id_display'] && $customer_group_info['tax_id_required'] && empty($this->request->post['tax_id'])) {
                     $json['error']['tax_id'] = $this->language->get('error_tax_id');
                 }
             }
             if (utf8_strlen($this->request->post['address_1']) < 3 || utf8_strlen($this->request->post['address_1']) > 128) {
                 $json['error']['address_1'] = $this->language->get('error_address_1');
             }
             if (utf8_strlen($this->request->post['city']) < 2 || utf8_strlen($this->request->post['city']) > 32) {
                 $json['error']['city'] = $this->language->get('error_city');
             }
             $this->load->model('localisation/country');
             $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
             if ($country_info) {
                 if ($country_info['postcode_required'] && utf8_strlen($this->request->post['postcode']) < 2 || utf8_strlen($this->request->post['postcode']) > 10) {
                     $json['error']['postcode'] = $this->language->get('error_postcode');
                 }
                 // VAT Validation
                 $this->load->helper('vat');
                 if ($this->config->get('config_vat') && !empty($this->request->post['tax_id']) && vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid') {
                     $json['error']['tax_id'] = $this->language->get('error_vat');
                 }
             }
             if ($this->request->post['country_id'] == '') {
                 $json['error']['country'] = $this->language->get('error_country');
             }
             if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
                 $json['error']['zone'] = $this->language->get('error_zone');
             }
             //jalen
             $this->load->helper('validation_form');
             $phoneSection = $this->request->post['phoneSection'];
             $phoneCode = $this->request->post['phoneCode'];
             $phoneExt = $this->request->post['phoneExt'];
             $phone = connection_phone($phoneSection, $phoneCode, $phoneExt);
             $this->request->post['phone'] = $phone;
             if (!validation_mobile($this->request->post['mobile']) && !$phoneSection && !$phoneCode && !$phoneExt) {
                 $json['error']['mobile'] = $this->language->get('error_mobile');
             } elseif (!$this->request->post['mobile'] && !validation_phone($phone)) {
                 $json['error']['phoneExt'] = $this->language->get('error_phoneExt');
             } elseif (!validation_mobile($this->request->post['mobile']) && !validation_phone($phone)) {
                 $json['error']['mobile'] = $this->language->get('error_mobile');
                 $json['error']['phoneExt'] = $this->language->get('error_phoneExt');
             }
             $postcode = $this->request->post['postcode'];
             if ($postcode && !check_postcode($postcode)) {
                 $json['error']['postcode'] = $this->language->get('error_postcode');
             }
             if (!$json) {
                 // Default Payment Address
                 $this->load->model('account/address');
                 $this->session->data['payment_address_id'] = $this->session->data['shipping_address_id'] = $this->model_account_address->addAddress($this->request->post);
                 $this->session->data['payment_country_id'] = $this->request->post['country_id'];
                 $this->session->data['payment_zone_id'] = $this->request->post['zone_id'];
                 //返回数据
                 $json_address = $this->model_account_address->getAddress($this->session->data['payment_address_id']);
                 $json['address'] = '<dl class="item selected">
             <dt>' . $json_address['firstname'] . ' ' . $json_address['lastname'] . '</dt>
             <dd>
                 <p class="tel">' . $json_address['mobile'] . '</p>
                 <p>' . $json_address['country'] . ' ' . $json_address['zone'] . ' ' . $json_address['city'] . ' ' . $json_address['address_1'] . ' </p>
                 <p>' . $json_address['address_1'] . '</p>
             </dd>
             <dd style="display:none">
                 <input type="radio" name="address_id" class="addressId" value="' . $this->session->data['payment_address_id'] . '">
             </dd>
         </dl>';
                 //unset($this->session->data['payment_method']);
                 //unset($this->session->data['payment_methods']);
             }
         }
     }
     $this->response->setOutput(json_encode($json));
 }
 public function save_consignee()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         app_redirect(url_wap("user#login"));
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])) > 10) {
         showErr("每个会员只能预设10个配送地址", $ajax, "");
     }
     $deal_item_id = intval($_REQUEST['deal_item_id']);
     $id = intval($_REQUEST['id']);
     $consignee = strim($_REQUEST['consignee']);
     $province = strim($_REQUEST['province']);
     $city = strim($_REQUEST['city']);
     $address = strim($_REQUEST['address']);
     $zip = strim($_REQUEST['zip']);
     $mobile = strim($_REQUEST['mobile']);
     if ($consignee == "") {
         showErr("请填写收货人姓名", $ajax, "");
     }
     if ($province == "") {
         showErr("请选择省份", $ajax, "");
     }
     if ($city == "") {
         showErr("请选择城市", $ajax, "");
     }
     if ($address == "") {
         showErr("请填写详细地址", $ajax, "");
     }
     if (!check_postcode($zip)) {
         showErr("请填写正确的邮编", $ajax, "");
     }
     if ($mobile == "") {
         showErr("请填写收货人手机号码", $ajax, "");
     }
     if (!check_mobile($mobile)) {
         showErr("请填写正确的手机号码", $ajax, "");
     }
     $data = array();
     $data['consignee'] = $consignee;
     $data['province'] = $province;
     $data['city'] = $city;
     $data['address'] = $address;
     $data['zip'] = $zip;
     $data['mobile'] = $mobile;
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     if (!check_ipop_limit(get_client_ip(), "setting_save_consignee", 5)) {
         showErr("提交太频繁", $ajax, "");
         exit;
     }
     if ($id > 0) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data, "UPDATE", "id=" . $id);
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data);
         $id = $GLOBALS['db']->insert_id();
     }
     if ($deal_item_id > 0) {
         echo url_wap("cart#index", array('id' => $deal_item_id));
         exit;
         showSuccess("保存成功", $ajax, url_wap("cart#index", array('id' => $deal_item_id)));
     } else {
         showSuccess("保存成功", $ajax, url_wap("settings#add_consignee", array('id' => $id)));
     }
     //$res = save_user($user_data);
 }