浏览代码

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/hdl/hdl_config.go
#	app/router/router.go
#	go.mod
master
huangjiajun 4 天前
父节点
当前提交
598bb02bf5
共有 40 个文件被更改,包括 14142 次插入27 次删除
  1. +4
    -0
      app/cfg/init_cfg.go
  2. +48
    -0
      app/db/model/im_send_red_package_ord.go
  3. +2
    -0
      app/e/code.go
  4. +57
    -0
      app/hdl/ModuleSetting.go
  5. +2
    -16
      app/hdl/comm/hdl_comm.go
  6. +25
    -1
      app/hdl/hdl_home_page.go
  7. +170
    -0
      app/hdl/hdl_im.go
  8. +49
    -0
      app/hdl/hdl_new_user_red_packet.go
  9. +49
    -0
      app/hdl/hdl_points_center.go
  10. +35
    -0
      app/hdl/hdl_wallet.go
  11. +4
    -0
      app/md/md.wallet.go
  12. +50
    -0
      app/md/md_im.go
  13. +10
    -0
      app/md/md_module_setting.go
  14. +12
    -0
      app/md/md_new_user_red_packet.go
  15. +1853
    -0
      app/pkg/pb/im.business.ext.pb.go
  16. +595
    -0
      app/pkg/pb/im.business.int.pb.go
  17. +131
    -0
      app/pkg/pb/im.common.ext.pb.go
  18. +2461
    -0
      app/pkg/pb/im.connect.ext.pb.go
  19. +395
    -0
      app/pkg/pb/im.connect.int.pb.go
  20. +3587
    -0
      app/pkg/pb/im.logic.ext.pb.go
  21. +1547
    -0
      app/pkg/pb/im.logic.int.pb.go
  22. +623
    -0
      app/pkg/pb/im.push.ext.pb.go
  23. +128
    -0
      app/pkg/proto/im.business.ext.proto
  24. +34
    -0
      app/pkg/proto/im.business.int.proto
  25. +5
    -0
      app/pkg/proto/im.common.ext.proto
  26. +232
    -0
      app/pkg/proto/im.connect.ext.proto
  27. +28
    -0
      app/pkg/proto/im.connect.int.proto
  28. +238
    -0
      app/pkg/proto/im.logic.ext.proto
  29. +102
    -0
      app/pkg/proto/im.logic.int.proto
  30. +58
    -0
      app/pkg/proto/im.push.ext.proto
  31. +15
    -0
      app/router/router.go
  32. +1
    -0
      app/svc/svc_auth.go
  33. +231
    -0
      app/svc/svc_im.go
  34. +26
    -0
      app/utils/algorithm.go
  35. +59
    -0
      app/utils/rpc_client.go
  36. +18
    -9
      app/utils/string.go
  37. +469
    -0
      docs/docs.go
  38. +469
    -0
      docs/swagger.json
  39. +316
    -0
      docs/swagger.yaml
  40. +4
    -1
      go.mod

+ 4
- 0
app/cfg/init_cfg.go 查看文件

@@ -19,6 +19,8 @@ var (
MQ *MQCfg
ES *ESCfg
Log *LogCfg
ImBusinessRpc *ImBusinessRpcCfg
ImLogicRpc *ImLogicRpcCfg
)

// 初始化配置文件,将cfg.yml读入到内存
@@ -50,4 +52,6 @@ func InitCfg() {
SrvAddr = conf.SrvAddr
MQ = &conf.MQ
ES = &conf.ES
ImBusinessRpc = &conf.ImBusinessRpc
ImLogicRpc = &conf.ImLogicRpc
}

+ 48
- 0
app/db/model/im_send_red_package_ord.go 查看文件

@@ -0,0 +1,48 @@
package model

import (
"time"
)

type ImSendRedPackageOrd struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
OrdNo string `json:"ord_no" xorm:"not null default '' comment('订单号') VARCHAR(255)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') index INT(11)"`
ImUid int `json:"im_uid" xorm:"not null default 0 comment('im对应用户id') index INT(11)"`
Amount string `json:"amount" xorm:"not null default '' comment('金额') VARCHAR(255)"`
RedPacketBalanceAmount string `json:"red_packet_balance_amount" xorm:"not null default '' comment('红包余额') VARCHAR(255)"`
RedPacketType int `json:"red_packet_type" xorm:"not null default 1 comment('红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)') TINYINT(1)"`
RedPacketNums int `json:"red_packet_nums" xorm:"not null default 1 comment('红包数量') TINYINT(1)"`
RedPacketBalanceNums int `json:"red_packet_balance_nums" xorm:"not null default 1 comment('红包剩余数量') TINYINT(1)"`
State int `json:"state" xorm:"not null default 1 comment('红包状态(0:未领取 1:领取中 2:领取完 3:已过期)') TINYINT(1)"`
WaitDrawUserIds string `json:"wait_draw_user_ids" xorm:"not null default 1 comment('待领取用户id(逗号分割)') VARCHAR(255)"`
WaitDrawImUserIds string `json:"wait_draw_im_user_ids" xorm:"not null default 1 comment('待领取im用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserIds string `json:"received_user_ids" xorm:"not null default 1 comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedImUserIds string `json:"received_im_user_ids" xorm:"not null default 1 comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserAmount string `json:"received_user_amount" xorm:"not null default 1 comment('已领取用户金额(逗号分割)') VARCHAR(255)"`
ReceivedTimes string `json:"received_times" xorm:"not null default 1 comment('已领取时间(逗号分割)') VARCHAR(255)"`
CreateTime time.Time `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
ImData string `json:"im_data" xorm:"not null default '' comment('im数据') VARCHAR(1000)"`
}

type ImSendRedPackageOrdResp struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
OrdNo string `json:"ord_no" xorm:"not null default '' comment('订单号') VARCHAR(255)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') index INT(11)"`
ImUid int `json:"im_uid" xorm:"not null default 0 comment('im对应用户id') index INT(11)"`
Amount string `json:"amount" xorm:"not null default '' comment('金额') VARCHAR(255)"`
RedPacketBalanceAmount string `json:"red_packet_balance_amount" xorm:"not null default '' comment('红包余额') VARCHAR(255)"`
RedPacketType int `json:"red_packet_type" xorm:"not null default 1 comment('红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)') TINYINT(1)"`
RedPacketNums int `json:"red_packet_nums" xorm:"not null default 1 comment('红包数量') TINYINT(1)"`
RedPacketBalanceNums int `json:"red_packet_balance_nums" xorm:"not null default 1 comment('红包剩余数量') TINYINT(1)"`
State int `json:"state" xorm:"not null default 1 comment('红包状态(0:未领取 1:领取中 2:领取完 3:已过期)') TINYINT(1)"`
WaitDrawUserIds string `json:"wait_draw_user_ids" xorm:"not null default 1 comment('待领取用户id(逗号分割)') VARCHAR(255)"`
WaitDrawImUserIds string `json:"wait_draw_im_user_ids" xorm:"not null default 1 comment('待领取im用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserIds string `json:"received_user_ids" xorm:"not null default 1 comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedImUserIds string `json:"received_im_user_ids" xorm:"not null default 1 comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserAmount string `json:"received_user_amount" xorm:"not null default 1 comment('已领取用户金额(逗号分割)') VARCHAR(255)"`
ReceivedTimes string `json:"received_times" xorm:"not null default 1 comment('已领取时间(逗号分割)') VARCHAR(255)"`
CreateTime string `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateTime string `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

+ 2
- 0
app/e/code.go 查看文件

@@ -118,6 +118,7 @@ const (
ERR_ALIPAY_ORDER_ERR = 500012
ERR_PAY_ERR = 500013
ERR_IS_BIND_THIRDOTHER = 500014
ERR_IS_GRPC = 501000
)

var MsgFlags = map[int]string{
@@ -233,4 +234,5 @@ var MsgFlags = map[int]string{
ERR_SEARCH_ERR: "暂无该分类商品",
ERR_LEVEL_REACH_TOP: "已经是最高等级",
ERR_USER_CHECK_ERR: "校验失败",
ERR_IS_GRPC: "GRPC请求失败",
}

+ 57
- 0
app/hdl/ModuleSetting.go 查看文件

@@ -0,0 +1,57 @@
package hdl

import (
"applet/app/db"
"applet/app/e"
"applet/app/md"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"github.com/gin-gonic/gin"
)

// GetModuleSetting
// @Summary 页面样式
// @Tags 页面样式
// @Description 页面样式
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param mod_name_value query string true "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)"
// @Success 200 {object} md.GetModuleSettingResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/getModuleSetting [GET]
func GetModuleSetting(c *gin.Context) {
modName := c.Query("mod_name_value")
modNameMap := map[string]string{
"1": "home_page",
"2": "member_center",
"3": "bottom_bar",
"4": "invitation_download_landing_page",
"5": "invitation_poster",
}
val, ok := modNameMap[modName]
if !ok {
e.OutErr(c, e.ERR_BAD_REQUEST, nil)
return
}
moduleStyleDb := implement.NewModuleStyleDb(db.Db)
moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
"key": "mod_name",
"value": val,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var dataMap map[string]interface{}
utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
resp := md.GetModuleSettingResp{
ModName: moduleStyle.ModName,
Position: moduleStyle.Position,
SkipIdentifier: moduleStyle.SkipIdentifier,
Title: moduleStyle.Title,
Subtitle: moduleStyle.Subtitle,
Data: dataMap,
}
e.OutSuc(c, resp, nil)
}

+ 2
- 16
app/hdl/comm/hdl_comm.go 查看文件

@@ -4,6 +4,7 @@ import (
"applet/app/db"
"applet/app/e"
"applet/app/md/comm"
"applet/app/svc"
"applet/app/utils/cache"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
@@ -84,22 +85,7 @@ func AccessRecords(c *gin.Context) {
return
}

if req.Index == "" {
e.OutErr(c, e.ERR_INVALID_ARGS, nil)
return
}

val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

user := svc.GetUser(c)
date := time.Now().Format("2006-01-02")
recordsDb := implement.NewEggAccessRecordsDb(db.Db)
exist, err := recordsDb.EggAccessRecordsExist(user.Id, date, req.Index)


+ 25
- 1
app/hdl/hdl_home_page.go 查看文件

@@ -357,15 +357,39 @@ func IsCanSignIn(c *gin.Context) {
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/homePage/isCanGetRedPackage [get]
func IsCanGetRedPackage(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

// 1. 红包活动是否开启
redPackageDb := implement.NewNewUserRedPackageDb(db.Db)
redPackage, err := redPackageDb.NewUserRedPackageGetOne()
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

// 2. 用户已有红包活动记录
userRecordsDb := implement.NewNewUserRedPackageWithUserRecordsDb(db.Db)
records, err := userRecordsDb.NewUserRedPackageWithUserRecordsGetLastPendingByParams(map[string]interface{}{
"key": "uid",
"value": user.Id,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}

isCan := false
if redPackage != nil {
if redPackage.IsOpen == 1 {
if redPackage.IsOpen == 1 && records != nil {
isCan = true
}
}


+ 170
- 0
app/hdl/hdl_im.go 查看文件

@@ -0,0 +1,170 @@
package hdl

import (
"applet/app/cfg"
"applet/app/db"
"applet/app/e"
"applet/app/md"
"applet/app/pkg/pb"
"applet/app/svc"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"github.com/gin-gonic/gin"
"github.com/tidwall/gjson"
)

// SendRedPackageDetail
// @Summary 蛋蛋星球-即时通讯-发送红包
// @Tags 即时通讯
// @Description 发送红包
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.SendRedPackageDetailReq true "红包的订单 ID"
// @Success 200 {object} md.SendRedPackageDetailResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/im/user/sendRedPackageDetail [POST]
func SendRedPackageDetail(c *gin.Context) {
var req *md.SendRedPackageDetailReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

//1、查找红包
redPackageOrdDb := implement.NewImSendRedPackageOrdDb(db.Db)
imSendRedPackageOrd, err := redPackageOrdDb.ImSendRedPackageOrdGetOneByParams(map[string]interface{}{
"key": "ord_no",
"value": req.OrderId,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
var redPackageID int64
im := md.SeqType{
Seq: 0,
}
if imSendRedPackageOrd != nil {
im.Seq = int(gjson.Get(imSendRedPackageOrd.ImData, "seq").Int())
redPackageID = imSendRedPackageOrd.Id
}
resp := md.SendRedPackageDetailResp{
Im: im,
RedPackageID: redPackageID,
}
e.OutSuc(c, resp, nil)
return
}

// GrabRedPackage
// @Summary 蛋蛋星球-即时通讯-领取红包
// @Tags 即时通讯
// @Description 领取红包
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.GrabRedPackageReq true "领取红包信息"
// @Success 200 {object} md.GrabRedPackageResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/im/user/grabRedPackage [POST]
func GrabRedPackage(c *gin.Context) {
var req *md.GrabRedPackageReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

redPackageContent, grabAmount, err := svc.DelGrabRedPackage(req, user)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

resp := md.GrabRedPackageResp{
Im: &pb.SendRedPacketResp{Seq: 0},
GrabAmount: grabAmount,
}

if redPackageContent == nil {
e.OutSuc(c, resp, nil)
return
}

//TODO::调用im GRPC 接口
// masterID := c.GetHeader("master_id")
res, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).SendRedPacket(utils.GetCtx(req.Token, req.UserId, req.DeviceId), &pb.SendRedPacketReq{
ReceiverType: pb.ReceiverType(req.ReceiverType),
ReceiverId: req.ReceiverId,
MessageType: pb.MessageType_MT_RED_PACKAGE,
MessageContent: redPackageContent,
SendTime: req.SendTime,
//ToUserIds: args.ToUserIds,
MessageContentBack: "",
})
if err != nil {
e.OutErr(c, e.ERR_IS_GRPC, err.Error())
return
}

resp.Im = res
e.OutSuc(c, resp, nil)
return
}

// RedPackageDetail
// @Summary 蛋蛋星球-即时通讯-红包详情(获取)
// @Tags 即时通讯
// @Description 红包详情(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param red_package_id query string true "红包 ID"
// @Success 200 {object} md.RedPackageDetailResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/im/redPackageDetail [GET]
func RedPackageDetail(c *gin.Context) {
redPackageId := c.DefaultQuery("red_package_id", "")

res, imSendRedPackageOrd, err := svc.DetailGrabRedPackage(redPackageId)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
resp := md.RedPackageDetailResp{
List: res,
Detail: model.ImSendRedPackageOrd{
OrdNo: imSendRedPackageOrd.OrdNo,
Uid: imSendRedPackageOrd.Uid,
ImUid: imSendRedPackageOrd.ImUid,
Amount: imSendRedPackageOrd.Amount,
RedPacketBalanceAmount: imSendRedPackageOrd.RedPacketBalanceAmount,
RedPacketType: imSendRedPackageOrd.RedPacketType,
RedPacketNums: imSendRedPackageOrd.RedPacketNums,
RedPacketBalanceNums: imSendRedPackageOrd.RedPacketBalanceNums,
State: imSendRedPackageOrd.State,
WaitDrawUserIds: imSendRedPackageOrd.WaitDrawUserIds,
WaitDrawImUserIds: imSendRedPackageOrd.WaitDrawImUserIds,
ReceivedUserIds: imSendRedPackageOrd.ReceivedUserIds,
ReceivedImUserIds: imSendRedPackageOrd.ReceivedImUserIds,
ReceivedUserAmount: imSendRedPackageOrd.ReceivedUserAmount,
ReceivedTimes: imSendRedPackageOrd.ReceivedTimes,
CreateTime: imSendRedPackageOrd.CreateTime,
UpdateTime: imSendRedPackageOrd.UpdateTime,
},
}
e.OutSuc(c, resp, nil)
return
}

+ 49
- 0
app/hdl/hdl_new_user_red_packet.go 查看文件

@@ -0,0 +1,49 @@
package hdl

import (
"applet/app/db"
"applet/app/e"
"applet/app/md"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"github.com/gin-gonic/gin"
)

func NewUserRedPacketInfo(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

userRecordsDb := implement.NewNewUserRedPackageWithUserRecordsDb(db.Db)
records, err := userRecordsDb.NewUserRedPackageWithUserRecordsGetLastPendingByParams(map[string]interface{}{
"key": "uid",
"value": user.Id,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
if records == nil {
e.OutErr(c, e.ERR_NO_DATA, "该用户没有有效新人红包活动")
return
}

resp := md.RedPacketInfoResp{
Uid: records.Uid,
TotalAmount: records.TotalAmount,
Days: records.Days,
BalanceAmount: records.BalanceAmount,
BalanceDays: records.BalanceDays,
ReceiveDays: records.ReceiveDays,
State: records.State,
CreateAt: records.CreateAt,
}
e.OutSuc(c, resp, nil)
}

+ 49
- 0
app/hdl/hdl_points_center.go 查看文件

@@ -17,9 +17,14 @@ import (
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy"
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc"
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"context"
"encoding/json"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"github.com/olivere/elastic/v7"
"github.com/shopspring/decimal"
"time"
)
@@ -665,6 +670,50 @@ func GetContributionValueFlow(c *gin.Context) {
e.OutSuc(c, resp, nil)
}

func GetPointMap(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
now := time.Now()
// 1. 获取当期有效蛋蛋分
nowIndex := es2.GetLatestEffectiveIndexFromAlias(now)
boolQuery := elastic.NewBoolQuery()
boolQuery.Filter(elastic.NewTermQuery("uid", user.Id))
searchResult, err := es.EsClient.Search().
Index(nowIndex).
Query(boolQuery).
Pretty(true).
Do(context.Background())
if searchResult == nil {
e.OutErr(c, e.ERR_DB_ORM, errors.New("failed to get current egg score"))
return
}

var results []md.UserEggFlowReqRespList
if searchResult.Hits.TotalHits.Value != 0 {
// 解析结果
for _, hit := range searchResult.Hits.Hits {
var doc md.UserEggFlowReqRespList
err = json.Unmarshal(hit.Source, &doc)
if err != nil {
e.OutErr(c, e.ERR_UNMARSHAL, err.Error())
return
}
results = append(results, doc)
}
}
// nowScore := utils.Float64ToStr(results[0].ScoreValue)
// todo 计算分数权重

}

// GetEggPointRecord
// @Summary 蛋蛋星球-积分中心-蛋蛋分明细(获取)
// @Tags 积分中心


+ 35
- 0
app/hdl/hdl_wallet.go 查看文件

@@ -92,3 +92,38 @@ func GetAmountFlow(c *gin.Context) {
}
e.OutSuc(c, resp, nil)
}

// WithdrawGetAmount
// @Summary 蛋蛋星球-钱包-提现余额(获取)
// @Tags 钱包
// @Description 提现余额(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.WithdrawGetAmountResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/wallet/withdraw/index [GET]
func WithdrawGetAmount(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

walletDb := implement.NewUserWalletDb(db.Db)
wallet, err := walletDb.GetUserVirtualWallet(user.Id)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

resp := md.WithdrawGetAmountResp{
Amount: wallet.Amount,
}
e.OutSuc(c, resp, nil)
}

+ 4
- 0
app/md/md.wallet.go 查看文件

@@ -21,3 +21,7 @@ type GetAmountFlowResp struct {
List []WalletFlowNode `json:"list"`
Paginate Paginate `json:"paginate"`
}

type WithdrawGetAmountResp struct {
Amount string `json:"amount"` // 余额
}

+ 50
- 0
app/md/md_im.go 查看文件

@@ -0,0 +1,50 @@
package md

import (
"applet/app/pkg/pb"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
)

type SendRedPackageDetailReq struct {
OrderId string `json:"order_id"` // 红包的订单 ID
}

type SeqType struct {
Seq int `json:"seq"` // 序列号
}

type SendRedPackageDetailResp struct {
Im SeqType `json:"im"`
RedPackageID int64 `json:"red_package_id"` // 红包 ID
}

type GrabRedPackageReq struct {
UserId string `json:"user_id"` //im用户id
SendRedPackageUserNikeName string `json:"send_red_package_user_nike_name"` //红包发送者-im用户昵称
SendRedPacketAvatarUrl string `json:"send_red_packet_avatar_url"` //红包发送者-im用户头像
DeviceId string `json:"device_id"` //设备id
Token string `json:"token"` //im-token
ReceiverType int `json:"receiver_type"` //接收者类型,1:user;2:group
ReceiverId int64 `json:"receiver_id"` //用户id或者群组id
SendTime int64 `json:"send_time"` //消息发送时间戳,精确到毫秒
RedPackageId int `json:"red_package_id"` //红包id
RedPackageCover string `json:"red_package_cover"` //红包封面
}

type GrabRedPackageResp struct {
Im *pb.SendRedPacketResp `json:"im"` // im 返回体
GrabAmount string `json:"grab_amount"` // 抢到的红包金额
}

type RedPackageDetailUserNode struct {
ImUserId string `json:"im_user_id"` //im用户id
UserNickName string `json:"user_nick_name"` //im用户昵称
UserAvatarUrl string `json:"user_avatar_url"` //im用户昵称
Amount string `json:"amount"` //金额
ReceiveAt string `json:"received_at"` //领取时间
}

type RedPackageDetailResp struct {
List []RedPackageDetailUserNode `json:"list"` // 领取红包用户列表
Detail model.ImSendRedPackageOrd `json:"detail"` // 红包详情信息
}

+ 10
- 0
app/md/md_module_setting.go 查看文件

@@ -0,0 +1,10 @@
package md

type GetModuleSettingResp struct {
ModName string `json:"mod_name"` // 模块名称
Position string `json:"position"` // 位置
SkipIdentifier string `json:"skip_identifier"` // 跳转标识
Title string `json:"title"` // 标题
Subtitle string `json:"subtitle"` // 副标题
Data map[string]interface{} `json:"data"` // 内容
}

+ 12
- 0
app/md/md_new_user_red_packet.go 查看文件

@@ -0,0 +1,12 @@
package md

type RedPacketInfoResp struct {
Uid int64 `json:"uid"` // 用户 ID
TotalAmount string `json:"total_amount"` // 金额
Days int `json:"days"` // 天数
BalanceAmount string `json:"balance_amount"` // 剩余金额
BalanceDays int `json:"balance_days"` // 剩余天数
ReceiveDays int `json:"receive_days"` // 领取天数
State int `json:"state"` // 状态(0:待领取 1:领取中 2:已领取 3:已冻结)
CreateAt string `json:"create_at"` // 创建时间
}

+ 1853
- 0
app/pkg/pb/im.business.ext.pb.go
文件差异内容过多而无法显示
查看文件


+ 595
- 0
app/pkg/pb/im.business.int.pb.go 查看文件

@@ -0,0 +1,595 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.20.0--rc1
// source: im.business.int.proto

package pb

import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type MasterAuthReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

MasterId string `protobuf:"bytes,1,opt,name=master_id,json=masterId,proto3" json:"master_id,omitempty"`
}

func (x *MasterAuthReq) Reset() {
*x = MasterAuthReq{}
if protoimpl.UnsafeEnabled {
mi := &file_business_int_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *MasterAuthReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*MasterAuthReq) ProtoMessage() {}

func (x *MasterAuthReq) ProtoReflect() protoreflect.Message {
mi := &file_business_int_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use MasterAuthReq.ProtoReflect.Descriptor instead.
func (*MasterAuthReq) Descriptor() ([]byte, []int) {
return file_business_int_proto_rawDescGZIP(), []int{0}
}

func (x *MasterAuthReq) GetMasterId() string {
if x != nil {
return x.MasterId
}
return ""
}

type AuthReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
}

func (x *AuthReq) Reset() {
*x = AuthReq{}
if protoimpl.UnsafeEnabled {
mi := &file_business_int_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *AuthReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*AuthReq) ProtoMessage() {}

func (x *AuthReq) ProtoReflect() protoreflect.Message {
mi := &file_business_int_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use AuthReq.ProtoReflect.Descriptor instead.
func (*AuthReq) Descriptor() ([]byte, []int) {
return file_business_int_proto_rawDescGZIP(), []int{1}
}

func (x *AuthReq) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}

func (x *AuthReq) GetDeviceId() int64 {
if x != nil {
return x.DeviceId
}
return 0
}

func (x *AuthReq) GetToken() string {
if x != nil {
return x.Token
}
return ""
}

type GetUsersReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

UserIds map[int64]int32 `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 用户id
}

