diff --git a/app/hdl/hdl_add_friend.go b/app/hdl/hdl_add_friend.go index 9a1c25f..21df728 100644 --- a/app/hdl/hdl_add_friend.go +++ b/app/hdl/hdl_add_friend.go @@ -392,21 +392,21 @@ func BasalRate(c *gin.Context) { now := time.Now() nowStr := now.Format("2006-01-02 15:04:05") signInDb := implement.NewEggSignInDb(db.Db) - has, eggSignIn, err := signInDb.EggSignINGetOneByTimeAndUid(nowStr, nowStr, user.Id, 0) + has, eggSignIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } if !has { resp := md.BasalRateResp{ - ConsumedTime: "", - ConsumedEggEnergy: "", - RemainingTime: "", - RemainingEggEnergy: "", - BasalRate: "", - ConsumedEggPoint: "", - EstimatedRevenue: "", - SignCountdown: "0000:00:00", + ConsumedTime: "0", + ConsumedEggEnergy: "0", + RemainingTime: "0", + RemainingEggEnergy: "0", + BasalRate: "0", + ConsumedEggPoint: "0", + EstimatedRevenue: "0", + SignCountdown: "00:00:00", } e.OutSuc(c, resp, nil) return @@ -444,11 +444,18 @@ func BasalRate(c *gin.Context) { } basalRate := basalRateDecimal.Mul(decimal.NewFromInt(60 * 60)) // 收益倒计时 + var signCountdown string + var signTimeSecs float64 duration := utils.TimeParseStd(eggSignIn.EndTime).Sub(now) // 计算时间差值 - hours := duration / time.Hour // 获取小时部分 - minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) - seconds := int64(duration/time.Second) % 60 - signCountdown := fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 + if duration > 0 { + hours := duration / time.Hour // 获取小时部分 + minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) + seconds := int64(duration/time.Second) % 60 + signCountdown = fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 + signTimeSecs = duration.Seconds() + } else { + signCountdown = fmt.Sprintf("00:00:00") + } resp := md.BasalRateResp{ ConsumedTime: consumedTime.String(), @@ -459,6 +466,7 @@ func BasalRate(c *gin.Context) { ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, EstimatedRevenue: estimatedRevenue.String(), SignCountdown: signCountdown, + SignTimeSecs: signTimeSecs, } e.OutSuc(c, resp, nil) } diff --git a/app/hdl/hdl_guide_page.go b/app/hdl/hdl_guide_page.go new file mode 100644 index 0000000..a65712f --- /dev/null +++ b/app/hdl/hdl_guide_page.go @@ -0,0 +1,40 @@ +package hdl + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "fmt" + "github.com/gin-gonic/gin" + "time" +) + +// GetRunningTime +// @Summary 蛋蛋星球-引导页-运行时间 +// @Tags 引导页 +// @Description 运行时间 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {string} "运行时间" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/guidePage/runningTime [GET] +func GetRunningTime(c *gin.Context) { + basicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) + setting, err := basicSettingDb.EggEnergyBasicSettingGetOne() + if err != nil { + e.OutErr(c, e.ERR_DB_ORM) + return + } + startTime := utils.TimeParseStd(setting.CreateAt) + now := time.Now() + duration := now.Sub(startTime) + days := duration / time.Hour / 24 // 获取天数 + hours := duration / time.Hour % 24 // 获取小时部分 + minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) + seconds := int64(duration/time.Second) % 60 + runTime := fmt.Sprintf("%d:%d:%d:%d", days, hours, minutes, seconds) //收益倒计时 + + e.OutSuc(c, runTime, nil) +} diff --git a/app/md/md_add_friend.go b/app/md/md_add_friend.go index 4295f5d..d28ceff 100644 --- a/app/md/md_add_friend.go +++ b/app/md/md_add_friend.go @@ -87,14 +87,15 @@ type NineDimensionalSpaceResp struct { } type BasalRateResp struct { - ConsumedTime string `json:"consumed_time"` // 消耗时间/小时 - ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 - RemainingTime string `json:"remaining_time"` // 剩余时间/小时 - RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 - BasalRate string `json:"basal_rate"` // 基础速率 - ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 - EstimatedRevenue string `json:"estimated_revenue"` // 预估收益蛋蛋能量 - SignCountdown string `json:"sign_countdown"` // 收益倒计时 + ConsumedTime string `json:"consumed_time"` // 消耗时间/小时 + ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 + RemainingTime string `json:"remaining_time"` // 剩余时间/小时 + RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 + BasalRate string `json:"basal_rate"` // 基础速率 + ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 + EstimatedRevenue string `json:"estimated_revenue"` // 预估收益蛋蛋能量 + SignCountdown string `json:"sign_countdown"` // 收益倒计时 + SignTimeSecs float64 `json:"sign_time_secs"` // 收益倒计时秒数 } type TotalRateResp struct { diff --git a/app/router/router.go b/app/router/router.go index 43be4ca..c8e2d39 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -80,6 +80,10 @@ func route(r *gin.RouterGroup) { r.POST("/inviteCode/userInfo", hdl.InviteCodeUserInfo) //邀请码查用户 } r.POST("/college/detail", hdl.CollegeDetail) // 文章详情 + rGuidePage := r.Group("/guidePage") + { + rGuidePage.GET("/runningTime", hdl.GetRunningTime) + } r.GET("/getModuleSetting", hdl.GetModuleSetting) // 获取页面样式 r.Use(mw.Auth) // 以下接口需要JWT验证 @@ -215,7 +219,6 @@ func rCircleFriends(r *gin.RouterGroup) { } func rComm(r *gin.RouterGroup) { - r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL r.GET("/accessRecords", comm.AccessRecords) // 访问记录 } diff --git a/docs/docs.go b/docs/docs.go index bb116bd..c4ea3da 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -1686,6 +1685,44 @@ const docTemplate = `{ } } }, + "/api/v1/guidePage/runningTime": { + "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/homePage/adRule": { "get": { "description": "视频奖励规则(获取)", @@ -3006,9 +3043,7 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -3799,68 +3834,6 @@ const docTemplate = `{ } } }, - "code_fnuoos_com_EggPlanet_egg_models_git_src_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" - } - } - }, "comm.AccessRecordsReq": { "type": "object", "properties": { @@ -4223,6 +4196,10 @@ const docTemplate = `{ "sign_countdown": { "description": "收益倒计时", "type": "string" + }, + "sign_time_secs": { + "description": "收益倒计时秒数", + "type": "number" } } }, @@ -5416,7 +5393,7 @@ const docTemplate = `{ "description": "红包详情信息", "allOf": [ { - "$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" + "$ref": "#/definitions/model.ImSendRedPackageOrd" } ] }, @@ -6098,6 +6075,68 @@ const docTemplate = `{ } } }, + "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": { @@ -6120,6 +6159,8 @@ var SwaggerInfo = &swag.Spec{ Description: "APP客户端-Api接口", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index e21a43c..f70555b 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1679,6 +1679,44 @@ } } }, + "/api/v1/guidePage/runningTime": { + "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/homePage/adRule": { "get": { "description": "视频奖励规则(获取)", @@ -2999,9 +3037,7 @@ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -3792,68 +3828,6 @@ } } }, - "code_fnuoos_com_EggPlanet_egg_models_git_src_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" - } - } - }, "comm.AccessRecordsReq": { "type": "object", "properties": { @@ -4216,6 +4190,10 @@ "sign_countdown": { "description": "收益倒计时", "type": "string" + }, + "sign_time_secs": { + "description": "收益倒计时秒数", + "type": "number" } } }, @@ -5409,7 +5387,7 @@ "description": "红包详情信息", "allOf": [ { - "$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" + "$ref": "#/definitions/model.ImSendRedPackageOrd" } ] }, @@ -6091,6 +6069,68 @@ } } }, + "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": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 1ebf04c..2e1616b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -12,47 +12,6 @@ definitions: description: 总数据量 type: integer type: object - code_fnuoos_com_EggPlanet_egg_models_git_src_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 comm.AccessRecordsReq: properties: index: @@ -310,6 +269,9 @@ definitions: sign_countdown: description: 收益倒计时 type: string + sign_time_secs: + description: 收益倒计时秒数 + type: number type: object md.BindAlipayAccountReq: properties: @@ -1136,7 +1098,7 @@ definitions: properties: detail: allOf: - - $ref: '#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd' + - $ref: '#/definitions/model.ImSendRedPackageOrd' description: 红包详情信息 list: description: 领取红包用户列表 @@ -1606,6 +1568,47 @@ definitions: 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: @@ -2723,6 +2726,31 @@ paths: summary: 页面样式 tags: - 页面样式 + /api/v1/guidePage/runningTime: + 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/homePage/adRule: get: consumes: @@ -3590,8 +3618,7 @@ paths: in: body name: req required: true - schema: - type: object + schema: {} produces: - application/json responses: diff --git a/go.mod b/go.mod index 90d7d98..8e35f9f 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241205080507-c27ed1ab5226 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206061858-d583849c70ea code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205061938-91f42710d6cd 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