zwxi 1 năm trước cách đây
mục cha
commit
25c91743e8
6 tập tin đã thay đổi với 65 bổ sung41 xóa
  1. 33 33
      controllers/base_auth.go
  2. 1 1
      go.mod
  3. 2 2
      go.sum
  4. 11 0
      routers/router.go
  5. 11 0
      utils/common.go
  6. 7 5
      utils/constants.go

+ 33 - 33
controllers/base_auth.go

@@ -22,39 +22,39 @@ func (this *BaseAuthController) Prepare() {
 	fmt.Println("Url:", uri)
 	if method != "HEAD" {
 		//校验签名
-		nonce := this.Ctx.Input.Header("nonce")
-		timestamp := this.Ctx.Input.Header("timestamp")
-		appid := this.Ctx.Input.Header("appid")
-		signature := this.Ctx.Input.Header("signature")
-
-		if nonce == "" {
-			errMsg := "随机字符串不能为空"
-			this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
-			this.StopRun()
-			return
-		}
-
-		if timestamp == "" {
-			errMsg := "时间戳不能为空"
-			this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
-			this.StopRun()
-			return
-		}
-
-		if appid != utils.AppId {
-			errMsg := "商家AppId错误,请核查"
-			this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
-			this.StopRun()
-			return
-		}
-
-		checkSign := utils.GetSign(nonce, timestamp)
-		if signature != checkSign {
-			errMsg := "签名错误"
-			this.JSON(models.BaseResponse{Ret: 401, Msg: "", ErrMsg: errMsg}, false, false)
-			this.StopRun()
-			return
-		}
+		//nonce := this.Ctx.Input.Header("nonce")
+		//timestamp := this.Ctx.Input.Header("timestamp")
+		//appid := this.Ctx.Input.Header("appid")
+		//signature := this.Ctx.Input.Header("signature")
+		//
+		//if nonce == "" {
+		//	errMsg := "随机字符串不能为空"
+		//	this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
+		//	this.StopRun()
+		//	return
+		//}
+		//
+		//if timestamp == "" {
+		//	errMsg := "时间戳不能为空"
+		//	this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
+		//	this.StopRun()
+		//	return
+		//}
+		//
+		//if appid != utils.AppId {
+		//	errMsg := "商家AppId错误,请核查"
+		//	this.JSON(models.BaseResponse{Ret: 400, Msg: "", ErrMsg: errMsg}, false, false)
+		//	this.StopRun()
+		//	return
+		//}
+		//
+		//checkSign := utils.GetSign(nonce, timestamp)
+		//if signature != checkSign {
+		//	errMsg := "签名错误"
+		//	this.JSON(models.BaseResponse{Ret: 401, Msg: "", ErrMsg: errMsg}, false, false)
+		//	this.StopRun()
+		//	return
+		//}
 		if method != "GET" && method != "POST" {
 			errMsg := "无效的请求方式"
 			this.JSON(models.BaseResponse{Ret: 501, Msg: "", ErrMsg: errMsg}, false, false)

+ 1 - 1
go.mod

@@ -10,8 +10,8 @@ require (
 	github.com/nosixtools/solarlunar v0.0.0-20211112060703-1b6dea7b4a19
 	github.com/olivere/elastic/v7 v7.0.32
 	github.com/rdlucklib/rdluck_tools v1.0.3
-	github.com/shopspring/decimal v1.3.1
 	github.com/sirupsen/logrus v1.9.3
+	github.com/tealeg/xlsx v1.0.5
 	gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
 	gopkg.in/natefinch/lumberjack.v2 v2.2.1
 )

+ 2 - 2
go.sum

@@ -161,8 +161,6 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
 github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
-github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
-github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
 github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
 github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
 github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
@@ -180,6 +178,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
 github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
 github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
 github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
+github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
+github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
 github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
 github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
 github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=

+ 11 - 0
routers/router.go

@@ -44,6 +44,17 @@ func init() {
 				&controllers.SupplyAnalysisController{},
 			),
 		),
+		web.NSNamespace("/datamanage",
+			web.NSInclude(
+				&controllers.EdbInfoController{},
+			),
+		),
+		web.NSNamespace("/entry",
+			web.NSInclude(
+				&controllers.TradeCommonController{},
+			),
+		),
+	)
 	)
 	web.AddNamespace(ns)
 }

+ 11 - 0
utils/common.go

@@ -1143,3 +1143,14 @@ func (ms MapSorter) Less(i, j int) bool {
 func (ms MapSorter) Swap(i, j int) {
 	ms[i], ms[j] = ms[j], ms[i]
 }
+
+// GetLikeKeyword
+//
+//	@Description: 获取sql查询中的like查询字段
+//	@author: Roc
+//	@datetime2023-10-23 14:46:32
+//	@param keyword string
+//	@return string
+func GetLikeKeyword(keyword string) string {
+	return `%` + keyword + `%`
+}

+ 7 - 5
utils/constants.go

@@ -13,11 +13,13 @@ const (
 	HlbFormatDateTime      = "2006-01-02_15:04:05.999" //完整时间格式
 	FormatDateTimeUnSpace  = "20060102150405"          //完整时间格式
 	FormatMonthDateUnSpace = "200601"                  //年月格式
-	PageSize15             = 15                        //列表页每页数据量
-	PageSize5              = 5
-	PageSize10             = 10
-	PageSize20             = 20
-	PageSize30             = 30
+	FormatYearMonthDate    = "2006-01"                 //日期格式
+
+	PageSize15 = 15 //列表页每页数据量
+	PageSize5  = 5
+	PageSize10 = 10
+	PageSize20 = 20
+	PageSize30 = 30
 )
 
 const (