func (x *GetUsersReq) Reset() {
*x = GetUsersReq{}
if protoimpl.UnsafeEnabled {
mi := &file_business_int_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *GetUsersReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*GetUsersReq) ProtoMessage() {}

func (x *GetUsersReq) ProtoReflect() protoreflect.Message {
mi := &file_business_int_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use GetUsersReq.ProtoReflect.Descriptor instead.
func (*GetUsersReq) Descriptor() ([]byte, []int) {
return file_business_int_proto_rawDescGZIP(), []int{2}
}

func (x *GetUsersReq) GetUserIds() map[int64]int32 {
if x != nil {
return x.UserIds
}
return nil
}

type GetUsersResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

Users map[int64]*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 用户信息
}

func (x *GetUsersResp) Reset() {
*x = GetUsersResp{}
if protoimpl.UnsafeEnabled {
mi := &file_business_int_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *GetUsersResp) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*GetUsersResp) ProtoMessage() {}

func (x *GetUsersResp) ProtoReflect() protoreflect.Message {
mi := &file_business_int_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use GetUsersResp.ProtoReflect.Descriptor instead.
func (*GetUsersResp) Descriptor() ([]byte, []int) {
return file_business_int_proto_rawDescGZIP(), []int{3}
}

func (x *GetUsersResp) GetUsers() map[int64]*User {
if x != nil {
return x.Users
}
return nil
}

var File_business_int_proto protoreflect.FileDescriptor

var file_business_int_proto_rawDesc = []byte{
0x0a, 0x12, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x62, 0x75, 0x73, 0x69,
0x6e, 0x65, 0x73, 0x73, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c,
0x0a, 0x0d, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x12,
0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x55, 0x0a, 0x07,
0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a,
0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f,
0x6b, 0x65, 0x6e, 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73,
0x52, 0x65, 0x71, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73,
0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x1a, 0x3a, 0x0a, 0x0c,
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74,
0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x05, 0x75, 0x73, 0x65,
0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65,
0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x42, 0x0a, 0x0a,
0x55, 0x73, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x32, 0xb4, 0x01, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x74,
0x12, 0x2a, 0x0a, 0x0a, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x11,
0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65,
0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x04,
0x41, 0x75, 0x74, 0x68, 0x12, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65,
0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x07,
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74,
0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74,
0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x55,
0x73, 0x65, 0x72, 0x73, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65,
0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
file_business_int_proto_rawDescOnce sync.Once
file_business_int_proto_rawDescData = file_business_int_proto_rawDesc
)

func file_business_int_proto_rawDescGZIP() []byte {
file_business_int_proto_rawDescOnce.Do(func() {
file_business_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_business_int_proto_rawDescData)
})
return file_business_int_proto_rawDescData
}

var file_business_int_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_business_int_proto_goTypes = []interface{}{
(*MasterAuthReq)(nil), // 0: pb.MasterAuthReq
(*AuthReq)(nil), // 1: pb.AuthReq
(*GetUsersReq)(nil), // 2: pb.GetUsersReq
(*GetUsersResp)(nil), // 3: pb.GetUsersResp
nil, // 4: pb.GetUsersReq.UserIdsEntry
nil, // 5: pb.GetUsersResp.UsersEntry
(*User)(nil), // 6: pb.User
(*GetUserReq)(nil), // 7: pb.GetUserReq
(*Empty)(nil), // 8: pb.Empty
(*GetUserResp)(nil), // 9: pb.GetUserResp
}
var file_business_int_proto_depIdxs = []int32{
4, // 0: pb.GetUsersReq.user_ids:type_name -> pb.GetUsersReq.UserIdsEntry
5, // 1: pb.GetUsersResp.users:type_name -> pb.GetUsersResp.UsersEntry
6, // 2: pb.GetUsersResp.UsersEntry.value:type_name -> pb.User
0, // 3: pb.BusinessInt.MasterAuth:input_type -> pb.MasterAuthReq
1, // 4: pb.BusinessInt.Auth:input_type -> pb.AuthReq
7, // 5: pb.BusinessInt.GetUser:input_type -> pb.GetUserReq
2, // 6: pb.BusinessInt.GetUsers:input_type -> pb.GetUsersReq
8, // 7: pb.BusinessInt.MasterAuth:output_type -> pb.Empty
8, // 8: pb.BusinessInt.Auth:output_type -> pb.Empty
9, // 9: pb.BusinessInt.GetUser:output_type -> pb.GetUserResp
3, // 10: pb.BusinessInt.GetUsers:output_type -> pb.GetUsersResp
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}

func init() { file_business_int_proto_init() }
func file_business_int_proto_init() {
if File_business_int_proto != nil {
return
}
file_common_ext_proto_init()
file_business_ext_proto_init()
if !protoimpl.UnsafeEnabled {
file_business_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MasterAuthReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_business_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuthReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_business_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUsersReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_business_int_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUsersResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_business_int_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_business_int_proto_goTypes,
DependencyIndexes: file_business_int_proto_depIdxs,
MessageInfos: file_business_int_proto_msgTypes,
}.Build()
File_business_int_proto = out.File
file_business_int_proto_rawDesc = nil
file_business_int_proto_goTypes = nil
file_business_int_proto_depIdxs = nil
}

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// BusinessIntClient is the client API for BusinessInt service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type BusinessIntClient interface {
// 站长权限校验
MasterAuth(ctx context.Context, in *MasterAuthReq, opts ...grpc.CallOption) (*Empty, error)
// 权限校验
Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*Empty, error)
// 批量获取用户信息
GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error)
// 批量获取用户信息
GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error)
}

