From 433d79254d55da5f70cb214c052b3aa2ea6dd458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 11 Nov 2020 09:50:53 +0800 Subject: [PATCH] initdata --- business/jxstore/initdata/initdata.go | 61 --------------------------- business/model/job.go | 2 + business/model/place.go | 11 ++--- 3 files changed, 5 insertions(+), 69 deletions(-) diff --git a/business/jxstore/initdata/initdata.go b/business/jxstore/initdata/initdata.go index 5a30b28f7..9e588c1a8 100644 --- a/business/jxstore/initdata/initdata.go +++ b/business/jxstore/initdata/initdata.go @@ -9,7 +9,6 @@ import ( "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/dao" - "git.rosy.net.cn/jx-callback/business/partner" "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 { 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) return err } diff --git a/business/model/job.go b/business/model/job.go index 208f80468..33be2b6c7 100644 --- a/business/model/job.go +++ b/business/model/job.go @@ -32,6 +32,8 @@ const ( JobTypeJdDelivery = 2 //京东快递任务 ) +const () + type Job struct { ModelIDCULD diff --git a/business/model/place.go b/business/model/place.go index 77be6a1fb..aa3fd6944 100644 --- a/business/model/place.go +++ b/business/model/place.go @@ -13,12 +13,7 @@ type Place struct { Code int `orm:"unique" json:"code"` // 国家标准代码 Name string `orm:"size(16);index" json:"name"` // 如果是直辖市,省的概念不加“市”来区别 ParentCode int `json:"parentCode"` // 上级代码 - // PostCode string `orm:"size(8);index" json:"postCode"` - Level int8 `json:"level"` // 城市级别,参见相关常量定义 - TelCode string `orm:"size(8);index" json:"telCode"` - JdCode int `orm:"index" json:"jdCode"` // 对应的京东代码 - EbaiCode int `orm:"index" json:"ebaiCode"` - Enabled int8 `json:"enabled"` // 是否启用 - MtpsPrice int `json:"mtpsPrice"` // 分为单位 - JdsCode int `json:"jdsCode"` //京东商城代码 + Level int8 `json:"level"` // 城市级别,参见相关常量定义 + TelCode string `orm:"size(8);index" json:"telCode"` + Enabled int8 `json:"enabled"` // 是否启用 }