go_dreamfactory/modules/sociaty/api_cross_applycancel.go
2022-10-31 15:12:35 +08:00

38 lines
978 B
Go

package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) ApplyCancelCheck(session comm.IUserSession, req *pb.SociatyApplyCancelReq) (code pb.ErrorCode) {
if req.SociatyId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) ApplyCancel(session comm.IUserSession, req *pb.SociatyApplyCancelReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ApplyCancelCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
if err := this.module.modelSociaty.applyCancel(uid, req.SociatyId); err != nil {
code = pb.ErrorCode_SociatyApplyCanel
this.module.Errorf("申请撤销失败:%v", err)
return
}
rsp := &pb.SociatyApplyResp{
Uid: uid,
ScoiatyId: req.SociatyId,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyCanel, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}