type businessIntClient struct {
cc grpc.ClientConnInterface
}

func NewBusinessIntClient(cc grpc.ClientConnInterface) BusinessIntClient {
return &businessIntClient{cc}
}

func (c *businessIntClient) MasterAuth(ctx context.Context, in *MasterAuthReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.BusinessInt/MasterAuth", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

func (c *businessIntClient) Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.BusinessInt/Auth", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

func (c *businessIntClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) {
out := new(GetUserResp)
err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUser", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

func (c *businessIntClient) GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error) {
out := new(GetUsersResp)
err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUsers", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// BusinessIntServer is the server API for BusinessInt service.
// All implementations must embed UnimplementedBusinessIntServer
// for forward compatibility
type BusinessIntServer interface {
// 站长权限校验
MasterAuth(context.Context, *MasterAuthReq) (*Empty, error)
// 权限校验
Auth(context.Context, *AuthReq) (*Empty, error)
// 批量获取用户信息
GetUser(context.Context, *GetUserReq) (*GetUserResp, error)
// 批量获取用户信息
GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error)
}

// UnimplementedBusinessIntServer must be embedded to have forward compatible implementations.
type UnimplementedBusinessIntServer struct {
}

func (UnimplementedBusinessIntServer) MasterAuth(context.Context, *MasterAuthReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method MasterAuth not implemented")
}
func (UnimplementedBusinessIntServer) Auth(context.Context, *AuthReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented")
}
func (UnimplementedBusinessIntServer) GetUser(context.Context, *GetUserReq) (*GetUserResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (UnimplementedBusinessIntServer) GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUsers not implemented")
}

func RegisterBusinessIntServer(s grpc.ServiceRegistrar, srv BusinessIntServer) {
s.RegisterService(&BusinessInt_ServiceDesc, srv)
}

func _BusinessInt_MasterAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MasterAuthReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BusinessIntServer).MasterAuth(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.BusinessInt/MasterAuth",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BusinessIntServer).MasterAuth(ctx, req.(*MasterAuthReq))
}
return interceptor(ctx, in, info, handler)
}

func _BusinessInt_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AuthReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BusinessIntServer).Auth(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.BusinessInt/Auth",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BusinessIntServer).Auth(ctx, req.(*AuthReq))
}
return interceptor(ctx, in, info, handler)
}

func _BusinessInt_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BusinessIntServer).GetUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.BusinessInt/GetUser",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BusinessIntServer).GetUser(ctx, req.(*GetUserReq))
}
return interceptor(ctx, in, info, handler)
}

func _BusinessInt_GetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUsersReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BusinessIntServer).GetUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.BusinessInt/GetUsers",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BusinessIntServer).GetUsers(ctx, req.(*GetUsersReq))
}
return interceptor(ctx, in, info, handler)
}

// BusinessInt_ServiceDesc is the grpc.ServiceDesc for BusinessInt service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BusinessInt_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.BusinessInt",
HandlerType: (*BusinessIntServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "MasterAuth",
Handler: _BusinessInt_MasterAuth_Handler,
},
{
MethodName: "Auth",
Handler: _BusinessInt_Auth_Handler,
},
{
MethodName: "GetUser",
Handler: _BusinessInt_GetUser_Handler,
},
{
MethodName: "GetUsers",
Handler: _BusinessInt_GetUsers_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "im.business.int.proto",
}

+ 131
- 0
app/pkg/pb/im.common.ext.pb.go 查看文件

@@ -0,0 +1,131 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.14.0
// source: common.ext.proto_back

package pb

import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}

func (x *Empty) Reset() {
*x = Empty{}
if protoimpl.UnsafeEnabled {
mi := &file_common_ext_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*Empty) ProtoMessage() {}

func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_common_ext_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_common_ext_proto_rawDescGZIP(), []int{0}
}

var File_common_ext_proto protoreflect.FileDescriptor

var file_common_ext_proto_rawDesc = []byte{
0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42,
0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
file_common_ext_proto_rawDescOnce sync.Once
file_common_ext_proto_rawDescData = file_common_ext_proto_rawDesc
)

func file_common_ext_proto_rawDescGZIP() []byte {
file_common_ext_proto_rawDescOnce.Do(func() {
file_common_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_ext_proto_rawDescData)
})
return file_common_ext_proto_rawDescData
}

var file_common_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_ext_proto_goTypes = []interface{}{
(*Empty)(nil), // 0: pb.Empty
}
var file_common_ext_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}

func init() { file_common_ext_proto_init() }
func file_common_ext_proto_init() {
if File_common_ext_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_common_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_ext_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_common_ext_proto_goTypes,
DependencyIndexes: file_common_ext_proto_depIdxs,
MessageInfos: file_common_ext_proto_msgTypes,
}.Build()
File_common_ext_proto = out.File
file_common_ext_proto_rawDesc = nil
file_common_ext_proto_goTypes = nil
file_common_ext_proto_depIdxs = nil
}

+ 2461
- 0
app/pkg/pb/im.connect.ext.pb.go
文件差异内容过多而无法显示
查看文件


+ 395
- 0
app/pkg/pb/im.connect.int.pb.go 查看文件

@@ -0,0 +1,395 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.14.0
// source: connect.int.proto_back

package pb

import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type DeliverMessageReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id
MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据
}

func (x *DeliverMessageReq) Reset() {
*x = DeliverMessageReq{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_int_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *DeliverMessageReq) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*DeliverMessageReq) ProtoMessage() {}

func (x *DeliverMessageReq) ProtoReflect() protoreflect.Message {
mi := &file_connect_int_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use DeliverMessageReq.ProtoReflect.Descriptor instead.
func (*DeliverMessageReq) Descriptor() ([]byte, []int) {
return file_connect_int_proto_rawDescGZIP(), []int{0}
}

func (x *DeliverMessageReq) GetDeviceId() int64 {
if x != nil {
return x.DeviceId
}
return 0
}

func (x *DeliverMessageReq) GetMessageSend() *MessageSend {
if x != nil {
return x.MessageSend
}
return nil
}

// 房间推送
type PushRoomMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 设备id
MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据
}

func (x *PushRoomMsg) Reset() {
*x = PushRoomMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_int_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *PushRoomMsg) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*PushRoomMsg) ProtoMessage() {}

func (x *PushRoomMsg) ProtoReflect() protoreflect.Message {
mi := &file_connect_int_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use PushRoomMsg.ProtoReflect.Descriptor instead.
func (*PushRoomMsg) Descriptor() ([]byte, []int) {
return file_connect_int_proto_rawDescGZIP(), []int{1}
}

func (x *PushRoomMsg) GetRoomId() int64 {
if x != nil {
return x.RoomId
}
return 0
}

func (x *PushRoomMsg) GetMessageSend() *MessageSend {
if x != nil {
return x.MessageSend
}
return nil
}

// 房间推送
type PushAllMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据
}

func (x *PushAllMsg) Reset() {
*x = PushAllMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_int_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *PushAllMsg) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*PushAllMsg) ProtoMessage() {}

func (x *PushAllMsg) ProtoReflect() protoreflect.Message {
mi := &file_connect_int_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use PushAllMsg.ProtoReflect.Descriptor instead.
func (*PushAllMsg) Descriptor() ([]byte, []int) {
return file_connect_int_proto_rawDescGZIP(), []int{2}
}

func (x *PushAllMsg) GetMessageSend() *MessageSend {
if x != nil {
return x.MessageSend
}
return nil
}

var File_connect_int_proto protoreflect.FileDescriptor

var file_connect_int_proto_rawDesc = []byte{
0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x64, 0x0a, 0x11,
0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65,
0x71, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x32,
0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65,
0x6e, 0x64, 0x22, 0x5a, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x73,
0x67, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x0c, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e,
0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x22, 0x40,
0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x32, 0x0a, 0x0c,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53,
0x65, 0x6e, 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, 0x64,
0x32, 0x40, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x74, 0x12, 0x32,
0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62,
0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
file_connect_int_proto_rawDescOnce sync.Once
file_connect_int_proto_rawDescData = file_connect_int_proto_rawDesc
)

func file_connect_int_proto_rawDescGZIP() []byte {
file_connect_int_proto_rawDescOnce.Do(func() {
file_connect_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_connect_int_proto_rawDescData)
})
return file_connect_int_proto_rawDescData
}

var file_connect_int_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_connect_int_proto_goTypes = []interface{}{
(*DeliverMessageReq)(nil), // 0: pb.DeliverMessageReq
(*PushRoomMsg)(nil), // 1: pb.PushRoomMsg
(*PushAllMsg)(nil), // 2: pb.PushAllMsg
(*MessageSend)(nil), // 3: pb.MessageSend
(*Empty)(nil), // 4: pb.Empty
}
var file_connect_int_proto_depIdxs = []int32{
3, // 0: pb.DeliverMessageReq.message_send:type_name -> pb.MessageSend
3, // 1: pb.PushRoomMsg.message_send:type_name -> pb.MessageSend
3, // 2: pb.PushAllMsg.message_send:type_name -> pb.MessageSend
0, // 3: pb.ConnectInt.DeliverMessage:input_type -> pb.DeliverMessageReq
4, // 4: pb.ConnectInt.DeliverMessage:output_type -> pb.Empty
4, // [4:5] is the sub-list for method output_type
3, // [3:4] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}

func init() { file_connect_int_proto_init() }
func file_connect_int_proto_init() {
if File_connect_int_proto != nil {
return
}
file_common_ext_proto_init()
file_connect_ext_proto_init()
if !protoimpl.UnsafeEnabled {
file_connect_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeliverMessageReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_connect_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushRoomMsg); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_connect_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushAllMsg); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_connect_int_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_connect_int_proto_goTypes,
DependencyIndexes: file_connect_int_proto_depIdxs,
MessageInfos: file_connect_int_proto_msgTypes,
}.Build()
File_connect_int_proto = out.File
file_connect_int_proto_rawDesc = nil
file_connect_int_proto_goTypes = nil
file_connect_int_proto_depIdxs = nil
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface

// This is a compile-time assertion to ensure that this generated comm
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6

// ConnectIntClient is the client API for ConnectInt service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ConnectIntClient interface {
// 消息投递
DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*Empty, error)
}

type connectIntClient struct {
cc grpc.ClientConnInterface
}

func NewConnectIntClient(cc grpc.ClientConnInterface) ConnectIntClient {
return &connectIntClient{cc}
}

func (c *connectIntClient) DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.ConnectInt/DeliverMessage", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// ConnectIntServer is the server API for ConnectInt service.
type ConnectIntServer interface {
// 消息投递
DeliverMessage(context.Context, *DeliverMessageReq) (*Empty, error)
}

// UnimplementedConnectIntServer can be embedded to have forward compatible implementations.
type UnimplementedConnectIntServer struct {
}

func (*UnimplementedConnectIntServer) DeliverMessage(context.Context, *DeliverMessageReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeliverMessage not implemented")
}

func RegisterConnectIntServer(s *grpc.Server, srv ConnectIntServer) {
s.RegisterService(&_ConnectInt_serviceDesc, srv)
}

func _ConnectInt_DeliverMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeliverMessageReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ConnectIntServer).DeliverMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ConnectInt/DeliverMessage",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ConnectIntServer).DeliverMessage(ctx, req.(*DeliverMessageReq))
}
return interceptor(ctx, in, info, handler)
}

var _ConnectInt_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.ConnectInt",
HandlerType: (*ConnectIntServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "DeliverMessage",
Handler: _ConnectInt_DeliverMessage_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "connect.int.proto_back",
}

+ 3587
- 0
app/pkg/pb/im.logic.ext.pb.go
文件差异内容过多而无法显示
查看文件


+ 1547
- 0
app/pkg/pb/im.logic.int.pb.go
文件差异内容过多而无法显示
查看文件


+ 623
- 0
app/pkg/pb/im.push.ext.pb.go 查看文件

@@ -0,0 +1,623 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.20.0--rc1
// source: im.push.ext.proto

package pb

import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type PushCode int32

const (
PushCode_PC_ADD_DEFAULT PushCode = 0
PushCode_PC_ADD_FRIEND PushCode = 100 // 添加好友请求
PushCode_PC_AGREE_ADD_FRIEND PushCode = 101 // 同意添加好友
PushCode_PC_UPDATE_GROUP PushCode = 110 // 更新群组
PushCode_PC_ADD_GROUP_MEMBERS PushCode = 120 // 添加群组成员
PushCode_PC_REMOVE_GROUP_MEMBER PushCode = 121 // 移除群组成员
)

// Enum value maps for PushCode.
var (
PushCode_name = map[int32]string{
0: "PC_ADD_DEFAULT",
100: "PC_ADD_FRIEND",
101: "PC_AGREE_ADD_FRIEND",
110: "PC_UPDATE_GROUP",
120: "PC_ADD_GROUP_MEMBERS",
121: "PC_REMOVE_GROUP_MEMBER",
}
PushCode_value = map[string]int32{
"PC_ADD_DEFAULT": 0,
"PC_ADD_FRIEND": 100,
"PC_AGREE_ADD_FRIEND": 101,
"PC_UPDATE_GROUP": 110,
"PC_ADD_GROUP_MEMBERS": 120,
"PC_REMOVE_GROUP_MEMBER": 121,
}
)

