瀏覽代碼

云打包

master
huangjiajun 11 小時之前
父節點
當前提交
89520d4a7f
共有 3 個文件被更改,包括 59 次插入23 次删除
  1. +13
    -6
      app/md/md_cloud_bundle.go
  2. +45
    -16
      app/svc/cloud_bundle/svc_list.go
  3. +1
    -1
      go.mod

+ 13
- 6
app/md/md_cloud_bundle.go 查看文件

@@ -5,12 +5,14 @@ type CloudBundleReq struct {
Limit string `json:"limit,required"` // 每页大小
}
type CloudBundleResp struct {
Total int64 `json:"total"`
List []CloudBundleList `json:"list"`
LastBit string `json:"last_bit"`
LastIsCombine string `json:"last_is_combine"`
LastAndroid string `json:"last_android"`
ListIos string `json:"list_ios"`
Total int64 `json:"total"`
List []CloudBundleList `json:"list"`
LastBit string `json:"last_bit"`
LastPlatform []string `json:"last_platform"`
LastIsCombine string `json:"last_is_combine"`
LastAndroid string `json:"last_android"`
ListIos string `json:"list_ios"`
SelectData []CloudBundleVersionMap `json:"select_data"`
}
type CloudBundleList struct {
Id string `json:"id"`
@@ -25,6 +27,7 @@ type CloudBundleList struct {
FinishAt string `json:"finish_at"`
IsCombine string `json:"is_combine"`
IsAuditing string `json:"is_auditing"`
Platform string `json:"platform"`
}
type CloudBundleBuildReq struct {
Memo string `json:"memo"`
@@ -83,6 +86,10 @@ type CloudBundleVersion struct {
Content string `json:"content"`
IsMust string `json:"is_must"`
}
type CloudBundleVersionMap struct {
Type string `json:"type"`
Name string `json:"name"`
}
type CloudBundleVersionResp struct {
Version []CloudBundleVersion `json:"version"`
}

+ 45
- 16
app/svc/cloud_bundle/svc_list.go 查看文件

@@ -9,6 +9,7 @@ import (
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/syyongx/php2go"
@@ -42,6 +43,7 @@ func List(c *gin.Context) {
Bit: v.Bit,
IsCombine: v.IsCombine,
FinishAt: "--",
Platform: v.Platform,
IsAuditing: utils.IntToStr(v.IsAuditing),
}
if v.ApplyAt > 0 {
@@ -56,16 +58,29 @@ func List(c *gin.Context) {
lastAndroid, _ := NewCloudBundleDb.GetCloudBundleLast("1")
resp.LastBit = "64"
resp.LastIsCombine = "0"
resp.LastPlatform = make([]string, 0)
if lastAndroid != nil {
resp.LastAndroid = lastAndroid.Version
resp.LastBit = lastAndroid.Bit
resp.LastIsCombine = lastAndroid.IsCombine
platform := make([]string, 0)
json.Unmarshal([]byte(lastAndroid.NewPlatform), &platform)
resp.LastPlatform = platform
}
lastIos, _ := NewCloudBundleDb.GetCloudBundleLast("2")
if lastIos != nil {
resp.ListIos = lastIos.Version
}
resp.List = noticeList
resp.SelectData = []md.CloudBundleVersionMap{
{Type: "station", Name: "本站"},
{Type: "yingyongbao", Name: "应用宝"},
{Type: "huawei", Name: "华为"},
{Type: "xiaomi", Name: "小米"},
{Type: "meizu", Name: "魅族"},
{Type: "vivo", Name: "VIVO"},
{Type: "oppo", Name: "OPPO"},
}
e.OutSuc(c, resp, nil)
return
}
@@ -80,14 +95,18 @@ func Build(c *gin.Context) {
e.OutErr(c, 400, e.NewErr(400, "版本已存在"))
return
}
if req.Os == "2" {
req.Platform = []string{"ios"}
}
tmp := model.CloudBundle{
Os: utils.StrToInt(req.Os),
Version: req.Version,
ApplyAt: int(time.Now().Unix()),
Memo: req.Memo,
AppletId: 0,
IsCombine: req.IsCombine,
NewBit: strings.Join(req.Bit, ","),
Os: utils.StrToInt(req.Os),
Version: req.Version,
ApplyAt: int(time.Now().Unix()),
Memo: req.Memo,
AppletId: 0,
NewPlatform: strings.Join(req.Platform, ","),
IsCombine: req.IsCombine,
NewBit: strings.Join(req.Bit, ","),
}
//TODO 调用打包机
keys := "CloudBuild"
@@ -101,7 +120,7 @@ func Build(c *gin.Context) {
masterKey = "dev"
domain = "http://ddstar.izhim.cn"
}
url := "http://120.76.175.204:8080/job/" + keys + "/buildWithParameters?os=" + req.Os + "&timestamp=" + utils.Int64ToStr(time.Now().Unix()) + "&token=" + token + "&branch=" + masterKey + "&domain=" + php2go.URLEncode(domain)
url := "http://120.76.175.204:8080/job/" + keys + "/buildWithParameters?platform=" + tmp.NewPlatform + "&os=" + req.Os + "&timestamp=" + utils.Int64ToStr(time.Now().Unix()) + "&token=" + token + "&branch=" + masterKey + "&domain=" + php2go.URLEncode(domain)
tmp.Bit = strings.Join(req.Bit, ",")
if req.Os == "2" {
db.Db.Insert(&tmp)
@@ -110,21 +129,30 @@ func Build(c *gin.Context) {
} else {
if req.IsCombine != "1" {
for _, v := range req.Bit {
newUrl := url
ids := make([]string, 0)
for _, v1 := range req.Platform {
tmp.Bit = v
tmp.Platform = v1
db.Db.Insert(&tmp)
url += "&id=" + utils.IntToStr(tmp.Id)
getcurl(url)
tmp1 := tmp
tmp1.Bit = v
tmp1.Platform = v1
db.Db.Insert(&tmp1)
ids = append(ids, utils.IntToStr(tmp1.Id))
}
newUrl += "&bit=" + v + "&id=" + strings.Join(ids, ",")
getcurl(newUrl)
}

} else {
ids := make([]string, 0)
for _, v1 := range req.Platform {
tmp.Platform = v1
db.Db.Insert(&tmp)
url += "&id=" + utils.IntToStr(tmp.Id)
tmp1 := tmp
tmp1.Platform = v1
db.Db.Insert(&tmp1)
url += "&id=" + utils.IntToStr(tmp1.Id)
getcurl(url)
}
url += "&bit=" + strings.Join(req.Bit, ",") + "&id=" + strings.Join(ids, ",")
getcurl(url)
}
}

@@ -132,6 +160,7 @@ func Build(c *gin.Context) {
return
}
func getcurl(url string) (string, error) {
return "", nil
client := &http.Client{}
// 创建请求
request, err := http.NewRequest("GET", url, nil)


+ 1
- 1
go.mod 查看文件

@@ -33,7 +33,7 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241128030209-743f36ef9dad
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241128084936-6c2fce34f497
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241127101803-8cd39f7b84b2
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5


Loading…
取消
儲存