123456789101112131415161718192021222324252627282930 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package check
- import (
- "adm-task/errors"
- "adm-task/utils"
- "context"
- "fmt"
- "google.golang.org/grpc/status"
- pb_v1 "adm-task/pb/v1"
- )
- func FieldCheck(ctx context.Context, req *pb_v1.FieldCheckRequest) (reply *pb_v1.FieldCheckReply, err error) {
- if req.Content == "" {
- return nil, errors.ParmsError
- }
- reply = &pb_v1.FieldCheckReply{}
- ok, fieldName := utils.CheckField(req.Content)
- if !ok {
- return reply, status.Error(20003, fmt.Sprintf("参数错误:字段%s不存在", fieldName))
- }
- return reply, nil
- }
|