refactor: localize protobuf definitions
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// CreateComment 评论
|
||||
func CommentCreate(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusReply, err error) {
|
||||
func CommentCreate(ctx context.Context, in *pb.CommentItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
RoleValve := &service.ParseOptions{RoleValue: "Mall_Admin"}
|
||||
if in.GetIsComment() == true {
|
||||
@@ -48,7 +48,7 @@ func CommentCreate(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusRep
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Identity: data.Identity,
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// 删除评论
|
||||
func CommentDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
func CommentDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -31,7 +31,7 @@ func CommentDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusRe
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// 产品的评论列表
|
||||
func CommentFetch(ctx context.Context, in *pb.FetchRequest) (reply *pb.CommentListReply, err error) {
|
||||
func CommentFetch(ctx context.Context, in *pb.MallFetchRequest) (reply *pb.CommentListReply, err error) {
|
||||
// valildate request id,identity.
|
||||
if in.GetStoreIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// ModifyComment 修改评论
|
||||
func CommentModify(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusReply, err error) {
|
||||
func CommentModify(ctx context.Context, in *pb.CommentItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -34,7 +34,7 @@ func CommentModify(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusRep
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// ReComment 回复评论
|
||||
func CommentRe(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusReply, err error) {
|
||||
func CommentRe(ctx context.Context, in *pb.CommentItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
auth, err := service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -39,7 +39,7 @@ func CommentRe(ctx context.Context, in *pb.CommentItem) (reply *pb.StatusReply,
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// Forbidden 批量操作
|
||||
func ItemBatchOp(ctx context.Context, in *pb.OpRequest) (reply *pb.StatusReply, err error) {
|
||||
func ItemBatchOp(ctx context.Context, in *pb.OpRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -30,7 +30,7 @@ func ItemBatchOp(ctx context.Context, in *pb.OpRequest) (reply *pb.StatusReply,
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// ItemCreate 创建或更新产品
|
||||
func ItemCreate(ctx context.Context, in *pb.ProductItem) (reply *pb.StatusReply, err error) {
|
||||
func ItemCreate(ctx context.Context, in *pb.ProductItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// 解析授权信息
|
||||
auth, err := service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -48,7 +48,7 @@ func ItemCreate(ctx context.Context, in *pb.ProductItem) (reply *pb.StatusReply,
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Identity: data.Identity,
|
||||
Message: "OK",
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// 删除产品
|
||||
func ItemDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
func ItemDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -31,7 +31,7 @@ func ItemDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// 获取产品列表
|
||||
func ItemFetch(ctx context.Context, in *pb.FetchRequest) (reply *pb.ListReply, err error) {
|
||||
func ItemFetch(ctx context.Context, in *pb.MallFetchRequest) (reply *pb.ListReply, err error) {
|
||||
if in.GetStoreIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// Modify 发布/取消发布 产品
|
||||
func ItemModify(ctx context.Context, in *pb.ModifyRequest) (reply *pb.StatusReply, err error) {
|
||||
func ItemModify(ctx context.Context, in *pb.ModifyRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -30,7 +30,7 @@ func ItemModify(ctx context.Context, in *pb.ModifyRequest) (reply *pb.StatusRepl
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// 添加产品图片
|
||||
func PhotoCreate(ctx context.Context, in *pb.PhotoItem) (reply *pb.StatusReply, err error) {
|
||||
func PhotoCreate(ctx context.Context, in *pb.PhotoItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -39,7 +39,7 @@ func PhotoCreate(ctx context.Context, in *pb.PhotoItem) (reply *pb.StatusReply,
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// 删除产品图片
|
||||
func PhotoDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
func PhotoDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -33,7 +33,7 @@ func PhotoDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusRepl
|
||||
|
||||
// TODO: add your logic code & delete this line.
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// CreateSpec 添加产品规格
|
||||
func SpecCreate(ctx context.Context, in *pb.SpecItem) (reply *pb.StatusReply, err error) {
|
||||
func SpecCreate(ctx context.Context, in *pb.SpecItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -40,7 +40,7 @@ func SpecCreate(ctx context.Context, in *pb.SpecItem) (reply *pb.StatusReply, er
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Identity: data.Identity,
|
||||
Message: "OK",
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// 删除产品规格
|
||||
func SpecDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
func SpecDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -32,7 +32,7 @@ func SpecDelete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply
|
||||
}
|
||||
// TODO: add your logic code & delete this line.
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// 产品规格列表
|
||||
func SpecFetch(ctx context.Context, in *pb.FetchRequest) (reply *pb.SpecReply, err error) {
|
||||
func SpecFetch(ctx context.Context, in *pb.MallFetchRequest) (reply *pb.SpecReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// ModifySpec 修改产品规格
|
||||
func SpecModify(ctx context.Context, in *pb.SpecItem) (reply *pb.StatusReply, err error) {
|
||||
func SpecModify(ctx context.Context, in *pb.SpecItem) (reply *pb.IdentityStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
@@ -37,7 +37,7 @@ func SpecModify(ctx context.Context, in *pb.SpecItem) (reply *pb.StatusReply, er
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
return &pb.IdentityStatusReply{
|
||||
Code: 0,
|
||||
Identity: data.Identity,
|
||||
Message: "OK",
|
||||
|
||||
Reference in New Issue
Block a user