package dao import ( "service/dbstruct" "service/library/logger" "github.com/gin-gonic/gin" "github.com/qiniu/qmgo" ) const ( DBUserIdSeq = "user_id_seq" COLUserIdSeq = "user_id_seq" COLUserIdMap = "user_id_map" DBAccountIdSeq = "account_id_seq" COLAccountIdSeq = "account_id_seq" DBMomentIdSeq = "moment_id_seq" COLMomentIdSeq = "moment_id_seq" DBStreamerAuthApprovalIdSeq = "streamer_auth_approval_id_seq" COLStreamerAuthApprovalIdSeq = "streamer_auth_approval_id_seq" COLStreamerAuthApprovalBasicIdSeq = "streamer_auth_approval_basic_id_seq" COLStreamerAuthApprovalDetailsIdSeq = "streamer_auth_approval_details_id_seq" DBAccountRelationIdSeq = "account_relation_id_seq" COLAccountRelationIdSeq = "account_relation_id_seq" DBMediaIdSeq = "media_id_seq" COLMediaIdSeq = "media_id_seq" DBStreamerLinkIdSeq = "streamer_link_id_seq" COLStreamerLinkIdSeq = "streamer_link_id_seq" DBUserWxAddCheckIdSeq = "user_wx_add_check_id_seq" COLUserWxAddCheckIdSeq = "user_wx_add_check_id_seq" DBRealNameAuthenticationIdSeq = "realname_authentication_id_seq" COLRealNameAuthenticationIdSeq = "realname_authentication_id_seq" DBContactCustomerServiceIdSeq = "contact_customer_service_id_seq" COLContactCustomerServiceIdSeq = "contact_customer_service_id_seq" DBContactCustomerServiceSessionIdSeq = "contact_customer_service_session_id_seq" COLContactCustomerServiceSessionIdSeq = "contact_customer_service_session_id_seq" DBFeedbackIdSeq = "feedback_id_seq" COLFeedbackIdSeq = "feedback_id_seq" DBAccountPunishmentIdSeq = "account_punishment_id_seq" COLAccountPunishmentIdSeq = "account_punishment_id_seq" DBZoneIdSeq = "zone_id_seq" COLZoneIdSeq = "zone_id_seq" DBZoneMomentIdSeq = "zone_moment_id_seq" COLZoneMomentIdSeq = "zone_moment_id_seq" DBZoneCollaboratorIdSeq = "zone_collaborator_id_seq" COLZoneCollaboratorIdSeq = "zone_collaborator_id_seq" DBContentAuditRTI = "content_audit_rti" COLImageAuditRTI = "image_audit_rti" COLTextAuditRTI = "text_audit_rti" COLVideoModerationRTI = "video_moderation_rti" DBRavenIQTestIdSeq = "Raven_IQ_test_id_seq" COLRavenIQTestIdSeq = "Raven_IQ_test_id_seq" DBNotificationIdSeq = "notification_id_seq" COLNotificationIdSeq = "notification_id_seq" ) // UserIdSeq序列表 func (m *Mongo) getColUserIdSeq() *qmgo.Collection { return m.clientMix.Database(DBUserIdSeq).Collection(COLUserIdSeq) } // UserIdMap映射表 func (m *Mongo) getColUserIdMap() *qmgo.Collection { return m.clientMix.Database(DBUserIdSeq).Collection(COLUserIdMap) } // AccountIdSeq序列表 func (m *Mongo) getColAccountIdSeq() *qmgo.Collection { return m.clientMix.Database(DBAccountIdSeq).Collection(COLAccountIdSeq) } // MomentIdSeq序列表 func (m *Mongo) getColMomentIdSeq() *qmgo.Collection { return m.clientMix.Database(DBMomentIdSeq).Collection(COLMomentIdSeq) } // StreamerAuthApprovalIdSeq序列表 func (m *Mongo) getColStreamerAuthApprovalIdSeq() *qmgo.Collection { return m.clientMix.Database(DBStreamerAuthApprovalIdSeq).Collection(COLStreamerAuthApprovalIdSeq) } // StreamerAuthApprovalBasicIdSeq序列表 func (m *Mongo) getColStreamerAuthApprovalBasicIdSeq() *qmgo.Collection { return m.clientMix.Database(DBStreamerAuthApprovalIdSeq).Collection(COLStreamerAuthApprovalBasicIdSeq) } // StreamerAuthApprovalDetailsIdSeq序列表 func (m *Mongo) getColStreamerAuthApprovalDetailsIdSeq() *qmgo.Collection { return m.clientMix.Database(DBStreamerAuthApprovalIdSeq).Collection(COLStreamerAuthApprovalDetailsIdSeq) } // AccountRelationIdSeq序列表 func (m *Mongo) getAccountRelationIdSeq() *qmgo.Collection { return m.clientMix.Database(DBAccountRelationIdSeq).Collection(COLAccountRelationIdSeq) } // StreamerLinkIdSeq序列表 func (m *Mongo) getStreamerLinkIdSeq() *qmgo.Collection { return m.clientMix.Database(DBStreamerLinkIdSeq).Collection(COLStreamerLinkIdSeq) } // UserWxAddCheckIdSeq序列表 func (m *Mongo) getUserWxAddCheckIdSeq() *qmgo.Collection { return m.clientMix.Database(DBUserWxAddCheckIdSeq).Collection(COLUserWxAddCheckIdSeq) } // RealNameAuthenticationIdSeq序列表 func (m *Mongo) getColRealNameAuthenticationIdSeq() *qmgo.Collection { return m.clientMix.Database(DBRealNameAuthenticationIdSeq).Collection(COLRealNameAuthenticationIdSeq) } // ContactCustomerServiceIdSeq序列表 func (m *Mongo) getColContactCustomerServiceIdSeq() *qmgo.Collection { return m.clientMix.Database(DBContactCustomerServiceIdSeq).Collection(COLContactCustomerServiceIdSeq) } // ContactCustomerServiceSessionIdSeq序列表 func (m *Mongo) getColContactCustomerServiceSessionIdSeq() *qmgo.Collection { return m.clientMix.Database(DBContactCustomerServiceSessionIdSeq).Collection(COLContactCustomerServiceIdSeq) } // FeedbackIdSeq序列表 func (m *Mongo) getColFeedbackIdSeq() *qmgo.Collection { return m.clientMix.Database(DBFeedbackIdSeq).Collection(COLFeedbackIdSeq) } // AccountPunishmentIdSeq序列表 func (m *Mongo) getColAccountPunishmentIdSeq() *qmgo.Collection { return m.clientMix.Database(DBAccountPunishmentIdSeq).Collection(COLAccountPunishmentIdSeq) } // ZoneIdSeq序列表 func (m *Mongo) getColZoneIdSeq() *qmgo.Collection { return m.clientMix.Database(DBZoneIdSeq).Collection(COLZoneIdSeq) } // ZoneMomentIdSeq序列表 func (m *Mongo) getColZoneMomentIdSeq() *qmgo.Collection { return m.clientMix.Database(DBZoneMomentIdSeq).Collection(COLZoneMomentIdSeq) } // ZoneCollaboratorIdSeq序列表 func (m *Mongo) getColZoneCollaboratorIdSeq() *qmgo.Collection { return m.clientMix.Database(DBZoneCollaboratorIdSeq).Collection(COLZoneCollaboratorIdSeq) } // 图像审核任务批次号表 func (m *Mongo) getColImageAuditRTI() *qmgo.Collection { return m.clientMix.Database(DBContentAuditRTI).Collection(COLImageAuditRTI) } // 文字审核任务批次号表 func (m *Mongo) getColTextAuditRTI() *qmgo.Collection { return m.clientMix.Database(DBContentAuditRTI).Collection(COLTextAuditRTI) } // 视频审核任务批次号表 func (m *Mongo) getColVideoModerationRTI() *qmgo.Collection { return m.clientMix.Database(DBContentAuditRTI).Collection(COLVideoModerationRTI) } // AccountIdSeq序列表 func (m *Mongo) getColRavenIQTestIdSeq() *qmgo.Collection { return m.clientMix.Database(DBRavenIQTestIdSeq).Collection(COLRavenIQTestIdSeq) } // NotificationIdSeq序列表 func (m *Mongo) getColNotificationIdSeq() *qmgo.Collection { return m.clientMix.Database(DBNotificationIdSeq).Collection(COLNotificationIdSeq) } // NotifReceiveIdSeq序列表 func (m *Mongo) getColNotifReceiveIdSeq() *qmgo.Collection { return m.clientMix.Database(DBNotification).Collection(COLNotifReceiveIdSeq) } // account_id发号器 func (m *Mongo) GetAndUpdateAccountIdSeq(ctx *gin.Context) (accountIdSeq *dbstruct.AccountIdSeq, err error) { col := m.getColAccountIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } accountIdSeqInstance := dbstruct.AccountIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "account_id_seq_id"}).Apply(change, &accountIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &accountIdSeqInstance, err } // user_id发号器 func (m *Mongo) GetAndUpdateUserIdSeq(ctx *gin.Context) (userIdSeq *dbstruct.UserIdSeq, err error) { col := m.getColUserIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } userIdSeqInstance := dbstruct.UserIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "user_id_seq_id"}).Apply(change, &userIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &userIdSeqInstance, err } // user_id映射 func (m *Mongo) GetMappedUserId(ctx *gin.Context, userIdSeq int64) (*dbstruct.UserIdMap, error) { userIdMap := &dbstruct.UserIdMap{} col := m.getColUserIdMap() query := qmgo.M{ "_id": userIdSeq, } err := col.Find(ctx, query).One(&userIdMap) return userIdMap, err } // moment_id发号器 func (m *Mongo) GetAndUpdateMomentIdSeq(ctx *gin.Context) (momentIdSeq *dbstruct.MomentIdSeq, err error) { col := m.getColMomentIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } momentIdSeqInstance := dbstruct.MomentIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "moment_id_seq_id"}).Apply(change, &momentIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &momentIdSeqInstance, err } // streamer_auth_approval_id发号器 func (m *Mongo) GetAndUpdateStreamerAuthApprovalIdSeq(ctx *gin.Context) (streamer_auth_approvalIdSeq *dbstruct.StreamerAuthApprovalIdSeq, err error) { col := m.getColStreamerAuthApprovalIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } streamerAuthApprovalIdSeqInstance := dbstruct.StreamerAuthApprovalIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "streamer_auth_approval_id_seq_id"}).Apply(change, &streamerAuthApprovalIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &streamerAuthApprovalIdSeqInstance, err } // streamer_auth_approval_basic_id发号器 func (m *Mongo) GetAndUpdateStreamerAuthApprovalBasicIdSeq(ctx *gin.Context) (idSeq *dbstruct.StreamerAuthApprovalBasicIdSeq, err error) { col := m.getColStreamerAuthApprovalBasicIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } instance := dbstruct.StreamerAuthApprovalBasicIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "streamer_auth_approval_basic_id_seq_id"}).Apply(change, &instance); err != nil { logger.Error("change error : %v", err) return } return &instance, err } // streamer_auth_approval_details_id发号器 func (m *Mongo) GetAndUpdateStreamerAuthApprovalDetailsIdSeq(ctx *gin.Context) (idSeq *dbstruct.StreamerAuthApprovalDetailsIdSeq, err error) { col := m.getColStreamerAuthApprovalDetailsIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } instance := dbstruct.StreamerAuthApprovalDetailsIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "streamer_auth_approval_details_id_seq_id"}).Apply(change, &instance); err != nil { logger.Error("change error : %v", err) return } return &instance, err } // account_relation_id发号器 func (m *Mongo) GetAndUpdateAccountRelationIdSeq(ctx *gin.Context) (accountRelationIdSeq *dbstruct.AccountRelationIdSeq, err error) { col := m.getAccountRelationIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } accountRelationIdSeqInstance := dbstruct.AccountRelationIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "account_relation_id_seq_id"}).Apply(change, &accountRelationIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &accountRelationIdSeqInstance, err } // streamer_link_id发号器 func (m *Mongo) GetAndUpdateStreamerLinkIdSeq(ctx *gin.Context) (streamerLinkIdSeq *dbstruct.StreamerLinkIdSeq, err error) { col := m.getStreamerLinkIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } streamerLinkIdSeqInstance := dbstruct.StreamerLinkIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "streamer_link_id_seq_id"}).Apply(change, &streamerLinkIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &streamerLinkIdSeqInstance, err } // user_wx_add_check_id发号器 func (m *Mongo) GetAndUpdateUserWxAddCheckIdSeq(ctx *gin.Context) (userWxAddCheckIdSeq *dbstruct.UserWxAddCheckIdSeq, err error) { col := m.getUserWxAddCheckIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } userWxAddCheckIdSeqInstance := dbstruct.UserWxAddCheckIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "user_wx_add_check_id_seq_id"}).Apply(change, &userWxAddCheckIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &userWxAddCheckIdSeqInstance, err } // realname_authentication_id发号器 func (m *Mongo) GetAndUpdateRealNameAuthenticationIdSeq(ctx *gin.Context) (realname_authenticationIdSeq *dbstruct.RealNameAuthenticationIdSeq, err error) { col := m.getColRealNameAuthenticationIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } realNameAuthenticationIdSeqInstance := dbstruct.RealNameAuthenticationIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "realname_authentication_id_seq_id"}).Apply(change, &realNameAuthenticationIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &realNameAuthenticationIdSeqInstance, err } // contact_customer_service_id发号器 func (m *Mongo) GetAndUpdateContactCustomerServiceIdSeq(ctx *gin.Context) (contactCustomerServiceIdSeq *dbstruct.ContactCustomerServiceIdSeq, err error) { col := m.getColContactCustomerServiceIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } contactCustomerServiceIdSeqInstance := dbstruct.ContactCustomerServiceIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "contact_customer_service_id_seq_id"}).Apply(change, &contactCustomerServiceIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &contactCustomerServiceIdSeqInstance, err } // contact_customer_service_session_id发号器 func (m *Mongo) GetAndUpdateContactCustomerServiceSessionIdSeq(ctx *gin.Context) (sessionIdSeq *dbstruct.ContactCustomerServiceSessionIdSeq, err error) { col := m.getColContactCustomerServiceSessionIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } contactCustomerServiceSessionIdSeqInstance := dbstruct.ContactCustomerServiceSessionIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "contact_customer_service_session_id_seq_id"}).Apply(change, &contactCustomerServiceSessionIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &contactCustomerServiceSessionIdSeqInstance, err } // feedback_id发号器 func (m *Mongo) GetAndUpdateFeedbackIdSeq(ctx *gin.Context) (feedbackIdSeq *dbstruct.FeedbackIdSeq, err error) { col := m.getColFeedbackIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } feedbackIdSeqInstance := dbstruct.FeedbackIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "feedback_id_seq_id"}).Apply(change, &feedbackIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &feedbackIdSeqInstance, err } // media_id发号器 func (m *Mongo) GetAndUpdateMediaSeq(ctx *gin.Context) (mediaIdSeq *dbstruct.MediaIdSeq, err error) { col := m.getColMomentIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } mediaIdSeqInstance := dbstruct.MediaIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "media_id_seq_id"}).Apply(change, &mediaIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &mediaIdSeqInstance, err } // accountpunishment_id发号器 func (m *Mongo) GetAndUpdateAccountPunishmentIdSeq(ctx *gin.Context) (accountpunishmentIdSeq *dbstruct.AccountPunishmentIdSeq, err error) { col := m.getColAccountPunishmentIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } accountpunishmentIdSeqInstance := dbstruct.AccountPunishmentIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "account_punishment_id_seq_id"}).Apply(change, &accountpunishmentIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &accountpunishmentIdSeqInstance, err } // zone_id发号器 func (m *Mongo) GetAndUpdateZoneIdSeq(ctx *gin.Context) (zoneIdSeq *dbstruct.ZoneIdSeq, err error) { col := m.getColZoneIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } zoneIdSeqInstance := dbstruct.ZoneIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "zone_id_seq_id"}).Apply(change, &zoneIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &zoneIdSeqInstance, err } // zone_moment_id发号器 func (m *Mongo) GetAndUpdateZoneMomentIdSeq(ctx *gin.Context) (zoneMomentIdSeq *dbstruct.ZoneMomentIdSeq, err error) { col := m.getColZoneMomentIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } zoneMomentIdSeqInstance := dbstruct.ZoneMomentIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "zone_moment_id_seq_id"}).Apply(change, &zoneMomentIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &zoneMomentIdSeqInstance, err } // zone_collaborator_id发号器 func (m *Mongo) GetAndUpdateZoneCollaboratorIdSeq(ctx *gin.Context) (zoneCollaboratorIdSeq *dbstruct.ZoneCollaboratorIdSeq, err error) { col := m.getColZoneCollaboratorIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } zoneCollaboratorIdSeqInstance := dbstruct.ZoneCollaboratorIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "zone_collaborator_id_seq_id"}).Apply(change, &zoneCollaboratorIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return &zoneCollaboratorIdSeqInstance, err } // 图像审核任务批次号 func (m *Mongo) GetAndUpdateImageAuditBatchId(ctx *gin.Context, batchId string) (imageAuditBatchId *dbstruct.ImageAuditBatchId, err error) { col := m.getColImageAuditRTI() change := qmgo.Change{ Update: qmgo.M{"$set": qmgo.M{"batch_id": batchId}}, Upsert: true, ReturnNew: false, } imageAuditBatchIdInstance := dbstruct.ImageAuditBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).Apply(change, &imageAuditBatchIdInstance); err != nil { logger.Error("change error : %v", err) return } return &imageAuditBatchIdInstance, err } // 文字审核任务批次号 func (m *Mongo) GetAndUpdateTextAuditBatchId(ctx *gin.Context, batchId string) (textAuditBatchId *dbstruct.TextAuditBatchId, err error) { col := m.getColTextAuditRTI() change := qmgo.Change{ Update: qmgo.M{"$set": qmgo.M{"batch_id": batchId}}, Upsert: true, ReturnNew: false, } textAuditBatchIdInstance := dbstruct.TextAuditBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).Apply(change, &textAuditBatchIdInstance); err != nil { logger.Error("change error : %v", err) return } return &textAuditBatchIdInstance, err } // 视频审核任务批次号 func (m *Mongo) GetAndUpdateVideoModerationBatchId(ctx *gin.Context, batchId string) (videoModerationBatchId *dbstruct.VideoModerationBatchId, err error) { col := m.getColVideoModerationRTI() change := qmgo.Change{ Update: qmgo.M{"$set": qmgo.M{"batch_id": batchId}}, Upsert: true, ReturnNew: false, } videoModerationBatchIdInstance := dbstruct.VideoModerationBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).Apply(change, &videoModerationBatchIdInstance); err != nil { logger.Error("change error : %v", err) return } return &videoModerationBatchIdInstance, err } // 图像审核任务批次号 func (m *Mongo) GetImageAuditBatchId(ctx *gin.Context) (imageAuditBatchId *dbstruct.ImageAuditBatchId, err error) { col := m.getColImageAuditRTI() imageAuditBatchId = &dbstruct.ImageAuditBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).One(imageAuditBatchId); err != nil { logger.Error("find error : %v", err) return } return } // 文字审核任务批次号 func (m *Mongo) GetTextAuditBatchId(ctx *gin.Context) (textAuditBatchId *dbstruct.TextAuditBatchId, err error) { col := m.getColTextAuditRTI() textAuditBatchId = &dbstruct.TextAuditBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).One(&textAuditBatchId); err != nil { logger.Error("find error : %v", err) return } return } // 视频审核任务批次号 func (m *Mongo) GetVideoModerationBatchId(ctx *gin.Context) (videoModerationBatchId *dbstruct.VideoModerationBatchId, err error) { col := m.getColVideoModerationRTI() videoModerationBatchId = &dbstruct.VideoModerationBatchId{} if err = col.Find(ctx, qmgo.M{"_id": "batch_id"}).One(&videoModerationBatchId); err != nil { logger.Error("find error : %v", err) return } return } // Raven_IQ_test_id发号器 func (m *Mongo) GetAndUpdateRavenIQTestIdSeq(ctx *gin.Context) (Raven_IQ_testIdSeq *dbstruct.RavenIQTestIdSeq, err error) { col := m.getColRavenIQTestIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } instance := dbstruct.RavenIQTestIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "Raven_IQ_test_id_seq_id"}).Apply(change, &instance); err != nil { logger.Error("change error : %v", err) return } return &instance, err } // notification_id发号器 func (m *Mongo) GetAndUpdateNotificationIdSeq(ctx *gin.Context) (notificationIdSeq *dbstruct.NotificationIdSeq, err error) { col := m.getColNotificationIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } notificationIdSeqInstance := dbstruct.NotificationIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "notification_id_seq_id"}).Apply(change, ¬ificationIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return ¬ificationIdSeqInstance, err } // notif_receive_id发号器 func (m *Mongo) GetAndUpdateNotifReceiveIdSeq(ctx *gin.Context) (notifReceiveIdSeq *dbstruct.NotifReceiveIdSeq, err error) { col := m.getColNotifReceiveIdSeq() change := qmgo.Change{ Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, Upsert: true, ReturnNew: false, } notifReceiveIdSeqInstance := dbstruct.NotifReceiveIdSeq{} if err = col.Find(ctx, qmgo.M{"_id": "notif_receive_id_seq_id"}).Apply(change, ¬ifReceiveIdSeqInstance); err != nil { logger.Error("change error : %v", err) return } return ¬ifReceiveIdSeqInstance, err }