diff --git a/Jenkinsfile b/Jenkinsfile index 9c22562..e51a268 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,46 +7,10 @@ pipeline { script { try { echo 'Start Build' - sh 'docker compose -f docker-compose.yaml down' - sh 'docker compose -f docker-compose.yaml up -d --build' - echo 'Build success' - } catch (err) { - echo err.getMessage() - } - } - } - post { // 添加post指令处理阶段完成后的情况 - failure { - echo 'Build failed, but continuing to the next stage...' - } - } - } - stage('Build Image With rabbit') { - agent { label '流氓兔' } // 在标签为'linux-build'的节点上执行 - steps { - script { - try { - echo 'Start Build' - sh 'docker compose -f docker-compose.yaml up -d --build' - echo 'Build success' - } catch (err) { - echo err.getMessage() - } - } - } - post { // 添加post指令处理阶段完成后的情况 - failure { - echo 'Build failed, but continuing to the next stage...' - } - } - } - stage('Build Image With L') { - agent { label 'L' } // 在标签为'linux-build'的节点上执行 - steps { - script { - try { - echo 'Start Build' + sh "docker ps -a --format '{{.ID}} {{.Names}}' | awk '{if (\$2 !~ /^1Panel-jenkins/) print \$1}' | xargs -r docker stop" sh 'docker compose -f docker-compose.yaml up -d --build' + sh 'docker start \$(docker ps -a -q)' + sh "docker restart \$(docker ps -a | grep kami_ | awk '{print \$1}')" echo 'Build success' } catch (err) { echo err.getMessage() diff --git a/Jenkinsfile.bak b/Jenkinsfile.bak new file mode 100644 index 0000000..7dd877e --- /dev/null +++ b/Jenkinsfile.bak @@ -0,0 +1,63 @@ +pipeline { + agent none + stages { + stage('Build Image With localhost') { + agent { label 'LocalHost' } // 在标签为'linux-build'的节点上执行 + steps { + script { + try { + echo 'Start Build' + sh 'docker stop $(docker ps -q --filter "status=running" --filter "name!=jenkins*")' + sh 'docker compose -f docker-compose.yaml up -d --build' + echo 'Build success' + } catch (err) { + echo err.getMessage() + } + } + } + post { // 添加post指令处理阶段完成后的情况 + failure { + echo 'Build failed, but continuing to the next stage...' + } + } + } + stage('Build Image With rabbit') { + agent { label '流氓兔' } // 在标签为'linux-build'的节点上执行 + steps { + script { + try { + echo 'Start Build' + sh 'docker compose -f docker-compose.yaml up -d --build' + echo 'Build success' + } catch (err) { + echo err.getMessage() + } + } + } + post { // 添加post指令处理阶段完成后的情况 + failure { + echo 'Build failed, but continuing to the next stage...' + } + } + } + stage('Build Image With L') { + agent { label 'L' } // 在标签为'linux-build'的节点上执行 + steps { + script { + try { + echo 'Start Build' + sh 'docker compose -f docker-compose.yaml up -d --build' + echo 'Build success' + } catch (err) { + echo err.getMessage() + } + } + } + post { // 添加post指令处理阶段完成后的情况 + failure { + echo 'Build failed, but continuing to the next stage...' + } + } + } + } +} \ No newline at end of file diff --git a/controllers/user_info.go b/controllers/user_info.go index bd637fd..04f103a 100644 --- a/controllers/user_info.go +++ b/controllers/user_info.go @@ -266,7 +266,6 @@ func (c *UserInfo) QueryAllowedMM() { _ = c.ServeJSON() return } - us := c.GetSession(enum.UserSession) u := us.(merchant.MerchantInfo) if u.Id == 0 { @@ -278,12 +277,31 @@ func (c *UserInfo) QueryAllowedMM() { return } result := service.QueryAllowedDeployInfoMM(u.MerchantUid, roadPool.RoadUid) + returnList := make([]struct { + ShowLabel float64 `json:"showLabel"` + }, 0) + for _, margin := range result { + isInList := false + for _, s := range returnList { + if s.ShowLabel == margin.ShowLabel { + // 存在 + isInList = true + } + } + if !isInList { + returnList = append(returnList, struct { + ShowLabel float64 `json:"showLabel"` + }{ + ShowLabel: margin.ShowLabel, + }) + } + } c.Data["json"] = response.CommonResWithData{ CommonRes: response.CommonRes{ Msg: "成功", Code: 0, }, - Data: result, + Data: returnList, } _ = c.ServeJSON() }