This commit is contained in:
邹宗楠
2024-01-16 16:24:50 +08:00
parent e3eff8739b
commit 1fe0ca13b0
7 changed files with 85 additions and 41 deletions

View File

@@ -397,10 +397,12 @@ func (c *PrinterHandler) UnregisterPrinter(ctx *jxcontext.Context, machineCode,
func (c *PrinterHandler) BindPrinter(ctx *jxcontext.Context, mapData map[string]interface{}) (bindResult *partner.BindPrinterResult, err error) {
machineCode := utils.Interface2String(mapData["machineCode"])
qrKey := utils.Interface2String(mapData["qrKey"])
if machineCode == "" || qrKey == "" {
msign := utils.Interface2String(mapData["msign"])
if machineCode == "" || (qrKey == "" && msign == "") {
return nil, fmt.Errorf("易联云扫描数据格式不正确")
}
tokenInfo, err := api.YilianyunAPI2.GetPrinterToken(machineCode, qrKey)
tokenInfo, err := api.YilianyunAPI2.GetPrinterToken(machineCode, qrKey, msign)
if err != nil {
return nil, err
}

View File

@@ -900,31 +900,34 @@ func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string)
return "", err
}
func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, storeId int) error {
storeDetail, err := dao.GetStoreDetail(db, storeId, model.VendorIDMTWM, "")
type SetBoxPrice struct {
StoreId int `json:"store_id"` // 门店id
SkuId int `json:"sku_id"` // 商品id
BoxPrice float64 `json:"box_price"` // 打包价格
}
func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, list []*SetBoxPrice) error {
storeDetail, err := dao.GetStoreDetail(db, list[0].StoreId, model.VendorIDMTWM, "")
if err != nil {
return err
}
storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeId}, nil)
if err != nil {
return err
}
//storeSkuList, err := dao.GetStoresSkusInfo(db, []int{list[0].StoreId}, nil)
//if err != nil {
// return err
//}
api := getAPI(storeDetail.VendorOrgCode, storeId, storeDetail.VendorStoreID)
api := getAPI(storeDetail.VendorOrgCode, list[0].StoreId, storeDetail.VendorStoreID)
foodDataList := make([]map[string]interface{}, 0)
for _, v := range storeSkuList {
if v.MtwmID != model.NO {
continue
}
for _, v := range list {
foodDataList = append(foodDataList, map[string]interface{}{
"app_spu_code": utils.Int2Str(v.SkuID),
"app_spu_code": utils.Int2Str(v.SkuId),
"skus": []map[string]interface{}{
{
"sku_id": utils.Int2Str(v.SkuID),
"ladder_box_num": "0",
"ladder_box_price": "0",
"sku_id": utils.Int2Str(v.SkuId),
"ladder_box_num": "1",
"ladder_box_price": utils.Float64ToStr(v.BoxPrice),
},
},
})