func (x PushCode) Enum() *PushCode {
p := new(PushCode)
*p = x
return p
}

func (x PushCode) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (PushCode) Descriptor() protoreflect.EnumDescriptor {
return file_push_ext_proto_enumTypes[0].Descriptor()
}

func (PushCode) Type() protoreflect.EnumType {
return &file_push_ext_proto_enumTypes[0]
}

func (x PushCode) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}

// Deprecated: Use PushCode.Descriptor instead.
func (PushCode) EnumDescriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{0}
}

// 推送码 PC_ADD_FRIEND = 100
type AddFriendPush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

FriendId int64 `protobuf:"varint,1,opt,name=friend_id,json=friendId,proto3" json:"friend_id,omitempty"` // 好友id
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` // 昵称
AvatarUrl string `protobuf:"bytes,3,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // 头像
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // 描述
}

func (x *AddFriendPush) Reset() {
*x = AddFriendPush{}
if protoimpl.UnsafeEnabled {
mi := &file_push_ext_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *AddFriendPush) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*AddFriendPush) ProtoMessage() {}

func (x *AddFriendPush) ProtoReflect() protoreflect.Message {
mi := &file_push_ext_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use AddFriendPush.ProtoReflect.Descriptor instead.
func (*AddFriendPush) Descriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{0}
}

func (x *AddFriendPush) GetFriendId() int64 {
if x != nil {
return x.FriendId
}
return 0
}

func (x *AddFriendPush) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}

func (x *AddFriendPush) GetAvatarUrl() string {
if x != nil {
return x.AvatarUrl
}
return ""
}

func (x *AddFriendPush) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}

// 推送码 PC_AGREE_ADD_FRIEND = 101
type AgreeAddFriendPush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

FriendId int64 `protobuf:"varint,1,opt,name=friend_id,json=friendId,proto3" json:"friend_id,omitempty"` // 好友id
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` // 昵称
AvatarUrl string `protobuf:"bytes,3,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // 头像
}

func (x *AgreeAddFriendPush) Reset() {
*x = AgreeAddFriendPush{}
if protoimpl.UnsafeEnabled {
mi := &file_push_ext_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *AgreeAddFriendPush) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*AgreeAddFriendPush) ProtoMessage() {}

func (x *AgreeAddFriendPush) ProtoReflect() protoreflect.Message {
mi := &file_push_ext_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use AgreeAddFriendPush.ProtoReflect.Descriptor instead.
func (*AgreeAddFriendPush) Descriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{1}
}

func (x *AgreeAddFriendPush) GetFriendId() int64 {
if x != nil {
return x.FriendId
}
return 0
}

func (x *AgreeAddFriendPush) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}

func (x *AgreeAddFriendPush) GetAvatarUrl() string {
if x != nil {
return x.AvatarUrl
}
return ""
}

// 更新群组 PC_UPDATE_GROUP = 110
type UpdateGroupPush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

OptId int64 `protobuf:"varint,1,opt,name=opt_id,json=optId,proto3" json:"opt_id,omitempty"` // 操作人用户id
OptName string `protobuf:"bytes,2,opt,name=opt_name,json=optName,proto3" json:"opt_name,omitempty"` // 操作人昵称
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // 群组名称
AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // 群组头像
Introduction string `protobuf:"bytes,5,opt,name=introduction,proto3" json:"introduction,omitempty"` // 群组简介
Extra string `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` // 附加字段
}

func (x *UpdateGroupPush) Reset() {
*x = UpdateGroupPush{}
if protoimpl.UnsafeEnabled {
mi := &file_push_ext_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *UpdateGroupPush) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*UpdateGroupPush) ProtoMessage() {}

func (x *UpdateGroupPush) ProtoReflect() protoreflect.Message {
mi := &file_push_ext_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use UpdateGroupPush.ProtoReflect.Descriptor instead.
func (*UpdateGroupPush) Descriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{2}
}

func (x *UpdateGroupPush) GetOptId() int64 {
if x != nil {
return x.OptId
}
return 0
}

func (x *UpdateGroupPush) GetOptName() string {
if x != nil {
return x.OptName
}
return ""
}

func (x *UpdateGroupPush) GetName() string {
if x != nil {
return x.Name
}
return ""
}

func (x *UpdateGroupPush) GetAvatarUrl() string {
if x != nil {
return x.AvatarUrl
}
return ""
}

func (x *UpdateGroupPush) GetIntroduction() string {
if x != nil {
return x.Introduction
}
return ""
}

func (x *UpdateGroupPush) GetExtra() string {
if x != nil {
return x.Extra
}
return ""
}

// 添加群组成员 PC_AGREE_ADD_GROUPS = 120
type AddGroupMembersPush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

OptId int64 `protobuf:"varint,1,opt,name=opt_id,json=optId,proto3" json:"opt_id,omitempty"` // 操作人用户id
OptName string `protobuf:"bytes,2,opt,name=opt_name,json=optName,proto3" json:"opt_name,omitempty"` // 操作人昵称
Members []*GroupMember `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` // 群组成员
}

func (x *AddGroupMembersPush) Reset() {
*x = AddGroupMembersPush{}
if protoimpl.UnsafeEnabled {
mi := &file_push_ext_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *AddGroupMembersPush) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*AddGroupMembersPush) ProtoMessage() {}

func (x *AddGroupMembersPush) ProtoReflect() protoreflect.Message {
mi := &file_push_ext_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use AddGroupMembersPush.ProtoReflect.Descriptor instead.
func (*AddGroupMembersPush) Descriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{3}
}

func (x *AddGroupMembersPush) GetOptId() int64 {
if x != nil {
return x.OptId
}
return 0
}

func (x *AddGroupMembersPush) GetOptName() string {
if x != nil {
return x.OptName
}
return ""
}

func (x *AddGroupMembersPush) GetMembers() []*GroupMember {
if x != nil {
return x.Members
}
return nil
}

// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 121
type RemoveGroupMemberPush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

OptId int64 `protobuf:"varint,1,opt,name=opt_id,json=optId,proto3" json:"opt_id,omitempty"` // 操作人用户id
OptName string `protobuf:"bytes,2,opt,name=opt_name,json=optName,proto3" json:"opt_name,omitempty"` // 操作人昵称
DeletedUserId int64 `protobuf:"varint,3,opt,name=deleted_user_id,json=deletedUserId,proto3" json:"deleted_user_id,omitempty"` // 被删除的成员id
DeletedUserName string `protobuf:"bytes,4,opt,name=deleted_user_name,json=deletedUserName,proto3" json:"deleted_user_name,omitempty"` // 被删除的成员昵称
}

func (x *RemoveGroupMemberPush) Reset() {
*x = RemoveGroupMemberPush{}
if protoimpl.UnsafeEnabled {
mi := &file_push_ext_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}

func (x *RemoveGroupMemberPush) String() string {
return protoimpl.X.MessageStringOf(x)
}

func (*RemoveGroupMemberPush) ProtoMessage() {}

func (x *RemoveGroupMemberPush) ProtoReflect() protoreflect.Message {
mi := &file_push_ext_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}

// Deprecated: Use RemoveGroupMemberPush.ProtoReflect.Descriptor instead.
func (*RemoveGroupMemberPush) Descriptor() ([]byte, []int) {
return file_push_ext_proto_rawDescGZIP(), []int{4}
}

func (x *RemoveGroupMemberPush) GetOptId() int64 {
if x != nil {
return x.OptId
}
return 0
}

func (x *RemoveGroupMemberPush) GetOptName() string {
if x != nil {
return x.OptName
}
return ""
}

func (x *RemoveGroupMemberPush) GetDeletedUserId() int64 {
if x != nil {
return x.DeletedUserId
}
return 0
}

func (x *RemoveGroupMemberPush) GetDeletedUserName() string {
if x != nil {
return x.DeletedUserName
}
return ""
}

var File_push_ext_proto protoreflect.FileDescriptor

var file_push_ext_proto_rawDesc = []byte{
0x0a, 0x0e, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x02, 0x70, 0x62, 0x1a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69,
0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65,
0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12,
0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x6c, 0x0a, 0x12, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69,
0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65,
0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x22,
0xb0, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50,
0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70,
0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61,
0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61,
0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05,
0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74,
0x72, 0x61, 0x22, 0x72, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65,
0x6d, 0x62, 0x65, 0x72, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64,
0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x6d,
0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70,
0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x07, 0x6d,
0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76,
0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68,
0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x73,
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x64, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x55, 0x73,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x2a, 0x95, 0x01, 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, 0x43,
0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x44, 0x45,
0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x43, 0x5f, 0x41, 0x44,
0x44, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x10, 0x64, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x43,
0x5f, 0x41, 0x47, 0x52, 0x45, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e,
0x44, 0x10, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x43, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45,
0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x6e, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x43, 0x5f, 0x41,
0x44, 0x44, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53,
0x10, 0x78, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x43, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f,
0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x79, 0x42, 0x0d,
0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
file_push_ext_proto_rawDescOnce sync.Once
file_push_ext_proto_rawDescData = file_push_ext_proto_rawDesc
)

func file_push_ext_proto_rawDescGZIP() []byte {
file_push_ext_proto_rawDescOnce.Do(func() {
file_push_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_push_ext_proto_rawDescData)
})
return file_push_ext_proto_rawDescData
}

var file_push_ext_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_push_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_push_ext_proto_goTypes = []interface{}{
(PushCode)(0), // 0: pb.PushCode
(*AddFriendPush)(nil), // 1: pb.AddFriendPush
(*AgreeAddFriendPush)(nil), // 2: pb.AgreeAddFriendPush
(*UpdateGroupPush)(nil), // 3: pb.UpdateGroupPush
(*AddGroupMembersPush)(nil), // 4: pb.AddGroupMembersPush
(*RemoveGroupMemberPush)(nil), // 5: pb.RemoveGroupMemberPush
(*GroupMember)(nil), // 6: pb.GroupMember
}
var file_push_ext_proto_depIdxs = []int32{
6, // 0: pb.AddGroupMembersPush.members:type_name -> pb.GroupMember
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}

func init() { file_push_ext_proto_init() }
func file_push_ext_proto_init() {
if File_push_ext_proto != nil {
return
}
file_logic_ext_proto_init()
if !protoimpl.UnsafeEnabled {
file_push_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddFriendPush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_push_ext_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AgreeAddFriendPush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_push_ext_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateGroupPush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_push_ext_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddGroupMembersPush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_push_ext_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveGroupMemberPush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_push_ext_proto_rawDesc,
NumEnums: 1,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_push_ext_proto_goTypes,
DependencyIndexes: file_push_ext_proto_depIdxs,
EnumInfos: file_push_ext_proto_enumTypes,
MessageInfos: file_push_ext_proto_msgTypes,
}.Build()
File_push_ext_proto = out.File
file_push_ext_proto_rawDesc = nil
file_push_ext_proto_goTypes = nil
file_push_ext_proto_depIdxs = nil
}

+ 128
- 0
app/pkg/proto/im.business.ext.proto 查看文件

@@ -0,0 +1,128 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.common.ext.proto";

service BusinessExt {
// 登录
rpc SignIn (SignInReq) returns (SignInResp);
// 获取用户信息
rpc GetUser (GetUserReq) returns (GetUserResp);
// 更新用户信息
rpc UpdateUser (UpdateUserReq) returns (Empty);
// 搜索用户(这里简单数据库实现,生产环境建议使用ES)
rpc SearchUser (SearchUserReq) returns (SearchUserResp);
// 上传文件至云端
rpc CloudUploadFile (CloudUploadFileReq) returns (CloudUploadFileResp);
// 获取表情
rpc EmoticonList (Empty) returns (EmoticonListResp);
// 判断是否为好友关系
rpc IsFriends (IsFriendsReq) returns (IsFriendsResp);
// 投诉群
rpc ComplainGroup (ComplainGroupReq) returns (Empty);
}


message ComplainGroupReq {
int64 group_id = 1;
ComplainType complain_type = 2; // 投诉类型
string text = 3; // 投诉内容
repeated string image_list = 4; // 图片
}

// 消息类型
enum ComplainType {
CT_UNKNOWN = 0; // 未知
CT_GAMBLE = 1; // 存在赌博行为
MT_DEFRAUD = 2; // 存在骗钱行为
MT_HARASS = 3; // 不当信息骚扰
MT_RUMOUR = 4; // 传播谣言
MT_COUNTERFEIT_GOODS_INFO = 5; // 发布假冒商品信息
MT_VIOLATION_OF_MINORS = 6; // 侵犯未成年人权益
MT_OTHER = 7; // 其他
}


message IsFriendsReq {
string user_phone = 1;
string friend_phone = 2;
}

message IsFriendsResp {
int64 is_friend = 1;
User user = 2; // 用户信息
}

message Emoticon {
string name = 1; // 名称
string img_url = 2; // 图片地址
string memo = 3; // 备注
int32 sort = 4; // 排序
}
message EmoticonListResp {
repeated Emoticon emoticons = 1;
}
message SignInReq {
string phone_number = 1; // 手机号
string code = 2; // 验证码
int64 device_id = 3; // 设备id
int64 master_id = 4; // 站长id
string push_alia = 5; // 极光推送-别名
string nickname = 6; // 昵称
string avatar_url = 7; // 头像地址
}
message SignInResp {
bool is_new = 1; // 是否是新用户
int64 user_id = 2; // 用户id
string token = 3; // token
int64 master_id = 4; // 站长id
}
message CloudUploadFileReq {
string dir = 1; // 目录名
string file_name = 2; // 上传原文件名称
string file_size = 3; // 文件大小
}
message CloudUploadFileResp {
string method = 1; // 请求方式
string host = 2; // 域名
string key = 3; // key
string token = 4; // token
}

message User {
int64 user_id = 1; // 用户id
string nickname = 2; // 昵称
int32 sex = 3; // 性别
string avatar_url = 4; // 头像地址
string extra = 5; // 附加字段
int64 create_time = 6; // 创建时间
int64 update_time = 7; // 更新时间
int64 master_id = 8; // 站长id
int64 is_auto_added_friends = 9; // 是否自动被添加好友
string phone_number = 10; // 手机号
}

