Exemple #1
0
 public static function get_order_address()
 {
     global $db;
     if (MES_User::server_check_login()) {
         $sql = "select * from ecs_user_address where user_id={$_SESSION['user_id']}";
         $address = $db->getAll($sql);
         for ($i = 0; $i < count($address); $i++) {
             $region_id = $address[$i]['city'];
             $district_id = $address[$i]['district'];
             $city_name = $db->getOne("select region_name from ship_region where region_id={$address[$i]['city']}");
             $address[$i]['cityName'] = $city_name;
             $address[$i]['districtName'] = MES_Order::_get_distruct_name($region_id, $district_id);
         }
     } else {
         $address = array();
     }
     return json_encode($address);
 }
Exemple #2
0
if ((DEBUG_MODE & 2) != 2) {
    $smarty->caching = true;
}
//路由分发的依据
$action = ANTI_SPAM($_GET['action']);
$mod = ANTI_SPAM($_GET['mod']);
function error_exit()
{
    return json_encode(array('code' => 2, 'msg' => 'param error'));
}
//需要登录的操作
$need_login_action = array('order' => array('get_order_address', 'del_order_address', 'update_order_address'), 'account' => array('logout', 'get_user_order_detail', 'get_user_order_list', 'del_one_order', 'set_password', 'change_mobile', 'get_user_mobile_number', 'change_password', 'get_users_info', 'change_sex', 'change_real_name'));
$_action_list = $need_login_action[$mod];
//验证必须登录的操作
if (in_array($action, $_action_list)) {
    if (!MES_User::server_check_login()) {
        echo json_encode(array('code' => RES_NEED_LOGIN));
        exit;
    }
}
switch ($mod) {
    case 'order':
        require_once ROOT_PATH . 'lib/order.php';
        if ($action == 'step1') {
            $order_list = MES_Order::get_order_list();
            $smarty->assign('order_list', $order_list);
            $smarty->display('shoppingcar_new.dwt');
            return;
        } else {
            if ($action == 'step2') {
                //每次结算要记录一个ip防止被刷