@@ -231,7 +231,10 @@ func HomePageWatchAdRule(c *gin.Context) { | |||
} | |||
} | |||
nextWatchAdDate, _ := cache.GetString(redisKey) | |||
var nextWatchAdTimes = utils.TimeParseStd(nextWatchAdDate).Unix() - time.Now().Unix() | |||
nextWatchAdTimes := utils.TimeParseStd(nextWatchAdDate).Unix() - time.Now().Unix() | |||
if nextWatchAdTimes < 0 { | |||
nextWatchAdTimes = 0 | |||
} | |||
utils.FilePutContents("nextWatchAdDate", utils.SerializeStr(map[string]interface{}{ | |||
"nextWatchAdDate": nextWatchAdDate, | |||
@@ -245,6 +248,7 @@ func HomePageWatchAdRule(c *gin.Context) { | |||
ResidueWatchAdNum: residueWatchAdNum, | |||
WatchAdRewardActivePoints: videoRewardSystem.RewardValue, | |||
NextWatchAdDate: nextWatchAdDate, | |||
NextWatchAdSecs: nextWatchAdTimes, | |||
EachRoundHour: videoRewardSystem.EachRoundHour, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
@@ -457,7 +457,7 @@ func LaunchBindAlipayAccount(c *gin.Context) { | |||
resUrl := fmt.Sprintf("apiname=com.alipay.account.auth&app_id=%s&app_name=mc&"+ | |||
"auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get"+ | |||
"&pid=%s&product_id=APP_FAST_LOGIN&scosspe=%s&sign_type=RSA2&"+ | |||
"&pid=%s&product_id=APP_FAST_LOGIN&scope=%s&sign_type=RSA2&"+ | |||
"target_id=%s&sign=%s", appId, pid, scope, targetId, sign) | |||
e.OutSuc(c, resUrl, nil) | |||
@@ -16,6 +16,7 @@ type HomePageWatchAdRuleResp struct { | |||
ResidueWatchAdNum int `json:"residue_watch_ad_num"` // 当前剩余可观看视频数 | |||
WatchAdRewardActivePoints string `json:"watch_ad_reward_active_points"` // 观看广告视频奖励X个活跃积分 | |||
NextWatchAdDate string `json:"next_watch_ad_date"` // 下次可观看广告时间,若为空允许观看视频 | |||
NextWatchAdSecs int64 `json:"next_watch_ad_secs"` // 下次可观看广告时间,若为空允许观看视频 | |||
EachRoundHour string `json:"each_round_hour"` // 每一轮X个小时 | |||
} | |||
@@ -88,6 +88,11 @@ func route(r *gin.RouterGroup) { | |||
rCircleFriends(r.Group("/circleFriends")) | |||
rComm(r.Group("/comm")) | |||
rAdvertising := r.Group("/advertising") //广告 | |||
{ | |||
rAdvertising.POST("/check", hdl.AdvertisingCheck) //广告位判断能不能看 | |||
rAdvertising.POST("/state", hdl.AdvertisingState) //广告位状态 | |||
} | |||
rHomePage := r.Group("/homePage") | |||
{ | |||
rHomePage.GET("/index", hdl.HomePage) // 主页 | |||
@@ -202,11 +207,6 @@ func rCircleFriends(r *gin.RouterGroup) { | |||
} | |||
func rComm(r *gin.RouterGroup) { | |||
rCommAdvertising := r.Group("/advertising") | |||
{ | |||
rCommAdvertising.POST("/advertising/check", hdl.AdvertisingCheck) //广告位判断能不能看 | |||
rCommAdvertising.POST("/advertising/state", hdl.AdvertisingState) //广告位状态 | |||
} | |||
r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL | |||
r.GET("/accessRecords", comm.AccessRecords) // 访问记录 | |||
@@ -501,6 +501,82 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"/api/v1/circleFriends/comment": { | |||
"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/circleFriends/isCanComment": { | |||
"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/college/cate": { | |||
"get": { | |||
"description": "蛋蛋学院-分类", | |||
@@ -3991,6 +4067,10 @@ const docTemplate = `{ | |||
"description": "下次可观看广告时间,若为空允许观看视频", | |||
"type": "string" | |||
}, | |||
"next_watch_ad_secs": { | |||
"description": "下次可观看广告时间,若为空允许观看视频", | |||
"type": "integer" | |||
}, | |||
"residue_watch_ad_num": { | |||
"description": "当前剩余可观看视频数", | |||
"type": "integer" | |||
@@ -495,6 +495,82 @@ | |||
} | |||
} | |||
}, | |||
"/api/v1/circleFriends/comment": { | |||
"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/circleFriends/isCanComment": { | |||
"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/college/cate": { | |||
"get": { | |||
"description": "蛋蛋学院-分类", | |||
@@ -3985,6 +4061,10 @@ | |||
"description": "下次可观看广告时间,若为空允许观看视频", | |||
"type": "string" | |||
}, | |||
"next_watch_ad_secs": { | |||
"description": "下次可观看广告时间,若为空允许观看视频", | |||
"type": "integer" | |||
}, | |||
"residue_watch_ad_num": { | |||
"description": "当前剩余可观看视频数", | |||
"type": "integer" | |||
@@ -666,6 +666,9 @@ definitions: | |||
next_watch_ad_date: | |||
description: 下次可观看广告时间,若为空允许观看视频 | |||
type: string | |||
next_watch_ad_secs: | |||
description: 下次可观看广告时间,若为空允许观看视频 | |||
type: integer | |||
residue_watch_ad_num: | |||
description: 当前剩余可观看视频数 | |||
type: integer | |||
@@ -1743,6 +1746,56 @@ paths: | |||
summary: 广告状态 看完之后拿到广告唯一值 | |||
tags: | |||
- 广告位 | |||
/api/v1/circleFriends/comment: | |||
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/circleFriends/isCanComment: | |||
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/college/cate: | |||
get: | |||
consumes: | |||