银豹创建商品修改
This commit is contained in:
@@ -23,9 +23,9 @@ func init() {
|
||||
// sandbox
|
||||
// api = New("594ab45a-9a73-4a43-82b0-a64cbd55d883", "06692746f7224695ad4788ce340bc854", "d6b42a35a7414a5490d811654d745c84")
|
||||
// prod
|
||||
api = New("77e703b7-7997-441b-a12a-2e522efb117a", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
|
||||
// api = New("77e703b7-7997-441b-a12a-2e522efb117a", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
|
||||
// 天天果园
|
||||
// api = New("84541069-fbe2-424b-b625-9b2ba1d4c9e6", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
|
||||
// const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHCT3RM3CQG7IJIPUQ3THS5UIUYWMKINM7ETUOQB7OBPOPZVCT3ZJY55243TDVXLO25PP4UYSPTTPMNQ7HPMWOJKJ3BJWGVHD243MXH7NZWW264TKN5UOCJBSSSOKD2QQII"
|
||||
const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHD6O37OTAHUCKU6ALXATYTGMHNFLM4XRLVSFUQAJR77M4URSZRKVO55243TDVXLO25PP4UYSPTTPMNRUFXDNP4WPE566Q6V4AH32F7HT"
|
||||
|
||||
@@ -111,7 +111,7 @@ func TestOrderShoudSettlementService2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderAddTips(t *testing.T) {
|
||||
err := api.OrderAddTips("918092290000042", 50, "xjh")
|
||||
err := api.OrderAddTips("2015763667000041", 100, "jxadmin")
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
|
||||
@@ -372,6 +372,7 @@ func (a *API) FindProduct(productId string) (findProductResult *FindProductResul
|
||||
type SaveProductParam struct {
|
||||
CategoryUid string `json:"categoryUid"`
|
||||
CategoryName string `json:"categoryName"`
|
||||
Enable int `json:"enable"`
|
||||
}
|
||||
|
||||
//更新单个商品信息(称编码和图片)
|
||||
@@ -379,6 +380,7 @@ type SaveProductParam struct {
|
||||
func (a *API) SaveProduct(userId, keyword string, saveProductParam *SaveProductParam) (err error) {
|
||||
var (
|
||||
categoryUid, categoryName string
|
||||
enable string
|
||||
)
|
||||
productId, err := a.LoadProductsByPage(userId, keyword)
|
||||
if err != nil {
|
||||
@@ -389,18 +391,32 @@ func (a *API) SaveProduct(userId, keyword string, saveProductParam *SaveProductP
|
||||
return err
|
||||
}
|
||||
if saveProductParam != nil {
|
||||
categoryUid = saveProductParam.CategoryUid
|
||||
categoryName = saveProductParam.CategoryName
|
||||
if saveProductParam.Enable != 0 {
|
||||
enable = utils.Int2Str(saveProductParam.Enable)
|
||||
} else {
|
||||
enable = utils.Int2Str(findProductResult.Enable)
|
||||
}
|
||||
if saveProductParam.CategoryUid != "" {
|
||||
categoryUid = saveProductParam.CategoryUid
|
||||
} else {
|
||||
categoryUid = utils.Int2Str(findProductResult.Enable)
|
||||
}
|
||||
if saveProductParam.CategoryName != "" {
|
||||
categoryName = saveProductParam.CategoryName
|
||||
} else {
|
||||
categoryName = utils.Int2Str(findProductResult.Enable)
|
||||
}
|
||||
} else {
|
||||
categoryUid = utils.Int64ToStr(findProductResult.CategoryUID)
|
||||
categoryName = findProductResult.Category.Name
|
||||
enable = utils.Int2Str(findProductResult.Enable)
|
||||
}
|
||||
params2 := map[string]interface{}{
|
||||
"pluCode": findProductResult.Barcode[3:],
|
||||
}
|
||||
params := map[string]interface{}{
|
||||
"id": utils.Int2Str(findProductResult.ID),
|
||||
"enable": utils.Int2Str(findProductResult.Enable),
|
||||
"enable": enable,
|
||||
"userId": utils.Int2Str(findProductResult.UserID),
|
||||
"barcode": findProductResult.Barcode,
|
||||
"name": findProductResult.Name,
|
||||
|
||||
@@ -60,7 +60,7 @@ func TestLoadCategorysWithOption(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadProductsByPage(t *testing.T) {
|
||||
result, err := api.LoadProductsByPage(MainStoreVendorOrgCode, "0000001")
|
||||
result, err := api.LoadProductsByPage("3936087", "0012113")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -76,10 +76,10 @@ func TestFindProduct(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSaveProduct(t *testing.T) {
|
||||
err := api.SaveProduct(MainStoreVendorOrgCode, "0000001")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// err := api.SaveProduct(MainStoreVendorOrgCode, "0000001")
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
}
|
||||
|
||||
func TestTryGetCookie(t *testing.T) {
|
||||
|
||||
@@ -17,8 +17,8 @@ func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("682628966212343269", "18C0E0867E467DBC26EFF5E957B02EC4") //总店
|
||||
api.SetCookie(".POSPALAUTH30220", "010285F62D8F18D6D708FE855EF2F020D6D708000833003900330033003100380039003A0000012F00FF2492A4FB8757535AA993086F60564361E0F54C49")
|
||||
api = New("1131812849010800342", "1F42E107A9A6B6B91B064B0B9D1147A1") //总店
|
||||
api.SetCookie(".POSPALAUTH30220", "0102A5F8291F691DD808FEA560EE80711DD808000833003900330036003000380037003A0000012F00FF7C8E026CA3DD2B6D2E5369FB1BBEEE8C3B9BE392")
|
||||
}
|
||||
|
||||
func TestAddProductInfo(t *testing.T) {
|
||||
@@ -58,7 +58,7 @@ func TestUpdateProductInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryProductByBarcode(t *testing.T) {
|
||||
result, err := api.QueryProductByBarcode("22510")
|
||||
result, err := api.QueryProductByBarcode("0012113")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -67,8 +67,7 @@ func TestQueryProductByBarcode(t *testing.T) {
|
||||
|
||||
func TestQueryProductByBarcodes(t *testing.T) {
|
||||
result, err := api.QueryProductByBarcodes([]string{
|
||||
"22510",
|
||||
"2003181534102",
|
||||
"0012113",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user