1
This commit is contained in:
@@ -6141,7 +6141,8 @@ func SetStoreAutoCallRider(vendorOrgCode string, openIDs, closeIDs []int64) (str
|
||||
|
||||
//操作 freight_template
|
||||
func ReplaceInsertFreight(storeID, templateID, warehouseID, tradeLimitID int, vendorStoreID, fenceID string) error {
|
||||
return dao.ReplaceInsertFreight2(storeID, templateID, warehouseID, tradeLimitID, vendorStoreID, fenceID)
|
||||
//return dao.ReplaceInsertFreight2(storeID, templateID, warehouseID, tradeLimitID, vendorStoreID, fenceID)
|
||||
return dao.InsertItemFreight2(storeID, templateID, warehouseID, tradeLimitID, vendorStoreID, fenceID)
|
||||
}
|
||||
|
||||
//辅助函数
|
||||
|
||||
@@ -34,16 +34,7 @@ SELECT ?,?,?,?,?,? FROM DUAL WHERE NOT EXISTS(SELECT COUNT(store_id) FROM freigh
|
||||
return err
|
||||
}
|
||||
|
||||
//func InsertItemFreight2(storeID, templateID, warehouseID, tradeLimitID int, vendorStoreID, fenceID string) error {
|
||||
// if storeID == 0 || len(vendorStoreID) == 0 {
|
||||
// return fmt.Errorf("storeID或vendorStoreID不允许为空")
|
||||
// }
|
||||
// //sqlStr := `UPDATE freight_template f SET f.warehouse_id = ? WHERE f.store_id= ? AND f.vendor_store_id = ?`
|
||||
// //sqlParam := []interface{}{}
|
||||
//
|
||||
// return nil
|
||||
//}
|
||||
func InsertItemFreight2(storeID int, vendorStoreID string, templateID, warehouseID, fenceID, tradeLimitID int64) error {
|
||||
func InsertItemFreight2(storeID, templateID, warehouseID, tradeLimitID int, vendorStoreID, fenceID string) error {
|
||||
var (
|
||||
sqlStr []string
|
||||
tStr = ""
|
||||
@@ -52,31 +43,71 @@ func InsertItemFreight2(storeID int, vendorStoreID string, templateID, warehouse
|
||||
if storeID == 0 && utils.Str2Int(vendorStoreID) == 0 {
|
||||
return errors.New("storeID,vendorStoreID 必传")
|
||||
}
|
||||
|
||||
sql := `UPDATE freight_template a SET `
|
||||
|
||||
sql := `UPDATE freight_template a SET `
|
||||
if templateID != 0 {
|
||||
templateIDSql := ` a.template_id = ? `
|
||||
sqlParams = append(sqlParams, templateIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
templateIDSql := ` a.template_id = ?`
|
||||
sqlParams = append(sqlParams, templateID)
|
||||
sqlStr = append(sqlStr, templateIDSql)
|
||||
}
|
||||
if warehouseID != 0 {
|
||||
warehouseIDSql := ` a.warehouse_id = ? `
|
||||
sqlParams = append(sqlParams, warehouseIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
warehouseIDSql := ` a.warehouse_id = ?`
|
||||
sqlParams = append(sqlParams, warehouseID)
|
||||
sqlStr = append(sqlStr, warehouseIDSql)
|
||||
}
|
||||
if fenceID != 0 {
|
||||
if len(fenceID) > 0 {
|
||||
fenceIDSql := ` a.fence_id = ?`
|
||||
sqlParams = append(sqlParams, fenceIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
sqlParams = append(sqlParams, fenceID)
|
||||
sqlStr = append(sqlStr, fenceIDSql)
|
||||
}
|
||||
if tradeLimitID != 0 {
|
||||
sql += ` a.fence_id = ? `
|
||||
sqlParams = append(sqlParams, templateID)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
tradeLimitIDSql := ` a.trade_limit_id = ? `
|
||||
sqlParams = append(sqlParams, tradeLimitID)
|
||||
sqlStr = append(sqlStr, tradeLimitIDSql)
|
||||
}
|
||||
tStr = "WHERE a.store_id = ? AND a.vendor_store_id = ?"
|
||||
|
||||
sqlParams = append(sqlParams, storeID, vendorStoreID)
|
||||
tStr2 := sql + strings.Join(sqlStr, ",") + tStr
|
||||
|
||||
_, err := ExecuteSQL(GetDB(), tStr2, sqlParams...)
|
||||
fmt.Println(tStr2)
|
||||
return err
|
||||
}
|
||||
|
||||
func InsertItemFreight(tem *model.FreightTemplate) error {
|
||||
if tem.StoreID == 0 || len(tem.VendorStoreID) == 0 {
|
||||
return fmt.Errorf("storeID或vendorStoreID不允许为空")
|
||||
}
|
||||
var (
|
||||
sqlStr []string
|
||||
tStr = ""
|
||||
sqlParams []interface{}
|
||||
)
|
||||
if tem.StoreID == 0 && utils.Str2Int(tem.VendorStoreID) == 0 {
|
||||
return errors.New("storeID,vendorStoreID 必传")
|
||||
}
|
||||
sql := `UPDATE freight_template a SET `
|
||||
if tem.TemplateID != 0 {
|
||||
templateIDSql := ` a.template_id = ?`
|
||||
sqlParams = append(sqlParams, tem.TemplateID)
|
||||
sqlStr = append(sqlStr, templateIDSql)
|
||||
}
|
||||
if tem.WarehouseID != 0 {
|
||||
warehouseIDSql := ` a.warehouse_id = ?`
|
||||
sqlParams = append(sqlParams, tem.WarehouseID)
|
||||
sqlStr = append(sqlStr, warehouseIDSql)
|
||||
}
|
||||
if len(tem.FenceID) > 0 {
|
||||
fenceIDSql := ` a.fence_id = ?`
|
||||
sqlParams = append(sqlParams, tem.FenceID)
|
||||
sqlStr = append(sqlStr, fenceIDSql)
|
||||
}
|
||||
if tem.TradeLimitID != 0 {
|
||||
tradeLimitIDSql := ` a.trade_limit_id = ? `
|
||||
sqlParams = append(sqlParams, tem.TradeLimitID)
|
||||
sqlStr = append(sqlStr, tradeLimitIDSql)
|
||||
}
|
||||
tStr = "WHERE a.store_id = ? AND a.vendor_store_id = ?"
|
||||
sqlParams = append(sqlParams, tem.StoreID, tem.VendorStoreID)
|
||||
tStr2 := sql + strings.Join(sqlStr, ",") + tStr
|
||||
|
||||
_, err := ExecuteSQL(GetDB(), tStr2, sqlParams...)
|
||||
|
||||
@@ -1606,23 +1606,23 @@ func InsertIntoFreightTemplate(storeID int, vendorStoreID string, templateID, wa
|
||||
|
||||
if templateID != 0 {
|
||||
templateIDSql := ` a.template_id = ? `
|
||||
sqlParams = append(sqlParams, templateIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
sqlParams = append(sqlParams, templateID)
|
||||
sqlStr = append(sqlStr, templateIDSql)
|
||||
}
|
||||
if warehouseID != 0 {
|
||||
warehouseIDSql := ` a.warehouse_id = ? `
|
||||
sqlParams = append(sqlParams, warehouseIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
sqlParams = append(sqlParams, warehouseID)
|
||||
sqlStr = append(sqlStr, warehouseIDSql)
|
||||
}
|
||||
if fenceID != 0 {
|
||||
fenceIDSql := ` a.fence_id = ?`
|
||||
sqlParams = append(sqlParams, fenceIDSql)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
sqlParams = append(sqlParams, fenceID)
|
||||
sqlStr = append(sqlStr, fenceIDSql)
|
||||
}
|
||||
if tradeLimitID != 0 {
|
||||
sql += ` a.fence_id = ? `
|
||||
sqlParams = append(sqlParams, templateID)
|
||||
sqlStr = append(sqlStr, sql)
|
||||
tradeLimitIDSql := ` a.fence_id = ? `
|
||||
sqlParams = append(sqlParams, tradeLimitID)
|
||||
sqlStr = append(sqlStr, tradeLimitIDSql)
|
||||
}
|
||||
tStr = "WHERE a.store_id = ? AND a.vendor_store_id = ?"
|
||||
|
||||
|
||||
@@ -288,6 +288,7 @@ func (c *PurchaseHandler) onOrderMsg(msgId, orderId string, msg interface{}) (re
|
||||
//抖音运单处理
|
||||
if msgId == tiktokShop.CallbackShipmentInfoChange {
|
||||
//msgId-骑手运单号 orderId-抖音店铺ID msg-回调运单参数
|
||||
|
||||
return c.onWaybillMsg(msgId, orderId, msg)
|
||||
}
|
||||
// 待支付订单将不做处理/支付订单待处理(抖音风控)
|
||||
|
||||
Reference in New Issue
Block a user