forked from cherish-chat/xxim-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
86 changed files
with
6,414 additions
and
4,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package appmgmtmodel | ||
|
||
type Stats struct { | ||
Date string `gorm:"column:date;type:varchar(10);index:date_type_idx,unique;not null" json:"date"` | ||
Type string `gorm:"column:type;type:varchar(32);index:date_type_idx,unique;not null" json:"type"` | ||
Val int `gorm:"column:val;type:bigint(20);not null" json:"val"` | ||
} | ||
|
||
func (m *Stats) TableName() string { | ||
return APPMGR_TABLE_PREFIX + "stats" | ||
} | ||
|
||
const ( | ||
StatsTypeNewUser = "newUser" | ||
StatsTypeNewGroup = "newGroup" | ||
StatsTypeTodayMsg = "todayMsg" | ||
StatsTypeTodayMsgUser = "todayMsgUser" | ||
StatsTypeTodayAliveGroup = "todayAliveGroup" | ||
StatsTypeTodayAliveSingle = "todayAliveSingle" | ||
StatsTypeTodayAliveUser = "todayAliveUser" | ||
StatsTypeTodayNewFriend = "todayNewFriend" | ||
) | ||
|
||
var StatsNameMap = map[string]string{ | ||
StatsTypeNewUser: "新增用户", | ||
StatsTypeNewGroup: "新增群组", | ||
StatsTypeTodayMsg: "今日消息", | ||
StatsTypeTodayMsgUser: "发消息用户", | ||
StatsTypeTodayAliveGroup: "活跃群组", | ||
StatsTypeTodayAliveSingle: "活跃单聊", | ||
StatsTypeTodayAliveUser: "活跃用户", | ||
StatsTypeTodayNewFriend: "新增好友", | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package logic | ||
|
||
import ( | ||
"context" | ||
"github.com/cherish-chat/xxim-server/app/appmgmt/appmgmtmodel" | ||
|
||
"github.com/cherish-chat/xxim-server/app/appmgmt/internal/svc" | ||
"github.com/cherish-chat/xxim-server/common/pb" | ||
|
||
"github.com/zeromicro/go-zero/core/logx" | ||
) | ||
|
||
type GetLatestVersionLogic struct { | ||
ctx context.Context | ||
svcCtx *svc.ServiceContext | ||
logx.Logger | ||
} | ||
|
||
func NewGetLatestVersionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLatestVersionLogic { | ||
return &GetLatestVersionLogic{ | ||
ctx: ctx, | ||
svcCtx: svcCtx, | ||
Logger: logx.WithContext(ctx), | ||
} | ||
} | ||
|
||
func (l *GetLatestVersionLogic) GetLatestVersion(in *pb.GetLatestVersionReq) (*pb.GetLatestVersionResp, error) { | ||
platform := in.CommonReq.Platform | ||
dest := &appmgmtmodel.Version{} | ||
err := l.svcCtx.Mysql().Model(dest).Where("platform = ?", platform).Order("createTime desc").First(dest).Error | ||
if err != nil { | ||
return &pb.GetLatestVersionResp{ | ||
AppMgmtVersion: &pb.AppMgmtVersion{ | ||
Version: in.CommonReq.AppVersion, | ||
Platform: platform, | ||
}, | ||
}, err | ||
} | ||
return &pb.GetLatestVersionResp{AppMgmtVersion: dest.ToPB()}, nil | ||
} |
Oops, something went wrong.