shenjiachi пре 1 дан
родитељ
комит
66e2e4ae5d
3 измењених фајлова са 38 додато и 9 уклоњено
  1. +22
    -0
      app/hdl/financial_center/hdl_withdraw.go
  2. +9
    -9
      app/router/router.go
  3. +7
    -0
      app/utils/time.go

+ 22
- 0
app/hdl/financial_center/hdl_withdraw.go Прегледај датотеку

@@ -9,6 +9,7 @@ import (
"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/rule/egg_energy/md"
"errors"
"github.com/gin-gonic/gin"
"strings"
"time"
@@ -148,6 +149,27 @@ func UpdateWithdrawSetting(c *gin.Context) {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
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)
withdrawFeeSetStr := utils.SerializeStr(req.WithdrawFeeSet)
firstWithdrawSetStr := utils.SerializeStr(req.FirstWithdrawSet)


+ 9
- 9
app/router/router.go Прегледај датотеку

@@ -341,21 +341,21 @@ func rFinancialCenter(r *gin.RouterGroup) {
func rFriendCircleSettings(r *gin.RouterGroup) {
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.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.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) // 发布动态
}
}



+ 7
- 0
app/utils/time.go Прегледај датотеку

@@ -3,6 +3,7 @@ package utils
import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"
"time"
@@ -240,3 +241,9 @@ func GetWeekInfo(dateStr string) (string, string, string, string) {
weekEnd := weekStart.AddDate(0, 0, 6)
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)
}

Loading…
Откажи
Сачувај