银豹更新商品分类
This commit is contained in:
@@ -369,9 +369,17 @@ func (a *API) FindProduct(productId string) (findProductResult *FindProductResul
|
||||
return findProductResult, err
|
||||
}
|
||||
|
||||
type SaveProductParam struct {
|
||||
CategoryUid string `json:"categoryUid"`
|
||||
CategoryName string `json:"categoryName"`
|
||||
}
|
||||
|
||||
//更新单个商品信息(称编码和图片)
|
||||
//Request URL: https://beta27.pospal.cn/Product/SaveProduct
|
||||
func (a *API) SaveProduct(userId, keyword string) (err error) {
|
||||
func (a *API) SaveProduct(userId, keyword string, saveProductParam *SaveProductParam) (err error) {
|
||||
var (
|
||||
categoryUid, categoryName string
|
||||
)
|
||||
productId, err := a.LoadProductsByPage(userId, keyword)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -380,6 +388,13 @@ func (a *API) SaveProduct(userId, keyword string) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if saveProductParam != nil {
|
||||
categoryUid = saveProductParam.CategoryUid
|
||||
categoryName = saveProductParam.CategoryName
|
||||
} else {
|
||||
categoryUid = utils.Int64ToStr(findProductResult.CategoryUID)
|
||||
categoryName = findProductResult.Category.Name
|
||||
}
|
||||
params2 := map[string]interface{}{
|
||||
"pluCode": findProductResult.Barcode[3:],
|
||||
}
|
||||
@@ -389,8 +404,8 @@ func (a *API) SaveProduct(userId, keyword string) (err error) {
|
||||
"userId": utils.Int2Str(findProductResult.UserID),
|
||||
"barcode": findProductResult.Barcode,
|
||||
"name": findProductResult.Name,
|
||||
"categoryUid": utils.Int64ToStr(findProductResult.CategoryUID),
|
||||
"categoryName": findProductResult.Category.Name,
|
||||
"categoryUid": categoryUid,
|
||||
"categoryName": categoryName,
|
||||
"sellPrice": utils.Float64ToStr(findProductResult.SellPrice),
|
||||
"buyPrice": utils.Float64ToStr(findProductResult.BuyPrice),
|
||||
"isCustomerDiscount": "1",
|
||||
|
||||
Reference in New Issue
Block a user