- GetServerInfo added.
This commit is contained in:
@@ -2,13 +2,57 @@ package cms
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
)
|
||||
|
||||
type MetaData struct {
|
||||
Units []string `json:"units"`
|
||||
SpecUnits []string `json:"specUnits"`
|
||||
|
||||
DeliveryRangeType map[int]string `json:"deliveryRangeType"`
|
||||
DeliveryType map[int]string `json:"deliveryType"`
|
||||
StoreStatus map[int]string `json:"storeStatus"`
|
||||
CategoryType map[int]string `json:"categoryType"`
|
||||
SkuStatus map[int]string `json:"skuStatus"`
|
||||
VendorName map[int]string `json:"vendorName"`
|
||||
}
|
||||
|
||||
type ServerInfo struct {
|
||||
Version string `json:"version"`
|
||||
BuildDate string `json:"buildDate"`
|
||||
GitCommit string `json:"gitCommit"`
|
||||
MetaData MetaData `json:"metaData"`
|
||||
}
|
||||
|
||||
var (
|
||||
CurVendorSync VendorSync
|
||||
serverInfo *ServerInfo
|
||||
)
|
||||
|
||||
func InitServerInfo(version, buildDate, gitCommit string) {
|
||||
serverInfo = &ServerInfo{
|
||||
Version: version,
|
||||
BuildDate: buildDate,
|
||||
GitCommit: gitCommit,
|
||||
MetaData: MetaData{
|
||||
Units: model.UnitNames,
|
||||
SpecUnits: model.SpecUnitNames,
|
||||
|
||||
DeliveryRangeType: model.DeliveryTypeName,
|
||||
DeliveryType: model.DeliveryTypeName,
|
||||
StoreStatus: model.SkuStatusName,
|
||||
CategoryType: model.CategoryTypeName,
|
||||
SkuStatus: model.SkuStatusName,
|
||||
VendorName: model.VendorChineseNames,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func GetPurchaseHandler(vendorID int) partner.IPurchasePlatformHandler {
|
||||
return basesch.FixedBaseScheduler.GetPurchasePlatformFromVendorID(vendorID)
|
||||
}
|
||||
|
||||
func GetServerInfo() *ServerInfo {
|
||||
return serverInfo
|
||||
}
|
||||
|
||||
@@ -35,13 +35,6 @@ func GetVendorCategories(vendorID int, parentID int) (vendorCats []*model.SkuVen
|
||||
return vendorCats, dao.GetEntities(nil, &vendorCats, cond, false)
|
||||
}
|
||||
|
||||
func GetSkuMetaInfo() (*model.SkuMetaInfo, error) {
|
||||
return &model.SkuMetaInfo{
|
||||
Units: model.UnitNames,
|
||||
SpecUnits: model.SpecUnitNames,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// parentID 为-1表示所有
|
||||
func GetCategories(parentID int) (cats []*model.SkuCategory, err error) {
|
||||
if parentID == -1 {
|
||||
@@ -196,7 +189,7 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
|
||||
if params["toStatus"] != nil {
|
||||
toStatus = params["toStatus"].(int)
|
||||
}
|
||||
sql += " AND t1.status >= ? AND t1.status <= ?"
|
||||
sql += " AND t2.status >= ? AND t2.status <= ?"
|
||||
sqlParams = append(sqlParams, fromStatus, toStatus)
|
||||
}
|
||||
sql += `
|
||||
@@ -210,7 +203,6 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
|
||||
t1.comment,
|
||||
t1.brand_id,
|
||||
t1.category_id,
|
||||
t1.status,
|
||||
t1.is_global,
|
||||
t1.unit,
|
||||
t1.price,
|
||||
@@ -229,13 +221,12 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
|
||||
t1.comment,
|
||||
t1.brand_id,
|
||||
t1.category_id,
|
||||
t1.status,
|
||||
t1.is_global,
|
||||
t1.unit,
|
||||
t1.price,
|
||||
t1.img,
|
||||
t1.elm_img_hash_code,
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"createdAt":"', CONCAT(REPLACE(t2.created_at," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(t2.updated_at," ","T"),"+08:00"), '","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight, ',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, "}")), "]") skus_str
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"status":', t2.status, ',"createdAt":"', CONCAT(REPLACE(t2.created_at," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(t2.updated_at," ","T"),"+08:00"), '","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight, ',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, "}")), "]") skus_str
|
||||
` + sql + `
|
||||
ORDER BY t1.id
|
||||
LIMIT ? OFFSET ?`
|
||||
|
||||
Reference in New Issue
Block a user