initdata
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,66 +68,6 @@ func InitPlace(ctx *jxcontext.Context) (err error) {
|
|||||||
if err = insertPlace(ctx, db, nil, placeList); err != nil {
|
if err = insertPlace(ctx, db, nil, placeList); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
updateSqls := []string{
|
|
||||||
`
|
|
||||||
UPDATE place t1
|
|
||||||
JOIN jde_city t2 ON t1.code = t2.col_tencentAddressCode
|
|
||||||
SET t1.jd_code = t2.col_areaCode;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE place t1
|
|
||||||
JOIN place t2 ON t1.parent_code = t2.code AND t2.jd_code != 0
|
|
||||||
JOIN jde_district t3 ON t1.name = t3.col_areaName AND t2.jd_code = t3.col_cityCode
|
|
||||||
SET t1.jd_code = t3.col_areaCode
|
|
||||||
WHERE t1.level = 3;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE
|
|
||||||
place t1
|
|
||||||
JOIN ebde_places t2 ON t1.name = t2.col_city_name
|
|
||||||
SET t1.ebai_code = t2.col_city_id
|
|
||||||
WHERE t1.level = 1 OR t1.level = 2;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE
|
|
||||||
place t1
|
|
||||||
JOIN place t1p ON t1.parent_code = t1p.code
|
|
||||||
JOIN ebde_places t2 ON t1.name = t2.col_city_name
|
|
||||||
JOIN ebde_places t2p ON t2.col_parent_id = t2p.col_city_id AND t1p.ebai_code = t2p.col_city_id
|
|
||||||
SET t1.ebai_code = t2.col_city_id
|
|
||||||
WHERE t1.level = 3;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE
|
|
||||||
place t1
|
|
||||||
JOIN mtpsdeliveryprice t2 ON t1.code = t2.citycode
|
|
||||||
SET t1.mtps_price = t2.price;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE
|
|
||||||
place t1
|
|
||||||
JOIN mtpsdeliveryprice t2 ON t1.name LIKE CONCAT(t2.cityname, '%')
|
|
||||||
SET t1.mtps_price = t2.price
|
|
||||||
WHERE t1.level = 2 AND t1.mtps_price = 0;
|
|
||||||
`,
|
|
||||||
`
|
|
||||||
UPDATE place t1
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT DISTINCT city_code
|
|
||||||
FROM store
|
|
||||||
UNION DISTINCT
|
|
||||||
SELECT DISTINCT place_code city_code
|
|
||||||
FROM sku_name_place_bind
|
|
||||||
) t2 ON t1.code = t2.city_code
|
|
||||||
SET t1.enabled = 0
|
|
||||||
WHERE t1.level = 2 AND t2.city_code IS NULL;
|
|
||||||
`,
|
|
||||||
}
|
|
||||||
for _, v := range updateSqls {
|
|
||||||
if _, err = dao.ExecuteSQL(db, v); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ const (
|
|||||||
JobTypeJdDelivery = 2 //京东快递任务
|
JobTypeJdDelivery = 2 //京东快递任务
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ()
|
||||||
|
|
||||||
type Job struct {
|
type Job struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,7 @@ type Place struct {
|
|||||||
Code int `orm:"unique" json:"code"` // 国家标准代码
|
Code int `orm:"unique" json:"code"` // 国家标准代码
|
||||||
Name string `orm:"size(16);index" json:"name"` // 如果是直辖市,省的概念不加“市”来区别
|
Name string `orm:"size(16);index" json:"name"` // 如果是直辖市,省的概念不加“市”来区别
|
||||||
ParentCode int `json:"parentCode"` // 上级代码
|
ParentCode int `json:"parentCode"` // 上级代码
|
||||||
// PostCode string `orm:"size(8);index" json:"postCode"`
|
Level int8 `json:"level"` // 城市级别,参见相关常量定义
|
||||||
Level int8 `json:"level"` // 城市级别,参见相关常量定义
|
TelCode string `orm:"size(8);index" json:"telCode"`
|
||||||
TelCode string `orm:"size(8);index" json:"telCode"`
|
Enabled int8 `json:"enabled"` // 是否启用
|
||||||
JdCode int `orm:"index" json:"jdCode"` // 对应的京东代码
|
|
||||||
EbaiCode int `orm:"index" json:"ebaiCode"`
|
|
||||||
Enabled int8 `json:"enabled"` // 是否启用
|
|
||||||
MtpsPrice int `json:"mtpsPrice"` // 分为单位
|
|
||||||
JdsCode int `json:"jdsCode"` //京东商城代码
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user