更新
This commit is contained in:
20
cmd/make.go
20
cmd/make.go
@@ -62,16 +62,19 @@ func (c *cMake) Api() {
|
||||
func (c *cMake) Act(id int) (err error) {
|
||||
filePath := fmt.Sprintf("api/act/v1/act%v.go", id)
|
||||
//生成文件不覆盖
|
||||
if gfile.Exists(filePath) {
|
||||
return
|
||||
}
|
||||
if !gfile.Exists(filePath) {
|
||||
err = gfile.PutContents(filePath, "package v1\n")
|
||||
}
|
||||
|
||||
filePath = fmt.Sprintf("internal/game/act/act%d/act%d.go", id, id)
|
||||
//生成文件不覆盖
|
||||
if !gfile.Exists(filePath) {
|
||||
//fileStr := gfile.GetContents(getFilePath)
|
||||
get, err := fs.ReadFile(ConfigFiles, "make/act")
|
||||
get, _ := fs.ReadFile(ConfigFiles, "make/act")
|
||||
fileStr := string(get)
|
||||
fileStr = gstr.Replace(fileStr, "{id}", gconv.String(id))
|
||||
err = gfile.PutContents(filePath, fileStr)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -79,15 +82,14 @@ func (c *cMake) Act(id int) (err error) {
|
||||
func (c *cMake) Logic(name string) (err error) {
|
||||
var filePath = fmt.Sprintf("internal/logic/%s/%s.go", name, name)
|
||||
//生成文件不覆盖
|
||||
if gfile.Exists(filePath) {
|
||||
return
|
||||
}
|
||||
if !gfile.Exists(filePath) {
|
||||
//fileStr := gfile.GetContents("./make/logic")
|
||||
get, err := fs.ReadFile(ConfigFiles, "make/act")
|
||||
get, _ := fs.ReadFile(ConfigFiles, "make/act")
|
||||
fileStr := string(get)
|
||||
fileStr = gstr.Replace(fileStr, "{package}", name)
|
||||
fileStr = gstr.Replace(fileStr, "{name}", gstr.CaseCamel(name))
|
||||
|
||||
err = gfile.PutContents(filePath, fileStr)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user