mirror of
https://gitlab.52pay.top/go/easygoadmin.git
synced 2025-09-26 22:58:01 +08:00
feat: 初始化项目
初始化项目
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
package controller
|
||||
|
||||
/*
|
||||
import (
|
||||
"easygoadmin/app/dto"
|
||||
"easygoadmin/app/service"
|
||||
@@ -101,3 +102,6 @@ func (c *customerCtl) RechargeRefund(ctx *gin.Context) {
|
||||
Msg: "退款成功",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
@@ -13,7 +13,6 @@ import (
|
||||
"easygoadmin/app/vo"
|
||||
"easygoadmin/utils"
|
||||
"easygoadmin/utils/common"
|
||||
"easygoadmin/utils/gconv"
|
||||
"easygoadmin/utils/response"
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -32,12 +31,12 @@ func (c *indexCtl) None(ctx *gin.Context) {
|
||||
ctx.String(http.StatusOK, "")
|
||||
return
|
||||
}
|
||||
res := service.PbShortLink.GetInfoById(ctx, gconv.Int64(id))
|
||||
if res.Id == 0 || res.Url == "" {
|
||||
ctx.String(http.StatusOK, "")
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusTemporaryRedirect, res.Url)
|
||||
//res := service.PbShortLink.GetInfoById(ctx, gconv.Int64(id))
|
||||
//if res.Id == 0 || res.Url == "" {
|
||||
// ctx.String(http.StatusOK, "")
|
||||
// return
|
||||
//}
|
||||
//ctx.Redirect(http.StatusTemporaryRedirect, res.Url)
|
||||
return
|
||||
|
||||
}
|
||||
|
@@ -2,12 +2,15 @@ package model
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"easygoadmin/utils"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LocalTime time.Time
|
||||
|
||||
const localDateTimeFormat = utils.LocalDateTimeFormat
|
||||
|
||||
func (l LocalTime) MarshalJSON() ([]byte, error) {
|
||||
b := make([]byte, 0, len(localDateTimeFormat)+2)
|
||||
b = append(b, '"')
|
||||
|
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
package service
|
||||
|
||||
/*
|
||||
import (
|
||||
"easygoadmin/app/dto"
|
||||
"easygoadmin/app/model"
|
||||
@@ -162,3 +163,5 @@ func (s *customerService) RechargeRefund(req *dto.CustomerCouponRefundReq, workI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
4
main.go
4
main.go
@@ -17,8 +17,8 @@ import (
|
||||
func main() {
|
||||
|
||||
// 开始调试模式
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
//gin.SetMode(gin.ReleaseMode)
|
||||
gin.SetMode("debug")
|
||||
// 实例化配置
|
||||
config := cfg.Instance()
|
||||
if config == nil {
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
//gin.SetMode(gin.ReleaseMode)
|
||||
//gin.SetMode(gin.DebugMode)
|
||||
//fmt.Println("路由已加载")
|
||||
// 初始化
|
||||
|
@@ -8,20 +8,20 @@ package utils
|
||||
|
||||
import "time"
|
||||
|
||||
const localDateTimeFormat string = "2006-01-02 15:04:05"
|
||||
const LocalDateTimeFormat string = "2006-01-02 15:04:05"
|
||||
|
||||
type LocalTime time.Time
|
||||
|
||||
func (l LocalTime) MarshalJSON() ([]byte, error) {
|
||||
b := make([]byte, 0, len(localDateTimeFormat)+2)
|
||||
b := make([]byte, 0, len(LocalDateTimeFormat)+2)
|
||||
b = append(b, '"')
|
||||
b = time.Time(l).AppendFormat(b, localDateTimeFormat)
|
||||
b = time.Time(l).AppendFormat(b, LocalDateTimeFormat)
|
||||
b = append(b, '"')
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (l *LocalTime) UnmarshalJSON(b []byte) error {
|
||||
now, err := time.ParseInLocation(`"`+localDateTimeFormat+`"`, string(b), time.Local)
|
||||
now, err := time.ParseInLocation(`"`+LocalDateTimeFormat+`"`, string(b), time.Local)
|
||||
*l = LocalTime(now)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user