parent
3399993966
commit
a6de6bb379
@ -0,0 +1,46 @@
|
|||||||
|
package eastiot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IotApiQueryOrderedPkgInfoResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Istest int `json:"istest"`
|
||||||
|
Data []struct {
|
||||||
|
Name string `json:"name"` // 流量包名字
|
||||||
|
PkgId int64 `json:"pkgId"` // 流量包ID
|
||||||
|
Traffic int `json:"traffic"` // 流量大小,单位:MB
|
||||||
|
Ntraffic float64 `json:"ntraffic"` // 已用量,单位:MB
|
||||||
|
Starttime int `json:"starttime"` // 流量生效起始时间时间戳
|
||||||
|
Endtime int `json:"endtime"` // 流量生效结束时间时间戳
|
||||||
|
Addtime int `json:"addtime"` // 订购时间时间戳
|
||||||
|
} `json:"data"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IotApiQueryOrderedPkgInfoResult struct {
|
||||||
|
Result IotApiQueryOrderedPkgInfoResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Err error // 错误
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIotApiQueryOrderedPkgInfoResult(result IotApiQueryOrderedPkgInfoResponse, body []byte, err error) *IotApiQueryOrderedPkgInfoResult {
|
||||||
|
return &IotApiQueryOrderedPkgInfoResult{Result: result, Body: body, Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IotApiQueryOrderedPkgInfo 查询流量卡已订购流量包
|
||||||
|
// https://www.showdoc.com.cn/916774523755909/5092045889939625
|
||||||
|
func (app *App) IotApiQueryOrderedPkgInfo(simId string) *IotApiQueryOrderedPkgInfoResult {
|
||||||
|
// 参数
|
||||||
|
param := NewParams()
|
||||||
|
param.Set("simId", simId)
|
||||||
|
params := app.NewParamsWith(param)
|
||||||
|
// 请求
|
||||||
|
body, err := app.request("http://m2m.eastiot.net/Api/IotApi/queryOrderedPkgInfo", params, http.MethodPost)
|
||||||
|
// 定义
|
||||||
|
var response IotApiQueryOrderedPkgInfoResponse
|
||||||
|
err = json.Unmarshal(body, &response)
|
||||||
|
return NewIotApiQueryOrderedPkgInfoResult(response, body, err)
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package eastiot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IotApiQueryUserPkgInfoResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Data []struct {
|
||||||
|
Type int `json:"type"`
|
||||||
|
PkgId int64 `json:"pkgId"`
|
||||||
|
PkgName string `json:"pkgName"`
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
Sprice float64 `json:"sprice"`
|
||||||
|
Traffic int `json:"traffic"`
|
||||||
|
Caltype int `json:"caltype"`
|
||||||
|
SimType int `json:"simType"`
|
||||||
|
Isdm int `json:"isdm"`
|
||||||
|
Isnm int `json:"isnm"`
|
||||||
|
Istest int `json:"istest"`
|
||||||
|
Isimm int `json:"isimm"`
|
||||||
|
Daynum int `json:"daynum"`
|
||||||
|
} `json:"data"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IotApiQueryUserPkgInfoResult struct {
|
||||||
|
Result IotApiQueryUserPkgInfoResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Err error // 错误
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIotApiQueryUserPkgInfoResult(result IotApiQueryUserPkgInfoResponse, body []byte, err error) *IotApiQueryUserPkgInfoResult {
|
||||||
|
return &IotApiQueryUserPkgInfoResult{Result: result, Body: body, Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IotApiQueryUserPkgInfo 账户可用流量包查询
|
||||||
|
// https://www.showdoc.com.cn/916774523755909/4850094776758927
|
||||||
|
func (app *App) IotApiQueryUserPkgInfo() *IotApiQueryUserPkgInfoResult {
|
||||||
|
// 请求
|
||||||
|
body, err := app.request("http://m2m.eastiot.net/Api/IotApi/queryUserPkgInfo", map[string]interface{}{}, http.MethodPost)
|
||||||
|
// 定义
|
||||||
|
var response IotApiQueryUserPkgInfoResponse
|
||||||
|
err = json.Unmarshal(body, &response)
|
||||||
|
return NewIotApiQueryUserPkgInfoResult(response, body, err)
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package eastiot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IotApiRechargeSimResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IotApiRechargeSimResult struct {
|
||||||
|
Result IotApiRechargeSimResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Err error // 错误
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIotApiRechargeSimResult(result IotApiRechargeSimResponse, body []byte, err error) *IotApiRechargeSimResult {
|
||||||
|
return &IotApiRechargeSimResult{Result: result, Body: body, Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IotApiRechargeSim 单卡流量充值
|
||||||
|
// https://www.showdoc.com.cn/916774523755909/4880284631482420
|
||||||
|
func (app *App) IotApiRechargeSim(notMustParams ...Params) *IotApiRechargeSimResult {
|
||||||
|
// 参数
|
||||||
|
params := app.NewParamsWith(notMustParams...)
|
||||||
|
// 请求
|
||||||
|
body, err := app.request("http://m2m.eastiot.net/Api/IotApi/rechargeSim", params, http.MethodPost)
|
||||||
|
// 定义
|
||||||
|
var response IotApiRechargeSimResponse
|
||||||
|
err = json.Unmarshal(body, &response)
|
||||||
|
return NewIotApiRechargeSimResult(response, body, err)
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package eastiot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IotApiQueryUserBalanceResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Data struct {
|
||||||
|
Balance float64 `json:"balance"`
|
||||||
|
} `json:"data"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IotApiQueryUserBalanceResult struct {
|
||||||
|
Result IotApiQueryUserBalanceResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Err error // 错误
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIotApiQueryUserBalanceResult(result IotApiQueryUserBalanceResponse, body []byte, err error) *IotApiQueryUserBalanceResult {
|
||||||
|
return &IotApiQueryUserBalanceResult{Result: result, Body: body, Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IotApiQueryUserBalance 余额查询
|
||||||
|
// https://www.showdoc.com.cn/916774523755909/4857910459512420
|
||||||
|
func (app *App) IotApiQueryUserBalance() *IotApiQueryUserBalanceResult {
|
||||||
|
// 请求
|
||||||
|
body, err := app.request("http://m2m.eastiot.net/Api/IotApi/queryUserBalance", map[string]interface{}{}, http.MethodPost)
|
||||||
|
// 定义
|
||||||
|
var response IotApiQueryUserBalanceResponse
|
||||||
|
err = json.Unmarshal(body, &response)
|
||||||
|
return NewIotApiQueryUserBalanceResult(response, body, err)
|
||||||
|
}
|
Loading…
Reference in new issue