diff --git a/app/hdl/hdl_im.go b/app/hdl/hdl_im.go index 193f646..e98908c 100644 --- a/app/hdl/hdl_im.go +++ b/app/hdl/hdl_im.go @@ -14,6 +14,17 @@ import ( "github.com/tidwall/gjson" ) +// SendRedPackageDetail +// @Summary 蛋蛋星球-即时通讯-发送红包 +// @Tags 即时通讯 +// @Description 发送红包 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.SendRedPackageDetailReq true "红包的订单 ID" +// @Success 200 {object} md.SendRedPackageDetailResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/im/user/sendRedPackageDetail [POST] func SendRedPackageDetail(c *gin.Context) { var req *md.SendRedPackageDetailReq if err1 := c.ShouldBindJSON(&req); err1 != nil { @@ -31,20 +42,33 @@ func SendRedPackageDetail(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, nil) return } - im := map[string]int{"seq": 0} - res := map[string]interface{}{ - "im": im, - "red_package_id": 0, + var redPackageID int64 + im := md.SeqType{ + Seq: 0, } if imSendRedPackageOrd != nil { - im = map[string]int{"seq": int(gjson.Get(imSendRedPackageOrd.ImData, "seq").Int())} - res["im"] = im - res["red_package_id"] = imSendRedPackageOrd.Id + im.Seq = int(gjson.Get(imSendRedPackageOrd.ImData, "seq").Int()) + redPackageID = imSendRedPackageOrd.Id } - e.OutSuc(c, res, nil) + resp := md.SendRedPackageDetailResp{ + Im: im, + RedPackageID: redPackageID, + } + e.OutSuc(c, resp, nil) return } +// GrabRedPackage +// @Summary 蛋蛋星球-即时通讯-领取红包 +// @Tags 即时通讯 +// @Description 领取红包 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.GrabRedPackageReq true "领取红包信息" +// @Success 200 {object} md.GrabRedPackageResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/im/user/grabRedPackage [POST] func GrabRedPackage(c *gin.Context) { var req *md.GrabRedPackageReq if err1 := c.ShouldBindJSON(&req); err1 != nil { @@ -69,17 +93,19 @@ func GrabRedPackage(c *gin.Context) { return } + resp := md.GrabRedPackageResp{ + Im: &pb.SendRedPacketResp{Seq: 0}, + GrabAmount: grabAmount, + } + if redPackageContent == nil { - e.OutSuc(c, map[string]interface{}{ - "im": pb.SendRedPacketResp{Seq: 0}, - "grab_amount": grabAmount, - }, nil) + e.OutSuc(c, resp, nil) return } //TODO::调用im GRPC 接口 masterID := c.GetHeader("master_id") - resp, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).SendRedPacket(utils.GetCtx(req.Token, req.UserId, req.DeviceId, masterID), &pb.SendRedPacketReq{ + res, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).SendRedPacket(utils.GetCtx(req.Token, req.UserId, req.DeviceId, masterID), &pb.SendRedPacketReq{ ReceiverType: pb.ReceiverType(req.ReceiverType), ReceiverId: req.ReceiverId, MessageType: pb.MessageType_MT_RED_PACKAGE, @@ -93,34 +119,33 @@ func GrabRedPackage(c *gin.Context) { return } - e.OutSuc(c, map[string]interface{}{ - "im": resp, - "grab_amount": grabAmount, - }, nil) + resp.Im = res + e.OutSuc(c, resp, nil) return } +// RedPackageDetail +// @Summary 蛋蛋星球-即时通讯-红包详情(获取) +// @Tags 即时通讯 +// @Description 红包详情(获取) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param red_package_id query string true "红包 ID" +// @Success 200 {object} md.RedPackageDetailResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/im/redPackageDetail [GET] func RedPackageDetail(c *gin.Context) { redPackageId := c.DefaultQuery("red_package_id", "") - 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 - } - resp, imSendRedPackageOrd, err := svc.DetailGrabRedPackage(user, redPackageId) + res, imSendRedPackageOrd, err := svc.DetailGrabRedPackage(redPackageId) if err != nil { - e.OutErr(c, e.ERR, err) + e.OutErr(c, e.ERR, err.Error()) return } - e.OutSuc(c, map[string]interface{}{ - "list": resp, - "detail": model.ImSendRedPackageOrd{ + resp := md.RedPackageDetailResp{ + List: res, + Detail: model.ImSendRedPackageOrd{ OrdNo: imSendRedPackageOrd.OrdNo, Uid: imSendRedPackageOrd.Uid, ImUid: imSendRedPackageOrd.ImUid, @@ -139,6 +164,7 @@ func RedPackageDetail(c *gin.Context) { CreateTime: imSendRedPackageOrd.CreateTime, UpdateTime: imSendRedPackageOrd.UpdateTime, }, - }, nil) + } + e.OutSuc(c, resp, nil) return } diff --git a/app/md/md_im.go b/app/md/md_im.go index 47ed43d..134595b 100644 --- a/app/md/md_im.go +++ b/app/md/md_im.go @@ -1,7 +1,21 @@ package md +import ( + "applet/app/pkg/pb" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + type SendRedPackageDetailReq struct { - OrderId string `json:"order_id"` + OrderId string `json:"order_id"` // 红包的订单 ID +} + +type SeqType struct { + Seq int `json:"seq"` // 序列号 +} + +type SendRedPackageDetailResp struct { + Im SeqType `json:"im"` + RedPackageID int64 `json:"red_package_id"` // 红包 ID } type GrabRedPackageReq struct { @@ -17,10 +31,20 @@ type GrabRedPackageReq struct { RedPackageCover string `json:"red_package_cover"` //红包封面 } -type RedPackageDetailResp struct { +type GrabRedPackageResp struct { + Im *pb.SendRedPacketResp `json:"im"` // im 返回体 + GrabAmount string `json:"grab_amount"` // 抢到的红包金额 +} + +type RedPackageDetailUserNode struct { ImUserId string `json:"im_user_id"` //im用户id UserNickName string `json:"user_nick_name"` //im用户昵称 UserAvatarUrl string `json:"user_avatar_url"` //im用户昵称 Amount string `json:"amount"` //金额 ReceiveAt string `json:"received_at"` //领取时间 } + +type RedPackageDetailResp struct { + List []RedPackageDetailUserNode `json:"list"` // 领取红包用户列表 + Detail model.ImSendRedPackageOrd `json:"detail"` // 红包详情信息 +} diff --git a/app/router/router.go b/app/router/router.go index e5bd81e..98c508f 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -112,15 +112,15 @@ func route(r *gin.RouterGroup) { rWithdraw.GET("/index", hdl.WithdrawGetAmount) } } - rNewUserRedPacket := r.Group("/newUserRedPacket") // 红包 + rNewUserRedPacket := r.Group("/newUserRedPacket") // 新人红包 { rNewUserRedPacket.GET("/index", hdl.NewUserRedPacketInfo) } rIm := r.Group("/im") { - rIm.POST("/user/sendRedPackageDetail", hdl.SendRedPackageDetail) - rIm.POST("/user/grabRedPackage", hdl.GrabRedPackage) - rIm.GET("/redPackageDetail", hdl.RedPackageDetail) + 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 01c3666..43b8b13 100644 --- a/app/svc/svc_im.go +++ b/app/svc/svc_im.go @@ -145,7 +145,7 @@ func DelGrabRedPackage(req *md.GrabRedPackageReq, user *model.User) (resp []byte dealUserWalletReq := md2.DealUserWalletReq{ Direction: "add", Kind: 5, - Title: "抢到红包收益", + Title: "领取红包收益", Uid: user.Id, Amount: utils.StrToFloat64(grabAmount), } @@ -187,7 +187,7 @@ func DelGrabRedPackage(req *md.GrabRedPackageReq, user *model.User) (resp []byte return resp, grabAmount, nil } -func DetailGrabRedPackage(user *model.User, redPackageId string) (resp []md.RedPackageDetailResp, imSendRedPackageOrd *model.ImSendRedPackageOrd, err error) { +func DetailGrabRedPackage(redPackageId string) (resp []md.RedPackageDetailUserNode, imSendRedPackageOrd *model.ImSendRedPackageOrd, err error) { //1、查找红包 redPackageOrdDb := implement.NewImSendRedPackageOrdDb(db.Db) @@ -219,7 +219,7 @@ func DetailGrabRedPackage(user *model.User, redPackageId string) (resp []md.RedP receivedUserAmount := strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",") for k, v := range receivedUserIds { - resp = append(resp, md.RedPackageDetailResp{ + resp = append(resp, md.RedPackageDetailUserNode{ ImUserId: receivedImUserIds[k], UserNickName: usersMap[v].Nickname, UserAvatarUrl: usersMap[v].Avatar, diff --git a/docs/docs.go b/docs/docs.go index b43ce78..f4f27a3 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -800,6 +800,145 @@ const docTemplate = `{ } } }, + "/api/v1/im/redPackageDetail": { + "get": { + "description": "红包详情(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-红包详情(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "红包 ID", + "name": "red_package_id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.RedPackageDetailResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/grabRedPackage": { + "post": { + "description": "领取红包", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-领取红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "领取红包信息", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.GrabRedPackageReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GrabRedPackageResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/sendRedPackageDetail": { + "post": { + "description": "发送红包", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-发送红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "红包的订单 ID", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SendRedPackageDetailReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.SendRedPackageDetailResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/login": { "post": { "description": "登入", @@ -1560,6 +1699,44 @@ const docTemplate = `{ } } }, + "/api/v1/wallet/withdraw/index": { + "get": { + "description": "提现余额(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包" + ], + "summary": "蛋蛋星球-钱包-提现余额(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.WithdrawGetAmountResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/wechatLogin": { "post": { "description": "微信登陆", @@ -2208,6 +2385,68 @@ const docTemplate = `{ } } }, + "md.GrabRedPackageReq": { + "type": "object", + "properties": { + "device_id": { + "description": "设备id", + "type": "string" + }, + "receiver_id": { + "description": "用户id或者群组id", + "type": "integer" + }, + "receiver_type": { + "description": "接收者类型,1:user;2:group", + "type": "integer" + }, + "red_package_cover": { + "description": "红包封面", + "type": "string" + }, + "red_package_id": { + "description": "红包id", + "type": "integer" + }, + "send_red_package_user_nike_name": { + "description": "红包发送者-im用户昵称", + "type": "string" + }, + "send_red_packet_avatar_url": { + "description": "红包发送者-im用户头像", + "type": "string" + }, + "send_time": { + "description": "消息发送时间戳,精确到毫秒", + "type": "integer" + }, + "token": { + "description": "im-token", + "type": "string" + }, + "user_id": { + "description": "im用户id", + "type": "string" + } + } + }, + "md.GrabRedPackageResp": { + "type": "object", + "properties": { + "grab_amount": { + "description": "抢到的红包金额", + "type": "string" + }, + "im": { + "description": "im 返回体", + "allOf": [ + { + "$ref": "#/definitions/pb.SendRedPacketResp" + } + ] + } + } + }, "md.HomePageResp": { "type": "object", "properties": { @@ -2556,6 +2795,51 @@ const docTemplate = `{ } } }, + "md.RedPackageDetailResp": { + "type": "object", + "properties": { + "detail": { + "description": "红包详情信息", + "allOf": [ + { + "$ref": "#/definitions/model.ImSendRedPackageOrd" + } + ] + }, + "list": { + "description": "领取红包用户列表", + "type": "array", + "items": { + "$ref": "#/definitions/md.RedPackageDetailUserNode" + } + } + } + }, + "md.RedPackageDetailUserNode": { + "type": "object", + "properties": { + "amount": { + "description": "金额", + "type": "string" + }, + "im_user_id": { + "description": "im用户id", + "type": "string" + }, + "received_at": { + "description": "领取时间", + "type": "string" + }, + "user_avatar_url": { + "description": "im用户昵称", + "type": "string" + }, + "user_nick_name": { + "description": "im用户昵称", + "type": "string" + } + } + }, "md.RegisterReq": { "type": "object", "required": [ @@ -2619,6 +2903,36 @@ const docTemplate = `{ } } }, + "md.SendRedPackageDetailReq": { + "type": "object", + "properties": { + "order_id": { + "description": "红包的订单 ID", + "type": "string" + } + } + }, + "md.SendRedPackageDetailResp": { + "type": "object", + "properties": { + "im": { + "$ref": "#/definitions/md.SeqType" + }, + "red_package_id": { + "description": "红包 ID", + "type": "integer" + } + } + }, + "md.SeqType": { + "type": "object", + "properties": { + "seq": { + "description": "序列号", + "type": "integer" + } + } + }, "md.SmsSendReq": { "type": "object", "required": [ @@ -2828,6 +3142,86 @@ const docTemplate = `{ "example": "微信UnionId" } } + }, + "md.WithdrawGetAmountResp": { + "type": "object", + "properties": { + "amount": { + "description": "余额", + "type": "string" + } + } + }, + "model.ImSendRedPackageOrd": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_data": { + "type": "string" + }, + "im_uid": { + "type": "integer" + }, + "ord_no": { + "type": "string" + }, + "received_im_user_ids": { + "type": "string" + }, + "received_times": { + "type": "string" + }, + "received_user_amount": { + "type": "string" + }, + "received_user_ids": { + "type": "string" + }, + "red_packet_balance_amount": { + "type": "string" + }, + "red_packet_balance_nums": { + "type": "integer" + }, + "red_packet_nums": { + "type": "integer" + }, + "red_packet_type": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "uid": { + "type": "integer" + }, + "update_time": { + "type": "string" + }, + "wait_draw_im_user_ids": { + "type": "string" + }, + "wait_draw_user_ids": { + "type": "string" + } + } + }, + "pb.SendRedPacketResp": { + "type": "object", + "properties": { + "seq": { + "description": "消息序列号", + "type": "integer" + } + } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index 41ba620..d585c26 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -794,6 +794,145 @@ } } }, + "/api/v1/im/redPackageDetail": { + "get": { + "description": "红包详情(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-红包详情(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "红包 ID", + "name": "red_package_id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.RedPackageDetailResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/grabRedPackage": { + "post": { + "description": "领取红包", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-领取红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "领取红包信息", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.GrabRedPackageReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GrabRedPackageResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/im/user/sendRedPackageDetail": { + "post": { + "description": "发送红包", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "即时通讯" + ], + "summary": "蛋蛋星球-即时通讯-发送红包", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "红包的订单 ID", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SendRedPackageDetailReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.SendRedPackageDetailResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/login": { "post": { "description": "登入", @@ -1554,6 +1693,44 @@ } } }, + "/api/v1/wallet/withdraw/index": { + "get": { + "description": "提现余额(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "钱包" + ], + "summary": "蛋蛋星球-钱包-提现余额(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.WithdrawGetAmountResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/wechatLogin": { "post": { "description": "微信登陆", @@ -2202,6 +2379,68 @@ } } }, + "md.GrabRedPackageReq": { + "type": "object", + "properties": { + "device_id": { + "description": "设备id", + "type": "string" + }, + "receiver_id": { + "description": "用户id或者群组id", + "type": "integer" + }, + "receiver_type": { + "description": "接收者类型,1:user;2:group", + "type": "integer" + }, + "red_package_cover": { + "description": "红包封面", + "type": "string" + }, + "red_package_id": { + "description": "红包id", + "type": "integer" + }, + "send_red_package_user_nike_name": { + "description": "红包发送者-im用户昵称", + "type": "string" + }, + "send_red_packet_avatar_url": { + "description": "红包发送者-im用户头像", + "type": "string" + }, + "send_time": { + "description": "消息发送时间戳,精确到毫秒", + "type": "integer" + }, + "token": { + "description": "im-token", + "type": "string" + }, + "user_id": { + "description": "im用户id", + "type": "string" + } + } + }, + "md.GrabRedPackageResp": { + "type": "object", + "properties": { + "grab_amount": { + "description": "抢到的红包金额", + "type": "string" + }, + "im": { + "description": "im 返回体", + "allOf": [ + { + "$ref": "#/definitions/pb.SendRedPacketResp" + } + ] + } + } + }, "md.HomePageResp": { "type": "object", "properties": { @@ -2550,6 +2789,51 @@ } } }, + "md.RedPackageDetailResp": { + "type": "object", + "properties": { + "detail": { + "description": "红包详情信息", + "allOf": [ + { + "$ref": "#/definitions/model.ImSendRedPackageOrd" + } + ] + }, + "list": { + "description": "领取红包用户列表", + "type": "array", + "items": { + "$ref": "#/definitions/md.RedPackageDetailUserNode" + } + } + } + }, + "md.RedPackageDetailUserNode": { + "type": "object", + "properties": { + "amount": { + "description": "金额", + "type": "string" + }, + "im_user_id": { + "description": "im用户id", + "type": "string" + }, + "received_at": { + "description": "领取时间", + "type": "string" + }, + "user_avatar_url": { + "description": "im用户昵称", + "type": "string" + }, + "user_nick_name": { + "description": "im用户昵称", + "type": "string" + } + } + }, "md.RegisterReq": { "type": "object", "required": [ @@ -2613,6 +2897,36 @@ } } }, + "md.SendRedPackageDetailReq": { + "type": "object", + "properties": { + "order_id": { + "description": "红包的订单 ID", + "type": "string" + } + } + }, + "md.SendRedPackageDetailResp": { + "type": "object", + "properties": { + "im": { + "$ref": "#/definitions/md.SeqType" + }, + "red_package_id": { + "description": "红包 ID", + "type": "integer" + } + } + }, + "md.SeqType": { + "type": "object", + "properties": { + "seq": { + "description": "序列号", + "type": "integer" + } + } + }, "md.SmsSendReq": { "type": "object", "required": [ @@ -2822,6 +3136,86 @@ "example": "微信UnionId" } } + }, + "md.WithdrawGetAmountResp": { + "type": "object", + "properties": { + "amount": { + "description": "余额", + "type": "string" + } + } + }, + "model.ImSendRedPackageOrd": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_data": { + "type": "string" + }, + "im_uid": { + "type": "integer" + }, + "ord_no": { + "type": "string" + }, + "received_im_user_ids": { + "type": "string" + }, + "received_times": { + "type": "string" + }, + "received_user_amount": { + "type": "string" + }, + "received_user_ids": { + "type": "string" + }, + "red_packet_balance_amount": { + "type": "string" + }, + "red_packet_balance_nums": { + "type": "integer" + }, + "red_packet_nums": { + "type": "integer" + }, + "red_packet_type": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "uid": { + "type": "integer" + }, + "update_time": { + "type": "string" + }, + "wait_draw_im_user_ids": { + "type": "string" + }, + "wait_draw_user_ids": { + "type": "string" + } + } + }, + "pb.SendRedPacketResp": { + "type": "object", + "properties": { + "seq": { + "description": "消息序列号", + "type": "integer" + } + } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index a844b67..6477e89 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -420,6 +420,49 @@ definitions: items: {} type: array type: object + md.GrabRedPackageReq: + properties: + device_id: + description: 设备id + type: string + receiver_id: + description: 用户id或者群组id + type: integer + receiver_type: + description: 接收者类型,1:user;2:group + type: integer + red_package_cover: + description: 红包封面 + type: string + red_package_id: + description: 红包id + type: integer + send_red_package_user_nike_name: + description: 红包发送者-im用户昵称 + type: string + send_red_packet_avatar_url: + description: 红包发送者-im用户头像 + type: string + send_time: + description: 消息发送时间戳,精确到毫秒 + type: integer + token: + description: im-token + type: string + user_id: + description: im用户id + type: string + type: object + md.GrabRedPackageResp: + properties: + grab_amount: + description: 抢到的红包金额 + type: string + im: + allOf: + - $ref: '#/definitions/pb.SendRedPacketResp' + description: im 返回体 + type: object md.HomePageResp: properties: egg_energy_now_price: @@ -665,6 +708,36 @@ definitions: user_count: type: string type: object + md.RedPackageDetailResp: + properties: + detail: + allOf: + - $ref: '#/definitions/model.ImSendRedPackageOrd' + description: 红包详情信息 + list: + description: 领取红包用户列表 + items: + $ref: '#/definitions/md.RedPackageDetailUserNode' + type: array + type: object + md.RedPackageDetailUserNode: + properties: + amount: + description: 金额 + type: string + im_user_id: + description: im用户id + type: string + received_at: + description: 领取时间 + type: string + user_avatar_url: + description: im用户昵称 + type: string + user_nick_name: + description: im用户昵称 + type: string + type: object md.RegisterReq: properties: avatar: @@ -710,6 +783,26 @@ definitions: example: 具体错误原因 type: string type: object + md.SendRedPackageDetailReq: + properties: + order_id: + description: 红包的订单 ID + type: string + type: object + md.SendRedPackageDetailResp: + properties: + im: + $ref: '#/definitions/md.SeqType' + red_package_id: + description: 红包 ID + type: integer + type: object + md.SeqType: + properties: + seq: + description: 序列号 + type: integer + type: object md.SmsSendReq: properties: captcha_output: @@ -855,6 +948,59 @@ definitions: example: 微信UnionId type: string type: object + md.WithdrawGetAmountResp: + properties: + amount: + description: 余额 + type: string + type: object + model.ImSendRedPackageOrd: + properties: + amount: + type: string + create_time: + type: string + id: + type: integer + im_data: + type: string + im_uid: + type: integer + ord_no: + type: string + received_im_user_ids: + type: string + received_times: + type: string + received_user_amount: + type: string + received_user_ids: + type: string + red_packet_balance_amount: + type: string + red_packet_balance_nums: + type: integer + red_packet_nums: + type: integer + red_packet_type: + type: integer + state: + type: integer + uid: + type: integer + update_time: + type: string + wait_draw_im_user_ids: + type: string + wait_draw_user_ids: + type: string + type: object + pb.SendRedPacketResp: + properties: + seq: + description: 消息序列号 + type: integer + type: object host: ddxq.izhim.com info: contact: @@ -1380,6 +1526,98 @@ paths: summary: 蛋蛋星球-主页-实时数据(获取) tags: - 主页 + /api/v1/im/redPackageDetail: + get: + consumes: + - application/json + description: 红包详情(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 红包 ID + in: query + name: red_package_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.RedPackageDetailResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 蛋蛋星球-即时通讯-红包详情(获取) + tags: + - 即时通讯 + /api/v1/im/user/grabRedPackage: + post: + consumes: + - application/json + description: 领取红包 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 领取红包信息 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.GrabRedPackageReq' + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.GrabRedPackageResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 蛋蛋星球-即时通讯-领取红包 + tags: + - 即时通讯 + /api/v1/im/user/sendRedPackageDetail: + post: + consumes: + - application/json + description: 发送红包 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 红包的订单 ID + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.SendRedPackageDetailReq' + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.SendRedPackageDetailResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 蛋蛋星球-即时通讯-发送红包 + tags: + - 即时通讯 /api/v1/login: post: consumes: @@ -1883,6 +2121,31 @@ paths: summary: 蛋蛋星球-钱包-余额明细(获取) tags: - 钱包 + /api/v1/wallet/withdraw/index: + get: + consumes: + - application/json + description: 提现余额(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.WithdrawGetAmountResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 蛋蛋星球-钱包-提现余额(获取) + tags: + - 钱包 /api/v1/wechatLogin: post: consumes: diff --git a/go.mod b/go.mod index f33103c..ad5e7b2 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.20241125034400-ef18ee319fd2 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241125145802-942cfd1ddd13 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125081706-0915be3f4144 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