Skip to content

查询历史账号报错:Format Error: account-id. #30

Open
@isaacwu666

Description

@isaacwu666

错误 :Get account history error: {"status":"error","err-code":"validation-format-error","err-msg":"Format Error: account-id.","data":null}
``

var (
	AccessKey = "xxx-xxx-xxx-xxx"
	SecretKey = "xxx-xxxx-xxxx-xxxx"
	accountId int64
)
/**
财务流水
*/
func (controller *Index) GetAccountHistory(r *ghttp.Request) {

	client := new(client.AccountClient).Init(AccessKey, SecretKey, config.Host)
	//if accountId == 0 {
	info, err := client.GetAccountInfo()
	applogger.Info("Get account ledger error: ", info)
	if err == nil {

		for _, accountInfo := range info {
			if accountInfo.Type == "spot" {
				accountId = (accountInfo.Id)
			}
		}

	} else {
		base.Error(r, "Get account ledger error"+err.Error())
		return
	}
	//}
	fmt.Println(accountId)
	getAccountHistoryOptionalRequest := account.GetAccountHistoryOptionalRequest{}

	resp, err := client.GetAccountHistory(string((accountId)), getAccountHistoryOptionalRequest)
	if err != nil {
		applogger.Error("Get account history error: %s", err)
		base.Error(r, "Get account history error"+err.Error())
		return
	} else {
		applogger.Info("Get account history, count=%d", len(resp))

		base.Succ(r, g.Map{"list": resp, "form": nil})
	}

	return
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions