Quellcode durchsuchen

fix:修复审核企业列表审核状态

zhangxinlei1996 vor 3 Jahren
Ursprung
Commit
d157bb5a41
7 geänderte Dateien mit 39 neuen und 31 gelöschten Zeilen
  1. BIN
      api/api
  2. 14 11
      entity/ent.go
  3. 6 1
      rpc/etc/usercenter.yaml
  4. 2 2
      rpc/internal/logic/checkentlogic.go
  5. 2 2
      rpc/internal/logic/entexaminelogic.go
  6. BIN
      rpc/rpc
  7. 15 15
      service/entService.go

BIN
api/api


+ 14 - 11
entity/ent.go

@@ -213,6 +213,7 @@ func (this *EntInfo) Add() (bool, int64) {
 			"regPhone":         this.Phone,
 			"entId":            this.Id,
 			"organizationType": this.Organization_type,
+			"authStatus":       1,
 		})
 		return this.Id > 0 && ok_2 > -1 && ok_3 > -1 && deptId > 0 && this.User_id > 0 && deptUser > -1 && userRole > -1 && AuthRecordId > 0
 	}), int64(this.Id)
@@ -256,17 +257,19 @@ func (this *EntInfo) Update() bool {
 			"id": this.Id,
 		}, m)
 		AuthRecordId := this.Mysql.InsertByTx(tx, Auth_record, map[string]interface{}{
-			"entId":          this.Id,
-			"creditCode":     this.Code,
-			"name":           this.Name,
-			"comPanyType":    this.Auth_type,
-			"areaNumber":     this.AreaNumber,
-			"business":       this.License,
-			"officialLetter": this.Official_letter,
-			"authName":       this.Linkman_name,
-			"authPhone":      this.Linkman_phone,
-			"authTime":       time.Now().Format(Date_Full_Layout), //提交时间
-			"regPhone":       this.Phone,
+			"entId":            this.Id,
+			"creditCode":       this.Code,
+			"name":             this.Name,
+			"comPanyType":      this.Auth_type,
+			"areaNumber":       this.AreaNumber,
+			"business":         this.License,
+			"officialLetter":   this.Official_letter,
+			"authName":         this.Linkman_name,
+			"authPhone":        this.Linkman_phone,
+			"authTime":         time.Now().Format(Date_Full_Layout), //提交时间
+			"regPhone":         this.Phone,
+			"authStatus":       1,
+			"organizationType": this.Organization_type,
 		})
 		return ok_1 && AuthRecordId > 0
 	})

+ 6 - 1
rpc/etc/usercenter.yaml

@@ -22,4 +22,9 @@ Mysql:
   userName: root
   passWord: Topnet123
   maxOpenConns: 5
-  maxIdleConns: 5
+  maxIdleConns: 5
+Logx:
+  Mode: console #console|file|volume
+  Path: logs
+  Level: info #info|error|severe
+  KeepDays: 100

+ 2 - 2
rpc/internal/logic/checkentlogic.go

