复制项目

This commit is contained in:
kim.dev.6789
2026-01-14 22:35:45 +08:00
parent 305d526110
commit b7f8db7d08
297 changed files with 81784 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"time"
"github.com/openimsdk/tools/db/pagination"
)
// Admin user
type Admin struct {
Account string `bson:"account"`
Password string `bson:"password"`
OperationPassword string `bson:"operation_password"`
FaceURL string `bson:"face_url"`
Nickname string `bson:"nickname"`
UserID string `bson:"user_id"`
Level int32 `bson:"level"`
GoogleAuthKey string `bson:"google_auth_key"`
CreateTime time.Time `bson:"create_time"`
}
func (Admin) TableName() string {
return "admins"
}
type AdminInterface interface {
Create(ctx context.Context, admins []*Admin) error
Take(ctx context.Context, account string) (*Admin, error)
TakeUserID(ctx context.Context, userID string) (*Admin, error)
Update(ctx context.Context, account string, update map[string]any) error
ChangePassword(ctx context.Context, userID string, newPassword string) error
ChangeOperationPassword(ctx context.Context, userID string, newPassword string) error
ClearGoogleAuthKey(ctx context.Context, userID string) error
Delete(ctx context.Context, userIDs []string) error
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*Admin, error)
}

View File

@@ -0,0 +1,49 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"time"
)
type Applet struct {
ID string `bson:"id"`
Name string `bson:"name"`
AppID string `bson:"app_id"`
Icon string `bson:"icon"`
URL string `bson:"url"`
MD5 string `bson:"md5"`
Size int64 `bson:"size"`
Version string `bson:"version"`
Priority uint32 `bson:"priority"`
Status uint8 `bson:"status"`
CreateTime time.Time `bson:"create_time"`
}
func (Applet) TableName() string {
return "applets"
}
type AppletInterface interface {
Create(ctx context.Context, applets []*Applet) error
Del(ctx context.Context, ids []string) error
Update(ctx context.Context, id string, data map[string]any) error
Take(ctx context.Context, id string) (*Applet, error)
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*Applet, error)
FindOnShelf(ctx context.Context) ([]*Applet, error)
FindID(ctx context.Context, ids []string) ([]*Applet, error)
}

View File

@@ -0,0 +1,29 @@
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"go.mongodb.org/mongo-driver/bson/primitive"
"time"
)
type Application struct {
ID primitive.ObjectID `bson:"_id"`
Platform string `bson:"platform"`
Hot bool `bson:"hot"`
Version string `bson:"version"`
Url string `bson:"url"`
Text string `bson:"text"`
Force bool `bson:"force"`
Latest bool `bson:"latest"`
CreateTime time.Time `bson:"create_time"`
}
type ApplicationInterface interface {
LatestVersion(ctx context.Context, platform string) (*Application, error)
AddVersion(ctx context.Context, val *Application) error
UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error
DeleteVersion(ctx context.Context, id []primitive.ObjectID) error
PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*Application, error)
FindPlatform(ctx context.Context, id []primitive.ObjectID) ([]string, error)
}

View File

@@ -0,0 +1,33 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import "context"
// ClientConfig config
type ClientConfig struct {
Key string `bson:"key"`
Value string `bson:"value"`
}
func (ClientConfig) TableName() string {
return "client_config"
}
type ClientConfigInterface interface {
Set(ctx context.Context, config map[string]string) error
Get(ctx context.Context) (map[string]string, error)
Del(ctx context.Context, keys []string) error
}

View File

@@ -0,0 +1,42 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"time"
)
// ForbiddenAccount table
type ForbiddenAccount struct {
UserID string `bson:"user_id"`
Reason string `bson:"reason"`
OperatorUserID string `bson:"operator_user_id"`
CreateTime time.Time `bson:"create_time"`
}
func (ForbiddenAccount) TableName() string {
return "forbidden_accounts"
}
type ForbiddenAccountInterface interface {
Create(ctx context.Context, ms []*ForbiddenAccount) error
Take(ctx context.Context, userID string) (*ForbiddenAccount, error)
Delete(ctx context.Context, userIDs []string) error
Find(ctx context.Context, userIDs []string) ([]*ForbiddenAccount, error)
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*ForbiddenAccount, error)
FindAllIDs(ctx context.Context) ([]string, error)
}

