From 9bbd1af1ca130f7fea0047849e9d1977b023b85b Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 26 Nov 2024 18:45:34 +0800 Subject: [PATCH] update --- app/hdl/comm/hdl_comm.go | 3 +- app/hdl/hdl_im.go | 67 +++++++++- app/md/md_im.go | 21 ++++ app/router/router.go | 3 +- app/svc/svc_im.go | 86 +++++++++++++ docs/docs.go | 258 +++++++++++++++++++++++++-------------- docs/swagger.json | 258 +++++++++++++++++++++++++-------------- docs/swagger.yaml | 182 +++++++++++++++++---------- go.mod | 5 +- 9 files changed, 625 insertions(+), 258 deletions(-) diff --git a/app/hdl/comm/hdl_comm.go b/app/hdl/comm/hdl_comm.go index 9531b9a..5333cee 100644 --- a/app/hdl/comm/hdl_comm.go +++ b/app/hdl/comm/hdl_comm.go @@ -23,7 +23,7 @@ import ( // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Success 200 {string} "许可链接" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/v1/comm/getOssUrl [get] +// @Router /api/settCenter/oss/aliYun/getBasic [get] func GetOssUrl(c *gin.Context) { redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) @@ -77,7 +77,6 @@ func GetOssUrl(c *gin.Context) { // @Success 200 {string} "success" // @Success 200 {string} "data exist" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/v1/comm/accessRecords [POST] func AccessRecords(c *gin.Context) { var req *comm.AccessRecordsReq if err1 := c.ShouldBindJSON(&req); err1 != nil { diff --git a/app/hdl/hdl_im.go b/app/hdl/hdl_im.go index 3fa0722..700017c 100644 --- a/app/hdl/hdl_im.go +++ b/app/hdl/hdl_im.go @@ -15,9 +15,9 @@ import ( ) // SendRedPackageDetail -// @Summary 蛋蛋星球-即时通讯-发送红包 +// @Summary 蛋蛋星球-即时通讯-发送红包详情 // @Tags 即时通讯 -// @Description 发送红包 +// @Description 发送红包详情 // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" @@ -168,3 +168,66 @@ func RedPackageDetail(c *gin.Context) { e.OutSuc(c, resp, nil) return } + +// SendRedPackage +// @Summary 蛋蛋星球-即时通讯-发送红包 +// @Tags 即时通讯 +// @Description 发送红包 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.SendRedPackageReq true "发送红包信息" +// @Success 200 {object} md.SendRedPackageResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/im/user/sendRedPackage [POST] +func SendRedPackage(c *gin.Context) { + var args md.SendRedPackageReq + if err := c.ShouldBindJSON(&args); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + if args.RedPacketNums <= 0 || utils.StrToFloat64(args.Amount)*100 <= 0 || utils.StrToFloat64(args.Amount)*100 < float64(args.RedPacketNums)*utils.RED_PACKET_MIN_MONEY { + e.OutErr(c, e.ERR, "传参有误") + return + } + + val, exists := c.Get("user") + if !exists { + e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) + return + } + user, ok := val.(*model.User) + if !ok { + e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) + return + } + + redPackageContent, redPackageId, err := svc.BalancePayForRedPackage(user, args.Amount, args) + if err != nil { + e.OutErr(c, e.ERR, err) + return + } + + //TODO::调用im GRPC 接口 + res, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).SendRedPacket(utils.GetCtx(args.Token, args.UserId, args.DeviceId), &pb.SendRedPacketReq{ + ReceiverType: pb.ReceiverType(args.ReceiverType), + ReceiverId: args.ReceiverId, + MessageType: pb.MessageType_MT_RED_PACKAGE, + MessageContent: redPackageContent, + SendTime: args.SendTime, + ToUserIds: args.ToUserIds, + MessageContentBack: "", + }) + if err != nil { + e.OutErr(c, e.ERR_IS_GRPC, err) + return + } + + resp := md.SendRedPackageResp{ + Im: res, + RedPackageId: redPackageId, + } + + e.OutSuc(c, resp, nil) + return +} diff --git a/app/md/md_im.go b/app/md/md_im.go index 134595b..dfa170d 100644 --- a/app/md/md_im.go +++ b/app/md/md_im.go @@ -48,3 +48,24 @@ type RedPackageDetailResp struct { List []RedPackageDetailUserNode `json:"list"` // 领取红包用户列表 Detail model.ImSendRedPackageOrd `json:"detail"` // 红包详情信息 } + +type SendRedPackageReq struct { + UserId string `json:"user_id"` //im用户id + DeviceId string `json:"device_id"` //设备id + Token string `json:"token"` //im-token + Amount string `json:"amount"` //红包金额 + RedPacketType int `json:"red_packet_type"` //红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包) + RedPacketNums int `json:"red_packet_nums"` //红包数量 + RedPacketContent string `json:"red_packet_content"` //红包文字内容 + RedPacketSmallContent string `json:"red_packet_small_content"` //红包文字内容 + ReceiverType int `json:"receiver_type"` //接收者类型,1:user;2:group + ReceiverId int64 `json:"receiver_id"` //用户id或者群组id + SendTime int64 `json:"send_time"` //消息发送时间戳,精确到毫秒 + ToUserIds []int64 `json:"to_user_ids"` //红包给到哪些用户(专属红包) + RedPackageCover string `json:"red_package_cover"` //红包封面 +} + +type SendRedPackageResp struct { + Im *pb.SendRedPacketResp `json:"im"` + RedPackageId int64 `json:"red_package_id"` // 红包ID +} diff --git a/app/router/router.go b/app/router/router.go index 44dab7d..a45d283 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -136,7 +136,8 @@ func route(r *gin.RouterGroup) { } rIm := r.Group("/im") { - rIm.POST("/user/sendRedPackageDetail", hdl.SendRedPackageDetail) // IM-发红包 + rIm.POST("/user/sendRedPackage", hdl.SendRedPackage) // IM-发送红包 + rIm.POST("/user/sendRedPackageDetail", hdl.SendRedPackageDetail) // IM-发送红包详情 rIm.POST("/user/grabRedPackage", hdl.GrabRedPackage) // IM-领取红包 rIm.GET("/redPackageDetail", hdl.RedPackageDetail) // IM-红包详情 } diff --git a/app/svc/svc_im.go b/app/svc/svc_im.go index 43b8b13..453276f 100644 --- a/app/svc/svc_im.go +++ b/app/svc/svc_im.go @@ -5,11 +5,14 @@ import ( "applet/app/md" "applet/app/pkg/pb" "applet/app/utils" + "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" "errors" + "github.com/google/uuid" "github.com/shopspring/decimal" "google.golang.org/protobuf/proto" "strings" @@ -229,3 +232,86 @@ func DetailGrabRedPackage(redPackageId string) (resp []md.RedPackageDetailUserNo } return resp, imSendRedPackageOrd, nil } + +// BalancePayForRedPackage 红包余额支付 +func BalancePayForRedPackage(user *model.User, money string, req md.SendRedPackageReq) (resp []byte, redPackageId int64, err error) { + + session := db.Db.NewSession() + defer session.Close() + //扣除用户余额 + dealUserWalletReq := md2.DealUserWalletReq{ + Direction: "sub", + Kind: 6, + Title: "领取红包收益", + Uid: user.Id, + Amount: utils.StrToFloat64(money), + } + err = rule.DealUserWallet(session, dealUserWalletReq) + if err != nil { + session.Rollback() + return nil, 0, err + } + + // 新增红包记录 + now := time.Now() + ordNo := uuid.New().String() + var waitDrawUserIds string + if req.RedPacketType == int(pb.RedPacketType_RPT_GROUP_SPECIALLY) { + var toUserIds []string + for _, v := range req.ToUserIds { + toUserIds = append(toUserIds, utils.AnyToString(v)) + } + waitDrawUserIds = strings.Join(toUserIds, ",") + } + + ordDb := implement.NewImSendRedPackageOrdDb(db.Db) + m := model.ImSendRedPackageOrd{ + OrdNo: ordNo, + Uid: utils.StrToInt(req.UserId), + Amount: req.Amount, + RedPacketBalanceAmount: req.Amount, + RedPacketType: req.RedPacketType, + RedPacketNums: req.RedPacketNums, + RedPacketBalanceNums: req.RedPacketNums, + State: 0, + WaitDrawUserIds: waitDrawUserIds, + CreateTime: now.Format("2006-01-02 15:04:05"), + UpdateTime: now.Format("2006-01-02 15:04:05"), + } + redPackageOrdId, err := ordDb.ImSendRedPackageOrdInsertBySession(session, &m) + if err != nil { + session.Rollback() + return nil, redPackageId, err + } + + err = session.Commit() + if err != nil { + return nil, redPackageOrdId, err + } + + redisConn := cache.GetPool().Get() + scheme, domain := svc.ImageBucket(db.Db, redisConn) + msg := &pb.RED_PACKAGE{ + RedMessageType: pb.RedPacketMessageType_RMT_SEND, + RedPacketType: pb.RedPacketType(req.RedPacketType), + RedPacketContent: req.RedPacketContent, + RedPacketAmount: float32(utils.AnyToFloat64(req.Amount)), + RedPacketNums: int32(req.RedPacketNums), + RedPacketBalanceAmount: float32(utils.AnyToFloat64(req.Amount)), + ReceivedUserId: utils.StrToInt64(waitDrawUserIds), + ReceivedUserAmount: 0, + ReceivedUserNickname: "", + RedPacketStatusType: 0, + RedPacketId: redPackageOrdId, + SendRedPacketUid: utils.StrToInt64(req.UserId), + SendRedPacketNickname: user.Nickname, + SendRedPacketAvatarUrl: svc.ImageFormatWithBucket(scheme, domain, user.Avatar), + RedPacketSmallContent: req.RedPacketSmallContent, + } + resp, err = proto.Marshal(msg) + if err != nil { + return nil, redPackageId, err + } + redPackageId = redPackageOrdId + return resp, redPackageId, nil +} diff --git a/docs/docs.go b/docs/docs.go index c84c1cc..a14d857 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -24,6 +24,44 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/api/settCenter/oss/aliYun/getBasic": { + "get": { + "description": "上传许可链接(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "对象存储" + ], + "summary": "通用请求-对象存储-上传许可链接(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "许可链接", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/addFriend/basalRate": { "get": { "description": "基础速率(获取)", @@ -680,91 +718,6 @@ const docTemplate = `{ } } }, - "/api/v1/comm/accessRecords": { - "post": { - "description": "页面记录", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "访问记录" - ], - "summary": "通用请求-访问记录-页面记录", - "parameters": [ - { - "type": "string", - "description": "验证参数Bearer和token空格拼接", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "页面标识", - "name": "req", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/comm.AccessRecordsReq" - } - } - ], - "responses": { - "200": { - "description": "data exist", - "schema": { - "type": "string" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, - "/api/v1/comm/getOssUrl": { - "get": { - "description": "上传许可链接(获取)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "对象存储" - ], - "summary": "通用请求-对象存储-上传许可链接(获取)", - "parameters": [ - { - "type": "string", - "description": "验证参数Bearer和token空格拼接", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "许可链接", - "schema": { - "type": "string" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, "/api/v1/config": { "get": { "description": "基本配置", @@ -1210,7 +1163,7 @@ const docTemplate = `{ } } }, - "/api/v1/im/user/sendRedPackageDetail": { + "/api/v1/im/user/sendRedPackage": { "post": { "description": "发送红包", "consumes": [ @@ -1223,6 +1176,53 @@ const docTemplate = `{ "即时通讯" ], "summary": "蛋蛋星球-即时通讯-发送红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "发送红包信息", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SendRedPackageReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.SendRedPackageResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/sendRedPackageDetail": { + "post": { + "description": "发送红包详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-发送红包详情", "parameters": [ { "type": "string", @@ -2323,7 +2323,7 @@ const docTemplate = `{ } }, "definitions": { - "applet_app_md.Paginate": { + "app_md.Paginate": { "type": "object", "properties": { "limit": { @@ -2717,7 +2717,7 @@ const docTemplate = `{ "description": "分页信息", "allOf": [ { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } ] }, @@ -2837,7 +2837,7 @@ const docTemplate = `{ "description": "分页信息", "allOf": [ { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } ] }, @@ -2943,7 +2943,7 @@ const docTemplate = `{ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -2957,7 +2957,7 @@ const docTemplate = `{ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -2984,7 +2984,7 @@ const docTemplate = `{ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -3003,7 +3003,7 @@ const docTemplate = `{ "type": "string" }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -3595,6 +3595,78 @@ const docTemplate = `{ } } }, + "md.SendRedPackageReq": { + "type": "object", + "properties": { + "amount": { + "description": "红包金额", + "type": "string" + }, + "device_id": { + "description": "设备id", + "type": "string" + }, + "receiver_id": { + "description": "用户id或者群组id", + "type": "integer" + }, + "receiver_type": { + "description": "接收者类型,1:user;2:group", + "type": "integer" + }, + "red_package_cover": { + "description": "红包封面", + "type": "string" + }, + "red_packet_content": { + "description": "红包文字内容", + "type": "string" + }, + "red_packet_nums": { + "description": "红包数量", + "type": "integer" + }, + "red_packet_small_content": { + "description": "红包文字内容", + "type": "string" + }, + "red_packet_type": { + "description": "红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)", + "type": "integer" + }, + "send_time": { + "description": "消息发送时间戳,精确到毫秒", + "type": "integer" + }, + "to_user_ids": { + "description": "红包给到哪些用户(专属红包)", + "type": "array", + "items": { + "type": "integer" + } + }, + "token": { + "description": "im-token", + "type": "string" + }, + "user_id": { + "description": "im用户id", + "type": "string" + } + } + }, + "md.SendRedPackageResp": { + "type": "object", + "properties": { + "im": { + "$ref": "#/definitions/pb.SendRedPacketResp" + }, + "red_package_id": { + "description": "红包ID", + "type": "integer" + } + } + }, "md.SeqType": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 70edbd6..8a2af07 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -18,6 +18,44 @@ "host": "ddxq.izhim.com", "basePath": "/api/v1", "paths": { + "/api/settCenter/oss/aliYun/getBasic": { + "get": { + "description": "上传许可链接(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "对象存储" + ], + "summary": "通用请求-对象存储-上传许可链接(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "许可链接", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/addFriend/basalRate": { "get": { "description": "基础速率(获取)", @@ -674,91 +712,6 @@ } } }, - "/api/v1/comm/accessRecords": { - "post": { - "description": "页面记录", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "访问记录" - ], - "summary": "通用请求-访问记录-页面记录", - "parameters": [ - { - "type": "string", - "description": "验证参数Bearer和token空格拼接", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "页面标识", - "name": "req", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/comm.AccessRecordsReq" - } - } - ], - "responses": { - "200": { - "description": "data exist", - "schema": { - "type": "string" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, - "/api/v1/comm/getOssUrl": { - "get": { - "description": "上传许可链接(获取)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "对象存储" - ], - "summary": "通用请求-对象存储-上传许可链接(获取)", - "parameters": [ - { - "type": "string", - "description": "验证参数Bearer和token空格拼接", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "许可链接", - "schema": { - "type": "string" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, "/api/v1/config": { "get": { "description": "基本配置", @@ -1204,7 +1157,7 @@ } } }, - "/api/v1/im/user/sendRedPackageDetail": { + "/api/v1/im/user/sendRedPackage": { "post": { "description": "发送红包", "consumes": [ @@ -1217,6 +1170,53 @@ "即时通讯" ], "summary": "蛋蛋星球-即时通讯-发送红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "发送红包信息", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SendRedPackageReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.SendRedPackageResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/sendRedPackageDetail": { + "post": { + "description": "发送红包详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-发送红包详情", "parameters": [ { "type": "string", @@ -2317,7 +2317,7 @@ } }, "definitions": { - "applet_app_md.Paginate": { + "app_md.Paginate": { "type": "object", "properties": { "limit": { @@ -2711,7 +2711,7 @@ "description": "分页信息", "allOf": [ { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } ] }, @@ -2831,7 +2831,7 @@ "description": "分页信息", "allOf": [ { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } ] }, @@ -2937,7 +2937,7 @@ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -2951,7 +2951,7 @@ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -2978,7 +2978,7 @@ } }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -2997,7 +2997,7 @@ "type": "string" }, "paginate": { - "$ref": "#/definitions/applet_app_md.Paginate" + "$ref": "#/definitions/app_md.Paginate" } } }, @@ -3589,6 +3589,78 @@ } } }, + "md.SendRedPackageReq": { + "type": "object", + "properties": { + "amount": { + "description": "红包金额", + "type": "string" + }, + "device_id": { + "description": "设备id", + "type": "string" + }, + "receiver_id": { + "description": "用户id或者群组id", + "type": "integer" + }, + "receiver_type": { + "description": "接收者类型,1:user;2:group", + "type": "integer" + }, + "red_package_cover": { + "description": "红包封面", + "type": "string" + }, + "red_packet_content": { + "description": "红包文字内容", + "type": "string" + }, + "red_packet_nums": { + "description": "红包数量", + "type": "integer" + }, + "red_packet_small_content": { + "description": "红包文字内容", + "type": "string" + }, + "red_packet_type": { + "description": "红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)", + "type": "integer" + }, + "send_time": { + "description": "消息发送时间戳,精确到毫秒", + "type": "integer" + }, + "to_user_ids": { + "description": "红包给到哪些用户(专属红包)", + "type": "array", + "items": { + "type": "integer" + } + }, + "token": { + "description": "im-token", + "type": "string" + }, + "user_id": { + "description": "im用户id", + "type": "string" + } + } + }, + "md.SendRedPackageResp": { + "type": "object", + "properties": { + "im": { + "$ref": "#/definitions/pb.SendRedPacketResp" + }, + "red_package_id": { + "description": "红包ID", + "type": "integer" + } + } + }, "md.SeqType": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index da39dbe..517a5a9 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,6 +1,6 @@ basePath: /api/v1 definitions: - applet_app_md.Paginate: + app_md.Paginate: properties: limit: description: 每页大小 @@ -276,7 +276,7 @@ definitions: type: array paginate: allOf: - - $ref: '#/definitions/applet_app_md.Paginate' + - $ref: '#/definitions/app_md.Paginate' description: 分页信息 person_egg_energy: description: 个人蛋蛋能量 @@ -359,7 +359,7 @@ definitions: type: array paginate: allOf: - - $ref: '#/definitions/applet_app_md.Paginate' + - $ref: '#/definitions/app_md.Paginate' description: 分页信息 person_egg_points: description: 个人蛋蛋积分 @@ -431,7 +431,7 @@ definitions: $ref: '#/definitions/md.WalletFlowNode' type: array paginate: - $ref: '#/definitions/applet_app_md.Paginate' + $ref: '#/definitions/app_md.Paginate' type: object md.GetContributionValueFlowResp: properties: @@ -440,7 +440,7 @@ definitions: $ref: '#/definitions/md.ContributionValueFlowNode' type: array paginate: - $ref: '#/definitions/applet_app_md.Paginate' + $ref: '#/definitions/app_md.Paginate' type: object md.GetContributionValueResp: properties: @@ -458,7 +458,7 @@ definitions: $ref: '#/definitions/md.EggEnergyFlowNode' type: array paginate: - $ref: '#/definitions/applet_app_md.Paginate' + $ref: '#/definitions/app_md.Paginate' type: object md.GetEggPointRecordResp: properties: @@ -471,7 +471,7 @@ definitions: description: 当前分数 type: string paginate: - $ref: '#/definitions/applet_app_md.Paginate' + $ref: '#/definitions/app_md.Paginate' type: object md.GetModuleSettingResp: properties: @@ -887,6 +887,58 @@ definitions: description: 红包 ID type: integer type: object + md.SendRedPackageReq: + properties: + amount: + description: 红包金额 + type: string + device_id: + description: 设备id + type: string + receiver_id: + description: 用户id或者群组id + type: integer + receiver_type: + description: 接收者类型,1:user;2:group + type: integer + red_package_cover: + description: 红包封面 + type: string + red_packet_content: + description: 红包文字内容 + type: string + red_packet_nums: + description: 红包数量 + type: integer + red_packet_small_content: + description: 红包文字内容 + type: string + red_packet_type: + description: 红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包) + type: integer + send_time: + description: 消息发送时间戳,精确到毫秒 + type: integer + to_user_ids: + description: 红包给到哪些用户(专属红包) + items: + type: integer + type: array + token: + description: im-token + type: string + user_id: + description: im用户id + type: string + type: object + md.SendRedPackageResp: + properties: + im: + $ref: '#/definitions/pb.SendRedPacketResp' + red_package_id: + description: 红包ID + type: integer + type: object md.SeqType: properties: seq: @@ -1184,6 +1236,31 @@ info: title: 蛋蛋星球-APP客户端 version: "1.0" paths: + /api/settCenter/oss/aliYun/getBasic: + get: + consumes: + - application/json + description: 上传许可链接(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 许可链接 + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 通用请求-对象存储-上传许可链接(获取) + tags: + - 对象存储 /api/v1/addFriend/basalRate: get: consumes: @@ -1617,62 +1694,6 @@ paths: summary: 蛋蛋学院-文章-分享后调用统计数量 tags: - 蛋蛋学院 - /api/v1/comm/accessRecords: - post: - consumes: - - application/json - description: 页面记录 - parameters: - - description: 验证参数Bearer和token空格拼接 - in: header - name: Authorization - required: true - type: string - - description: 页面标识 - in: body - name: req - required: true - schema: - $ref: '#/definitions/comm.AccessRecordsReq' - produces: - - application/json - responses: - "200": - description: data exist - schema: - type: string - "400": - description: 具体错误 - schema: - $ref: '#/definitions/md.Response' - summary: 通用请求-访问记录-页面记录 - tags: - - 访问记录 - /api/v1/comm/getOssUrl: - get: - consumes: - - application/json - description: 上传许可链接(获取) - parameters: - - description: 验证参数Bearer和token空格拼接 - in: header - name: Authorization - required: true - type: string - produces: - - application/json - responses: - "200": - description: 许可链接 - schema: - type: string - "400": - description: 具体错误 - schema: - $ref: '#/definitions/md.Response' - summary: 通用请求-对象存储-上传许可链接(获取) - tags: - - 对象存储 /api/v1/config: get: consumes: @@ -1967,12 +1988,43 @@ paths: summary: 蛋蛋星球-即时通讯-领取红包 tags: - 即时通讯 - /api/v1/im/user/sendRedPackageDetail: + /api/v1/im/user/sendRedPackage: post: consumes: - application/json description: 发送红包 parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 发送红包信息 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.SendRedPackageReq' + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.SendRedPackageResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 蛋蛋星球-即时通讯-发送红包 + tags: + - 即时通讯 + /api/v1/im/user/sendRedPackageDetail: + post: + consumes: + - application/json + description: 发送红包详情 + parameters: - description: 验证参数Bearer和token空格拼接 in: header name: Authorization @@ -1995,7 +2047,7 @@ paths: description: 具体错误 schema: $ref: '#/definitions/md.Response' - summary: 蛋蛋星球-即时通讯-发送红包 + summary: 蛋蛋星球-即时通讯-发送红包详情 tags: - 即时通讯 /api/v1/login: diff --git a/go.mod b/go.mod index 2bea63c..e987c76 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module applet go 1.19 -// replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models +//replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models // // replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules @@ -32,7 +32,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126080048-3c72cf5fa2e9 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126104405-980be92ee61d code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241126083327-1b1d0a2602a0 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 @@ -40,6 +40,7 @@ require ( github.com/gin-contrib/sessions v1.0.1 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 + github.com/google/uuid v1.3.0 github.com/olivere/elastic/v7 v7.0.32 github.com/shopspring/decimal v1.3.1 github.com/tidwall/gjson v1.14.1