浏览代码

过滤空值

xuzhiheng 2 年之前
父节点
当前提交
5a7cd52d6e
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      service/service.go

+ 7 - 0
service/service.go

@@ -22,6 +22,13 @@ import (
 
 func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp {
 	timeStr, ok, id, msg, code := time.Now().Format("2006-01-02 15:04:05"), false, int64(0), "", int64(0)
+	if this.EntUserId == "" {
+		return &entmanageapplication.AddUsePersonResp{
+			ErrorCode: -1,
+			ErrorMsg:  "添加失败",
+			Data:      &entmanageapplication.AddUsePerson{Status: int64(-1)},
+		}
+	}
 	UserArr := strings.Split(this.EntUserId, ",")
 	sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
 	if sourceData != nil && len(*sourceData) > 0 {