Finish the first step of i18n.

This commit is contained in:
zicla
2019-05-04 19:20:09 +08:00
parent 2b687331b5
commit 900924d196
19 changed files with 270 additions and 209 deletions

View File

@ -2,6 +2,7 @@ package result
import (
"fmt"
"github.com/eyebluecn/tank/code/tool/i18n"
"net/http"
)
@ -101,7 +102,11 @@ func CustomWebResult(codeWrapper *CodeWrapper, description string) *WebResult {
return wr
}
//请求参数有问题
func BadRequestI18n(request *http.Request, item *i18n.Item, v ...interface{}) *WebResult {
return CustomWebResult(BAD_REQUEST, fmt.Sprintf(item.Message(request), v...))
}
//没有权限
func BadRequest(format string, v ...interface{}) *WebResult {
return CustomWebResult(BAD_REQUEST, fmt.Sprintf(format, v...))
}