<?php
defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
$settings = $this->module['config'];
$op = ! empty($_GPC['op']) ? $_GPC['op'] : 'display';
$type = $_GPC['type'];
if($op=='open'){
    $id =intval($_GPC['id']);
    $result = pdo_update('evzg_express_member_address',array('defeult'=>0),array('openid'=>$_W['openid']));
    $result = pdo_update('evzg_express_member_address',array('defeult'=>1),array('id'=>$id,'openid'=>$_W['openid']));
    if($result){
        ijson(array('code'=>200,'msg'=>'设置成功'));
    }else{
        ijson(array('code'=>401,'msg'=>'设置失败'));
    }
}
if($op=='del'){
    $id =intval($_GPC['id']);
    $result = pdo_delete('evzg_express_member_address',array('id'=>$id,'openid'=>$_W['openid']));
    if($result){
        ijson(array('code'=>200,'msg'=>'删除成功'));
    }else{
        ijson(array('code'=>401,'msg'=>'删除失败'));
    }
}
$address_list = pdo_getall("evzg_express_member_address",array('openid'=>$_W['openid']));
// var_dump($shop);die();
$default='default/';
include $this->template($default.'myaddress');