- add jxcontext.Context to all public API.

This commit is contained in:
gazebo
2018-10-21 22:41:11 +08:00
parent 5d2bf9a510
commit b51ceb3d1d
22 changed files with 228 additions and 200 deletions

View File

@@ -6,6 +6,7 @@ import (
"strconv"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
@@ -44,11 +45,11 @@ func InitServiceInfo(version, buildDate, gitCommit string) {
Init()
}
func GetServiceInfo() interface{} {
func GetServiceInfo(ctx *jxcontext.Context) interface{} {
return serviceInfo
}
func GetQiniuUploadToken(suffix string) (upTokenInfo map[string]interface{}, err error) {
func GetQiniuUploadToken(ctx *jxcontext.Context, suffix string) (upTokenInfo map[string]interface{}, err error) {
putPolicy := storage.PutPolicy{
Scope: globals.QiniuBucket,
Expires: qiniuTokenExpires,
@@ -61,7 +62,7 @@ func GetQiniuUploadToken(suffix string) (upTokenInfo map[string]interface{}, err
return upTokenInfo, err
}
func GetPlaces(keyword string, includeDisabled bool, params map[string]interface{}) ([]*model.Place, error) {
func GetPlaces(ctx *jxcontext.Context, keyword string, includeDisabled bool, params map[string]interface{}) ([]*model.Place, error) {
sql := `
SELECT *
FROM place t1
@@ -94,7 +95,7 @@ func GetPlaces(keyword string, includeDisabled bool, params map[string]interface
return places, dao.GetRows(nil, &places, sql, sqlParams)
}
func UpdatePlaces(places []map[string]interface{}, userName string) (num int64, err error) {
func UpdatePlaces(ctx *jxcontext.Context, places []map[string]interface{}, userName string) (num int64, err error) {
if len(places) == 0 {
return 0, ErrMissingInput
}
@@ -111,9 +112,9 @@ func UpdatePlaces(places []map[string]interface{}, userName string) (num int64,
return num, err
}
func UpdatePlace(placeCode int, payload map[string]interface{}, userName string) (num int64, err error) {
func UpdatePlace(ctx *jxcontext.Context, placeCode int, payload map[string]interface{}, userName string) (num int64, err error) {
payload["code"] = placeCode
return UpdatePlaces([]map[string]interface{}{payload}, userName)
return UpdatePlaces(ctx, []map[string]interface{}{payload}, userName)
}
/////