@@ -10,16 +10,18 @@ type Config struct { | |||
CurlDebug bool `yaml:"curldebug"` | |||
SrvAddr string `yaml:"srv_addr"` | |||
RedisAddr string `yaml:"redis_addr"` | |||
MqWorkQueueName string `yaml:"mq_work_queue_name"` | |||
RabbitMqAddr string `yaml:"rabbitMq_addr"` | |||
RabbitMqAddrTest string `yaml:"rabbitMq_addr_test"` | |||
DB DBCfg `yaml:"db"` | |||
DataDB DBCfg `yaml:"data_db"` | |||
ImDB DBCfg `yaml:"im_db"` | |||
MQ MQCfg `yaml:"mq"` | |||
ES ESCfg `yaml:"es"` | |||
Log LogCfg `yaml:"log"` | |||
ArkID ArkIDCfg `yaml:"arkid"` | |||
Admin AdminCfg `yaml:"admin"` | |||
ImBusinessRpc ImBusinessRpcCfg `yaml:"im_business_rpc"` | |||
ImLogicRpc ImLogicRpcCfg `yaml:"im_logic_rpc"` | |||
Official OfficialCfg `yaml:"official"` | |||
WxappletFilepath WxappletFilepathCfg `yaml:"wxapplet_filepath"` | |||
Local bool | |||
@@ -95,3 +97,13 @@ type LogCfg struct { | |||
FileMaxSize int `yaml:"file_max_size"` | |||
FileMaxAge int `yaml:"file_max_age"` | |||
} | |||
type ImBusinessRpcCfg struct { | |||
URL string `yaml:"url"` | |||
PORT string `yaml:"port"` | |||
} | |||
type ImLogicRpcCfg struct { | |||
URL string `yaml:"url"` | |||
PORT string `yaml:"port"` | |||
} |
@@ -9,24 +9,21 @@ import ( | |||
//配置文件数据,全局变量 | |||
var ( | |||
Debug bool | |||
Prd bool | |||
CurlDebug bool | |||
SrvAddr string | |||
RedisAddr string | |||
DB *DBCfg | |||
DataDB *DBCfg | |||
MQ *MQCfg | |||
ES *ESCfg | |||
Log *LogCfg | |||
ArkID *ArkIDCfg | |||
Admin *AdminCfg | |||
Official *OfficialCfg | |||
WxappletFilepath *WxappletFilepathCfg | |||
Local bool | |||
AppComm *AppCommCfg | |||
MqWorkQueueName string | |||
RabbitMqAddr string | |||
Debug bool | |||
Prd bool | |||
CurlDebug bool | |||
RedisAddr string | |||
DB *DBCfg | |||
DataDB *DBCfg | |||
ImDB *DBCfg | |||
MQ *MQCfg | |||
ES *ESCfg | |||
Log *LogCfg | |||
Admin *AdminCfg | |||
ImBusinessRpc *ImBusinessRpcCfg | |||
ImLogicRpc *ImLogicRpcCfg | |||
Local bool | |||
AppComm *AppCommCfg | |||
) | |||
//初始化配置文件,将cfg.yml读入到内存 | |||
@@ -55,19 +52,12 @@ func InitCfg() { | |||
CurlDebug = conf.CurlDebug | |||
DB = &conf.DB | |||
DataDB = &conf.DataDB | |||
ImDB = &conf.ImDB | |||
Log = &conf.Log | |||
ArkID = &conf.ArkID | |||
RedisAddr = conf.RedisAddr | |||
SrvAddr = conf.SrvAddr | |||
Admin = &conf.Admin | |||
Official = &conf.Official | |||
WxappletFilepath = &conf.WxappletFilepath | |||
AppComm = &conf.AppComm | |||
MqWorkQueueName = conf.MqWorkQueueName | |||
RabbitMqAddr = conf.RabbitMqAddrTest | |||
if conf.Prd { | |||
RabbitMqAddr = conf.RabbitMqAddr | |||
} | |||
MQ = &conf.MQ | |||
ES = &conf.ES | |||
ImBusinessRpc = &conf.ImBusinessRpc | |||
ImLogicRpc = &conf.ImLogicRpc | |||
} |
@@ -0,0 +1,141 @@ | |||
package db | |||
import ( | |||
"applet/app/db/model" | |||
"applet/app/utils" | |||
"applet/app/utils/logx" | |||
"errors" | |||
"fmt" | |||
"reflect" | |||
"xorm.io/xorm" | |||
) | |||
// BatchSelectDouShenImGroups 批量查询数据 TODO::和下面的方法重复了,建议采用下面的 `DouShenImGroupFindByParams` 方法 | |||
func BatchSelectDouShenImGroups(Db *xorm.Engine, params map[string]interface{}) (*[]model.DouShenImGroup, error) { | |||
var DouShenImGroupData []model.DouShenImGroup | |||
if err := Db.In(utils.AnyToString(params["key"]), params["value"]). | |||
Find(&DouShenImGroupData); err != nil { | |||
return nil, logx.Warn(err) | |||
} | |||
return &DouShenImGroupData, nil | |||
} | |||
// DouShenImGroupInsert 插入单条数据 | |||
func DouShenImGroupInsert(Db *xorm.Engine, DouShenImGroup *model.DouShenImGroup) (int, error) { | |||
_, err := Db.InsertOne(DouShenImGroup) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return DouShenImGroup.Id, nil | |||
} | |||
// BatchAddDouShenImGroups 批量新增数据 | |||
func BatchAddDouShenImGroups(Db *xorm.Engine, DouShenImGroupData []*model.DouShenImGroup) (int64, error) { | |||
affected, err := Db.Insert(DouShenImGroupData) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return affected, nil | |||
} | |||
func GetDouShenImGroupCount(Db *xorm.Engine) int { | |||
var DouShenImGroup model.DouShenImGroup | |||
session := Db.Where("") | |||
count, err := session.Count(&DouShenImGroup) | |||
if err != nil { | |||
return 0 | |||
} | |||
return int(count) | |||
} | |||
// DouShenImGroupDelete 删除记录 | |||
func DouShenImGroupDelete(Db *xorm.Engine, id interface{}) (int64, error) { | |||
if reflect.TypeOf(id).Kind() == reflect.Slice { | |||
return Db.In("id", id).Delete(model.DouShenImGroup{}) | |||
} else { | |||
return Db.Where("id = ?", id).Delete(model.DouShenImGroup{}) | |||
} | |||
} | |||
// DouShenImGroupUpdate 更新记录 | |||
func DouShenImGroupUpdate(Db *xorm.Engine, id interface{}, DouShenImGroup *model.DouShenImGroup, forceColums ...string) (int64, error) { | |||
var ( | |||
affected int64 | |||
err error | |||
) | |||
if forceColums != nil { | |||
affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(DouShenImGroup) | |||
} else { | |||
affected, err = Db.Where("id=?", id).Update(DouShenImGroup) | |||
} | |||
if err != nil { | |||
return 0, err | |||
} | |||
return affected, nil | |||
} | |||
// DouShenImGroupGetOneByParams 通过传入的参数查询数据(单条) | |||
func DouShenImGroupGetOneByParams(Db *xorm.Engine, kind int, params map[string]interface{}) (*model.DouShenImGroup, error) { | |||
var m model.DouShenImGroup | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
if has, err := Db.Where(query, params["value"]).And("kind = ?", kind).Get(&m); err != nil || has == false { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} | |||
func DouShenImGroupGetOneByParamsForOfficial(Db *xorm.Engine, kind int) (*model.DouShenImGroup, error) { | |||
var m model.DouShenImGroup | |||
has, err := Db.Where("kind = ?", kind).Get(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return &m, nil | |||
} | |||
func DouShenImGroupGetOneByParamsForFans(Db *xorm.Engine, kind int, uid int64) (*model.DouShenImGroup, error) { | |||
var m model.DouShenImGroup | |||
has, err := Db.Where("kind = ?", kind).And("uid =?", uid).Get(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return &m, nil | |||
} | |||
// DouShenImGroupFindByParams 通过传入的参数查询数据(多条) | |||
func DouShenImGroupFindByParams(Db *xorm.Engine, params map[string]interface{}) (*[]model.DouShenImGroup, error) { | |||
var m []model.DouShenImGroup | |||
if params["value"] == nil { | |||
return nil, errors.New("参数有误") | |||
} | |||
if params["key"] == nil { | |||
//查询全部数据 | |||
err := Db.Find(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} else { | |||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||
//指定In查询 | |||
if err := Db.In(utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { | |||
return nil, logx.Warn(err) | |||
} | |||
return &m, nil | |||
} else { | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
err := Db.Where(query, params["value"]).Find(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} | |||
} | |||
} |
@@ -0,0 +1,192 @@ | |||
package db | |||
import ( | |||
"applet/app/db/gim/model" | |||
"applet/app/utils" | |||
"applet/app/utils/logx" | |||
"errors" | |||
"fmt" | |||
"reflect" | |||
"xorm.io/xorm" | |||
) | |||
// BatchSelectUsers 批量查询数据 TODO::和下面的方法重复了,建议采用下面的 `UserFindByParams` 方法 | |||
func BatchSelectUsers(Db *xorm.Engine, params map[string]interface{}) (*[]model.User, error) { | |||
var UserData []model.User | |||
if err := Db.In(utils.AnyToString(params["key"]), params["value"]). | |||
Find(&UserData); err != nil { | |||
return nil, logx.Warn(err) | |||
} | |||
return &UserData, nil | |||
} | |||
// UserInsert 插入单条数据 | |||
func UserInsert(Db *xorm.Engine, User *model.User) (int64, error) { | |||
_, err := Db.InsertOne(User) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return User.Id, nil | |||
} | |||
// BatchAddUsers 批量新增数据 | |||
func BatchAddUsers(Db *xorm.Engine, UserData []*model.User) (int64, error) { | |||
affected, err := Db.Insert(UserData) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return affected, nil | |||
} | |||
func GetUserCount(Db *xorm.Engine) int { | |||
var User model.User | |||
session := Db.Where("") | |||
count, err := session.Count(&User) | |||
if err != nil { | |||
return 0 | |||
} | |||
return int(count) | |||
} | |||
// UserDelete 删除记录 | |||
func UserDelete(Db *xorm.Engine, id interface{}) (int64, error) { | |||
if reflect.TypeOf(id).Kind() == reflect.Slice { | |||
return Db.In("id", id).Delete(model.User{}) | |||
} else { | |||
return Db.Where("id = ?", id).Delete(model.User{}) | |||
} | |||
} | |||
// UserUpdate 更新记录 | |||
func UserUpdate(Db *xorm.Engine, id interface{}, User *model.User, forceColums ...string) (int64, error) { | |||
var ( | |||
affected int64 | |||
err error | |||
) | |||
if forceColums != nil { | |||
affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(User) | |||
} else { | |||
affected, err = Db.Where("id=?", id).Update(User) | |||
} | |||
if err != nil { | |||
return 0, err | |||
} | |||
return affected, nil | |||
} | |||
// UserGetOneByParams 通过传入的参数查询数据(单条) | |||
func UserGetOneByParams(Db *xorm.Engine, masterId string, params map[string]interface{}) (*model.User, error) { | |||
var m model.User | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
if has, err := Db.Where(query, params["value"]).And("master_id = ?", masterId).Get(&m); err != nil || has == false { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} | |||
// UserFindByParams 通过传入的参数查询数据(多条) | |||
func UserFindByParams(Db *xorm.Engine, params map[string]interface{}) (*[]model.User, error) { | |||
var m []model.User | |||
if params["value"] == nil { | |||
return nil, errors.New("参数有误") | |||
} | |||
if params["key"] == nil { | |||
//查询全部数据 | |||
err := Db.Find(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} else { | |||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||
//指定In查询 | |||
if err := Db.In(utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { | |||
return nil, logx.Warn(err) | |||
} | |||
return &m, nil | |||
} else { | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
err := Db.Where(query, params["value"]).Find(&m) | |||
if err != nil { | |||
return nil, logx.Error(err) | |||
} | |||
return &m, nil | |||
} | |||
} | |||
} | |||
// UserFindByLevel 查询等级数据(多条) | |||
//func UserFindByLevel(level int) (*[]model.User, error) { | |||
// var m []model.User | |||
// | |||
//} | |||
// 根据经纬度获取网点 | |||
// lng float64 经度 | |||
// lat float64 维度 | |||
func GetSelectedSiteWithLatLng(engine *xorm.Engine, lng, lat float64, page, pageSize string, scopeOfBranches int) (*[]model.User, error) { | |||
var regions []model.User | |||
where := `sqrt( ( (( %f - longitude)*PI()*12656*cos((( %f +latitude)/2)*PI()/180)/180) * (( %f - longitude)*PI()*12656*cos (((%f+latitude)/2)*PI()/180)/180) ) + ( ((%f-latitude)*PI()*12656/180) * ((%f-latitude)*PI()*12656/180) ) ) < ` + utils.IntToStr(scopeOfBranches) | |||
where = fmt.Sprintf(where, lng, lat, lng, lat, lat, lat) | |||
if page == "" && pageSize == "" { | |||
err := engine.Where(where).Find(®ions) | |||
if err != nil { | |||
return nil, err | |||
} | |||
return ®ions, nil | |||
} | |||
p := utils.StrToInt(page) // 页码 | |||
ps := utils.StrToInt(pageSize) // 每页记录数 | |||
err := engine.Where(where).Limit(ps, (p-1)*ps).Find(®ions) | |||
if err != nil { | |||
return nil, err | |||
} | |||
return ®ions, nil | |||
} | |||
// 根据经纬度获取最近的网点 | |||
// lng float64 经度 | |||
// lat float64 维度 | |||
func GetSelectedSiteWithLatLngNearClose(engine *xorm.Engine, lng, lat float64, scopeOfBranches int) (*model.User, error) { | |||
var region model.User | |||
where := `sqrt( ( (( %f - longitude)*PI()*12656*cos((( %f +latitude)/2)*PI()/180)/180) * (( %f - longitude)*PI()*12656*cos (((%f+latitude)/2)*PI()/180)/180) ) + ( ((%f-latitude)*PI()*12656/180) * ((%f-latitude)*PI()*12656/180) ) ) < ` + utils.IntToStr(scopeOfBranches) | |||
where = fmt.Sprintf(where, lng, lat, lng, lat, lat, lat) | |||
sel := `regional_agent_region.*, sqrt( ( (( %f - longitude)*PI()*12656*cos((( %f +latitude)/2)*PI()/180)/180) * (( %f - longitude)*PI()*12656*cos (((%f+latitude)/2)*PI()/180)/180) ) + ( ((%f-latitude)*PI()*12656/180) * ((%f-latitude)*PI()*12656/180) ) ) AS km` | |||
sel = fmt.Sprintf(sel, lng, lat, lng, lat, lat, lat) | |||
isHas, err := engine.Select(sel). | |||
Table("regional_agent_region").Where(where).Get(®ion) | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !isHas { | |||
return nil, nil | |||
} | |||
return ®ion, nil | |||
} | |||
// 根据总后台的区id获取代理网点 | |||
func GetSiteListWithWebSiteRegionId(session *xorm.Session, websiteRegionId string) (*model.User, error) { | |||
var regionD *model.User | |||
isExist, err := session.Table("regional_agent_region"). | |||
Where("website_region_id = ?", websiteRegionId). | |||
Get(®ionD) | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !isExist { | |||
return nil, nil | |||
} | |||
var regionSite *model.User | |||
isExist, err = session.Table("regional_agent_region"). | |||
Where("district_id = ?", regionD.Id).Get(®ionSite) | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !isExist { | |||
return regionD, nil | |||
} | |||
return regionSite, nil | |||
} |
@@ -0,0 +1,13 @@ | |||
package model | |||
type User struct { | |||
Id int64 `json:"id"` | |||
PhoneNumber string `json:"phone_number"` | |||
Nickname string `json:"nickname"` | |||
AvatarUrl string `json:"avatar_url"` | |||
Sex int `json:"sex"` | |||
CreateTime string `json:"create_time"` | |||
UpdateTime string `json:"update_time"` | |||
MasterId int64 `json:"master_id"` | |||
IsAutoAddedFriends int `json:"is_auto_added_friends"` | |||
} |
@@ -0,0 +1,50 @@ | |||
package db | |||
import ( | |||
"fmt" | |||
"os" | |||
"time" | |||
_ "github.com/go-sql-driver/mysql" //必须导入mysql驱动,否则会panic | |||
"xorm.io/xorm" | |||
"xorm.io/xorm/log" | |||
"applet/app/cfg" | |||
) | |||
var ImDb *xorm.Engine | |||
//根据DB配置文件初始化数据库 | |||
func InitImDB(c *cfg.DBCfg) error { | |||
var ( | |||
err error | |||
f *os.File | |||
) | |||
//创建Orm引擎 | |||
if ImDb, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4", c.User, c.Psw, c.Host, c.Name)); err != nil { | |||
return err | |||
} | |||
ImDb.SetConnMaxLifetime(c.MaxLifetime * time.Second) //设置最长连接时间 | |||
ImDb.SetMaxOpenConns(c.MaxOpenConns) //设置最大打开连接数 | |||
ImDb.SetMaxIdleConns(c.MaxIdleConns) //设置连接池的空闲数大小 | |||
if err = ImDb.Ping(); err != nil { //尝试ping数据库 | |||
return err | |||
} | |||
if c.ShowLog { //根据配置文件设置日志 | |||
ImDb.ShowSQL(true) //设置是否打印sql | |||
ImDb.Logger().SetLevel(0) //设置日志等级 | |||
//修改日志文件存放路径文件名是%s.log | |||
path := fmt.Sprintf(c.Path, c.Name) | |||
f, err = os.OpenFile(path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0777) | |||
if err != nil { | |||
os.RemoveAll(c.Path) | |||
if f, err = os.OpenFile(c.Path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0777); err != nil { | |||
return err | |||
} | |||
} | |||
logger := log.NewSimpleLogger(f) | |||
logger.ShowSQL(true) | |||
ImDb.SetLogger(logger) | |||
} | |||
return nil | |||
} |
@@ -0,0 +1,14 @@ | |||
package model | |||
import "time" | |||
type DouShenImGroup struct { | |||
Id int `json:"id"` | |||
Kind int `json:"kind"` | |||
Uid int `json:"uid"` | |||
GroupId int `json:"group_id"` | |||
IsFull int `json:"is_full"` | |||
Name string `json:"name" ` | |||
CreateTime time.Time `json:"create_time"` | |||
UpdateTime time.Time `json:"update_time" ` | |||
} |
@@ -0,0 +1,60 @@ | |||
package utils | |||
import ( | |||
"applet/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, masterId 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, | |||
"master_id", masterId, | |||
"request_id", strconv.FormatInt(time.Now().UnixNano(), 10))) | |||
} |
@@ -30,6 +30,11 @@ func init() { | |||
if err := db.InitDataDB(&dataDb); err != nil { | |||
panic(err) | |||
} | |||
imDb := *cfg.ImDB | |||
imDb.Path = fmt.Sprintf(cfg.ImDB.Path, cfg.ImDB.Name) | |||
if err := db.InitImDB(&imDb); err != nil { | |||
panic(err) | |||
} | |||
utils.CurlDebug = true | |||
//cfg.InitMemCache() | |||
} | |||
@@ -0,0 +1,103 @@ | |||
package consume | |||
import ( | |||
"applet/app/cfg" | |||
"applet/app/db" | |||
db2 "applet/app/db/gim" | |||
"applet/app/db/model" | |||
utils2 "applet/app/utils" | |||
"applet/app/utils/logx" | |||
utils "applet/app/utils/rpc" | |||
"applet/consume/md" | |||
"applet/pkg/pb" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"encoding/json" | |||
"errors" | |||
"fmt" | |||
"github.com/streadway/amqp" | |||
"time" | |||
) | |||
func DouShenUserRegisterConsumeForMyFans(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") | |||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||
if err != nil { | |||
logx.Error(err) | |||
return | |||
} | |||
defer ch.Release() | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(1) | |||
delivery := ch.Consume(queue.Name, false) | |||
var res amqp.Delivery | |||
var ok bool | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") | |||
err = handleDouShenUserRegisterConsumeForMyFans(res.Body) | |||
if err != nil { | |||
fmt.Println("!!!!!!!err!!!!!!!", err) | |||
_ = res.Reject(false) | |||
} else { | |||
_ = res.Ack(true) | |||
} | |||
} else { | |||
panic(errors.New("error getting message")) | |||
} | |||
} | |||
fmt.Println("get msg done") | |||
} | |||
func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.DouShenUserRegisterMessageStructForMyFans | |||
err := json.Unmarshal(msgData, &msg) | |||
if err != nil { | |||
return err | |||
} | |||
//2、查找用户对应im系统中的数据 | |||
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ | |||
"key": "phone_number", | |||
"value": msg.Phone, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
if gimUser == nil { | |||
return errors.New("用户暂未注册im系统") | |||
} | |||
groupName := "我的直属粉丝【x】群" | |||
//3、创建群 | |||
resp, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).CreateGroup(utils.GetCtx("", utils2.Int64ToStr(gimUser.Id), "", msg.MasterId), &pb.CreateGroupReq{ | |||
Name: groupName, | |||
AvatarUrl: "", | |||
Introduction: "粉丝群", | |||
Extra: "", | |||
MemberIds: nil, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
//插入 dou_shen_im_group 记录 | |||
now := time.Now() | |||
_, err = db.DouShenImGroupInsert(db.Db, &model.DouShenImGroup{ | |||
Kind: 3, | |||
Uid: int(msg.Uid), | |||
GroupId: int(resp.GroupId), | |||
IsFull: 0, | |||
Name: groupName, | |||
CreateTime: now, | |||
UpdateTime: now, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
return nil | |||
} |
@@ -0,0 +1,86 @@ | |||
package consume | |||
import ( | |||
"applet/app/cfg" | |||
"applet/app/db" | |||
db2 "applet/app/db/gim" | |||
"applet/app/utils/logx" | |||
utils "applet/app/utils/rpc" | |||
"applet/consume/md" | |||
"applet/pkg/pb" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"encoding/json" | |||
"errors" | |||
"fmt" | |||
"github.com/streadway/amqp" | |||
) | |||
func DouShenUserRegisterConsumeForMyRecommender(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") | |||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||
if err != nil { | |||
logx.Error(err) | |||
return | |||
} | |||
defer ch.Release() | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(1) | |||
delivery := ch.Consume(queue.Name, false) | |||
var res amqp.Delivery | |||
var ok bool | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") | |||
err = handleDouShenUserRegisterConsumeForMyRecommender(res.Body) | |||
if err != nil { | |||
fmt.Println("!!!!!!!err!!!!!!!", err) | |||
_ = res.Reject(false) | |||
} else { | |||
_ = res.Ack(true) | |||
} | |||
} else { | |||
panic(errors.New("error getting message")) | |||
} | |||
} | |||
fmt.Println("get msg done") | |||
} | |||
func handleDouShenUserRegisterConsumeForMyRecommender(msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.DouShenUserRegisterMessageStructForMyRecommender | |||
err := json.Unmarshal(msgData, &msg) | |||
if err != nil { | |||
return err | |||
} | |||
//2、查找用户对应im系统中的数据 | |||
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ | |||
"key": "phone_number", | |||
"value": msg.Phone, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
if gimUser == nil { | |||
return errors.New("用户暂未注册im系统") | |||
} | |||
//2、查找是否有群 | |||
fansGroup, err := db.DouShenImGroupGetOneByParamsForFans(db.Db, 3, msg.RecommenderUid) | |||
if err != nil { | |||
return err | |||
} | |||
if fansGroup == nil { | |||
return errors.New("当前推荐人暂未拥有粉丝群,请联系管理员!!!") | |||
} else { | |||
//加入群 | |||
_, err = utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).AddGroupMembers(utils.GetCtx("", "-1", "", msg.MasterId), &pb.AddGroupMembersReq{ | |||
GroupId: int64(fansGroup.GroupId), | |||
UserIds: []int64{gimUser.Id}, | |||
}) | |||
} | |||
return nil | |||
} |
@@ -0,0 +1,113 @@ | |||
package consume | |||
import ( | |||
"applet/app/cfg" | |||
"applet/app/db" | |||
db2 "applet/app/db/gim" | |||
"applet/app/db/model" | |||
"applet/app/utils/logx" | |||
utils "applet/app/utils/rpc" | |||
"applet/consume/md" | |||
"applet/pkg/pb" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"encoding/json" | |||
"errors" | |||
"fmt" | |||
"github.com/streadway/amqp" | |||
"time" | |||
) | |||
func DouShenUserRegisterConsumeForOfficial(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") | |||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||
if err != nil { | |||
logx.Error(err) | |||
return | |||
} | |||
defer ch.Release() | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(1) | |||
delivery := ch.Consume(queue.Name, false) | |||
var res amqp.Delivery | |||
var ok bool | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") | |||
err = handleDouShenUserRegisterConsumeForOfficial(res.Body) | |||
if err != nil { | |||
fmt.Println("!!!!!!!err!!!!!!!", err) | |||
_ = res.Reject(false) | |||
} else { | |||
_ = res.Ack(true) | |||
} | |||
} else { | |||
panic(errors.New("error getting message")) | |||
} | |||
} | |||
fmt.Println("get msg done") | |||
} | |||
func handleDouShenUserRegisterConsumeForOfficial(msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.DouShenUserRegisterMessageStructForOfficial | |||
err := json.Unmarshal(msgData, &msg) | |||
if err != nil { | |||
return err | |||
} | |||
//2、查找用户对应im系统中的数据 | |||
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ | |||
"key": "phone_number", | |||
"value": msg.Phone, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
if gimUser == nil { | |||
return errors.New("用户暂未注册im系统") | |||
} | |||
//2、查找是否有群 | |||
officialGroup, err := db.DouShenImGroupGetOneByParamsForOfficial(db.Db, 1) | |||
if err != nil { | |||
return err | |||
} | |||
if officialGroup == nil { | |||
groupName := "官方[1]群" | |||
//3、创建群 | |||
resp, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).CreateGroup(utils.GetCtx("", "13231", "74802", msg.MasterId), &pb.CreateGroupReq{ | |||
Name: groupName, | |||
AvatarUrl: "", | |||
Introduction: "官方群", | |||
Extra: "", | |||
MemberIds: []int64{gimUser.Id}, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
//插入 dou_shen_im_group 记录 | |||
now := time.Now() | |||
_, err = db.DouShenImGroupInsert(db.Db, &model.DouShenImGroup{ | |||
Kind: 1, | |||
Uid: 21, | |||
GroupId: int(resp.GroupId), | |||
IsFull: 0, | |||
Name: groupName, | |||
CreateTime: now, | |||
UpdateTime: now, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
} else { | |||
//加入群 | |||
_, err = utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).AddGroupMembers(utils.GetCtx("", "-1", "74802", msg.MasterId), &pb.AddGroupMembersReq{ | |||
GroupId: int64(officialGroup.GroupId), | |||
UserIds: []int64{gimUser.Id}, | |||
}) | |||
} | |||
return nil | |||
} |
@@ -0,0 +1,86 @@ | |||
package consume | |||
import ( | |||
"applet/app/cfg" | |||
"applet/app/db" | |||
db2 "applet/app/db/gim" | |||
"applet/app/utils/logx" | |||
utils "applet/app/utils/rpc" | |||
"applet/consume/md" | |||
"applet/pkg/pb" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"encoding/json" | |||
"errors" | |||
"fmt" | |||
"github.com/streadway/amqp" | |||
) | |||
func DouShenUserRegisterConsumeForOperationCenter(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") | |||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||
if err != nil { | |||
logx.Error(err) | |||
return | |||
} | |||
defer ch.Release() | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(1) | |||
delivery := ch.Consume(queue.Name, false) | |||
var res amqp.Delivery | |||
var ok bool | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") | |||
err = handleDouShenUserRegisterConsumeForOperationCenter(res.Body) | |||
if err != nil { | |||
fmt.Println("!!!!!!!err!!!!!!!", err) | |||
_ = res.Reject(false) | |||
} else { | |||
_ = res.Ack(true) | |||
} | |||
} else { | |||
panic(errors.New("error getting message")) | |||
} | |||
} | |||
fmt.Println("get msg done") | |||
} | |||
func handleDouShenUserRegisterConsumeForOperationCenter(msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.DouShenUserRegisterMessageStructForOperationCenter | |||
err := json.Unmarshal(msgData, &msg) | |||
if err != nil { | |||
return err | |||
} | |||
//2、查找用户对应im系统中的数据 | |||
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ | |||
"key": "phone_number", | |||
"value": msg.Phone, | |||
}) | |||
if err != nil { | |||
return err | |||
} | |||
if gimUser == nil { | |||
return errors.New("用户暂未注册im系统") | |||
} | |||
//2、查找是否有群 | |||
OperationGroup, err := db.DouShenImGroupGetOneByParamsForFans(db.Db, 2, msg.OperationCenterUid) | |||
if err != nil { | |||
return err | |||
} | |||
if OperationGroup == nil { | |||
return errors.New("当前城市合伙人暂未拥有运营中心群,请联系管理员!!!") | |||
} else { | |||
//加入群 | |||
_, err = utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).AddGroupMembers(utils.GetCtx("", "-1", "", msg.MasterId), &pb.AddGroupMembersReq{ | |||
GroupId: int64(OperationGroup.GroupId), | |||
UserIds: []int64{gimUser.Id}, | |||
}) | |||
} | |||
return nil | |||
} |
@@ -20,6 +20,10 @@ func initConsumes() { | |||
jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume | |||
jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume | |||
jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume | |||
jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial | |||
jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter | |||
jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender | |||
jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans | |||
jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay | |||
jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess | |||
jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund | |||
@@ -65,13 +65,53 @@ var RabbitMqQueueKeyList = []*MqQueue{ | |||
BindKey: "", | |||
ConsumeFunName: "ZhiosFastReturnOrderRefund", | |||
}, | |||
{ | |||
ExchangeName: "zhios.doushen.user.register.exchange", | |||
Name: "zhios_doushen_user_register_official", | |||
Type: DirectQueueType, | |||
IsPersistent: false, | |||
RoutKey: "official", | |||
BindKey: "official", | |||
ConsumeFunName: "DouShenUserRegisterConsumeForOfficial", | |||
}, | |||
{ | |||
ExchangeName: "zhios.doushen.user.register.exchange", | |||
Name: "zhios_doushen_user_register_operation_center", | |||
Type: DirectQueueType, | |||
IsPersistent: false, | |||
RoutKey: "official", | |||
BindKey: "official", | |||
ConsumeFunName: "DouShenUserRegisterConsumeForOfficial", | |||
}, | |||
{ | |||
ExchangeName: "zhios.doushen.user.register.exchange", | |||
Name: "zhios_doushen_user_register_official", | |||
Type: DirectQueueType, | |||
IsPersistent: false, | |||
RoutKey: "official", | |||
BindKey: "official", | |||
ConsumeFunName: "DouShenUserRegisterConsumeForOfficial", | |||
}, | |||
{ | |||
ExchangeName: "zhios.doushen.user.register.exchange", | |||
Name: "zhios_doushen_user_register_official", | |||
Type: DirectQueueType, | |||
IsPersistent: false, | |||
RoutKey: "official", | |||
BindKey: "official", | |||
ConsumeFunName: "DouShenUserRegisterConsumeForOfficial", | |||
}, | |||
} | |||
const ( | |||
CanalOrderConsumeFunName = "CanalOrderConsume" | |||
CanalGuideOrderConsumeFunName = "CanalGuideOrderConsume" | |||
ZhiOsUserVisitIpAddressConsumeFunName = "ZhiOsUserVisitIpAddressConsume" | |||
ZhiosFastReturnOrderPayFunName = "ZhiosFastReturnOrderPay" | |||
ZhiosFastReturnOrderSuccessFunName = "ZhiosFastReturnOrderSuccess" | |||
ZhiosFastReturnOrderRefundFunName = "ZhiosFastReturnOrderRefund" | |||
CanalOrderConsumeFunName = "CanalOrderConsume" | |||
CanalGuideOrderConsumeFunName = "CanalGuideOrderConsume" | |||
ZhiOsUserVisitIpAddressConsumeFunName = "ZhiOsUserVisitIpAddressConsume" | |||
DouShenUserRegisterConsumeForOfficialFunName = "DouShenUserRegisterConsumeForOfficial" | |||
DouShenUserRegisterConsumeForOperationCenterFunName = "DouShenUserRegisterConsumeForOperationCenter" | |||
DouShenUserRegisterConsumeForMyRecommenderFunName = "DouShenUserRegisterConsumeForMyRecommender" | |||
DouShenUserRegisterConsumeForMyFansFunName = "DouShenUserRegisterConsumeForMyFans" | |||
ZhiosFastReturnOrderPayFunName = "ZhiosFastReturnOrderPay" | |||
ZhiosFastReturnOrderSuccessFunName = "ZhiosFastReturnOrderSuccess" | |||
ZhiosFastReturnOrderRefundFunName = "ZhiosFastReturnOrderRefund" | |||
) |
@@ -0,0 +1,24 @@ | |||
package md | |||
type DouShenUserRegisterMessageStructForOfficial struct { | |||
MasterId string `json:"master_id"` | |||
Phone int64 `json:"phone"` | |||
Uid int64 `json:"uid"` | |||
} | |||
type DouShenUserRegisterMessageStructForMyFans struct { | |||
MasterId string `json:"master_id"` | |||
Phone int64 `json:"phone"` | |||
Uid int64 `json:"uid"` | |||
} | |||
type DouShenUserRegisterMessageStructForMyRecommender struct { | |||
MasterId string `json:"master_id"` | |||
Phone int64 `json:"phone"` | |||
Uid int64 `json:"uid"` | |||
RecommenderUid int64 `json:"recommender_uid"` | |||
} | |||
type DouShenUserRegisterMessageStructForOperationCenter struct { | |||
MasterId string `json:"master_id"` | |||
Phone int64 `json:"phone"` | |||
Uid int64 `json:"uid"` | |||
OperationCenterUid int64 `json:"operation_center_uid"` | |||
} |
@@ -30,6 +30,8 @@ require ( | |||
github.com/syyongx/php2go v0.9.7 | |||
github.com/tidwall/gjson v1.7.4 | |||
go.uber.org/zap v1.16.0 | |||
google.golang.org/grpc v1.32.0 | |||
google.golang.org/protobuf v1.28.0 | |||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 | |||
gopkg.in/yaml.v2 v2.4.0 | |||
xorm.io/xorm v1.3.0 | |||
@@ -45,6 +47,7 @@ require ( | |||
github.com/go-openapi/spec v0.20.3 // indirect | |||
github.com/go-openapi/swag v0.19.15 // indirect | |||
github.com/goccy/go-json v0.9.7 // indirect | |||
github.com/golang/protobuf v1.5.0 // indirect | |||
github.com/golang/snappy v0.0.4 // indirect | |||
github.com/gorilla/context v1.1.1 // indirect | |||
github.com/gorilla/securecookie v1.1.1 // indirect | |||
@@ -75,7 +78,7 @@ require ( | |||
golang.org/x/text v0.3.7 // indirect | |||
golang.org/x/tools v0.1.0 // indirect | |||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | |||
google.golang.org/protobuf v1.28.0 // indirect | |||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect | |||
honnef.co/go/tools v0.0.1-2020.1.4 // indirect | |||
xorm.io/builder v0.3.10 // indirect | |||
) |
@@ -26,6 +26,9 @@ func init() { | |||
if err := db.InitDataDB(cfg.DataDB); err != nil { //数据大屏本身库初始化 | |||
panic(err) | |||
} | |||
if err := db.InitImDB(cfg.ImDB); err != nil { //im本身库初始化 | |||
panic(err) | |||
} | |||
channel := make(chan int, 0) //开辟管道,缓冲为 | |||
go db.InitDBs(channel) | |||
<-channel | |||
@@ -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", | |||
} |
@@ -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 | |||
} |
@@ -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", | |||
} |
@@ -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 | |||
} |
@@ -0,0 +1,103 @@ | |||
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); | |||
} | |||
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; // 极光推送-别名 | |||
} | |||
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; // 是否自动被添加好友 | |||
} | |||
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; | |||
} | |||
@@ -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; // 用户信息 | |||
} |
@@ -0,0 +1,5 @@ | |||
syntax = "proto3"; | |||
package pb; | |||
option go_package = "gim/pkg/pb/"; | |||
message Empty{} |
@@ -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; // 禁言 | |||
} |
@@ -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; // 数据 | |||
} | |||
@@ -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; // 群组成员附加字段 | |||
} |
@@ -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; | |||
} |
@@ -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; // 被删除的成员昵称 | |||
} |