京东商城修改

This commit is contained in:
苏尹岚
2020-05-21 09:28:37 +08:00
parent 125f541670
commit d498a21563
3 changed files with 42 additions and 24 deletions

View File

@@ -1,6 +1,9 @@
package tempop
import (
"fmt"
"io/ioutil"
"net/http"
"testing"
"git.rosy.net.cn/jx-callback/globals/api2"
@@ -24,3 +27,18 @@ func TestJdStoreInfo1125(t *testing.T) {
t.Fatal(err)
}
}
func Testaa(t *testing.T) {
request, _ := http.NewRequest(http.MethodGet, "https://stores.shop.jd.com/stores/updateStoreStatus?storeId=24332466&storeStatus=1", nil)
c := &http.Cookie{
Name: "thor",
Value: "80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0AB6BF053A5325612EC0407791BB05F5301356E71E8B282C40C06D0B5DF3439DEECB102A78FAFF7AC0FC4E2D1FA8DD8BBAE1A011E50B5C74F1870AD982D7BF453F470F31F2241B73AC4C25485025C2ABEBC8A538AF7257824D2FAEE300A1435175B0B451FB5C19B78D729FC83152CA3BAF",
}
request.AddCookie(c)
client := &http.Client{}
fmt.Println("test1", request.URL)
response, _ := client.Do(request)
defer response.Body.Close()
bodyData, _ := ioutil.ReadAll(response.Body)
fmt.Println("test1", string(bodyData))
}

View File

@@ -3,9 +3,6 @@ package jdshop
import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
@@ -19,9 +16,9 @@ import (
)
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (storeDetail *dao.StoreDetail, err error) {
result, err := api.JdShopAPI.NewInfoList(utils.Str2Int64(vendorStoreID))
storeDetail.VendorStoreID = vendorStoreID
storeDetail.Status = JdsStatus2jxStatus(result.StoreStatus)
// result, err := api.JdShopAPI.NewInfoList(utils.Str2Int64(vendorStoreID))
// storeDetail.VendorStoreID = vendorStoreID
// storeDetail.Status = JdsStatus2jxStatus(result.StoreStatus)
result2, err := api.JdShopAPI.QueryEntityStore(utils.Str2Int64(vendorStoreID))
storeDetail.ID = utils.Str2Int(result2.ExStoreID)
storeDetail.Name = result2.StoreName
@@ -59,23 +56,23 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
CustomerID: utils.Int2Str(store.ID),
}
err = api.JdShopAPI.UpdateEntityStore(updateEntityStoreParam)
if err == nil {
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
// mergeStatus := jxutils.MergeStoreStatus(store.Status, store.VendorStatus)
request, _ := http.NewRequest(http.MethodGet, "https://stores.shop.jd.com/stores/updateStoreStatus?storeId=24332466&storeStatus=1", nil)
c := &http.Cookie{
Name: "thor",
Value: "80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0AB6BF053A5325612EC0407791BB05F5301356E71E8B282C40C06D0B5DF3439DEECB102A78FAFF7AC0FC4E2D1FA8DD8BBAE1A011E50B5C74F1870AD982D7BF453F470F31F2241B73AC4C25485025C2ABEBC8A538AF7257824D2FAEE300A1435175B0B451FB5C19B78D729FC83152CA3BAF",
}
request.AddCookie(c)
client := &http.Client{}
fmt.Println("test1", request.URL)
response, _ := client.Do(request)
defer response.Body.Close()
bodyData, _ := ioutil.ReadAll(response.Body)
fmt.Println("test1", string(bodyData))
}
}
// if err == nil {
// if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
// // mergeStatus := jxutils.MergeStoreStatus(store.Status, store.VendorStatus)
// request, _ := http.NewRequest(http.MethodGet, "https://stores.shop.jd.com/stores/updateStoreStatus?storeId=24332466&storeStatus=1", nil)
// c := &http.Cookie{
// Name: "thor",
// Value: "80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0AB6BF053A5325612EC0407791BB05F5301356E71E8B282C40C06D0B5DF3439DEECB102A78FAFF7AC0FC4E2D1FA8DD8BBAE1A011E50B5C74F1870AD982D7BF453F470F31F2241B73AC4C25485025C2ABEBC8A538AF7257824D2FAEE300A1435175B0B451FB5C19B78D729FC83152CA3BAF",
// }
// request.AddCookie(c)
// client := &http.Client{}
// fmt.Println("test1", request.URL)
// response, _ := client.Do(request)
// defer response.Body.Close()
// bodyData, _ := ioutil.ReadAll(response.Body)
// fmt.Println("test1", string(bodyData))
// }
// }
return err
}

View File

@@ -102,6 +102,8 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v
pic3, err2 := uploadImg2(v.DescImg, name, "desc")
err = err2
desc = `<p><img src="` + jdshopapi.JdsImgURL + pic3 + `" style="width: auto; height: auto; max-width: 100%;"><br></p><p><br></p>`
} else {
desc = `<p><br></p><p><br></p>`
}
updateWareParam.Introduction = desc
updateWareParam.MobileDesc = desc
@@ -524,7 +526,8 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j
sku.StockNum = 0
}
}
createSkuParamWare.MarketPrice = jxutils.IntPrice2Standard(vendorPrice)
//市场价固定500
createSkuParamWare.MarketPrice = 500
return createSkuParamWare, createSkuParamSkus, err
}