message GetUserReq {
int64 user_id = 1; // 用户id
string phone = 2; // 用户手机号
}
message GetUserResp {
User user = 1; // 用户信息
}

message UpdateUserReq {
string nickname = 1; // 昵称
int32 sex = 2; // 性别
string avatar_url = 3; // 头像地址
string extra = 4; // 附加字段
}

message SearchUserReq{
string key = 1;
int64 master_id = 2;
}
message SearchUserResp{
repeated User users = 1;
}


+ 34
- 0
app/pkg/proto/im.business.int.proto 查看文件

@@ -0,0 +1,34 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.common.ext.proto";
import "im.business.ext.proto";

service BusinessInt {
// 站长权限校验
rpc MasterAuth (MasterAuthReq) returns (Empty);
// 权限校验
rpc Auth (AuthReq) returns (Empty);
// 批量获取用户信息
rpc GetUser (GetUserReq) returns (GetUserResp);
// 批量获取用户信息
rpc GetUsers (GetUsersReq) returns (GetUsersResp);
}

message MasterAuthReq {
string master_id = 1;
}

message AuthReq {
int64 user_id = 1;
int64 device_id = 2;
string token = 3;
}

message GetUsersReq {
map<int64, int32> user_ids = 1; // 用户id
}
message GetUsersResp {
map<int64, User> users = 1; // 用户信息
}

+ 5
- 0
app/pkg/proto/im.common.ext.proto 查看文件

@@ -0,0 +1,5 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

message Empty{}

+ 232
- 0
app/pkg/proto/im.connect.ext.proto 查看文件

@@ -0,0 +1,232 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

enum PackageType {
PT_UNKNOWN = 0; // 未知
PT_SIGN_IN = 1; // 设备登录请求
PT_SYNC = 2; // 消息同步触发
PT_HEARTBEAT = 3; // 心跳
PT_MESSAGE = 4; // 消息投递
PT_SUBSCRIBE_ROOM = 5; // 订阅房间
}

/************************************消息体定义开始************************************/
// 单条消息投递内容(估算大约100个字节),todo 通知栏提醒
message Message {
Sender sender = 1; // 发送者
ReceiverType receiver_type = 2; // 接收者类型,1:user;2:group
int64 receiver_id = 3; // 用户id或者群组id
repeated int64 to_user_ids = 4; // 需要@的用户id列表
MessageType message_type = 5; // 消息类型
bytes message_content = 6; // 消息内容
int64 seq = 7; // 用户消息发送序列号
int64 send_time = 8; // 消息发送时间戳,精确到毫秒
MessageStatus status = 9; // 消息状态
}

message Sender {
SenderType sender_type = 1; // 发送者类型,1:系统,2:用户,3:第三方业务系统
int64 sender_id = 2; // 发送者id
int64 device_id = 3; // 发送者设备id
string avatar_url = 4; // 头像
string nickname = 5; // 昵称
string extra = 6; // 扩展字段
}

// 消息类型
enum MessageType {
MT_UNKNOWN = 0; // 未知
MT_TEXT = 1; // 文本
MT_FACE = 2; // 表情
MT_VOICE = 3; // 语音消息
MT_IMAGE = 4; // 图片
MT_FILE = 5; // 文件
MT_LOCATION = 6; // 地理位置
MT_COMMAND = 7; // 指令推送
MT_CUSTOM = 8; // 自定义
MT_RECALL = 9; // 撤回消息
MT_RED_PACKAGE = 10; // 红包消息
}

// 红包类型
enum RedPacketType {
RPT_UNKNOWN = 0; // 未知
RPT_FRIEND = 1; // 好友红包
RPT_GROUP_NORMAL = 2; // 群组普通红包
RPT_GROUP_LUCK = 3; // 群组手气红包
RPT_GROUP_SPECIALLY = 4; // 群组专属红包
RPT_SYSTEM_FOR = 5; // 系统红包
}

// 红包消息类型
enum RedPacketMessageType {
RMT_UNKNOWN = 0; // 未知
RMT_SEND = 1; // 发红包
RMT_GRAB = 2; // 抢红包
}

// 红包状态类型
enum RedPacketStatusType {
RPS_NOT_DRAW = 0; // 未领取
RPS_DRAWING = 1; // 领取中
RPS_DRAW_OVER = 2; // 领取完
RPS_EXPIRE = 3; //已过期
}

// 文本消息
message Text {
string text = 1; // 文本消息内容
}

// 表情消息
message Face {
int64 face_id = 1;
string face_url = 2;
}

// 语音消息
message Voice {
string id = 1; // 语音包id
int32 size = 2; // 语音包大小
int32 duration = 3; // 语音时长
string url = 4; // 语音文件URL
}

// 图片消息
message Image {
string id = 1; // 图片id
int32 width = 2; // 图片宽度
int32 height = 3; // 图片长度
string url = 4; // 图片URL
string thumbnail_url = 5; // 图片缩略图url
}

// 文件消息
message File {
int64 id = 12; // 文件id
string name = 13; // 文件名
int64 size = 14; // 文件大小
string url = 15; // 文件url
}

// 地理位置消息
message Location {
string desc = 1; // 描述
double latitude = 2; // 经度
double longitude = 3; // 纬度
}

// Command 指令推送,1000以下,IM内部用,1000以上,留给业务用
message Command {
int32 code = 1; // 指令码
bytes data = 2; // 数据内容
}

// 自定义消息
message Custom {
string data = 1; // 自定义数据
}

// 撤回消息
message RECALL {
int64 recall_seq = 1; // 撤回消息seq
}


// 红包消息
message RED_PACKAGE {
RedPacketMessageType red_message_type = 1;// 红包消息类型
RedPacketType red_packet_type = 2; // 红包类型
string red_packet_content = 3; // 红包文字内容
float red_packet_amount = 6; // 红包金额
int32 red_packet_nums = 5; // 红包数量
float red_packet_balance_amount = 7; // 红包余额
int64 received_user_id = 8; // 领取用户id
float received_user_amount = 9; // 领取用户金额
string received_user_nickname = 10; // 领取用户昵称
RedPacketStatusType red_packet_status_type = 11; // 领取状态
int64 red_packet_id = 12; // 红包id
int64 send_red_packet_uid = 13; // 红包发送者uid
string send_red_packet_nickname = 14; // 红包发送者昵称
string send_red_packet_avatar_url = 15; // 红包发送者头像
string red_packet_small_content = 16; // 红包小文字内容
}

/************************************消息体定义结束************************************/

// 上行数据
message Input {
PackageType type = 1; // 包的类型
int64 request_id = 2; // 请求id
bytes data = 3; // 数据
}

// 下行数据
message Output {
PackageType type = 1; // 包的类型
int64 request_id = 2; // 请求id
int32 code = 3; // 错误码
string message = 4; // 错误信息
bytes data = 5; // 数据
}

// 设备登录,package_type:1
message SignInInput {
int64 device_id = 1; // 设备id
int64 user_id = 2; // 用户id
string token = 3; // 秘钥
}

// 消息同步请求,package_type:2
message SyncInput {
int64 seq = 1; // 客户端已经同步的序列号
}
// 消息同步响应,package_type:2
message SyncOutput {
repeated Message messages = 1; // 消息列表
bool has_more = 2; // 是否有更多数据
}

// 订阅房间请求
message SubscribeRoomInput {
int64 room_id = 1; // 房间ID,如果为0,取消房间订阅
int64 seq = 2; // 消息消息序列号,
}

enum ReceiverType {
RT_UNKNOWN = 0; // 未知
RT_USER = 1; // 用户
RT_GROUP = 2; // 群组
RT_ROOM = 3; // 房间
}

// 消息投递,package_type:4
message MessageSend {
Message message = 1; // 消息
}

enum SenderType {
ST_UNKNOWN = 0; // 未知的
ST_SYSTEM = 1; // IM系统
ST_USER = 2; // 用户
ST_BUSINESS = 3; // 业务方
}

enum MessageStatus {
MS_UNKNOWN = 0; // 未知的
MS_NORMAL = 1; // 正常的
MS_RECALL = 2; // 撤回
}

// 投递消息回执,package_type:4
message MessageACK {
int64 device_ack = 2; // 设备收到消息的确认号
int64 receive_time = 3; // 消息接收时间戳,精确到毫秒
}

// 群组用户状态
enum GroupUserStatusType {
GROUP_USER_STATUS_NORMAL = 0; // 正常
GROUP_USER_STATUS_Banned = 1; // 禁言
}

+ 28
- 0
app/pkg/proto/im.connect.int.proto 查看文件

@@ -0,0 +1,28 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.common.ext.proto";
import "im.connect.ext.proto";

service ConnectInt {
// 消息投递
rpc DeliverMessage (DeliverMessageReq) returns (Empty);
}

message DeliverMessageReq {
int64 device_id = 1; // 设备id
MessageSend message_send = 2; // 数据
}

// 房间推送
message PushRoomMsg{
int64 room_id = 1; // 设备id
MessageSend message_send = 2; // 数据
}

// 房间推送
message PushAllMsg{
MessageSend message_send = 2; // 数据
}


+ 238
- 0
app/pkg/proto/im.logic.ext.proto 查看文件

@@ -0,0 +1,238 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.common.ext.proto";
import "im.connect.ext.proto";

service LogicExt {
// 注册设备
rpc RegisterDevice (RegisterDeviceReq) returns (RegisterDeviceResp);

// 发送消息
rpc SendMessage (SendMessageReq) returns (SendMessageResp);
// 撤回消息
rpc RecallMessage (RecallMessageReq) returns (RecallMessageResp);
// 推送消息到房间
rpc PushRoom(PushRoomReq)returns(Empty);

// 发送红包
rpc SendRedPacket (SendRedPacketReq) returns (SendRedPacketResp);

// 添加好友
rpc AddFriend (AddFriendReq) returns (Empty);
// 同意添加好友
rpc AgreeAddFriend (AgreeAddFriendReq) returns (Empty);
// 删除好友
rpc DeleteFriend (DeleteFriendReq) returns (Empty);
// 设置好友信息
rpc SetFriend (SetFriendReq) returns (SetFriendResp);
// 获取好友列表
rpc GetFriends (Empty) returns (GetFriendsResp);

// 创建群组
rpc CreateGroup (CreateGroupReq) returns (CreateGroupResp);
// 更新群组
rpc UpdateGroup (UpdateGroupReq) returns (Empty);
// 获取群组信息
rpc GetGroup (GetGroupReq) returns (GetGroupResp);
// 获取用户加入的所有群组
rpc GetGroups (Empty) returns (GetGroupsResp);

// 添加群组成员
rpc AddGroupMembers (AddGroupMembersReq) returns (AddGroupMembersResp);
// 更新群组成员信息
rpc UpdateGroupMember (UpdateGroupMemberReq) returns (Empty);
// 添加群组成员
rpc DeleteGroupMember (DeleteGroupMemberReq) returns (Empty);
// 获取群组成员
rpc GetGroupMembers (GetGroupMembersReq) returns (GetGroupMembersResp);
}

message RegisterDeviceReq {
int32 type = 2; // 设备类型
string brand = 3; // 厂商
string model = 4; // 机型
string system_version = 5; // 系统版本
string sdk_version = 6; // sdk版本号
}
message RegisterDeviceResp {
int64 device_id = 1; // 设备id
}

message SendMessageReq {
ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
int64 receiver_id = 2; // 用户id或者群组id
repeated int64 to_user_ids = 3; // 需要@的用户id列表
MessageType message_type = 4; // 消息类型
bytes message_content = 5; // 消息内容
int64 send_time = 6; // 消息发送时间戳,精确到毫秒
bool is_persist = 7; // 是否将消息持久化到数据库
string message_content_back = 8;
}
message SendMessageResp {
int64 seq = 1; // 消息序列号
}

message RecallMessageReq {
ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
int64 receiver_id = 2; // 用户id或者群组id
repeated int64 to_user_ids = 3; // 需要@的用户id列表
MessageType message_type = 4; // 消息类型
bytes message_content = 5; // 消息内容
int64 send_time = 6; // 消息发送时间戳,精确到毫秒
bool is_persist = 7; // 是否将消息持久化到数据库
string message_content_back = 8;
}
message RecallMessageResp {
int64 seq = 1; // 消息序列号
}


message SendRedPacketReq {
ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
int64 receiver_id = 2; // 用户id或者群组id
MessageType message_type = 3; // 消息类型
bytes message_content = 4; // 消息内容
int64 send_time = 5; // 消息发送时间戳,精确到毫秒
repeated int64 to_user_ids = 6; // 红包给到哪些用户(专属红包)
string message_content_back = 7;
}
message SendRedPacketResp {
int64 seq = 1; // 消息序列号
}

message PushRoomReq{
int64 room_id = 1; // 房间id
MessageType message_type = 2; // 消息类型
bytes message_content = 3; // 消息内容
int64 send_time = 4; // 消息发送时间戳,精确到毫秒
bool is_persist = 5; // 是否将消息持久化
bool is_priority = 6; // 是否优先推送
}

message AddFriendReq {
int64 friend_id = 1; // 用户id
string remarks = 2; // 备注
string description = 3; // 描述
}

message DeleteFriendReq {
int64 user_id = 1; // 用户id
}


message AgreeAddFriendReq {
int64 user_id = 1; // 用户id
string remarks = 2; // 备注
}

message SetFriendReq {
int64 friend_id = 1; // 好友id
string remarks = 2; // 备注
string extra = 8; // 附加字段
}
message SetFriendResp {
int64 friend_id = 1; // 好友id
string remarks = 2; // 备注
string extra = 8; // 附加字段
}

message Friend {
int64 user_id = 1; // 用户id
string phone_number = 2; // 电话号码
string nickname = 3; // 昵称
int32 sex = 4; // 性别
string avatar_url = 5; // 头像地址
string user_extra = 6; // 用户附加字段
string remarks = 7; // 备注
string extra = 8; // 附加字段
}
message GetFriendsResp {
repeated Friend friends = 1;
}

message CreateGroupReq {
string name = 1; // 名称
string avatar_url = 2; // 头像
string introduction = 3; // 简介
string extra = 4; // 附加字段
repeated int64 member_ids = 5; // 群组成员ID列表
}
message CreateGroupResp {
int64 group_id = 1; // 群组id
}

