perf: replace package name
This commit is contained in:
@@ -5,7 +5,8 @@ import (
|
|||||||
"crm/global"
|
"crm/global"
|
||||||
"crm/models"
|
"crm/models"
|
||||||
"crm/response"
|
"crm/response"
|
||||||
"io/ioutil"
|
"os"
|
||||||
|
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -52,7 +53,7 @@ func InitData() int {
|
|||||||
env := global.Config.Server.Runenv
|
env := global.Config.Server.Runenv
|
||||||
if env == Prod {
|
if env == Prod {
|
||||||
fn := "/home/ubuntu/crmapi/crm.sql"
|
fn := "/home/ubuntu/crmapi/crm.sql"
|
||||||
sql, err := ioutil.ReadFile(fn)
|
sql, err := os.ReadFile(fn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] read file %s error: %s", fn, err)
|
log.Printf("[ERROR] read file %s error: %s", fn, err)
|
||||||
return response.ErrCodeInitDataFailed
|
return response.ErrCodeInitDataFailed
|
||||||
@@ -60,7 +61,7 @@ func InitData() int {
|
|||||||
sqls := strings.Split(string(sql), ";")
|
sqls := strings.Split(string(sql), ";")
|
||||||
for _, sql := range sqls {
|
for _, sql := range sqls {
|
||||||
s := strings.TrimSpace(sql)
|
s := strings.TrimSpace(sql)
|
||||||
if s == "" {
|
if s == StringNull {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := global.Db.Exec(s).Error; err != nil {
|
if err := global.Db.Exec(s).Error; err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user