``` //修改默认地址 public function default($id) { if(!Request()->isAjax() && $id == ''){ return json(array('status' => 0 , 'info' => '请求方法不正确')); }else{ $is_default['is_default'] = '1'; //dump($is_default);die; $res = db('user_address')->where('address_id',$id)->update($is_default); if($res){ $res_default['is_default'] = '0'; $where = array(); $where[] = array('address_uid', '=', session('home_uid')); $where[] = array('address_id', '<>', $id); db('user_address')->where($where)->update($res_default); return json(array('status' => 1, 'info' => '修改默认地址成功')); }else{ return json(array('status' => 0, 'info' => '修改默认地址失败')); } } } ```