增加用户注销功能
This commit is contained in:
		| @@ -3,15 +3,16 @@ package agent | ||||
| import ( | ||||
| 	"context" | ||||
| 	"fmt" | ||||
| 	"github.com/pkg/errors" | ||||
| 	"github.com/zeromicro/go-zero/core/stores/redis" | ||||
| 	"github.com/zeromicro/go-zero/core/stores/sqlx" | ||||
| 	"time" | ||||
| 	"tydata-server/app/user/model" | ||||
| 	jwtx "tydata-server/common/jwt" | ||||
| 	"tydata-server/common/xerr" | ||||
| 	"tydata-server/pkg/lzkit/lzUtils" | ||||
|  | ||||
| 	"github.com/pkg/errors" | ||||
| 	"github.com/zeromicro/go-zero/core/stores/redis" | ||||
| 	"github.com/zeromicro/go-zero/core/stores/sqlx" | ||||
|  | ||||
| 	"tydata-server/app/user/cmd/api/internal/svc" | ||||
| 	"tydata-server/app/user/cmd/api/internal/types" | ||||
|  | ||||
| @@ -79,11 +80,16 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type | ||||
| 			} | ||||
| 		} | ||||
| 		userID = user.Id | ||||
| 		agentAuditModel, findAgentAuditErr := l.svcCtx.AgentAuditModel.FindOneByUserId(transCtx, user.Id) | ||||
| 		if findAgentAuditErr != nil && !errors.Is(findAgentAuditErr, model.ErrNotFound) { | ||||
|  | ||||
| 		// 使用SelectBuilder构建查询,查找符合user_id的记录并按创建时间降序排序获取最新一条 | ||||
| 		builder := l.svcCtx.AgentAuditModel.SelectBuilder().Where("user_id = ?", user.Id).OrderBy("create_time DESC").Limit(1) | ||||
| 		agentAuditList, findAgentAuditErr := l.svcCtx.AgentAuditModel.FindAll(transCtx, builder, "") | ||||
| 		if findAgentAuditErr != nil { | ||||
| 			return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 查找审核列表失败%+v", findAgentAuditErr) | ||||
| 		} | ||||
| 		if agentAuditModel != nil { | ||||
|  | ||||
| 		if len(agentAuditList) > 0 { | ||||
| 			agentAuditModel := agentAuditList[0] | ||||
| 			if agentAuditModel.Status == 0 { | ||||
| 				return errors.Wrapf(xerr.NewErrMsg("您的代理申请中"), "代理申请, 代理申请中") | ||||
| 			} else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user