Ai
7 Star 43 Fork 44

王布衣/gotdx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ex_cmd1.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-05-07 06:58 +08:00 . 调整目录结构
package ext
import (
"gitee.com/quant1x/gotdx/internal"
"gitee.com/quant1x/gotdx/proto/std"
)
// ExCmd1Request 请求包结构
type ExCmd1Request struct {
Cmd []byte `struc:"[92]byte" json:"cmd"`
}
// Marshal 请求包序列化输出
func (req *ExCmd1Request) Marshal() ([]byte, error) {
return std.DefaultMarshal(req)
}
// ExCmd1Response 响应包结构
type ExCmd1Response struct {
Unknown []byte `json:"unknown"`
Reply string `json:"reply"`
}
func (resp *ExCmd1Response) Unmarshal(data []byte) error {
//resp.Unknown = data
resp.Reply = internal.Utf8ToGbk(data[3:53])
return nil
}
// NewExCmd1Request 创建ExCmd1请求包
func NewExCmd1Request() (*ExCmd1Request, error) {
hexString := "01 01 48 65 00 01 52 00 52 00 54 24 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 1f 32 c6 e5 d5 3d fb 41 cc e1 6d ff d5 ba 3f b8 cb c5 7a 05 4f 77 48 ea"
//hexString := "01 01 48 65 00 01 02 00 02 00 55 24"
request := &ExCmd1Request{
Cmd: internal.HexString2Bytes(hexString),
}
return request, nil
}
func NewExCmd1() (*ExCmd1Request, *ExCmd1Response, error) {
var response ExCmd1Response
var request, err = NewExCmd1Request()
return request, &response, err
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gotdx.git
git@gitee.com:quant1x/gotdx.git
quant1x
gotdx
gotdx
v1.23.15

搜索帮助