message UpdateGroupReq {
int64 group_id = 1; // 群组id
string avatar_url = 2; // 头像
string name = 3; // 名称
string introduction = 4; // 简介
string extra = 5; // 附加字段
}

message GetGroupReq {
int64 group_id = 1;
}
message GetGroupResp {
Group group = 1;
}

message Group {
int64 group_id = 1; // 群组id
string name = 2; // 名称
string avatar_url = 3; // 头像
string introduction = 4; // 简介
int32 user_mum = 5; // 用户数
string extra = 6; // 附加字段
int64 create_time = 7; // 创建时间
int64 update_time = 8; // 更新时间
}

message GetGroupsResp {
repeated Group groups = 1;
}

message AddGroupMembersReq {
int64 group_id = 1; // 群组id
repeated int64 user_ids = 2; // 用户id列表
}
message AddGroupMembersResp {
repeated int64 user_ids = 1; // 已经在群组的用户id列表
}

enum MemberType {
GMT_UNKNOWN = 0; // 未知
GMT_ADMIN = 1; // 管理员
GMT_MEMBER = 2; // 成员
}

message UpdateGroupMemberReq {
int64 group_id = 1; // 群组id
int64 user_id = 2; // 用户id
MemberType member_type = 3; // 成员类型
string remarks = 4; // 备注
string extra = 5; // 附加字段
}

message DeleteGroupMemberReq {
int64 group_id = 1; // 群组id
int64 user_id = 2; // 用户id
}

message GetGroupMembersReq {
int64 group_id = 1;
}
message GetGroupMembersResp {
repeated GroupMember members = 1;
}
message GroupMember {
int64 user_id = 1;
string nickname = 2; // 昵称
int32 sex = 3; // 性别
string avatar_url = 4; // 头像地址
string user_extra = 5; // 用户附加字段
MemberType member_type = 6; // 成员类型
string remarks = 7; // 备注
string extra = 8; // 群组成员附加字段
}

+ 102
- 0
app/pkg/proto/im.logic.int.proto 查看文件

@@ -0,0 +1,102 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.common.ext.proto";
import "im.connect.ext.proto";
import "im.logic.ext.proto";

service LogicInt {
// 登录
rpc ConnSignIn (ConnSignInReq) returns (Empty);
// 消息同步
rpc Sync (SyncReq) returns (SyncResp);
// 设备收到消息回执
rpc MessageACK (MessageACKReq) returns (Empty);
// 设备离线
rpc Offline (OfflineReq) returns (Empty);
// 订阅房间
rpc SubscribeRoom(SubscribeRoomReq)returns(Empty);
// 发送消息
rpc SendMessage (SendMessageReq) returns (SendMessageResp);
// 推送消息到房间
rpc PushRoom(PushRoomReq)returns(Empty);
// 全服推送
rpc PushAll(PushAllReq)returns(Empty);

// 获取设备信息
rpc GetDevice (GetDeviceReq) returns (GetDeviceResp);
// 服务停止
rpc ServerStop (ServerStopReq) returns (Empty);
}

message ConnSignInReq {
int64 device_id = 1; // 设备id
int64 user_id = 2; // 用户id
string token = 3; // 秘钥
string conn_addr = 4; // 服务器地址
string client_addr = 5; // 客户端地址
}

message SyncReq {
int64 user_id = 1; // 用户id
int64 device_id = 2; // 设备id
int64 seq = 3; // 客户端已经同步的序列号
}
message SyncResp {
repeated Message messages = 1; // 消息列表
bool has_more = 2; // 是否有更多数据
}

message MessageACKReq {
int64 user_id = 1; // 用户id
int64 device_id = 2; // 设备id
int64 device_ack = 3; // 设备收到消息的确认号
int64 receive_time = 4; // 消息接收时间戳,精确到毫秒
}

message OfflineReq {
int64 user_id = 1; // 用户id
int64 device_id = 2; // 设备id
string client_addr = 3; // 客户端地址
}

message SubscribeRoomReq{
int64 user_id = 1; // 用户id
int64 device_id = 2; // 设备id
int64 room_id = 3; // 房间id
int64 seq = 4; // 消息序列号
string conn_addr = 5; // 服务器地址
}

message PushAllReq{
MessageType message_type = 1; // 消息类型
bytes message_content = 2; // 消息内容
int64 send_time = 3; // 消息发送时间戳,精确到毫秒
}

message GetDeviceReq {
int64 device_id = 1;
}
message GetDeviceResp {
Device device = 1;
}

message Device {
int64 device_id = 1; // 设备id
int64 user_id = 2; // 用户id
int32 type = 3; // 设备类型,1:Android;2:IOS;3:Windows; 4:MacOS;5:Web
string brand = 4; // 手机厂商
string model = 5; // 机型
string system_version = 6; // 系统版本
string sdk_version = 7; // SDK版本
int32 status = 8; // 在线状态,0:不在线;1:在线
string conn_addr = 9; // 服务端连接地址
string client_addr = 10; // 客户端地址
int64 create_time = 11; // 创建时间
int64 update_time = 12; // 更新时间
}

message ServerStopReq {
string conn_addr = 1;
}

+ 58
- 0
app/pkg/proto/im.push.ext.proto 查看文件

@@ -0,0 +1,58 @@
syntax = "proto3";
package pb;
option go_package = "gim/pkg/pb/";

import "im.logic.ext.proto";

enum PushCode {
PC_ADD_DEFAULT = 0;

PC_ADD_FRIEND = 100; // 添加好友请求
PC_AGREE_ADD_FRIEND = 101; // 同意添加好友

PC_UPDATE_GROUP = 110; // 更新群组

PC_ADD_GROUP_MEMBERS = 120; // 添加群组成员
PC_REMOVE_GROUP_MEMBER = 121; // 移除群组成员

}

// 推送码 PC_ADD_FRIEND = 100
message AddFriendPush {
int64 friend_id = 1; // 好友id
string nickname = 2; // 昵称
string avatar_url = 3; // 头像
string description = 4; // 描述
}

// 推送码 PC_AGREE_ADD_FRIEND = 101
message AgreeAddFriendPush {
int64 friend_id = 1; // 好友id
string nickname = 2; // 昵称
string avatar_url = 3; // 头像
}

// 更新群组 PC_UPDATE_GROUP = 110
message UpdateGroupPush {
int64 opt_id = 1; // 操作人用户id
string opt_name = 2; // 操作人昵称
string name = 3; // 群组名称
string avatar_url = 4; // 群组头像
string introduction = 5; // 群组简介
string extra = 6; // 附加字段
}

// 添加群组成员 PC_AGREE_ADD_GROUPS = 120
message AddGroupMembersPush {
int64 opt_id = 1; // 操作人用户id
string opt_name = 2; // 操作人昵称
repeated GroupMember members = 3; // 群组成员
}

// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 121
message RemoveGroupMemberPush {
int64 opt_id = 1; // 操作人用户id
string opt_name = 2; // 操作人昵称
int64 deleted_user_id = 3; // 被删除的成员id
string deleted_user_name = 4; // 被删除的成员昵称
}

+ 15
- 0
app/router/router.go 查看文件

