Browse Source

feat: 候选客户提交校验

zhangxinlei1996 1 year ago
parent
commit
ca75eba5fd
1 changed files with 8 additions and 9 deletions
  1. 8 9
      service/util.go

+ 8 - 9
service/util.go

@@ -21,7 +21,7 @@ func CanAdd(entId int64, key string, employInfoId, employCustomId, positionId in
 	if (len(*tenantData) == 0) || (len(*tenantData) > 0 && gconv.Int((*tenantData)[0][key]) == 0) {
 		employInfoIdArr := []int64{}
 		if employInfoId > 0 {
-			employ_info := cm.BaseMysql.SelectBySql(`select id from crm.employ_info where source_id =(SELECT source_id FROM crm.employ_info WHERE id =?)`, employInfoId)
+			employ_info := cm.BaseMysql.SelectBySql(`select id from crm.employ_info where source_id =(SELECT source_id FROM crm.employ_info WHERE id =?) and status=1`, employInfoId)
 			if employ_info != nil && len(*employ_info) > 0 {
 				for _, v := range *employ_info {
 					employInfoIdArr = append(employInfoIdArr, gconv.Int64(v["id"]))
@@ -71,16 +71,15 @@ func CanAdd(entId int64, key string, employInfoId, employCustomId, positionId in
 				}
 			} else if employCustomId > 0 {
 				employCustomIdArr := []int64{}
-				if employInfoId > 0 {
-					employ_info := cm.BaseMysql.SelectBySql(`select id from crm.employ_custom where company_id =(SELECT company_id FROM crm.employ_custom WHERE id =?)`, employCustomId)
-					if employ_info != nil && len(*employ_info) > 0 {
-						for _, v := range *employ_info {
-							employInfoIdArr = append(employInfoIdArr, gconv.Int64(v["id"]))
-						}
-					} else {
-						employCustomIdArr = []int64{employCustomId}
+				employ_info := cm.BaseMysql.SelectBySql(`select id from crm.employ_custom where company_id =(SELECT company_id FROM crm.employ_custom WHERE id =?)`, employCustomId)
+				if employ_info != nil && len(*employ_info) > 0 {
+					for _, v := range *employ_info {
+						employCustomIdArr = append(employCustomIdArr, gconv.Int64(v["id"]))
 					}
+				} else {
+					employCustomIdArr = []int64{employCustomId}
 				}
+
 				args, ws := GetInForCommaArr(employCustomIdArr)
 				args = append(args, entId)
 				d := cm.BaseMysql.SelectBySql(`select create_person,position_id from crm.custom where   employ_custom_id in( `+ws+`) and ent_id =? `, args...)