From fb14155afd714744fff6aba36bb3b00fd4dabbca Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 7 Nov 2024 20:10:55 +0800 Subject: [PATCH] update --- .../public_platoon/hdl_basic.go | 36 ++++++++++++++++--- go.mod | 26 ++++++++------ 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index efb3e12..5a1e277 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -7,6 +7,7 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "github.com/gin-gonic/gin" + "time" ) // GetPublicPlatoonBasic @@ -21,11 +22,31 @@ import ( // @Router /api/publicPlatoon/getBasic [get] func GetPublicPlatoonBasic(c *gin.Context) { publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) - publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOneByParams(nil) + publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOne() if err != nil { e.OutErr(c, e.ERR_DB_ORM, err) return } + now := time.Now() + if publicPlatoonBasic == nil { + publicPlatoonBasic = &model.PublicPlatoonBasicSetting{ + IsOpen: 1, + OriginatorUid: 0, + SeveralTimes: 0, + SeveralRows: 0, + SystemPunishReplace: 0, + SystemPunishReplaceValue: 0, + IsSelfActiveGetTeamRevenue: 0, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + } + _, err1 := publicPlatoonBasicDb.PublicPlatoonBasicSettingInsert(publicPlatoonBasic) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + + } var resp public_platoon.GetPublicPlatoonBasicResp resp = public_platoon.GetPublicPlatoonBasicResp{ @@ -59,8 +80,16 @@ func UpdatePublicPlatoonBasic(c *gin.Context) { return } + publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) + + publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOne() + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err) + return + } + setting := &model.PublicPlatoonBasicSetting{ - Id: 1, + Id: publicPlatoonBasic.Id, IsOpen: req.IsOpen, OriginatorUid: req.OriginatorUid, SeveralTimes: req.SeveralTimes, @@ -72,8 +101,7 @@ func UpdatePublicPlatoonBasic(c *gin.Context) { UpdateAt: "", } - publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) - updateAffected, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(1, setting, "") + updateAffected, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(publicPlatoonBasic.Id, setting, "") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err) return diff --git a/go.mod b/go.mod index a9a8b99..eb6ea65 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( filippo.io/edwards25519 v1.1.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/goquery v1.9.2 // indirect - github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/purell v1.2.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect github.com/antchfx/htmlquery v1.3.3 // indirect @@ -54,12 +54,13 @@ require ( github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.19.6 // indirect - github.com/go-openapi/spec v0.20.4 // indirect - github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -83,7 +84,9 @@ require ( github.com/onsi/gomega v1.19.0 // indirect github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/streadway/amqp v1.0.0 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/temoto/robotstxt v1.1.2 // indirect @@ -91,21 +94,24 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + github.com/urfave/cli/v2 v2.27.5 // indirect + github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.4.0 // indirect google.golang.org/protobuf v1.34.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.0.1-2020.1.4 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect xorm.io/builder v0.3.13 // indirect )