|
@@ -9,6 +9,7 @@ import ( |
|
|
"applet/app/utils" |
|
|
"applet/app/utils" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
|
|
"encoding/json" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/syyongx/php2go" |
|
@@ -42,6 +43,7 @@ func List(c *gin.Context) { |
|
|
Bit: v.Bit, |
|
|
Bit: v.Bit, |
|
|
IsCombine: v.IsCombine, |
|
|
IsCombine: v.IsCombine, |
|
|
FinishAt: "--", |
|
|
FinishAt: "--", |
|
|
|
|
|
Platform: v.Platform, |
|
|
IsAuditing: utils.IntToStr(v.IsAuditing), |
|
|
IsAuditing: utils.IntToStr(v.IsAuditing), |
|
|
} |
|
|
} |
|
|
if v.ApplyAt > 0 { |
|
|
if v.ApplyAt > 0 { |
|
@@ -56,16 +58,29 @@ func List(c *gin.Context) { |
|
|
lastAndroid, _ := NewCloudBundleDb.GetCloudBundleLast("1") |
|
|
lastAndroid, _ := NewCloudBundleDb.GetCloudBundleLast("1") |
|
|
resp.LastBit = "64" |
|
|
resp.LastBit = "64" |
|
|
resp.LastIsCombine = "0" |
|
|
resp.LastIsCombine = "0" |
|
|
|
|
|
resp.LastPlatform = make([]string, 0) |
|
|
if lastAndroid != nil { |
|
|
if lastAndroid != nil { |
|
|
resp.LastAndroid = lastAndroid.Version |
|
|
resp.LastAndroid = lastAndroid.Version |
|
|
resp.LastBit = lastAndroid.Bit |
|
|
resp.LastBit = lastAndroid.Bit |
|
|
resp.LastIsCombine = lastAndroid.IsCombine |
|
|
resp.LastIsCombine = lastAndroid.IsCombine |
|
|
|
|
|
platform := make([]string, 0) |
|
|
|
|
|
json.Unmarshal([]byte(lastAndroid.NewPlatform), &platform) |
|
|
|
|
|
resp.LastPlatform = platform |
|
|
} |
|
|
} |
|
|
lastIos, _ := NewCloudBundleDb.GetCloudBundleLast("2") |
|
|
lastIos, _ := NewCloudBundleDb.GetCloudBundleLast("2") |
|
|
if lastIos != nil { |
|
|
if lastIos != nil { |
|
|
resp.ListIos = lastIos.Version |
|
|
resp.ListIos = lastIos.Version |
|
|
} |
|
|
} |
|
|
resp.List = noticeList |
|
|
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) |
|
|
e.OutSuc(c, resp, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -80,14 +95,18 @@ func Build(c *gin.Context) { |
|
|
e.OutErr(c, 400, e.NewErr(400, "版本已存在")) |
|
|
e.OutErr(c, 400, e.NewErr(400, "版本已存在")) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if req.Os == "2" { |
|
|
|
|
|
req.Platform = []string{"ios"} |
|
|
|
|
|
} |
|
|
tmp := model.CloudBundle{ |
|
|
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 调用打包机 |
|
|
//TODO 调用打包机 |
|
|
keys := "CloudBuild" |
|
|
keys := "CloudBuild" |
|
@@ -101,7 +120,7 @@ func Build(c *gin.Context) { |
|
|
masterKey = "dev" |
|
|
masterKey = "dev" |
|
|
domain = "http://ddstar.izhim.cn" |
|
|
domain = "http://ddstar.izhim.cn" |
|
|
} |
|
|
} |
|
|
url := "http://120.76.175.204:8080/job/" + keys + "/buildWithParameters?os=" + req.Os + "×tamp=" + 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 + "×tamp=" + utils.Int64ToStr(time.Now().Unix()) + "&token=" + token + "&branch=" + masterKey + "&domain=" + php2go.URLEncode(domain) |
|
|
tmp.Bit = strings.Join(req.Bit, ",") |
|
|
tmp.Bit = strings.Join(req.Bit, ",") |
|
|
if req.Os == "2" { |
|
|
if req.Os == "2" { |
|
|
db.Db.Insert(&tmp) |
|
|
db.Db.Insert(&tmp) |
|
@@ -110,21 +129,30 @@ func Build(c *gin.Context) { |
|
|
} else { |
|
|
} else { |
|
|
if req.IsCombine != "1" { |
|
|
if req.IsCombine != "1" { |
|
|
for _, v := range req.Bit { |
|
|
for _, v := range req.Bit { |
|
|
|
|
|
newUrl := url |
|
|
|
|
|
ids := make([]string, 0) |
|
|
for _, v1 := range req.Platform { |
|
|
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 { |
|
|
} else { |
|
|
|
|
|
ids := make([]string, 0) |
|
|
for _, v1 := range req.Platform { |
|
|
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) |
|
|
getcurl(url) |
|
|
} |
|
|
} |
|
|
|
|
|
url += "&bit=" + strings.Join(req.Bit, ",") + "&id=" + strings.Join(ids, ",") |
|
|
|
|
|
getcurl(url) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -132,6 +160,7 @@ func Build(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
func getcurl(url string) (string, error) { |
|
|
func getcurl(url string) (string, error) { |
|
|
|
|
|
return "", nil |
|
|
client := &http.Client{} |
|
|
client := &http.Client{} |
|
|
// 创建请求 |
|
|
// 创建请求 |
|
|
request, err := http.NewRequest("GET", url, nil) |
|
|
request, err := http.NewRequest("GET", url, nil) |
|
|