更新
This commit is contained in:
@@ -43,6 +43,8 @@ package v1
|
||||
|
||||
import (
|
||||
{{- if .HasImport}}
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
{{- end}}
|
||||
{{- if .NeedGtime}}
|
||||
@@ -182,6 +184,15 @@ type {{.ModelClass}}ImportRes struct {
|
||||
Failed int `json:"failed"` // 失败数
|
||||
Reasons []string `json:"reasons"` // 失败原因列表
|
||||
}
|
||||
|
||||
// ResMsg 导入结果提示语(response.MsgProvider,前端成功通道直接弹出):
|
||||
// 无失败行时"成功导入 X 条数据",有失败行时"成功导入 X 条,失败 Y 条"
|
||||
func (r *{{.ModelClass}}ImportRes) ResMsg() string {
|
||||
if r.Failed > 0 {
|
||||
return fmt.Sprintf("成功导入 %d 条,失败 %d 条", r.Success, r.Failed)
|
||||
}
|
||||
return fmt.Sprintf("成功导入 %d 条数据", r.Success)
|
||||
}
|
||||
{{- end}}
|
||||
{{- if .HasExport}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user