package library import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) //参数校验 func (this *apiComp) ActivationFetterCheck(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (code pb.ErrorCode) { if req.Oid == "" { code = pb.ErrorCode_ReqParameterError } return } func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (code pb.ErrorCode, data *pb.ErrorData) { code = this.ActivationFetterCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } rsp := &pb.LibraryActivationFetterResp{} defer session.SendMsg(string(this.module.GetType()), LibraryActivationFetterResp, rsp) fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid) if fetter == nil { code = pb.ErrorCode_LibraryNoData return } if fetter.Activation { code = pb.ErrorCode_LibraryActivation return } fetter.Activation = true mapData := make(map[string]interface{}, 0) mapData["activation"] = fetter.Activation rsp.Data = fetter return }