@@ -26,9 +26,9 @@ func NewCheckEntLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckEnt
 // 查看企业状态
 func (l *CheckEntLogic) CheckEnt(in *pb.CheckEntReq) (*pb.CheckEntResp, error) {
 	// todo: add your logic here and delete this line
-	authStatus, frozenStatus, msg := Entservice.CheckEnt(in)
+	authStatus, frozenStatus, msg, code := Entservice.CheckEnt(in)
 	return &pb.CheckEntResp{
-		ErrorCode: 1,
+		ErrorCode: code,
 		ErrorMsg:  msg,
 		Data: &pb.CheckEntRespCheckData{
 			AuthStatus:   authStatus,

+ 2 - 2
rpc/internal/logic/entexaminelogic.go

@@ -26,12 +26,12 @@ func NewEntExamineLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EntExa
 // 机构审核
 func (l *EntExamineLogic) EntExamine(in *pb.ExamineReq) (*pb.ExamineResp, error) {
 	// todo: add your logic here and delete this line
-	code, msg := Entservice.Examinet(in)
+	status, msg, code := Entservice.Examinet(in)
 	return &pb.ExamineResp{
 		ErrorCode: code,
 		ErrorMsg:  msg,
 		Data: &pb.ExamineResp_ExamineData{
-			Status: code,
+			Status: status,
 		},
 	}, nil
 }

BIN
rpc/rpc


+ 15 - 15
service/entService.go

@@ -79,7 +79,7 @@ func (this *EntService) CreateEnt(data *userCenter.EntAuthReq) (int64, string, i
 			entinfo.Id = int(id)
 			entinfo.Phone = phone //更换注册人手机号为管理员手机号
 			if entinfo.Update() {
-				return 1, OKMSG, 1, int64(entinfo.Id)
+				return entity.SuccessCode, OKMSG, 1, int64(entinfo.Id)
 			}
 		}
 	}
@@ -95,7 +95,7 @@ func (this *EntService) CreateEnt(data *userCenter.EntAuthReq) (int64, string, i
 			//该企业下员工 可以重新认证
 			if ent_name != entinfo.Name { //企业名称不同 创建全新企业
 				if ok, entid := entinfo.Add(); ok {
-					return 1, OKMSG, 1, entid
+					return entity.SuccessCode, OKMSG, 1, entid
 				}
 			}
 			if audit_status == 1 {
@@ -111,20 +111,20 @@ func (this *EntService) CreateEnt(data *userCenter.EntAuthReq) (int64, string, i
 			entinfo.Id = int(id)
 			entinfo.Phone = phone //更换注册人手机号为管理员手机号
 			if entinfo.Update() {
-				return 1, OKMSG, 1, int64(entinfo.Id)
+				return entity.SuccessCode, OKMSG, 1, int64(entinfo.Id)
 			}
 		}
 	}
 	if ok, id := entinfo.Add(); ok {
-		return 1, OKMSG, 1, id
+		return entity.SuccessCode, OKMSG, 1, id
 	}
 	return entity.ErrorCode, "", entity.ErrorCode, 0
 }
 
 //机构审核
-func (this *EntService) Examinet(data *userCenter.ExamineReq) (int64, string) {
+func (this *EntService) Examinet(data *userCenter.ExamineReq) (int64, string, int64) {
 	if data.EntId == 0 || data.ExamineId == "" {
-		return -1, "参数异常"
+		return -1, "参数异常", 0
 	}
 	info := &entity.Examine{
 		ExamineId:   data.ExamineId,
@@ -136,10 +136,10 @@ func (this *EntService) Examinet(data *userCenter.ExamineReq) (int64, string) {
 		ResourceLib: entity.ResourceLib,
 	}
 	if info.EntExamine() {
-		return 1, ""
+		return 1, "", 0
 	}
 	//修改状态
-	return -1, "修改失败"
+	return -1, "修改失败", -1
 }
 
 //企业列表
@@ -176,7 +176,7 @@ func (this *EntService) EntList(data *userCenter.EntListReq) (int64, string, *us
 			FrozenStatus:     common.Int64All(v["frozenStatus"]),
 		})
 	}
-	return 1, "", &userCenter.EntData{
+	return 0, "", &userCenter.EntData{
 		Count:    count,
 		PageSize: int64(i_pageSize),
 		List:     list,
@@ -213,20 +213,20 @@ func (this *EntService) ExamineList(data *userCenter.ExamineListReq) (int64, str
 			RegPhone:    common.ObjToString(v["regPhone"]),
 		})
 	}
-	return 1, "", &userCenter.ExamineListData{
+	return 0, "", &userCenter.ExamineListData{
 		Count:    count,
 		PageSize: int64(i_pageSize),
 		List:     list,
 	}
 }
 
-func (this *EntService) CheckEnt(data *userCenter.CheckEntReq) (int64, int64, string) {
+func (this *EntService) CheckEnt(data *userCenter.CheckEntReq) (int64, int64, string, int64) {
 	info := &entity.CheckEnt{
 		EntId: data.EntId,
 		Mysql: entity.Mysql,
 	}
 	authStatus, frozenStatus, msg := info.Check()
-	return authStatus, frozenStatus, msg
+	return authStatus, frozenStatus, msg, common.Int64All(common.If(msg == "", entity.SuccessCode, entity.ErrorCode))
 }
 
 //企业信息
@@ -252,7 +252,7 @@ func (this *EntService) Info(data *userCenter.CheckEntReq) (int64, string, *user
 		ContactPhone:     rdata.ContactPhone,
 		AuthType:         rdata.AuthType,
 	}
-	return 1, "", entInfoData
+	return 0, "", entInfoData
 }
 
 func (this *EntService) UpdateEnt(data *userCenter.EntUpdateReq) (int64, string, int64) {
@@ -263,7 +263,7 @@ func (this *EntService) UpdateEnt(data *userCenter.EntUpdateReq) (int64, string,
 		ResourceLib: entity.ResourceLib,
 	}
 	status, msg := info.UpdateEnt()
-	return 1, msg, status
+	return 0, msg, status
 }
 
 func (this *EntService) ExamineInfo(data *userCenter.CheckExamineReq) (int64, string, *userCenter.EntInfoData) {
@@ -289,5 +289,5 @@ func (this *EntService) ExamineInfo(data *userCenter.CheckExamineReq) (int64, st
 		AuditUser:        rdata.AuditUser,
 		AuditTime:        rdata.AuditTime,
 	}
-	return 1, "", entInfoData
+	return 0, "", entInfoData
 }