View File

@@ -0,0 +1,40 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"time"
)
type InvitationRegister struct {
InvitationCode string `bson:"invitation_code"`
UsedByUserID string `bson:"used_by_user_id"`
CreateTime time.Time `bson:"create_time"`
}
func (InvitationRegister) TableName() string {
return "invitation_registers"
}
type InvitationRegisterInterface interface {
Find(ctx context.Context, codes []string) ([]*InvitationRegister, error)
Del(ctx context.Context, codes []string) error
Create(ctx context.Context, v []*InvitationRegister) error
Take(ctx context.Context, code string) (*InvitationRegister, error)
Update(ctx context.Context, code string, data map[string]any) error
Search(ctx context.Context, keyword string, state int32, userIDs []string, codes []string, pagination pagination.Pagination) (int64, []*InvitationRegister, error)
}

View File

@@ -0,0 +1,40 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"time"
)
type IPForbidden struct {
IP string `bson:"ip"`
LimitRegister bool `bson:"limit_register"`
LimitLogin bool `bson:"limit_login"`
CreateTime time.Time `bson:"create_time"`
}
func (IPForbidden) IPForbidden() string {
return "ip_forbiddens"
}
type IPForbiddenInterface interface {
Take(ctx context.Context, ip string) (*IPForbidden, error)
Find(ctx context.Context, ips []string) ([]*IPForbidden, error)
Search(ctx context.Context, keyword string, state int32, pagination pagination.Pagination) (int64, []*IPForbidden, error)
Create(ctx context.Context, ms []*IPForbidden) error
Delete(ctx context.Context, ips []string) error
}

View File

@@ -0,0 +1,39 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"github.com/openimsdk/tools/db/pagination"
"time"
)
type LimitUserLoginIP struct {
UserID string `bson:"user_id"`
IP string `bson:"ip"`
CreateTime time.Time `bson:"create_time"`
}
func (LimitUserLoginIP) TableName() string {
return "limit_user_login_ips"
}
type LimitUserLoginIPInterface interface {
Create(ctx context.Context, ms []*LimitUserLoginIP) error
Delete(ctx context.Context, ms []*LimitUserLoginIP) error
Count(ctx context.Context, userID string) (uint32, error)
Take(ctx context.Context, userID string, ip string) (*LimitUserLoginIP, error)
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*LimitUserLoginIP, error)
}

View File

@@ -0,0 +1,39 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"time"
"github.com/openimsdk/tools/db/pagination"
)
type RegisterAddFriend struct {
UserID string `bson:"user_id"`
CreateTime time.Time `bson:"create_time"`
}
func (RegisterAddFriend) TableName() string {
return "register_add_friends"
}
type RegisterAddFriendInterface interface {
Add(ctx context.Context, registerAddFriends []*RegisterAddFriend) error
Del(ctx context.Context, userIDs []string) error
FindUserID(ctx context.Context, userIDs []string) ([]string, error)
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*RegisterAddFriend, error)
CountTotal(ctx context.Context) (int64, error) // 统计好友总数
}

View File

@@ -0,0 +1,40 @@
// Copyright © 2023 OpenIM open source community. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package admin
import (
"context"
"time"
"github.com/openimsdk/tools/db/pagination"
)
type RegisterAddGroup struct {
GroupID string `bson:"group_id"`
CreateTime time.Time `bson:"create_time"`
}
func (RegisterAddGroup) TableName() string {
return "register_add_groups"
}
type RegisterAddGroupInterface interface {
Add(ctx context.Context, registerAddGroups []*RegisterAddGroup) error
Del(ctx context.Context, groupIDs []string) error
FindGroupID(ctx context.Context, groupIDs []string) ([]string, error)
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*RegisterAddGroup, error)
CountTotal(ctx context.Context) (int64, error) // 统计群组总数
CountToday(ctx context.Context) (int64, error) // 统计今天新建的群组数
}