@@ -65,6 +65,7 @@ func route(r *gin.RouterGroup) {
r.POST("/register", hdl.Register) //注册
r.POST("/login", hdl.Login) //登录
r.POST("/findPassword", hdl.FindPassword) //找回密码
r.GET("/getModuleSetting", hdl.GetModuleSetting) // 获取
r.Use(mw.Auth) // 以下接口需要JWT验证
rComm(r.Group("/comm"))
r.GET("/userInfo", hdl.UserInfo) //用户基础信息
@@ -106,6 +107,10 @@ func route(r *gin.RouterGroup) {
rWallet := r.Group("/wallet") // 钱包
{
rWallet.GET("/amountFlow", hdl.GetAmountFlow) // 余额流水
rWithdraw := r.Group("/withdraw")
{
rWithdraw.GET("/index", hdl.WithdrawGetAmount)
}
}
rCollege := r.Group("/college") //学院
{
@@ -125,6 +130,16 @@ func route(r *gin.RouterGroup) {
rUserFeedback.POST("/say", hdl.UserFeedbackSay) // 沟通
}

rNewUserRedPacket := r.Group("/newUserRedPacket") // 新人红包
{
rNewUserRedPacket.GET("/index", hdl.NewUserRedPacketInfo)
}
rIm := r.Group("/im")
{
rIm.POST("/user/sendRedPackageDetail", hdl.SendRedPackageDetail) // IM-发红包
rIm.POST("/user/grabRedPackage", hdl.GrabRedPackage) // IM-领取红包
rIm.GET("/redPackageDetail", hdl.RedPackageDetail) // IM-红包详情
}
}

func rComm(r *gin.RouterGroup) {


+ 1
- 0
app/svc/svc_auth.go 查看文件

@@ -61,6 +61,7 @@ func CheckUser(c *gin.Context) (user *model.User, newToken string, err error) {
if err != nil {
return user, newToken, err
}

// 3、获取用户信息
//userInfoProvider := provider.GetUserInfoProvider()
userInfoProvider := provider.NewUserInfoProvider()


+ 231
- 0
app/svc/svc_im.go 查看文件

@@ -0,0 +1,231 @@
package svc

import (
"applet/app/db"
"applet/app/md"
"applet/app/pkg/pb"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule"
"errors"
"github.com/shopspring/decimal"
"google.golang.org/protobuf/proto"
"strings"
"time"
)

func DelGrabRedPackage(req *md.GrabRedPackageReq, user *model.User) (resp []byte, grabAmount string, err error) {
var redPacketBalanceAmount, redPacketReceivedUserIds, redPacketReceivedImUserIds, redPackageReceivedUserAmount string
//1、查找红包
redPackageOrdDb := implement.NewImSendRedPackageOrdDb(db.Db)
imSendRedPackageOrd, err := redPackageOrdDb.ImSendRedPackageOrdGetOneByParams(map[string]interface{}{
"key": "id",
"value": req.RedPackageId,
})
if err != nil {
return nil, grabAmount, err
}

if imSendRedPackageOrd == nil {
return nil, grabAmount, errors.New("未查询到对应的红包记录")
}
if imSendRedPackageOrd.RedPacketBalanceNums == 0 || imSendRedPackageOrd.State == int(pb.RedPacketStatusType_RPS_EXPIRE) {
return nil, "-1", nil
}

//2、判断用户是否已领取
receivedUserIds := strings.Split(imSendRedPackageOrd.ReceivedUserIds, ",")
for k, receivedUserId := range receivedUserIds {
if receivedUserId == utils.Int64ToStr(user.Id) {
redPackageReceivedUserAmounts := strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",")
grabAmount = redPackageReceivedUserAmounts[k]
return nil, grabAmount, err
}
}

//3、判断红包类型
if imSendRedPackageOrd.RedPacketType == int(pb.RedPacketType_RPT_FRIEND) {
//好友红包
grabAmount = imSendRedPackageOrd.Amount
redPacketBalanceAmount = "0"
redPacketReceivedImUserIds = req.UserId
redPacketReceivedUserIds = utils.Int64ToStr(user.Id)
redPackageReceivedUserAmount = imSendRedPackageOrd.Amount
} else {
var receivedImUserIds, receivedUserIds, waitDrawImUserIds, redPackageReceivedUserAmounts []string
if imSendRedPackageOrd.ReceivedImUserIds != "" {
receivedImUserIds = strings.Split(imSendRedPackageOrd.ReceivedImUserIds, ",")
}
if imSendRedPackageOrd.ReceivedUserIds != "" {
receivedUserIds = strings.Split(imSendRedPackageOrd.ReceivedUserIds, ",")
}
if imSendRedPackageOrd.WaitDrawImUserIds != "" {
waitDrawImUserIds = strings.Split(imSendRedPackageOrd.WaitDrawImUserIds, ",")
}
if imSendRedPackageOrd.ReceivedUserAmount != "" {
redPackageReceivedUserAmounts = strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",")
}

//群组红包
switch imSendRedPackageOrd.RedPacketType {
case int(pb.RedPacketType_RPT_GROUP_NORMAL):
amount, _ := decimal.NewFromString(imSendRedPackageOrd.Amount)
tmpGrabAmount := amount.Div(decimal.NewFromInt(int64(imSendRedPackageOrd.RedPacketNums)))
grabAmount = tmpGrabAmount.String()
tempRedPacketBalanceAmount, _ := decimal.NewFromString(imSendRedPackageOrd.RedPacketBalanceAmount)
redPacketBalanceAmount = tempRedPacketBalanceAmount.Sub(tmpGrabAmount).String()
break
case int(pb.RedPacketType_RPT_GROUP_LUCK):
balanceAmount, err := decimal.NewFromString(imSendRedPackageOrd.RedPacketBalanceAmount)
if err != nil {
return nil, grabAmount, err
}
balanceAmountValue, _ := balanceAmount.Float64()
tmpGrabAmount := float64(utils.DoubleAverage(int64(imSendRedPackageOrd.RedPacketBalanceNums), utils.FloatToInt64(balanceAmountValue*100))) / 100
grabAmount = utils.AnyToString(tmpGrabAmount)
redPacketBalanceAmount = balanceAmount.Sub(decimal.NewFromFloat(tmpGrabAmount)).String()
break
case int(pb.RedPacketType_RPT_GROUP_SPECIALLY):
if !utils.ContainerStr(waitDrawImUserIds, req.UserId) {
return nil, grabAmount, errors.New("非专属用户不能领取")
}
grabAmount = imSendRedPackageOrd.Amount
redPacketBalanceAmount = "0"
redPacketReceivedImUserIds = req.UserId
break
case int(pb.RedPacketType_RPT_SYSTEM_FOR):
if !utils.ContainerStr(waitDrawImUserIds, req.UserId) {
return nil, grabAmount, errors.New("非专属用户不能领取")
}
grabAmount = imSendRedPackageOrd.Amount
redPacketBalanceAmount = "0"
redPacketReceivedImUserIds = req.UserId
break
}
receivedImUserIds = append(receivedImUserIds, req.UserId)
redPacketReceivedImUserIds = strings.Join(receivedImUserIds, ",")
receivedUserIds = append(receivedUserIds, utils.AnyToString(user.Id))
redPacketReceivedUserIds = strings.Join(receivedUserIds, ",")
redPackageReceivedUserAmounts = append(redPackageReceivedUserAmounts, grabAmount)
redPackageReceivedUserAmount = strings.Join(redPackageReceivedUserAmounts, ",")
}

session := db.Db.NewSession()
defer session.Close()

//2、改变红包记录状态
if imSendRedPackageOrd.ReceivedTimes != "" {
receivedTimes := strings.Split(imSendRedPackageOrd.ReceivedTimes, ",")
receivedTimes = append(receivedTimes, time.Now().Format("2006-01-02 15:04:05"))
imSendRedPackageOrd.ReceivedTimes = strings.Join(receivedTimes, ",")
} else {
imSendRedPackageOrd.ReceivedTimes = time.Now().Format("2006-01-02 15:04:05")
}

imSendRedPackageOrd.RedPacketBalanceNums = imSendRedPackageOrd.RedPacketBalanceNums - 1
if imSendRedPackageOrd.RedPacketBalanceNums > 0 {
imSendRedPackageOrd.State = int(pb.RedPacketStatusType_RPS_DRAWING)
} else {
imSendRedPackageOrd.State = int(pb.RedPacketStatusType_RPS_DRAW_OVER)
}
imSendRedPackageOrd.ReceivedUserAmount = redPackageReceivedUserAmount
imSendRedPackageOrd.RedPacketBalanceAmount = redPacketBalanceAmount
imSendRedPackageOrd.ReceivedUserIds = redPacketReceivedUserIds
imSendRedPackageOrd.ReceivedImUserIds = redPacketReceivedImUserIds
_, err = redPackageOrdDb.ImSendRedPackageOrdUpdateBySession(session, imSendRedPackageOrd.Id, imSendRedPackageOrd, "red_packet_balance_nums", "state", "received_user_ids", "received_im_user_ids", "received_times",
"received_user_amount", "create_time", "update_time", "red_packet_balance_amount")
if err != nil {
session.Rollback()
return nil, grabAmount, err
}

//3、加上给用户加上余额
dealUserWalletReq := md2.DealUserWalletReq{
Direction: "add",
Kind: 5,
Title: "领取红包收益",
Uid: user.Id,
Amount: utils.StrToFloat64(grabAmount),
}
err = rule.DealUserWallet(session, dealUserWalletReq)
if err != nil {
session.Rollback()
return nil, grabAmount, err
}

//4、组装消息参数
msg := &pb.RED_PACKAGE{
RedMessageType: pb.RedPacketMessageType_RMT_GRAB,
RedPacketType: pb.RedPacketType(imSendRedPackageOrd.RedPacketType),
RedPacketContent: "",
//RedPacketAmount: float32(utils.AnyToFloat64(req.Amount)),
//RedPacketNums: int32(req.RedPacketNums),
RedPacketBalanceAmount: float32(utils.AnyToFloat64(imSendRedPackageOrd.RedPacketBalanceAmount)),
ReceivedUserId: utils.StrToInt64(req.UserId),
ReceivedUserAmount: utils.StrToFloat32(grabAmount),
ReceivedUserNickname: user.Nickname,
RedPacketStatusType: pb.RedPacketStatusType(imSendRedPackageOrd.State),
RedPacketId: imSendRedPackageOrd.Id,
SendRedPacketUid: int64(imSendRedPackageOrd.ImUid),
SendRedPacketNickname: req.SendRedPackageUserNikeName,
SendRedPacketAvatarUrl: req.SendRedPacketAvatarUrl,
//RedPacketSmallContent: req.RedPacketSmallContent,
RedPacketCover: req.RedPackageCover,
}

utils.FilePutContents("DelGrabRedPackage", utils.SerializeStr(map[string]interface{}{
"args": req,
"msg": msg,
"ord": imSendRedPackageOrd,
}))
resp, err = proto.Marshal(msg)
if err != nil {
return nil, grabAmount, err
}
return resp, grabAmount, nil
}

func DetailGrabRedPackage(redPackageId string) (resp []md.RedPackageDetailUserNode, imSendRedPackageOrd *model.ImSendRedPackageOrd, err error) {

//1、查找红包
redPackageOrdDb := implement.NewImSendRedPackageOrdDb(db.Db)
imSendRedPackageOrd, err = redPackageOrdDb.ImSendRedPackageOrdGetOneByParams(map[string]interface{}{
"key": "id",
"value": redPackageId,
})
if err != nil {
return nil, nil, err
}
if imSendRedPackageOrd == nil {
return resp, imSendRedPackageOrd, errors.New("未查询到对应的红包记录")
}
receivedUserIds := strings.Split(imSendRedPackageOrd.ReceivedUserIds, ",")
userDb := implement.NewUserDb(db.Db)
users, err := userDb.UserFindByParams(map[string]interface{}{
"key": "id",
"value": receivedUserIds,
})
if err != nil {
return resp, imSendRedPackageOrd, err
}
var usersMap = map[string]model.User{}
for _, v := range users {
usersMap[utils.AnyToString(v.Id)] = v
}
receivedImUserIds := strings.Split(imSendRedPackageOrd.ReceivedImUserIds, ",")
receivedTimes := strings.Split(imSendRedPackageOrd.ReceivedTimes, ",")
receivedUserAmount := strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",")

for k, v := range receivedUserIds {
resp = append(resp, md.RedPackageDetailUserNode{
ImUserId: receivedImUserIds[k],
UserNickName: usersMap[v].Nickname,
UserAvatarUrl: usersMap[v].Avatar,
Amount: receivedUserAmount[k],
ReceiveAt: receivedTimes[k],
})
}
return resp, imSendRedPackageOrd, nil
}

+ 26
- 0
app/utils/algorithm.go 查看文件

@@ -0,0 +1,26 @@
package utils

import (
"math/rand"
"time"
)

// RED_PACKET_MIN_MONEY 红包最小金额(单位:分)
const RED_PACKET_MIN_MONEY = 1

// DoubleAverage 二倍均值算法
func DoubleAverage(count, amount int64) int64 {
if count == 1 {
return amount
}
//计算出最大可用金额
max := amount - RED_PACKET_MIN_MONEY*count
//计算出最大可用平均值
avg := max / count
//二倍均值基础上再加上最小金额 防止出现金额为0
avg2 := 2*avg + RED_PACKET_MIN_MONEY
//随机红包金额序列元素,把二倍均值作为随机的最大数
rand.Seed(time.Now().UnixNano())
x := rand.Int63n(avg2) + RED_PACKET_MIN_MONEY
return x
}

+ 59
- 0
app/utils/rpc_client.go 查看文件

@@ -0,0 +1,59 @@
package utils

import (
"applet/app/pkg/pb"
"context"
"fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"strconv"
"time"
)

func GetBusinessIntClient(url, port string) pb.BusinessIntClient {
target := fmt.Sprintf("%s:%s", url, port)
conn, err := grpc.Dial(target, grpc.WithInsecure())
if err != nil {
fmt.Println(err)
return nil
}
return pb.NewBusinessIntClient(conn)
}

func GetBusinessExtClient(url, port string) pb.BusinessExtClient {
target := fmt.Sprintf("%s:%s", url, port)
conn, err := grpc.Dial(target, grpc.WithInsecure())
//defer conn.Close()
if err != nil {
fmt.Println(err)
return nil
}
return pb.NewBusinessExtClient(conn)
}

func GetLogicExtClient(url, port string) pb.LogicExtClient {
target := fmt.Sprintf("%s:%s", url, port)
conn, err := grpc.Dial(target, grpc.WithInsecure())
if err != nil {
fmt.Println(err)
return nil
}
return pb.NewLogicExtClient(conn)
}

func GetCtx(token, userId, deviceId string) context.Context {
if userId == "" {
userId = "1"
}
if deviceId == "" {
deviceId = "1"
}
if token == "" {
token = "0"
}
return metadata.NewOutgoingContext(context.TODO(), metadata.Pairs(
"user_id", userId,
"device_id", deviceId,
"token", token,
"request_id", strconv.FormatInt(time.Now().UnixNano(), 10)))
}

+ 18
- 9
app/utils/string.go 查看文件

@@ -16,7 +16,7 @@ func Implode(glue string, args ...interface{}) string {
return strings.Join(data, glue)
}

//字符串是否在数组里
// 字符串是否在数组里
func InArr(target string, str_array []string) bool {
for _, element := range str_array {
if target == element {
@@ -26,7 +26,7 @@ func InArr(target string, str_array []string) bool {
return false
}

//把数组的值放到key里
// 把数组的值放到key里
func ArrayColumn(array interface{}, key string) (result map[string]interface{}, err error) {
result = make(map[string]interface{})
t := reflect.TypeOf(array)
@@ -55,7 +55,7 @@ func ArrayColumn(array interface{}, key string) (result map[string]interface{},
return result, err
}

//转string
// 转string
func InterfaceToString(v interface{}) (result string, err error) {
switch reflect.TypeOf(v).Kind() {
case reflect.Int64, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32:
@@ -114,12 +114,12 @@ func GetQueryParam(uri string) map[string]string {
return query
}

//JoinStringsInASCII 按照规则,参数名ASCII码从小到大排序后拼接
//data 待拼接的数据
//sep 连接符
//onlyValues 是否只包含参数值,true则不包含参数名,否则参数名和参数值均有
//includeEmpty 是否包含空值,true则包含空值,否则不包含,注意此参数不影响参数名的存在
//exceptKeys 被排除的参数名,不参与排序及拼接
// JoinStringsInASCII 按照规则,参数名ASCII码从小到大排序后拼接
// data 待拼接的数据
// sep 连接符
// onlyValues 是否只包含参数值,true则不包含参数名,否则参数名和参数值均有
// includeEmpty 是否包含空值,true则包含空值,否则不包含,注意此参数不影响参数名的存在
// exceptKeys 被排除的参数名,不参与排序及拼接
func JoinStringsInASCII(data map[string]string, sep string, onlyValues, includeEmpty bool, exceptKeys ...string) string {
var list []string
var keyList []string
@@ -153,3 +153,12 @@ func JoinStringsInASCII(data map[string]string, sep string, onlyValues, includeE
}
return strings.Join(list, sep)
}

func ContainerStr(slice []string, element string) bool {
for _, e := range slice {
if e == element {
return true
}
}
return false
}

+ 469
- 0
docs/docs.go 查看文件

@@ -884,6 +884,51 @@ const docTemplate = `{
}
}
},
"/api/v1/getModuleSetting": {
"get": {
"description": "页面样式",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"页面样式"
],
"summary": "页面样式",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)",
"name": "mod_name_value",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.GetModuleSettingResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/homePage/adRule": {
"get": {
"description": "视频奖励规则(获取)",
@@ -1074,6 +1119,145 @@ const docTemplate = `{
}
}
},
"/api/v1/im/redPackageDetail": {
"get": {
"description": "红包详情(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-红包详情(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "红包 ID",
"name": "red_package_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.RedPackageDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/im/user/grabRedPackage": {
"post": {
"description": "领取红包",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-领取红包",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "领取红包信息",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.GrabRedPackageReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.GrabRedPackageResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/im/user/sendRedPackageDetail": {
"post": {
"description": "发送红包",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-发送红包",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "红包的订单 ID",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.SendRedPackageDetailReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.SendRedPackageDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/login": {
"post": {
"description": "登入",
@@ -2062,6 +2246,44 @@ const docTemplate = `{
}
}
},
"/api/v1/wallet/withdraw/index": {
"get": {
"description": "提现余额(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"钱包"
],
"summary": "蛋蛋星球-钱包-提现余额(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.WithdrawGetAmountResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/wechatLogin": {
"post": {
"description": "微信登陆",
@@ -2788,6 +3010,36 @@ const docTemplate = `{
}
}
},
"md.GetModuleSettingResp": {
"type": "object",
"properties": {
"data": {
"description": "内容",
"type": "object",
"additionalProperties": true
},
"mod_name": {
"description": "模块名称",
"type": "string"
},
"position": {
"description": "位置",
"type": "string"
},
"skip_identifier": {
"description": "跳转标识",
"type": "string"
},
"subtitle": {
"description": "副标题",
"type": "string"
},
"title": {
"description": "标题",
"type": "string"
}
}
},
"md.GetPriceCurveResp": {
"type": "object",
"properties": {
@@ -2801,6 +3053,68 @@ const docTemplate = `{
}
}
},
"md.GrabRedPackageReq": {
"type": "object",
"properties": {
"device_id": {
"description": "设备id",
"type": "string"
},
"receiver_id": {
"description": "用户id或者群组id",
"type": "integer"
},
"receiver_type": {
"description": "接收者类型,1:user;2:group",
"type": "integer"
},
"red_package_cover": {
"description": "红包封面",
"type": "string"
},
"red_package_id": {
"description": "红包id",
"type": "integer"
},
"send_red_package_user_nike_name": {
"description": "红包发送者-im用户昵称",
"type": "string"
},
"send_red_packet_avatar_url": {
"description": "红包发送者-im用户头像",
"type": "string"
},
"send_time": {
"description": "消息发送时间戳,精确到毫秒",
"type": "integer"
},
"token": {
"description": "im-token",
"type": "string"
},
"user_id": {
"description": "im用户id",
"type": "string"
}
}
},
"md.GrabRedPackageResp": {
"type": "object",
"properties": {
"grab_amount": {
"description": "抢到的红包金额",
"type": "string"
},
"im": {
"description": "im 返回体",
"allOf": [
{
"$ref": "#/definitions/pb.SendRedPacketResp"
}
]
}
}
},
"md.HomePageResp": {
"type": "object",
"properties": {
@@ -3149,6 +3463,51 @@ const docTemplate = `{
}
}
},
"md.RedPackageDetailResp": {
"type": "object",
"properties": {
"detail": {
"description": "红包详情信息",
"allOf": [
{
"$ref": "#/definitions/model.ImSendRedPackageOrd"
}
]
},
"list": {
"description": "领取红包用户列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.RedPackageDetailUserNode"
}
}
}
},
"md.RedPackageDetailUserNode": {
"type": "object",
"properties": {
"amount": {
"description": "金额",
"type": "string"
},
"im_user_id": {
"description": "im用户id",
"type": "string"
},
"received_at": {
"description": "领取时间",
"type": "string"
},
"user_avatar_url": {
"description": "im用户昵称",
"type": "string"
},
"user_nick_name": {
"description": "im用户昵称",
"type": "string"
}
}
},
"md.RegisterReq": {
"type": "object",
"required": [
@@ -3212,6 +3571,36 @@ const docTemplate = `{
}
}
},
"md.SendRedPackageDetailReq": {
"type": "object",
"properties": {
"order_id": {
"description": "红包的订单 ID",
"type": "string"
}
}
},
"md.SendRedPackageDetailResp": {
"type": "object",
"properties": {
"im": {
"$ref": "#/definitions/md.SeqType"
},
"red_package_id": {
"description": "红包 ID",
"type": "integer"
}
}
},
"md.SeqType": {
"type": "object",
"properties": {
"seq": {
"description": "序列号",
"type": "integer"
}
}
},
"md.SmsSendReq": {
"type": "object",
"required": [
@@ -3539,6 +3928,86 @@ const docTemplate = `{
"example": "微信UnionId"
}
}
},
"md.WithdrawGetAmountResp": {
"type": "object",
"properties": {
"amount": {
"description": "余额",
"type": "string"
}
}
},
"model.ImSendRedPackageOrd": {
"type": "object",
"properties": {
"amount": {
"type": "string"
},
"create_time": {
"type": "string"
},
"id": {
"type": "integer"
},
"im_data": {
"type": "string"
},
"im_uid": {
"type": "integer"
},
"ord_no": {
"type": "string"
},
"received_im_user_ids": {
"type": "string"
},
"received_times": {
"type": "string"
},
"received_user_amount": {
"type": "string"
},
"received_user_ids": {
"type": "string"
},
"red_packet_balance_amount": {
"type": "string"
},
"red_packet_balance_nums": {
"type": "integer"
},
"red_packet_nums": {
"type": "integer"
},
"red_packet_type": {
"type": "integer"
},
"state": {
"type": "integer"
},
"uid": {
"type": "integer"
},
"update_time": {
"type": "string"
},
"wait_draw_im_user_ids": {
"type": "string"
},
"wait_draw_user_ids": {
"type": "string"
}
}
},
"pb.SendRedPacketResp": {
"type": "object",
"properties": {
"seq": {
"description": "消息序列号",
"type": "integer"
}
}
}
}
}`


+ 469
- 0
docs/swagger.json 查看文件

@@ -877,6 +877,51 @@
}
}
},
"/api/v1/getModuleSetting": {
"get": {
"description": "页面样式",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"页面样式"
],
"summary": "页面样式",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)",
"name": "mod_name_value",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.GetModuleSettingResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/homePage/adRule": {
"get": {
"description": "视频奖励规则(获取)",
@@ -1067,6 +1112,145 @@
}
}
},
"/api/v1/im/redPackageDetail": {
"get": {
"description": "红包详情(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-红包详情(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "红包 ID",
"name": "red_package_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.RedPackageDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/im/user/grabRedPackage": {
"post": {
"description": "领取红包",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-领取红包",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "领取红包信息",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.GrabRedPackageReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.GrabRedPackageResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/im/user/sendRedPackageDetail": {
"post": {
"description": "发送红包",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"即时通讯"
],
"summary": "蛋蛋星球-即时通讯-发送红包",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "红包的订单 ID",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.SendRedPackageDetailReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.SendRedPackageDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/login": {
"post": {
"description": "登入",
@@ -2055,6 +2239,44 @@
}
}
},
"/api/v1/wallet/withdraw/index": {
"get": {
"description": "提现余额(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"钱包"
],
"summary": "蛋蛋星球-钱包-提现余额(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.WithdrawGetAmountResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/wechatLogin": {
"post": {
"description": "微信登陆",
@@ -2781,6 +3003,36 @@
}
}
},
"md.GetModuleSettingResp": {
"type": "object",
"properties": {
"data": {
"description": "内容",
"type": "object",
"additionalProperties": true
},
"mod_name": {
"description": "模块名称",
"type": "string"
},
"position": {
"description": "位置",
"type": "string"
},
"skip_identifier": {
"description": "跳转标识",
"type": "string"
},
"subtitle": {
"description": "副标题",
"type": "string"
},
"title": {
"description": "标题",
"type": "string"
}
}
},
"md.GetPriceCurveResp": {
"type": "object",
"properties": {
@@ -2794,6 +3046,68 @@
}
}
},
"md.GrabRedPackageReq": {
"type": "object",
"properties": {
"device_id": {
"description": "设备id",
"type": "string"
},
"receiver_id": {
"description": "用户id或者群组id",
"type": "integer"
},
"receiver_type": {
"description": "接收者类型,1:user;2:group",
"type": "integer"
},
"red_package_cover": {
"description": "红包封面",
"type": "string"
},
"red_package_id": {
"description": "红包id",
"type": "integer"
},
"send_red_package_user_nike_name": {
"description": "红包发送者-im用户昵称",
"type": "string"
},
"send_red_packet_avatar_url": {
"description": "红包发送者-im用户头像",
"type": "string"
},
"send_time": {
"description": "消息发送时间戳,精确到毫秒",
"type": "integer"
},
"token": {
"description": "im-token",
"type": "string"
},
"user_id": {
"description": "im用户id",
"type": "string"
}
}
},
"md.GrabRedPackageResp": {
"type": "object",
"properties": {
"grab_amount": {
"description": "抢到的红包金额",
"type": "string"
},
"im": {
"description": "im 返回体",
"allOf": [
{
"$ref": "#/definitions/pb.SendRedPacketResp"
}
]
}
}
},
"md.HomePageResp": {
"type": "object",
"properties": {
@@ -3142,6 +3456,51 @@
}
}
},
"md.RedPackageDetailResp": {
"type": "object",
"properties": {
"detail": {
"description": "红包详情信息",
"allOf": [
{
"$ref": "#/definitions/model.ImSendRedPackageOrd"
}
]
},
"list": {
"description": "领取红包用户列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.RedPackageDetailUserNode"
}
}
}
},
"md.RedPackageDetailUserNode": {
"type": "object",
"properties": {
"amount": {
"description": "金额",
"type": "string"
},
"im_user_id": {
"description": "im用户id",
"type": "string"
},
"received_at": {
"description": "领取时间",
"type": "string"
},
"user_avatar_url": {
"description": "im用户昵称",
"type": "string"
},
"user_nick_name": {
"description": "im用户昵称",
"type": "string"
}
}
},
"md.RegisterReq": {
"type": "object",
"required": [
@@ -3205,6 +3564,36 @@
}
}
},
"md.SendRedPackageDetailReq": {
"type": "object",
"properties": {
"order_id": {
"description": "红包的订单 ID",
"type": "string"
}
}
},
"md.SendRedPackageDetailResp": {
"type": "object",
"properties": {
"im": {
"$ref": "#/definitions/md.SeqType"
},
"red_package_id": {
"description": "红包 ID",
"type": "integer"
}
}
},
"md.SeqType": {
"type": "object",
"properties": {
"seq": {
"description": "序列号",
"type": "integer"
}
}
},
"md.SmsSendReq": {
"type": "object",
"required": [
@@ -3532,6 +3921,86 @@
"example": "微信UnionId"
}
}
},
"md.WithdrawGetAmountResp": {
"type": "object",
"properties": {
"amount": {
"description": "余额",
"type": "string"
}
}
},
"model.ImSendRedPackageOrd": {
"type": "object",
"properties": {
"amount": {
"type": "string"
},
"create_time": {
"type": "string"
},
"id": {
"type": "integer"
},
"im_data": {
"type": "string"
},
"im_uid": {
"type": "integer"
},
"ord_no": {
"type": "string"
},
"received_im_user_ids": {
"type": "string"
},
"received_times": {
"type": "string"
},
"received_user_amount": {
"type": "string"
},
"received_user_ids": {
"type": "string"
},
"red_packet_balance_amount": {
"type": "string"
},
"red_packet_balance_nums": {
"type": "integer"
},
"red_packet_nums": {
"type": "integer"
},
"red_packet_type": {
"type": "integer"
},
"state": {
"type": "integer"
},
"uid": {
"type": "integer"
},
"update_time": {
"type": "string"
},
"wait_draw_im_user_ids": {
"type": "string"
},
"wait_draw_user_ids": {
"type": "string"
}
}
},
"pb.SendRedPacketResp": {
"type": "object",
"properties": {
"seq": {
"description": "消息序列号",
"type": "integer"
}
}
}
}
}

+ 316
- 0
docs/swagger.yaml 查看文件

@@ -473,6 +473,28 @@ definitions:
paginate:
$ref: '#/definitions/applet_app_md.Paginate'
type: object
md.GetModuleSettingResp:
properties:
data:
additionalProperties: true
description: 内容
type: object
mod_name:
description: 模块名称
type: string
position:
description: 位置
type: string
skip_identifier:
description: 跳转标识
type: string
subtitle:
description: 副标题
type: string
title:
description: 标题
type: string
type: object
md.GetPriceCurveResp:
properties:
x_data:
@@ -482,6 +504,49 @@ definitions:
items: {}
type: array
type: object
md.GrabRedPackageReq:
properties:
device_id:
description: 设备id
type: string
receiver_id:
description: 用户id或者群组id
type: integer
receiver_type:
description: 接收者类型,1:user;2:group
type: integer
red_package_cover:
description: 红包封面
type: string
red_package_id:
description: 红包id
type: integer
send_red_package_user_nike_name:
description: 红包发送者-im用户昵称
type: string
send_red_packet_avatar_url:
description: 红包发送者-im用户头像
type: string
send_time:
description: 消息发送时间戳,精确到毫秒
type: integer
token:
description: im-token
type: string
user_id:
description: im用户id
type: string
type: object
md.GrabRedPackageResp:
properties:
grab_amount:
description: 抢到的红包金额
type: string
im:
allOf:
- $ref: '#/definitions/pb.SendRedPacketResp'
description: im 返回体
type: object
md.HomePageResp:
properties:
egg_energy_now_price:
@@ -727,6 +792,36 @@ definitions:
user_count:
type: string
type: object
md.RedPackageDetailResp:
properties:
detail:
allOf:
- $ref: '#/definitions/model.ImSendRedPackageOrd'
description: 红包详情信息
list:
description: 领取红包用户列表
items:
$ref: '#/definitions/md.RedPackageDetailUserNode'
type: array
type: object
md.RedPackageDetailUserNode:
properties:
amount:
description: 金额
type: string
im_user_id:
description: im用户id
type: string
received_at:
description: 领取时间
type: string
user_avatar_url:
description: im用户昵称
type: string
user_nick_name:
description: im用户昵称
type: string
type: object
md.RegisterReq:
properties:
avatar:
@@ -772,6 +867,26 @@ definitions:
example: 具体错误原因
type: string
type: object
md.SendRedPackageDetailReq:
properties:
order_id:
description: 红包的订单 ID
type: string
type: object
md.SendRedPackageDetailResp:
properties:
im:
$ref: '#/definitions/md.SeqType'
red_package_id:
description: 红包 ID
type: integer
type: object
md.SeqType:
properties:
seq:
description: 序列号
type: integer
type: object
md.SmsSendReq:
properties:
captcha_output:
@@ -996,6 +1111,59 @@ definitions:
example: 微信UnionId
type: string
type: object
md.WithdrawGetAmountResp:
properties:
amount:
description: 余额
type: string
type: object
model.ImSendRedPackageOrd:
properties:
amount:
type: string
create_time:
type: string
id:
type: integer
im_data:
type: string
im_uid:
type: integer
ord_no:
type: string
received_im_user_ids:
type: string
received_times:
type: string
received_user_amount:
type: string
received_user_ids:
type: string
red_packet_balance_amount:
type: string
red_packet_balance_nums:
type: integer
red_packet_nums:
type: integer
red_packet_type:
type: integer
state:
type: integer
uid:
type: integer
update_time:
type: string
wait_draw_im_user_ids:
type: string
wait_draw_user_ids:
type: string
type: object
pb.SendRedPacketResp:
properties:
seq:
description: 消息序列号
type: integer
type: object
host: ddxq.izhim.com
info:
contact:
@@ -1576,6 +1744,37 @@ paths:
summary: 注册
tags:
- 注册
/api/v1/getModuleSetting:
get:
consumes:
- application/json
description: 页面样式
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page
5:invitation_poster)
in: query
name: mod_name_value
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.GetModuleSettingResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 页面样式
tags:
- 页面样式
/api/v1/homePage/adRule:
get:
consumes:
@@ -1701,6 +1900,98 @@ paths:
summary: 蛋蛋星球-主页-实时数据(获取)
tags:
- 主页
/api/v1/im/redPackageDetail:
get:
consumes:
- application/json
description: 红包详情(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 红包 ID
in: query
name: red_package_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.RedPackageDetailResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-即时通讯-红包详情(获取)
tags:
- 即时通讯
/api/v1/im/user/grabRedPackage:
post:
consumes:
- application/json
description: 领取红包
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 领取红包信息
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.GrabRedPackageReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.GrabRedPackageResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-即时通讯-领取红包
tags:
- 即时通讯
/api/v1/im/user/sendRedPackageDetail:
post:
consumes:
- application/json
description: 发送红包
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 红包的订单 ID
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.SendRedPackageDetailReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.SendRedPackageDetailResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-即时通讯-发送红包
tags:
- 即时通讯
/api/v1/login:
post:
consumes:
@@ -2354,6 +2645,31 @@ paths:
summary: 蛋蛋星球-钱包-余额明细(获取)
tags:
- 钱包
/api/v1/wallet/withdraw/index:
get:
consumes:
- application/json
description: 提现余额(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.WithdrawGetAmountResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-钱包-提现余额(获取)
tags:
- 钱包
/api/v1/wechatLogin:
post:
consumes:


+ 4
- 1
go.mod 查看文件

@@ -32,6 +32,7 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125081706-0915be3f4144
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126080048-3c72cf5fa2e9
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125063326-ee85ee3b2b1f
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be
@@ -43,6 +44,8 @@ require (
github.com/olivere/elastic/v7 v7.0.32
github.com/shopspring/decimal v1.3.1
github.com/tidwall/gjson v1.14.1
google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.34.0
)

require (
@@ -119,7 +122,7 @@ require (
golang.org/x/tools v0.20.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.4.0 // indirect
google.golang.org/protobuf v1.34.0 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect


正在加载...
取消
保存