diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 1a206eee7..28141dd3b 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -137,6 +137,7 @@ var ( feiePageCookie string jdStorePageEarning string jdsCookie string + jdsCookie2 string ) func GetImportantTaskID(taskName string) string { @@ -340,8 +341,8 @@ func Init() { api.JdShopAPI.SetCookieWithStr(jdsCookie) } if configs, err := dao.QueryConfigs(dao.GetDB(), "jdsCookie2", model.ConfigTypeCookie, ""); err == nil { - jdsCookie = configs[0].Value - api.JdShop2API.SetCookieWithStr(jdsCookie) + jdsCookie2 = configs[0].Value + api.JdShop2API.SetCookieWithStr(jdsCookie2) } if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil { yinbaoCookie := configs[0].Value diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index f5840690b..02ac2e232 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1729,32 +1729,42 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.CreateEntity(db, storeMap) if shopDetailResult, err := api.JdShop2API.ShopDetail(utils.Str2Int(vendorStoreID)); err == nil { - err = api.JdShop2API.UpdateBasic(&jdshopapi.UpdateBasicParam{ - StoreID: utils.Str2Int(vendorStoreID), - StoreName: shopDetailResult.StoreName, - CategoryID2: 62, - Coordinate: shopDetailResult.Coordinate, - BussinessBeginTime: shopDetailResult.BussinessBeginTime, - BussinessEndTime: shopDetailResult.BussinessEndTime, - ImgURL: shopDetailResult.ImgURL, - StorePhone: shopDetailResult.StorePhone, - AddName: shopDetailResult.AddName, - AddCode1: shopDetailResult.AddCode1, - AddCode2: shopDetailResult.AddCode2, - AddCode3: shopDetailResult.AddCode3, - CategoryID1: 34, - QualificationRequests: []*jdshopapi.QualificationRequests{ - &jdshopapi.QualificationRequests{ - QualificationID: 41, - QualificationName: "营业执照", - QualificationNo: "11111", - QualificationURL: "jfs/t1/148622/37/14846/10266/5fb4e3e2Ef2f61870/a7cfba9c1513d95e.png", - StartTime: "2020-11-04 00:00:00", - EndingTime: "2020-11-06 23:59:59", - Time: []string{"2020-11-04 00:00:00", "2020-11-06 23:59:59"}, + if store.Licence != "" { + data, _, _ := jxutils.DownloadFileByURL(store.Licence) + fileName := store.Licence[strings.LastIndex(store.Licence, "/")+1 : len(store.Licence)] + url, _ := api.JdShop2API.UploadImageNew(data, fileName) + ex := store.LicenceExpire + if ex == "" { + ex = utils.Time2Str(utils.Str2Time(store.LicenceValid).AddDate(0, 6, 0)) + } + err = api.JdShop2API.UpdateBasic(&jdshopapi.UpdateBasicParam{ + StoreID: utils.Str2Int(vendorStoreID), + StoreName: shopDetailResult.StoreName, + CategoryID2: 62, + Coordinate: shopDetailResult.Coordinate, + BussinessBeginTime: shopDetailResult.BussinessBeginTime, + BussinessEndTime: shopDetailResult.BussinessEndTime, + ImgURL: shopDetailResult.ImgURL, + StorePhone: shopDetailResult.StorePhone, + AddName: shopDetailResult.AddName, + AddCode1: shopDetailResult.AddCode1, + AddCode2: shopDetailResult.AddCode2, + AddCode3: shopDetailResult.AddCode3, + CategoryID1: 34, + QualificationRequests: []*jdshopapi.QualificationRequests{ + &jdshopapi.QualificationRequests{ + QualificationID: 41, + QualificationName: "营业执照", + QualificationNo: store.LicenceCode, + QualificationURL: url, + StartTime: utils.Time2Str(utils.Str2Time(store.LicenceValid)), + EndingTime: ex, + Time: []string{utils.Time2Str(utils.Str2Time(store.LicenceValid)), ex}, + }, }, - }, - }) + }) + } + err = api.JdShop2API.UpdateExpand(utils.Str2Int(vendorStoreID)) } break }