package models import "strings" type UnisHttpRequest struct { ResC chan *UnisHttpResponse ResP *UnisHttpResponse Id string Msg interface{} } func (u *UnisHttpRequest) SetReqParam(id string, msg interface{}) { u.Id = id u.Msg = msg } type UnisHttpResponse struct { Code int Msg interface{} Data interface{} } func (u *UnisHttpResponse) SetResParam(code int, msg, data interface{}) { u.Code = code u.Msg = msg u.Data = data } type UnisHttpClientRequest struct { Url string Methord string Id string Msg interface{} } type UnisHttpClientResponse struct { Url string Methord string Id string Msg interface{} } type UnisHttpUrl string const UnisHttpUrlPrefix = "/api/unis" func (u UnisHttpUrl) Url() string { return strings.TrimPrefix(string(u), UnisHttpUrlPrefix) } const ( UNIS_HTTP_URL_CONFIG_ADD UnisHttpUrl = "/api/unis/config/v1/add" ) func (u UnisHttpUrl) GetMsgId() string { return mapHttpUrlId[u] } type UnisHttpMsgId string const ( UNIS_HTTP_ID_CONFIG_ADD UnisHttpMsgId = "/api/unis/config/v1/add" ) var mapHttpUrlId = map[UnisHttpUrl]string{ UNIS_HTTP_URL_CONFIG_ADD: string(UNIS_HTTP_ID_CONFIG_ADD), } var UnisHttpResponseOk = &UnisHttpResponse{Code: int(CodeSuccess), Msg: CodeSuccess.String()}