Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -486,9 +486,6 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v
|
|||||||
|
|
||||||
//
|
//
|
||||||
func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
if len(vendorIDs) > 0 && vendorIDs[0] == model.VendorIDTaoVegetable {
|
|
||||||
globals.SugarLogger.Debugf("=====================storeIDs: %s", utils.Format4Output(storeIDs, false))
|
|
||||||
}
|
|
||||||
isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8
|
isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8
|
||||||
funcParam := func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
funcParam := func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||||
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
|
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
|
||||||
|
|||||||
@@ -285,24 +285,7 @@ func Init() {
|
|||||||
ScheduleTimerFunc("RefreshSyncSkuListTao", func() {
|
ScheduleTimerFunc("RefreshSyncSkuListTao", func() {
|
||||||
syncStoreSkuTao()
|
syncStoreSkuTao()
|
||||||
}, []string{
|
}, []string{
|
||||||
"14:25:00",
|
"16:50:00",
|
||||||
"16:25:00",
|
|
||||||
"18:52:00",
|
|
||||||
"20:25:00",
|
|
||||||
"21:25:00",
|
|
||||||
"22:25:00",
|
|
||||||
"23:25:00",
|
|
||||||
"00:25:00",
|
|
||||||
"01:25:00",
|
|
||||||
"02:25:00",
|
|
||||||
"03:25:00",
|
|
||||||
"04:25:00",
|
|
||||||
"05:25:00",
|
|
||||||
"06:25:00",
|
|
||||||
"07:25:00",
|
|
||||||
"08:25:00",
|
|
||||||
"10:25:00",
|
|
||||||
"12:25:00",
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,241 +640,6 @@ func syncStoreSkuTiktok() {
|
|||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
var syncLen = 0
|
|
||||||
var beijin = []int{
|
|
||||||
//669113,
|
|
||||||
//669111,
|
|
||||||
//669110,
|
|
||||||
//669109,
|
|
||||||
//669108,
|
|
||||||
//669107,
|
|
||||||
//669106,
|
|
||||||
//669103,
|
|
||||||
//669100,
|
|
||||||
//669099,
|
|
||||||
//669098,
|
|
||||||
//669097,
|
|
||||||
//669096,
|
|
||||||
//669095,
|
|
||||||
//669094,
|
|
||||||
//669093,
|
|
||||||
//669092,
|
|
||||||
//669091,
|
|
||||||
//669087,
|
|
||||||
//669086,
|
|
||||||
//669085,
|
|
||||||
//669084, // zheer
|
|
||||||
//669083,
|
|
||||||
//669082,
|
|
||||||
//669079,
|
|
||||||
//669078,
|
|
||||||
//669077,
|
|
||||||
//669075,
|
|
||||||
//669074,
|
|
||||||
//669072,
|
|
||||||
//669070,
|
|
||||||
//669067,
|
|
||||||
//669064,
|
|
||||||
//669063,
|
|
||||||
//669062,
|
|
||||||
//669060,
|
|
||||||
//669059,
|
|
||||||
//669056,
|
|
||||||
//669055,
|
|
||||||
//669054,
|
|
||||||
//669050,
|
|
||||||
//669049,
|
|
||||||
//669047, //
|
|
||||||
//669046,
|
|
||||||
//669045,
|
|
||||||
//669042,
|
|
||||||
//669041,
|
|
||||||
//669038,
|
|
||||||
//669036,
|
|
||||||
//669035,
|
|
||||||
//669033,
|
|
||||||
//669032, // zher
|
|
||||||
//669031,
|
|
||||||
//669027,
|
|
||||||
//669025,
|
|
||||||
//669024,
|
|
||||||
//669022,
|
|
||||||
//669021,
|
|
||||||
//669020,
|
|
||||||
//669017,
|
|
||||||
//669015, /// zher
|
|
||||||
//669014,
|
|
||||||
//669012,
|
|
||||||
//669009,
|
|
||||||
//669007,
|
|
||||||
//669002,
|
|
||||||
//669000,
|
|
||||||
//668999,
|
|
||||||
//668997,
|
|
||||||
//668996,
|
|
||||||
//668993, //
|
|
||||||
//668988,
|
|
||||||
//668986,
|
|
||||||
//668984,
|
|
||||||
//668966,
|
|
||||||
//668963,
|
|
||||||
//668961,
|
|
||||||
//668958,
|
|
||||||
//668954,
|
|
||||||
//668950,
|
|
||||||
//668948,
|
|
||||||
//668946,
|
|
||||||
//668943, ///
|
|
||||||
//668938,
|
|
||||||
//668928,
|
|
||||||
//668910,
|
|
||||||
//668907,
|
|
||||||
//668900,
|
|
||||||
//668897,
|
|
||||||
668896,
|
|
||||||
668891,
|
|
||||||
668889,
|
|
||||||
668883,
|
|
||||||
668882,
|
|
||||||
668868,
|
|
||||||
668860,
|
|
||||||
668855,
|
|
||||||
668853,
|
|
||||||
668850,
|
|
||||||
668849,
|
|
||||||
668843,
|
|
||||||
668838,
|
|
||||||
668807,
|
|
||||||
668802,
|
|
||||||
668784,
|
|
||||||
668773,
|
|
||||||
668771,
|
|
||||||
668767,
|
|
||||||
668766,
|
|
||||||
668755,
|
|
||||||
668749,
|
|
||||||
668728,
|
|
||||||
668724,
|
|
||||||
668722,
|
|
||||||
668721,
|
|
||||||
668716,
|
|
||||||
668706,
|
|
||||||
668704,
|
|
||||||
668699,
|
|
||||||
668697,
|
|
||||||
668695,
|
|
||||||
668693,
|
|
||||||
668692,
|
|
||||||
668688,
|
|
||||||
668686,
|
|
||||||
668682,
|
|
||||||
668680,
|
|
||||||
668679,
|
|
||||||
668678,
|
|
||||||
668672,
|
|
||||||
668666,
|
|
||||||
668662,
|
|
||||||
668660,
|
|
||||||
668659,
|
|
||||||
668656,
|
|
||||||
668655,
|
|
||||||
668654,
|
|
||||||
668649,
|
|
||||||
668648,
|
|
||||||
668643,
|
|
||||||
668642,
|
|
||||||
668640,
|
|
||||||
668636,
|
|
||||||
668632,
|
|
||||||
668631,
|
|
||||||
668629,
|
|
||||||
668624,
|
|
||||||
668616,
|
|
||||||
668613,
|
|
||||||
668608,
|
|
||||||
668594,
|
|
||||||
668548,
|
|
||||||
668543,
|
|
||||||
668540,
|
|
||||||
668537,
|
|
||||||
668530,
|
|
||||||
668512,
|
|
||||||
668258,
|
|
||||||
668257,
|
|
||||||
668256,
|
|
||||||
668254,
|
|
||||||
668203,
|
|
||||||
668190,
|
|
||||||
668186,
|
|
||||||
668185,
|
|
||||||
668182,
|
|
||||||
668170,
|
|
||||||
668169,
|
|
||||||
668168,
|
|
||||||
668166,
|
|
||||||
668165,
|
|
||||||
668164,
|
|
||||||
668157,
|
|
||||||
668156,
|
|
||||||
668125,
|
|
||||||
668121,
|
|
||||||
668095,
|
|
||||||
668094,
|
|
||||||
668071,
|
|
||||||
667959,
|
|
||||||
667745,
|
|
||||||
667744,
|
|
||||||
667743,
|
|
||||||
667563,
|
|
||||||
667562,
|
|
||||||
667561,
|
|
||||||
667560,
|
|
||||||
667559,
|
|
||||||
667558,
|
|
||||||
667556,
|
|
||||||
667420,
|
|
||||||
667332,
|
|
||||||
667308,
|
|
||||||
667305,
|
|
||||||
667304,
|
|
||||||
667299,
|
|
||||||
667292,
|
|
||||||
667285,
|
|
||||||
667281,
|
|
||||||
667278,
|
|
||||||
667263,
|
|
||||||
667001,
|
|
||||||
666975,
|
|
||||||
666677,
|
|
||||||
666667,
|
|
||||||
666666,
|
|
||||||
103408,
|
|
||||||
103184,
|
|
||||||
103174,
|
|
||||||
103127,
|
|
||||||
103113,
|
|
||||||
102925,
|
|
||||||
102740,
|
|
||||||
102736,
|
|
||||||
102630,
|
|
||||||
102383,
|
|
||||||
102180,
|
|
||||||
101942,
|
|
||||||
101897,
|
|
||||||
101875,
|
|
||||||
101036,
|
|
||||||
100840,
|
|
||||||
100743,
|
|
||||||
100654,
|
|
||||||
100471,
|
|
||||||
100144,
|
|
||||||
100135,
|
|
||||||
100129,
|
|
||||||
100126,
|
|
||||||
100123,
|
|
||||||
100115,
|
|
||||||
}
|
|
||||||
|
|
||||||
// syncStoreSkuTao 同步商品到淘鲜达
|
// syncStoreSkuTao 同步商品到淘鲜达
|
||||||
func syncStoreSkuTao() {
|
func syncStoreSkuTao() {
|
||||||
syncFlag := 0
|
syncFlag := 0
|
||||||
@@ -902,11 +650,12 @@ func syncStoreSkuTao() {
|
|||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
switch step {
|
switch step {
|
||||||
case 0:
|
case 0:
|
||||||
if err := ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达消息:", utils.Format4Output(beijin[syncLen:syncLen+5], false)); err != nil {
|
|
||||||
|
if err := ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达消息:", utils.Format4Output("开始同步", false)); err != nil {
|
||||||
globals.SugarLogger.Debugf("SendUserMessage := %s", utils.Format4Output(err, false))
|
globals.SugarLogger.Debugf("SendUserMessage := %s", utils.Format4Output(err, false))
|
||||||
}
|
}
|
||||||
enterprise_msg.SendUserMessage("18981810340", "淘鲜达同步消息", utils.Format4Output(beijin[syncLen:syncLen+5], false), utils.Format4Output(beijin[syncLen:syncLen+5], false))
|
enterprise_msg.SendUserMessage("18981810340", "淘鲜达同步消息", utils.Format4Output("开始同步", false), utils.Format4Output("开始同步", false))
|
||||||
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin[syncLen:syncLen+5], false, nil, nil, syncFlag, true, true)
|
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, nil, false, nil, nil, syncFlag, true, true)
|
||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
case 1:
|
case 1:
|
||||||
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
||||||
@@ -915,7 +664,6 @@ func syncStoreSkuTao() {
|
|||||||
return retVal, err
|
return retVal, err
|
||||||
}, []int{0, 1})
|
}, []int{0, 1})
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
syncLen += 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func doDailyWork2() {
|
func doDailyWork2() {
|
||||||
|
|||||||
@@ -1221,7 +1221,7 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd
|
|||||||
order.Flag = 1
|
order.Flag = 1
|
||||||
if jxOrder.OrderType == model.OrderTypeMatter {
|
if jxOrder.OrderType == model.OrderTypeMatter {
|
||||||
order.WaybillVendorID = model.VendorIDJDWL
|
order.WaybillVendorID = model.VendorIDJDWL
|
||||||
order.ConsigneeAddress = deliveryAddress.Address
|
order.ConsigneeAddress = fmt.Sprintf("%s%s", deliveryAddress.Address, deliveryAddress.DetailAddress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果是自提单就设置
|
//如果是自提单就设置
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
package tao_vegetable
|
package tao_vegetable
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||||
request1475 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability1475/request"
|
request1475 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability1475/request"
|
||||||
@@ -26,6 +21,12 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"image/jpeg"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -445,6 +446,22 @@ func checkNameLength(name string, weight int, uint string) string {
|
|||||||
return lastName[0:60]
|
return lastName[0:60]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图片压缩,大于3M
|
||||||
|
func decodeImg(data []byte) []byte {
|
||||||
|
if float64(len(data))/float64(1024)/float64(1024) > float64(3) {
|
||||||
|
jpgimg, err := jpeg.Decode(strings.NewReader(string(data))) // 文件解码成图像对象
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err = jpeg.Encode(&buf, jpgimg, &jpeg.Options{Quality: 30})
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return buf.Bytes()
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
func uploadImg(api *tao_vegetable.API, skuId, vendorId int, imgs []string) *string {
|
func uploadImg(api *tao_vegetable.API, skuId, vendorId int, imgs []string) *string {
|
||||||
vendorImg, _ := dao.GetVendorImg(skuId, vendorId)
|
vendorImg, _ := dao.GetVendorImg(skuId, vendorId)
|
||||||
result := make([]string, 0, 0)
|
result := make([]string, 0, 0)
|
||||||
@@ -468,6 +485,8 @@ func uploadImg(api *tao_vegetable.API, skuId, vendorId int, imgs []string) *stri
|
|||||||
if strings.Contains(string(body), "Document not found") || len(body) == 0 {
|
if strings.Contains(string(body), "Document not found") || len(body) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// 检查图片大小
|
||||||
|
body = decodeImg(body)
|
||||||
newImg, _ := api.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{
|
newImg, _ := api.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{
|
||||||
PictureCategoryId: utils.Int64ToPointer(0),
|
PictureCategoryId: utils.Int64ToPointer(0),
|
||||||
Img: &body,
|
Img: &body,
|
||||||
@@ -563,6 +582,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
|
|||||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||||
OnlineSaleFlag: utils.Int64ToPointer(onlineStatus),
|
OnlineSaleFlag: utils.Int64ToPointer(onlineStatus),
|
||||||
SubTitle: utils.String2Pointer("小时达"),
|
SubTitle: utils.String2Pointer("小时达"),
|
||||||
|
AllowAppSale: utils.Int64ToPointer(onlineStatus),
|
||||||
//CleanSkuMemberPrice: utils.Int64ToPointer(model.YES),
|
//CleanSkuMemberPrice: utils.Int64ToPointer(model.YES),
|
||||||
}
|
}
|
||||||
updateSkuList = append(updateSkuList, updateSku)
|
updateSkuList = append(updateSkuList, updateSku)
|
||||||
|
|||||||
Reference in New Issue
Block a user