117 lines
3.3 KiB
Go
117 lines
3.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type UpstreamChanConfig struct {
|
|
Address string `json:"address"`
|
|
Timeout time.Duration `json:"timeout"`
|
|
}
|
|
|
|
type SimKey struct {
|
|
ChanKey string `json:"chanKey"`
|
|
ICCID string `json:"iccid"`
|
|
IMSI string `json:"imsi"`
|
|
MSISDN string `json:"msisdn"`
|
|
}
|
|
|
|
type SimBaseReq[T any] struct {
|
|
SimKeys []*SimKey `json:"simKeys"`
|
|
ReqData T `json:"reqData"`
|
|
}
|
|
|
|
// SimInputReqNullDate is used by current-month real-time usage calls. The
|
|
// upstream determines the current month at request time.
|
|
type SimInputReqNullDate struct{}
|
|
|
|
type SimDataUsageInput = SimBaseReq[SimInputReqNullDate]
|
|
|
|
type SimDataUsageItem struct {
|
|
DataUsage float64 `json:"dataUsage"`
|
|
}
|
|
|
|
type SimBaseRes[T any] struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
ErrCode string `json:"errCode"`
|
|
SimKey *SimKey `json:"simKey"`
|
|
ResData T `json:"resData"`
|
|
}
|
|
|
|
type SimBasicInfoInput = SimBaseReq[SimInputReqNullDate]
|
|
|
|
type SimBasicInfoItem struct {
|
|
ICCID string `json:"iccid"`
|
|
IMSI string `json:"imsi"`
|
|
MSISDN string `json:"msisdn"`
|
|
ActiveDate string `json:"activeDate"`
|
|
OpenDate string `json:"openDate"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type SimDataUsageMonthlyInput = SimBaseReq[SimDataUsageMonthlyInputItem]
|
|
type SimDataUsageMonthlyInputItem struct {
|
|
QueryDate string `json:"queryDate"`
|
|
}
|
|
type SimDataUsageMonthlyOutputItem struct {
|
|
DeadLine string `json:"deadLine"`
|
|
DataAmount float64 `json:"dataAmount"`
|
|
}
|
|
|
|
type SimDataUsageDailyInput = SimBaseReq[SimDataUsageDailyInputItem]
|
|
type SimDataUsageDailyInputItem struct {
|
|
QueryDate string `json:"queryDate"`
|
|
}
|
|
type SimDataUsageDailyOutputItem struct {
|
|
QueryDate string `json:"queryDate"`
|
|
DataAmount float64 `json:"dataAmount"`
|
|
}
|
|
|
|
// SimCardStatusInput is the request envelope for carrier status queries.
|
|
type SimCardStatusInput = SimBaseReq[SimInputReqNullDate]
|
|
|
|
// SimImeiInput is the request envelope for terminal IMEI queries.
|
|
type SimImeiInput = SimBaseReq[SimInputReqNullDate]
|
|
|
|
// SimImeiItem is the terminal IMEI returned for one SIM card.
|
|
//
|
|
// A carrier may answer successfully yet return an empty value (for example a
|
|
// card whose device never reported an IMEI, or a template whose upstream
|
|
// endpoint does not expose IMEI at all). Callers must therefore distinguish
|
|
// "query succeeded with an empty value" from "query failed".
|
|
type SimImeiItem struct {
|
|
Imei string `json:"imei"`
|
|
}
|
|
|
|
// SimCardStatusItem is the carrier status returned for one SIM card.
|
|
type SimCardStatusItem struct {
|
|
CardStatus int `json:"cardStatus"`
|
|
LastChangeDate string `json:"lastChangeDate"`
|
|
}
|
|
|
|
type SimCardStatusChangeInput = SimBaseReq[SimCardStatusChangeInputItem]
|
|
|
|
type SimCardStatusChangeInputItem struct {
|
|
OperType string `json:"operType"`
|
|
}
|
|
|
|
type SimCardStatusChangeOutputItem struct {
|
|
OrderNum string `json:"orderNum"`
|
|
}
|
|
|
|
type SimCardApnChangeInput = SimBaseReq[SimCardApnChangeInputItem]
|
|
|
|
type SimCardApnChangeInputItem struct {
|
|
OperType string `json:"operType"`
|
|
ApnName string `json:"apnName"`
|
|
SubmitOnly bool `json:"submitOnly,omitempty"`
|
|
QueryJobID string `json:"queryJobId,omitempty"`
|
|
OperationID string `json:"operationId,omitempty"`
|
|
RecoverOnly bool `json:"recoverOnly,omitempty"`
|
|
}
|
|
|
|
type SimCardApnChangeOutputItem struct {
|
|
OrderNum string `json:"orderNum"`
|
|
Pending bool `json:"pending,omitempty"`
|
|
Uncertain bool `json:"uncertain,omitempty"`
|
|
}
|