---
url: "https://pay.weixin.qq.com/doc/v3/partner/4019557811-go.md"
title: "查询停车场进件申请单列表-请求示例-go"
doc_id: 4019557811
example_lang: "go"
---

## Go


需配合微信支付工具库 wxpay\_utility 使用，请参考 [Go](https://pay.weixin.qq.com/doc/v3/partner/4015119446.md)

```
package main

import (
	"demo/wxpay_utility" // 引用微信支付工具库，参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
)

func main() {
	// TODO: 请准备商户开发必要参数，参考：https://pay.weixin.qq.com/doc/v3/partner/4013080340
	config, err := wxpay_utility.CreateMchConfig(
		"19xxxxxxxx",                 // 商户号，是由微信支付系统生成并分配给每个商户的唯一标识符，商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340
		"1DDE55AD98Exxxxxxxxxx",      // 商户API证书序列号，如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924
		"/path/to/apiclient_key.pem", // 商户API证书私钥文件路径，本地文件路径
		"PUB_KEY_ID_xxxxxxxxxxxxx",   // 微信支付公钥ID，如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589
		"/path/to/wxp_pub.pem",       // 微信支付公钥文件路径，本地文件路径
	)
	if err != nil {
		fmt.Println(err)
		return
	}

	request := &FindApplicationListRequest{
		OutParkingLotId: wxpay_utility.String("lot_sz_tencent_001"),
		Offset:          wxpay_utility.Int64(789),
		Limit:           wxpay_utility.Int64(789),
	}

	response, err := FindApplicationList(config, request)
	if err != nil {
		fmt.Printf("请求失败: %+v\n", err)
		// TODO: 请求失败，根据状态码执行不同的处理
		return
	}

	// TODO: 请求成功，继续业务逻辑
	fmt.Printf("请求成功: %+v\n", response)
}

func FindApplicationList(config *wxpay_utility.MchConfig, request *FindApplicationListRequest) (response *FindApplicationListResponse, err error) {
	const (
		host   = "https://api.mch.weixin.qq.com"
		method = "GET"
		path   = "/v3/parking/reminders/applications"
	)

	reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
	if err != nil {
		return nil, err
	}
	query := reqUrl.Query()
	if request.OutParkingLotId != nil {
		query.Add("out_parking_lot_id", *request.OutParkingLotId)
	}
	if request.Offset != nil {
		query.Add("offset", fmt.Sprintf("%v", *request.Offset))
	}
	if request.Limit != nil {
		query.Add("limit", fmt.Sprintf("%v", *request.Limit))
	}
	reqUrl.RawQuery = query.Encode()
	httpRequest, err := http.NewRequest(method, reqUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	httpRequest.Header.Set("Accept", "application/json")
	httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
	authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil)
	if err != nil {
		return nil, err
	}
	httpRequest.Header.Set("Authorization", authorization)

	client := &http.Client{}
	httpResponse, err := client.Do(httpRequest)
	if err != nil {
		return nil, err
	}
	respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
	if err != nil {
		return nil, err
	}
	if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
		// 2XX 成功，验证应答签名
		err = wxpay_utility.ValidateResponse(
			config.WechatPayPublicKeyId(),
			config.WechatPayPublicKey(),
			&httpResponse.Header,
			respBody,
		)
		if err != nil {
			return nil, err
		}
		response := &FindApplicationListResponse{}
		if err := json.Unmarshal(respBody, response); err != nil {
			return nil, err
		}

		return response, nil
	} else {
		return nil, wxpay_utility.NewApiException(
			httpResponse.StatusCode,
			httpResponse.Header,
			respBody,
		)
	}
}

type FindApplicationListRequest struct {
	OutParkingLotId *string `json:"out_parking_lot_id,omitempty"`
	Offset          *int64  `json:"offset,omitempty"`
	Limit           *int64  `json:"limit,omitempty"`
}

func (o *FindApplicationListRequest) MarshalJSON() ([]byte, error) {
	type Alias FindApplicationListRequest
	a := &struct {
		OutParkingLotId *string `json:"out_parking_lot_id,omitempty"`
		Offset          *int64  `json:"offset,omitempty"`
		Limit           *int64  `json:"limit,omitempty"`
		*Alias
	}{
		// 序列化时移除非 Body 字段
		OutParkingLotId: nil,
		Offset:          nil,
		Limit:           nil,
		Alias:           (*Alias)(o),
	}
	return json.Marshal(a)
}

type FindApplicationListResponse struct {
	Code            *string                 `json:"code,omitempty"`
	Message         *string                 `json:"message,omitempty"`
	ApplicationList []ParkingLotApplication `json:"application_list,omitempty"`
	WxParkingLotId  *string                 `json:"wx_parking_lot_id,omitempty"`
}

type ParkingLotApplication struct {
	ParkingLotAuditNo *string                 `json:"parking_lot_audit_no,omitempty"`
	AuditStatus       *AuditStatus            `json:"audit_status,omitempty"`
	SubmitTime        *int64                  `json:"submit_time,omitempty"`
	ParkingLot        *ParkingLot             `json:"parking_lot,omitempty"`
	AuditComment      *ParkingLotAuditComment `json:"audit_comment,omitempty"`
}

type AuditStatus string

func (e AuditStatus) Ptr() *AuditStatus {
	return &e
}

const (
	AUDITSTATUS_AUDIT_STATUS_UNKNOWN   AuditStatus = "AUDIT_STATUS_UNKNOWN"
	AUDITSTATUS_AUDIT_STATUS_PENDING   AuditStatus = "AUDIT_STATUS_PENDING"
	AUDITSTATUS_AUDIT_STATUS_WITHDRAWN AuditStatus = "AUDIT_STATUS_WITHDRAWN"
	AUDITSTATUS_AUDIT_STATUS_APPROVED  AuditStatus = "AUDIT_STATUS_APPROVED"
	AUDITSTATUS_AUDIT_STATUS_REJECTED  AuditStatus = "AUDIT_STATUS_REJECTED"
)

type ParkingLot struct {
	ParkingLotName            *string         `json:"parking_lot_name,omitempty"`
	OutParkingLotId           *string         `json:"out_parking_lot_id,omitempty"`
	ParkingLotAddress         *string         `json:"parking_lot_address,omitempty"`
	Longitude                 *string         `json:"longitude,omitempty"`
	Latitude                  *string         `json:"latitude,omitempty"`
	ParkingLotType            *ParkingLotType `json:"parking_lot_type,omitempty"`
	PhoneNumber               *string         `json:"phone_number,omitempty"`
	ParkingSignUrl            *string         `json:"parking_sign_url,omitempty"`
	NotificationTextList      []string        `json:"notification_text_list,omitempty"`
	PaymentMiniProgAppid      *string         `json:"payment_mini_prog_appid,omitempty"`
	PaymentPath               *string         `json:"payment_path,omitempty"`
	ParkingOrderMiniProgAppid *string         `json:"parking_order_mini_prog_appid,omitempty"`
	ParkingOrderPath          *string         `json:"parking_order_path,omitempty"`
	ChargingRule              *ChargingRule   `json:"charging_rule,omitempty"`
}

type ParkingLotAuditComment struct {
	Fields         []FieldAudit `json:"fields,omitempty"`
	Recommendation *string      `json:"recommendation,omitempty"`
}

type ParkingLotType string

func (e ParkingLotType) Ptr() *ParkingLotType {
	return &e
}

const (
	PARKINGLOTTYPE_PARKING_LOT_TYPE_UNKNOWN               ParkingLotType = "PARKING_LOT_TYPE_UNKNOWN"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_BUSINESS_DISTRICT     ParkingLotType = "PARKING_LOT_TYPE_BUSINESS_DISTRICT"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_OFFICE_BUILDING       ParkingLotType = "PARKING_LOT_TYPE_OFFICE_BUILDING"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_TRANSPORTATION_HUB    ParkingLotType = "PARKING_LOT_TYPE_TRANSPORTATION_HUB"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_RESIDENTIAL_AREA      ParkingLotType = "PARKING_LOT_TYPE_RESIDENTIAL_AREA"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_PARK_AREA             ParkingLotType = "PARKING_LOT_TYPE_PARK_AREA"
	PARKINGLOTTYPE_PARKING_LOT_TYPE_OTHER_PUBLIC_FACILITY ParkingLotType = "PARKING_LOT_TYPE_OTHER_PUBLIC_FACILITY"
)

type ChargingRule struct {
	RuleType            *ChargingRuleType     `json:"rule_type,omitempty"`
	FeeLimitType        *FeeLimitType         `json:"fee_limit_type,omitempty"`
	DailyLimitType      *DailyLimitType       `json:"daily_limit_type,omitempty"`
	TimeRoundingType    *TimeRoundingType     `json:"time_rounding_type,omitempty"`
	FreeEntryDuration   *int64                `json:"free_entry_duration,omitempty"`
	FreeExitDuration    *int64                `json:"free_exit_duration,omitempty"`
	FixedIntervalRule   []FixedIntervalRule   `json:"fixed_interval_rule,omitempty"`
	DurationSegmentRule []DurationSegmentRule `json:"duration_segment_rule,omitempty"`
	PreEntryRule        []PreEntryRule        `json:"pre_entry_rule,omitempty"`
	HolidayMode         *HolidayMode          `json:"holiday_mode,omitempty"`
	AggregateLimitMode  *AggregateLimitMode   `json:"aggregate_limit_mode,omitempty"`
	FirstChargeTimeMode *FirstChargeTimeMode  `json:"first_charge_time_mode,omitempty"`
}

type FieldAudit struct {
	Field   *string `json:"field,omitempty"`
	Comment *string `json:"comment,omitempty"`
}

type ChargingRuleType string

func (e ChargingRuleType) Ptr() *ChargingRuleType {
	return &e
}

const (
	CHARGINGRULETYPE_CHARGING_RULE_UNKNOWN        ChargingRuleType = "CHARGING_RULE_UNKNOWN"
	CHARGINGRULETYPE_CHARGING_RULE_FIXED_INTERVAL ChargingRuleType = "CHARGING_RULE_FIXED_INTERVAL"
	CHARGINGRULETYPE_CHARGING_RULE_SEGMENT        ChargingRuleType = "CHARGING_RULE_SEGMENT"
	CHARGINGRULETYPE_CHARGING_RULE_PER_ENTRY      ChargingRuleType = "CHARGING_RULE_PER_ENTRY"
)

type FeeLimitType string

func (e FeeLimitType) Ptr() *FeeLimitType {
	return &e
}

const (
	FEELIMITTYPE_FEE_LIMIT_UNKNOWN   FeeLimitType = "FEE_LIMIT_UNKNOWN"
	FEELIMITTYPE_FEE_LIMIT_AGGREGATE FeeLimitType = "FEE_LIMIT_AGGREGATE"
	FEELIMITTYPE_FEE_LIMIT_SINGLE    FeeLimitType = "FEE_LIMIT_SINGLE"
)

type DailyLimitType string

func (e DailyLimitType) Ptr() *DailyLimitType {
	return &e
}

const (
	DAILYLIMITTYPE_DAILY_LIMIT_UNKNOWN      DailyLimitType = "DAILY_LIMIT_UNKNOWN"
	DAILYLIMITTYPE_DAILY_LIMIT_ROLLING_24_H DailyLimitType = "DAILY_LIMIT_ROLLING_24H"
	DAILYLIMITTYPE_DAILY_LIMIT_CALENDAR_DAY DailyLimitType = "DAILY_LIMIT_CALENDAR_DAY"
)

type TimeRoundingType string

func (e TimeRoundingType) Ptr() *TimeRoundingType {
	return &e
}

const (
	TIMEROUNDINGTYPE_TIME_ROUND_UNKNOWN TimeRoundingType = "TIME_ROUND_UNKNOWN"
	TIMEROUNDINGTYPE_TIME_ROUND_DOWN    TimeRoundingType = "TIME_ROUND_DOWN"
	TIMEROUNDINGTYPE_TIME_ROUND_UP      TimeRoundingType = "TIME_ROUND_UP"
)

type FixedIntervalRule struct {
	DayType                   *DayType                   `json:"day_type,omitempty"`
	StartTime                 *string                    `json:"start_time,omitempty"`
	EndTime                   *string                    `json:"end_time,omitempty"`
	VehicleType               *VehicleType               `json:"vehicle_type,omitempty"`
	PlateType                 *PlateType                 `json:"plate_type,omitempty"`
	FirstDuration             *int64                     `json:"first_duration,omitempty"`
	FirstAmount               *int64                     `json:"first_amount,omitempty"`
	IntervalDuration          *int64                     `json:"interval_duration,omitempty"`
	IntervalAmount            *int64                     `json:"interval_amount,omitempty"`
	IntervalMaxAmount         *int64                     `json:"interval_max_amount,omitempty"`
	MaxFeePerDay              *int64                     `json:"max_fee_per_day,omitempty"`
	FreePeriodChargingMode    *FreePeriodChargingMode    `json:"free_period_charging_mode,omitempty"`
	FreePeriodCalculationMode *FreePeriodCalculationMode `json:"free_period_calculation_mode,omitempty"`
	IsGreenVehicleFreeParking *bool                      `json:"is_green_vehicle_free_parking,omitempty"`
	FirstDurationMode         *FirstDurationMode         `json:"first_duration_mode,omitempty"`
}

type DurationSegmentRule struct {
	DayType           *DayType     `json:"day_type,omitempty"`
	StartTime         *string      `json:"start_time,omitempty"`
	EndTime           *string      `json:"end_time,omitempty"`
	VehicleType       *VehicleType `json:"vehicle_type,omitempty"`
	PlateType         *PlateType   `json:"plate_type,omitempty"`
	ChargeMode        *ChargeMode  `json:"charge_mode,omitempty"`
	DurationFrom      *int64       `json:"duration_from,omitempty"`
	DurationTo        *int64       `json:"duration_to,omitempty"`
	FixedAmount       *int64       `json:"fixed_amount,omitempty"`
	IntervalMin       *int64       `json:"interval_min,omitempty"`
	IntervalAmount    *int64       `json:"interval_amount,omitempty"`
	IntervalMaxAmount *int64       `json:"interval_max_amount,omitempty"`
	MaxFeePerDay      *int64       `json:"max_fee_per_day,omitempty"`
}

type PreEntryRule struct {
	DayType      *DayType     `json:"day_type,omitempty"`
	StartTime    *string      `json:"start_time,omitempty"`
	EndTime      *string      `json:"end_time,omitempty"`
	VehicleType  *VehicleType `json:"vehicle_type,omitempty"`
	PlateType    *PlateType   `json:"plate_type,omitempty"`
	Amount       *int64       `json:"amount,omitempty"`
	MaxFeePerDay *int64       `json:"max_fee_per_day,omitempty"`
}

type HolidayMode string

func (e HolidayMode) Ptr() *HolidayMode {
	return &e
}

const (
	HOLIDAYMODE_HOLIDAY_MODE_UNKNOWN        HolidayMode = "HOLIDAY_MODE_UNKNOWN"
	HOLIDAYMODE_HOLIDAY_MODE_LEGAL_MODY     HolidayMode = "HOLIDAY_MODE_LEGAL_MODY"
	HOLIDAYMODE_HOLIDAY_MODE_CALENDAR_MODY  HolidayMode = "HOLIDAY_MODE_CALENDAR_MODY"
	HOLIDAYMODE_HOLIDAY_MODE_FINANCIAL_MODY HolidayMode = "HOLIDAY_MODE_FINANCIAL_MODY"
)

type AggregateLimitMode string

func (e AggregateLimitMode) Ptr() *AggregateLimitMode {
	return &e
}

const (
	AGGREGATELIMITMODE_AGGREGATE_LIMIT_MODE_UNKNOWN AggregateLimitMode = "AGGREGATE_LIMIT_MODE_UNKNOWN"
	AGGREGATELIMITMODE_AGGREGATE_LIMIT_MODE_NORMAL  AggregateLimitMode = "AGGREGATE_LIMIT_MODE_NORMAL"
	AGGREGATELIMITMODE_AGGREGATE_LIMIT_MODE_MIN     AggregateLimitMode = "AGGREGATE_LIMIT_MODE_MIN"
)

type FirstChargeTimeMode string

func (e FirstChargeTimeMode) Ptr() *FirstChargeTimeMode {
	return &e
}

const (
	FIRSTCHARGETIMEMODE_FIRST_CHARGE_TIME_MODE_UNKNOWN    FirstChargeTimeMode = "FIRST_CHARGE_TIME_MODE_UNKNOWN"
	FIRSTCHARGETIMEMODE_FIRST_CHARGE_TIME_MODE_ENTER      FirstChargeTimeMode = "FIRST_CHARGE_TIME_MODE_ENTER"
	FIRSTCHARGETIMEMODE_FIRST_CHARGE_TIME_MODE_AFTER_FREE FirstChargeTimeMode = "FIRST_CHARGE_TIME_MODE_AFTER_FREE"
)

type DayType string

func (e DayType) Ptr() *DayType {
	return &e
}

const (
	DAYTYPE_DAY_TYPE_UNKNOWN DayType = "DAY_TYPE_UNKNOWN"
	DAYTYPE_DAY_TYPE_WEEKDAY DayType = "DAY_TYPE_WEEKDAY"
	DAYTYPE_DAY_TYPE_HOLIDAY DayType = "DAY_TYPE_HOLIDAY"
	DAYTYPE_DAY_TYPE_ALL_DAY DayType = "DAY_TYPE_ALL_DAY"
)

type VehicleType string

func (e VehicleType) Ptr() *VehicleType {
	return &e
}

const (
	VEHICLETYPE_VEHICLE_TYPE_UNKNOWN     VehicleType = "VEHICLE_TYPE_UNKNOWN"
	VEHICLETYPE_VEHICLE_TYPE_SMALL       VehicleType = "VEHICLE_TYPE_SMALL"
	VEHICLETYPE_VEHICLE_TYPE_LARGE       VehicleType = "VEHICLE_TYPE_LARGE"
	VEHICLETYPE_VEHICLE_TYPE_EXTRA_LARGE VehicleType = "VEHICLE_TYPE_EXTRA_LARGE"
	VEHICLETYPE_VEHICLE_TYPE_ALL_TYPE    VehicleType = "VEHICLE_TYPE_ALL_TYPE"
)

type PlateType string

func (e PlateType) Ptr() *PlateType {
	return &e
}

const (
	PLATETYPE_PLATE_TYPE_UNKNOWN   PlateType = "PLATE_TYPE_UNKNOWN"
	PLATETYPE_PLATE_TYPE_TEMPORARY PlateType = "PLATE_TYPE_TEMPORARY"
	PLATETYPE_PLATE_TYPE_MONTHLY   PlateType = "PLATE_TYPE_MONTHLY"
	PLATETYPE_PLATE_TYPE_FREE      PlateType = "PLATE_TYPE_FREE"
	PLATETYPE_PLATE_TYPE_PREPAID   PlateType = "PLATE_TYPE_PREPAID"
	PLATETYPE_PLATE_TYPE_OTHERS    PlateType = "PLATE_TYPE_OTHERS"
)

type FreePeriodChargingMode string

func (e FreePeriodChargingMode) Ptr() *FreePeriodChargingMode {
	return &e
}

const (
	FREEPERIODCHARGINGMODE_FREE_PERIOD_CHARGING_UNKNOWN                      FreePeriodChargingMode = "FREE_PERIOD_CHARGING_UNKNOWN"
	FREEPERIODCHARGINGMODE_FREE_PERIOD_CHARGING_ONCE_PER_ENTRY               FreePeriodChargingMode = "FREE_PERIOD_CHARGING_ONCE_PER_ENTRY"
	FREEPERIODCHARGINGMODE_FREE_PERIOD_CHARGING_ONCE_PER_24_HOURS            FreePeriodChargingMode = "FREE_PERIOD_CHARGING_ONCE_PER_24_HOURS"
	FREEPERIODCHARGINGMODE_FREE_PERIOD_CHARGING_ONCE_PER_CALENDAR_DAY        FreePeriodChargingMode = "FREE_PERIOD_CHARGING_ONCE_PER_CALENDAR_DAY"
	FREEPERIODCHARGINGMODE_FREE_PERIOD_CHARGING_CUMULATIVE_QUOTA_CALCULATION FreePeriodChargingMode = "FREE_PERIOD_CHARGING_CUMULATIVE_QUOTA_CALCULATION"
)

type FreePeriodCalculationMode string

func (e FreePeriodCalculationMode) Ptr() *FreePeriodCalculationMode {
	return &e
}

const (
	FREEPERIODCALCULATIONMODE_FREE_PERIOD_CAL_UNKNOWN          FreePeriodCalculationMode = "FREE_PERIOD_CAL_UNKNOWN"
	FREEPERIODCALCULATIONMODE_FREE_PERIOD_CAL_CONCURRENT_START FreePeriodCalculationMode = "FREE_PERIOD_CAL_CONCURRENT_START"
	FREEPERIODCALCULATIONMODE_FREE_PERIOD_CAL_SEQUENTIAL_START FreePeriodCalculationMode = "FREE_PERIOD_CAL_SEQUENTIAL_START"
)

type FirstDurationMode string

func (e FirstDurationMode) Ptr() *FirstDurationMode {
	return &e
}

const (
	FIRSTDURATIONMODE_FIRST_DURATION_MODE_UNKNOWN              FirstDurationMode = "FIRST_DURATION_MODE_UNKNOWN"
	FIRSTDURATIONMODE_FIRST_DURATION_MODE_ONLY_FIRST_DURATION  FirstDurationMode = "FIRST_DURATION_MODE_ONLY_FIRST_DURATION"
	FIRSTDURATIONMODE_FIRST_DURATION_MODE_EVERY_FIRST_DURATION FirstDurationMode = "FIRST_DURATION_MODE_EVERY_FIRST_DURATION"
)

type ChargeMode string

func (e ChargeMode) Ptr() *ChargeMode {
	return &e
}

const (
	CHARGEMODE_UNKNOWN  ChargeMode = "UNKNOWN"
	CHARGEMODE_INTERVAL ChargeMode = "INTERVAL"
	CHARGEMODE_ONE_TIME ChargeMode = "ONE_TIME"
)

```
