package sociaty import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) // 签到 func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.SociatySignReq) (code pb.ErrorCode) { if req.SociatyId == "" { code = pb.ErrorCode_ReqParameterError } return } func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (code pb.ErrorCode, data proto.Message) { if code = this.SignCheck(session, req); code != pb.ErrorCode_Success { return } uid := session.GetUserId() sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) if sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound this.module.Errorf("sociatyId: %s no found", req.SociatyId) return } if err := this.module.modelSociaty.sign(uid, sociaty); err != nil { code = pb.ErrorCode_SociatyAgree this.module.Errorf("签到失败:%v", err) return } //发奖 rsp := &pb.SociatySignResp{ Uid: uid, SociatyId: req.SociatyId, } if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSign, rsp); err != nil { code = pb.ErrorCode_SystemError } return }