Skip to content

Commit

Permalink
docs: add openim chat options
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>
  • Loading branch information
cubxxw committed Oct 23, 2023
1 parent 33baf05 commit 39b2515
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 28 deletions.
7 changes: 4 additions & 3 deletions cmd/api/admin-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ package main

import (
"flag"
"github.com/OpenIMSDK/chat/pkg/discovery_register"
"github.com/OpenIMSDK/chat/tools/component"
"github.com/OpenIMSDK/tools/discoveryregistry"
"math/rand"
"net"
"strconv"
"time"

"github.com/OpenIMSDK/chat/pkg/discovery_register"
"github.com/OpenIMSDK/chat/tools/component"
"github.com/OpenIMSDK/tools/discoveryregistry"

mw2 "github.com/OpenIMSDK/chat/pkg/common/mw"

"github.com/OpenIMSDK/chat/internal/api"
Expand Down
2 changes: 2 additions & 0 deletions cmd/api/chat-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"strconv"
"time"

"github.com/OpenIMSDK/chat/tools/component"

mw2 "github.com/OpenIMSDK/chat/pkg/common/mw"

"github.com/OpenIMSDK/chat/internal/api"
Expand Down
5 changes: 3 additions & 2 deletions cmd/rpc/admin-rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package main

import (
"flag"
"math/rand"
"time"

"github.com/OpenIMSDK/chat/pkg/common/chatrpcstart"
"github.com/OpenIMSDK/chat/tools/component"
"github.com/OpenIMSDK/tools/log"
"math/rand"
"time"

"github.com/OpenIMSDK/chat/internal/rpc/admin"
"github.com/OpenIMSDK/chat/pkg/common/config"
Expand Down
5 changes: 3 additions & 2 deletions cmd/rpc/chat-rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package main

import (
"flag"
"math/rand"
"time"

"github.com/OpenIMSDK/chat/pkg/common/chatrpcstart"
"github.com/OpenIMSDK/chat/tools/component"
"github.com/OpenIMSDK/tools/log"
"math/rand"
"time"

"github.com/OpenIMSDK/chat/internal/rpc/chat"
"github.com/OpenIMSDK/chat/pkg/common/config"
Expand Down
2 changes: 0 additions & 2 deletions internal/rpc/admin/ip_forbidden.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package admin
import (
"context"
"time"


"github.com/OpenIMSDK/tools/log"

admin2 "github.com/OpenIMSDK/chat/pkg/common/db/table/admin"
Expand Down
2 changes: 0 additions & 2 deletions internal/rpc/admin/register_add_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"time"

"github.com/OpenIMSDK/tools/log"


"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"

Expand Down
2 changes: 0 additions & 2 deletions internal/rpc/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"context"
"strings"
"time"


"github.com/OpenIMSDK/chat/pkg/common/constant"
"github.com/OpenIMSDK/tools/log"

Expand Down
2 changes: 0 additions & 2 deletions internal/rpc/admin/user_ip_limit_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package admin
import (
"context"
"time"


"github.com/OpenIMSDK/tools/log"

"github.com/OpenIMSDK/tools/errs"
Expand Down
5 changes: 3 additions & 2 deletions internal/rpc/chat/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package chat
import (
"context"
"fmt"
"math/rand"
"time"

"github.com/OpenIMSDK/chat/pkg/common/constant"
table "github.com/OpenIMSDK/chat/pkg/common/db/table/chat"
"github.com/OpenIMSDK/chat/pkg/common/mctx"
Expand All @@ -11,8 +14,6 @@ import (
"github.com/OpenIMSDK/tools/mw/specialerror"
utils2 "github.com/OpenIMSDK/tools/utils"
"gorm.io/gorm/utils"
"math/rand"
"time"
)

func (o *chatSvr) genLogID() string {
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/chat/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package chat

import (
"context"
"github.com/OpenIMSDK/chat/pkg/common/mctx"
"math/rand"
"strconv"
"strings"
"time"

"github.com/OpenIMSDK/chat/pkg/common/mctx"

constant2 "github.com/OpenIMSDK/protocol/constant"

"github.com/OpenIMSDK/tools/errs"
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/chat/statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package chat

import (
"context"
"time"

"github.com/OpenIMSDK/chat/pkg/proto/chat"
"github.com/OpenIMSDK/tools/errs"
"time"
)

func (o *chatSvr) UserLoginCount(ctx context.Context, req *chat.UserLoginCountReq) (*chat.UserLoginCountResp, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/db/model/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"context"
"crypto/md5"
"encoding/hex"
"github.com/OpenIMSDK/tools/log"
"time"
"github.com/OpenIMSDK/tools/log"

"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/db/table/admin"
Expand Down
4 changes: 3 additions & 1 deletion pkg/common/db/model/chat/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package chat

import (
"context"
"time"

"github.com/OpenIMSDK/chat/pkg/common/db/table/chat"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/ormutil"
"gorm.io/gorm"
"time"
)

type Logs struct {
Expand Down Expand Up @@ -39,6 +40,7 @@ func (l *Logs) Get(ctx context.Context, logIDs []string, userID string) ([]*chat
}
return logs, errs.Wrap(l.db.WithContext(ctx).Where("log_id in ? and user_id=?", logIDs, userID).Find(&logs).Error)
}

func NewLogs(db *gorm.DB) chat.LogInterface {
return &Logs{db: db}
}
3 changes: 1 addition & 2 deletions pkg/common/db/model/chat/user_login_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ package chat

import (
"context"

"github.com/OpenIMSDK/tools/errs"
"time"
"github.com/OpenIMSDK/tools/errs"

"gorm.io/gorm"

Expand Down
4 changes: 3 additions & 1 deletion pkg/proto/chat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package chat

import (
"github.com/OpenIMSDK/tools/utils"
"regexp"
"strconv"

"github.com/OpenIMSDK/tools/utils"

"github.com/OpenIMSDK/chat/pkg/common/constant"
constant2 "github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/errs"
Expand Down Expand Up @@ -221,6 +222,7 @@ func (x *UploadLogsReq) Check() error {
}
return nil
}

func (x *SearchLogsReq) Check() error {
if x.Pagination == nil {
return errs.ErrArgs.Wrap("Pagination is empty")
Expand Down
3 changes: 1 addition & 2 deletions pkg/sms/sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ package sms
import (
"context"
"fmt"
"github.com/OpenIMSDK/chat/pkg/common/config"
"strings"

"github.com/OpenIMSDK/chat/pkg/common/config"
)

func New() (SMS, error) {
Expand Down
5 changes: 3 additions & 2 deletions tools/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package component

import (
"fmt"
"os"
"time"

"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/go-zookeeper/zk"
"github.com/pkg/errors"
"gopkg.in/yaml.v3"
"os"
"time"
)

func initCfg(cfgPath string) error {
Expand Down

0 comments on commit 39b2515

Please sign in to comment.