@@ -9,6 +9,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | ||||
"errors" | |||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"strings" | "strings" | ||||
"time" | "time" | ||||
@@ -148,6 +149,27 @@ func UpdateWithdrawSetting(c *gin.Context) { | |||||
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) | e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) | ||||
return | return | ||||
} | } | ||||
if req.WithdrawTimeInterval.StartAt != "" { | |||||
res := utils.IsTimeFormat(req.WithdrawTimeInterval.StartAt) | |||||
if req.WithdrawTimeInterval.StartAt > "23:59" { | |||||
res = false | |||||
} | |||||
if !res { | |||||
e.OutErr(c, e.ERR_INVALID_ARGS, errors.New("开始时间应为 xx:xx 且不超过 23:59").Error()) | |||||
return | |||||
} | |||||
} | |||||
if req.WithdrawTimeInterval.EndAt != "" { | |||||
res := utils.IsTimeFormat(req.WithdrawTimeInterval.EndAt) | |||||
if req.WithdrawTimeInterval.EndAt > "23:59" { | |||||
res = false | |||||
} | |||||
if !res { | |||||
e.OutErr(c, e.ERR_INVALID_ARGS, errors.New("结束时间应为 xx:xx 且不超过 23:59").Error()) | |||||
return | |||||
} | |||||
} | |||||
frequencyStr := utils.SerializeStr(req.FrequencySet) | frequencyStr := utils.SerializeStr(req.FrequencySet) | ||||
withdrawFeeSetStr := utils.SerializeStr(req.WithdrawFeeSet) | withdrawFeeSetStr := utils.SerializeStr(req.WithdrawFeeSet) | ||||
firstWithdrawSetStr := utils.SerializeStr(req.FirstWithdrawSet) | firstWithdrawSetStr := utils.SerializeStr(req.FirstWithdrawSet) | ||||
@@ -341,21 +341,21 @@ func rFinancialCenter(r *gin.RouterGroup) { | |||||
func rFriendCircleSettings(r *gin.RouterGroup) { | func rFriendCircleSettings(r *gin.RouterGroup) { | ||||
rBasic := r.Group("/basic") | rBasic := r.Group("/basic") | ||||
{ | { | ||||
rBasic.GET("/index", friend_circle.GetFriendCircleBasicSettings) | |||||
rBasic.POST("/save", friend_circle.UpdateFriendCircleBasicSettings) | |||||
rBasic.GET("/index", friend_circle.GetFriendCircleBasicSettings) // 获取动态基础设置 | |||||
rBasic.POST("/save", friend_circle.UpdateFriendCircleBasicSettings) // 更新动态设置 | |||||
} | } | ||||
rBlackList := r.Group("/blackList") | rBlackList := r.Group("/blackList") | ||||
{ | { | ||||
rBlackList.GET("/index", friend_circle.GetBlackList) | |||||
rBlackList.POST("/add", friend_circle.AddBlackList) | |||||
rBlackList.DELETE("/del", friend_circle.DeleteBlackList) | |||||
rBlackList.GET("/index", friend_circle.GetBlackList) // 获取黑名单 | |||||
rBlackList.POST("/add", friend_circle.AddBlackList) // 添加黑名单 | |||||
rBlackList.DELETE("/del", friend_circle.DeleteBlackList) // 删除黑名单 | |||||
} | } | ||||
rDynamic := r.Group("/dynamic") | rDynamic := r.Group("/dynamic") | ||||
{ | { | ||||
rDynamic.POST("/index", friend_circle.GetDynamic) | |||||
rDynamic.POST("/update", friend_circle.UpdateDynamic) | |||||
rDynamic.DELETE("/del", friend_circle.DeleteDynamic) | |||||
rDynamic.POST("/release", friend_circle.ReleaseDynamic) | |||||
rDynamic.POST("/index", friend_circle.GetDynamic) // 获取动态列表 | |||||
rDynamic.POST("/update", friend_circle.UpdateDynamic) // 更新动态 | |||||
rDynamic.DELETE("/del", friend_circle.DeleteDynamic) // 删除动态 | |||||
rDynamic.POST("/release", friend_circle.ReleaseDynamic) // 发布动态 | |||||
} | } | ||||
} | } | ||||
@@ -3,6 +3,7 @@ package utils | |||||
import ( | import ( | ||||
"errors" | "errors" | ||||
"fmt" | "fmt" | ||||
"regexp" | |||||
"strconv" | "strconv" | ||||
"strings" | "strings" | ||||
"time" | "time" | ||||
@@ -240,3 +241,9 @@ func GetWeekInfo(dateStr string) (string, string, string, string) { | |||||
weekEnd := weekStart.AddDate(0, 0, 6) | weekEnd := weekStart.AddDate(0, 0, 6) | ||||
return IntToStr(year), IntToStr(week), weekStart.Format("2006-01-02"), weekEnd.Format("2006-01-02") | return IntToStr(year), IntToStr(week), weekStart.Format("2006-01-02"), weekEnd.Format("2006-01-02") | ||||
} | } | ||||
func IsTimeFormat(s string) bool { | |||||
// 正则表达式匹配HH:MM格式 | |||||
re := regexp.MustCompile(`^(\d{2}):(\d{2})$`) | |||||
return re.MatchString(s) | |||||
} |