change log-times time type
This commit is contained in:
@@ -158,7 +158,7 @@ type LogItemsRequest struct {
|
|||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
||||||
Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
|
Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
|
||||||
Time string `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"`
|
Time []string `protobuf:"bytes,3,rep,name=time,proto3" json:"time,omitempty"`
|
||||||
HostCode string `protobuf:"bytes,4,opt,name=host_code,json=hostCode,proto3" json:"host_code,omitempty"`
|
HostCode string `protobuf:"bytes,4,opt,name=host_code,json=hostCode,proto3" json:"host_code,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -208,11 +208,11 @@ func (x *LogItemsRequest) GetSize() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LogItemsRequest) GetTime() string {
|
func (x *LogItemsRequest) GetTime() []string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Time
|
return x.Time
|
||||||
}
|
}
|
||||||
return ""
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LogItemsRequest) GetHostCode() string {
|
func (x *LogItemsRequest) GetHostCode() string {
|
||||||
@@ -476,7 +476,7 @@ const file_water_water_proto_rawDesc = "" +
|
|||||||
"\x0fLogItemsRequest\x12\x12\n" +
|
"\x0fLogItemsRequest\x12\x12\n" +
|
||||||
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" +
|
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" +
|
||||||
"\x04size\x18\x02 \x01(\x05R\x04size\x12\x12\n" +
|
"\x04size\x18\x02 \x01(\x05R\x04size\x12\x12\n" +
|
||||||
"\x04time\x18\x03 \x01(\tR\x04time\x12\x1b\n" +
|
"\x04time\x18\x03 \x03(\tR\x04time\x12\x1b\n" +
|
||||||
"\thost_code\x18\x04 \x01(\tR\bhostCode\"T\n" +
|
"\thost_code\x18\x04 \x01(\tR\bhostCode\"T\n" +
|
||||||
"\rAddLogRequest\x12\x1b\n" +
|
"\rAddLogRequest\x12\x1b\n" +
|
||||||
"\thost_code\x18\x01 \x01(\tR\bhostCode\x12\x12\n" +
|
"\thost_code\x18\x01 \x01(\tR\bhostCode\x12\x12\n" +
|
||||||
|
|||||||
Binary file not shown.
@@ -19,7 +19,7 @@ message HostCodeRequest {
|
|||||||
message LogItemsRequest {
|
message LogItemsRequest {
|
||||||
int32 page = 1;
|
int32 page = 1;
|
||||||
int32 size = 2;
|
int32 size = 2;
|
||||||
string time = 3;
|
repeated string time = 3;
|
||||||
string host_code = 4;
|
string host_code = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"lone-services/pkg/modelbase"
|
"lone-services/pkg/modelbase"
|
||||||
"lone-services/pkg/utils"
|
"lone-services/pkg/utils"
|
||||||
|
"lone-services/rpc/water/pb"
|
||||||
"lone-services/services/water/dao"
|
"lone-services/services/water/dao"
|
||||||
|
"lone-services/services/water/internal/svc"
|
||||||
"lone-services/services/water/model"
|
"lone-services/services/water/model"
|
||||||
"lone-services/services/water/validator"
|
"lone-services/services/water/validator"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"lone-services/rpc/water/pb"
|
|
||||||
"lone-services/services/water/internal/svc"
|
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
@@ -45,9 +43,9 @@ func (l *LogItemsLogic) LogItems(in *water.LogItemsRequest) (*water.Response, er
|
|||||||
Page: int(in.Page),
|
Page: int(in.Page),
|
||||||
Size: int(in.Size),
|
Size: int(in.Size),
|
||||||
Eq: map[string]string{"host_code": in.HostCode}}
|
Eq: map[string]string{"host_code": in.HostCode}}
|
||||||
times := strings.Split(in.Time, utils.CentralHorizontalLine)
|
if len(in.Time) == utils.NumberTwo {
|
||||||
if len(times) == utils.NumberTwo {
|
w.Between = map[string][2]string{
|
||||||
w.Between = map[string][2]string{"create_time": {in.Time, in.Time}}
|
"create_time": {in.Time[utils.NumberZero], in.Time[utils.NumberOne]}}
|
||||||
}
|
}
|
||||||
var info []dao.LogInfo
|
var info []dao.LogInfo
|
||||||
items, err := model.LogModel{}.Init().Page(w, &info)
|
items, err := model.LogModel{}.Init().Page(w, &info)
|
||||||
|
|||||||
Reference in New Issue
Block a user