diff --git a/business/jxstore/yonghui/yonghui.go b/business/jxstore/yonghui/yonghui.go index 9992ecd2a..06068f668 100644 --- a/business/jxstore/yonghui/yonghui.go +++ b/business/jxstore/yonghui/yonghui.go @@ -42,6 +42,11 @@ type SheetParam struct { SkuRow int } +type DataStoreSkusSuccessLock struct { + dataStoreSkusSuccessList []DataStoreSkusSuccess + locker sync.RWMutex +} + type DataSuccessLock struct { dataSuccessList []DataSuccess locker sync.RWMutex @@ -52,8 +57,18 @@ type DataFailedLock struct { locker sync.RWMutex } +type DataStoreSkusSuccess struct { + StoreID int `json:"门店ID"` + NameID int `json:"商品编码"` + Name string `json:"商品名称"` + Unit string `json:"单位"` + OrgPrice float64 `json:"原价"` + NowPrice float64 `json:"现价"` + MixPrice float64 `json:"涨跌"` +} + type DataSuccess struct { - NameID string `json:"商品nameID"` + NameID string `json:"商品编码"` Name string `json:"商品名称"` Unit string `json:"单位"` OrgPrice float64 `json:"原价"` @@ -150,8 +165,17 @@ var ( SkuRow: 1, }, } + titleListStoreSkusSuccess = []string{ + "门店ID", + "商品编码", + "商品名称", + "单位", + "原价", + "现价", + "涨跌", + } titleListSuccess = []string{ - "商品nameID", + "商品编码", "商品名称", "单位", "原价", @@ -168,8 +192,9 @@ var ( "商品名称", "订货数量", } - dataSuccess DataSuccessLock - dataFailed DataFailedLock + dataSuccess DataSuccessLock + dataFailed DataFailedLock + dataStoreSkusSuccess DataStoreSkusSuccessLock ) const ( @@ -190,6 +215,12 @@ func (d *DataFailedLock) AppendData2(dataFailed DataFailed) { d.dataFailedList = append(d.dataFailedList, dataFailed) } +func (d *DataStoreSkusSuccessLock) AppendData3(dataStoreSkusSuccess DataStoreSkusSuccess) { + d.locker.Lock() + defer d.locker.Unlock() + d.dataStoreSkusSuccessList = append(d.dataStoreSkusSuccessList, dataStoreSkusSuccess) +} + func LoadExcelByYongHui(ctx *jxcontext.Context, files []*multipart.FileHeader, isAsync, isContinueWhenError bool) (hint string, err error) { if len(files) == 0 { return "", errors.New("没有文件上传!") @@ -509,7 +540,7 @@ func updateWeiMobGoods(costPrice, salePrice float64, unit string, isCompare bool } } else { outPutData := DataSuccess{ - NameID: goodsDetail.SkuMap.SingleSku.OuterSkuCode, + NameID: goodsDetail.OuterGoodsCode, Name: goodsDetail.Title, Unit: unit, OrgPrice: goodsDetail.SkuMap.SingleSku.SalePrice, @@ -710,7 +741,7 @@ func WriteToExcel(task *tasksch.SeqTask, dataSuccess []DataSuccess, dataFailed [ } sheetList2 = append(sheetList2, excelConf2) if excelConf1 != nil { - downloadURL1, fileName1, err = UploadExeclAndPushMsg(sheetList1, "已更新商品") + downloadURL1, fileName1, err = UploadExeclAndPushMsg(sheetList1, "微盟已更新商品") } else { baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!") } @@ -743,14 +774,13 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo storeSkuBindInfoList []interface{} skuBindInfos []*cms.StoreSkuBindInfo ) - //获取微盟所有上架商品 - queryParameter := &weimobapi.QueryGoodsListRequestVo{ - GoodsStatus: weimobapi.GoodsTypeNormal, - } + db := dao.GetDB() + dataFailed.dataFailedList = dataFailed.dataFailedList[0:0] + dataStoreSkusSuccess.dataStoreSkusSuccessList = dataStoreSkusSuccess.dataStoreSkusSuccessList[0:0] + //获取微盟所有商品 param := &weimobapi.QueryGoodsListParam{ - PageNum: 1, - PageSize: jdapi.MaxSkuIDsCount4QueryListBySkuIds, - QueryParameter: queryParameter, + PageNum: 1, + PageSize: jdapi.MaxSkuIDsCount4QueryListBySkuIds, } goodsList, err := GetWeiMobGoodsList(param) if err != nil { @@ -765,14 +795,53 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo if err != nil { baseapi.SugarLogger.Errorf("QueryGoodsDetail error:%v", err) } - if goodsDetail.OuterGoodsCode != "" && goodsDetail.IsPutAway == weimobapi.GoodsTypeNormal { - nameID := int(utils.Str2Int64(goodsDetail.SkuMap.SingleSku.OuterSkuCode)) - unitPrice := int(utils.Float64TwoInt64(goodsDetail.SkuMap.SingleSku.CostPrice * 100)) - storeSkuBindInfo := &cms.StoreSkuBindInfo{ - NameID: nameID, - UnitPrice: unitPrice, + nameID := int(utils.Str2Int64(goodsDetail.SkuMap.SingleSku.OuterSkuCode)) + unitPrice := int(utils.Float64TwoInt64(goodsDetail.SkuMap.SingleSku.CostPrice * 100)) + goodsID := goodsDetail.OuterGoodsCode + skuList, err := dao.GetStoreSkusByNameIDs(db, storeIDs, nameID) + if len(skuList) > 0 { + if goodsDetail.OuterGoodsCode != "" { + if goodsDetail.IsPutAway == weimobapi.GoodsTypeNormal { + storeSkuBindInfo := &cms.StoreSkuBindInfo{ + NameID: nameID, + UnitPrice: unitPrice, + } + retVal = []*cms.StoreSkuBindInfo{storeSkuBindInfo} + for _, v := range skuList { + outPutData := DataStoreSkusSuccess{ + StoreID: v.StoreID, + NameID: nameID, + Name: v.Name, + Unit: v.Unit, + OrgPrice: utils.Str2Float64(utils.Int64ToStr(v.UnitPrice)) / 100, + NowPrice: goodsDetail.SkuMap.SingleSku.CostPrice, + MixPrice: Float64Round((utils.Str2Float64(utils.Int64ToStr(v.UnitPrice)) / 100) - goodsDetail.SkuMap.SingleSku.CostPrice), + } + dataStoreSkusSuccess.AppendData3(outPutData) + } + } else { //如果微盟为下架 + outPutData := DataFailed{ + GoodsID: goodsID, + GoodsName: goodsDetail.Title, + Comment: "微盟已下架", + } + dataFailed.AppendData2(outPutData) + } + } else { + outPutData := DataFailed{ + GoodsID: goodsID, + GoodsName: goodsDetail.Title, + Comment: "微盟上没有该商品的spu编码", + } + dataFailed.AppendData2(outPutData) } - retVal = []*cms.StoreSkuBindInfo{storeSkuBindInfo} + } else { + outPutData := DataFailed{ + GoodsID: goodsID, + GoodsName: goodsDetail.Title, + Comment: "京西未关注该商品", + } + dataFailed.AppendData2(outPutData) } return retVal, err } @@ -784,10 +853,12 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo skuBindInfos = append(skuBindInfos, v.(*cms.StoreSkuBindInfo)) } cms.UpdateStoresSkus(ctx, storeIDs, skuBindInfos, isAsync, isContinueWhenError) + case 2: + WriteToExcel3(task, dataStoreSkusSuccess.dataStoreSkusSuccessList, dataFailed.dataFailedList) } return result, err } - taskSeq := tasksch.NewSeqTask2("根据微盟商品更新京西价", ctx, isContinueWhenError, taskSeqFunc, 2) + taskSeq := tasksch.NewSeqTask2("根据微盟商品更新京西价", ctx, isContinueWhenError, taskSeqFunc, 3) tasksch.HandleTask(taskSeq, nil, true).Run() if !isAsync { _, err = taskSeq.GetResult(0) @@ -798,6 +869,42 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo return hint, err } +func WriteToExcel3(task *tasksch.SeqTask, dataSuccess []DataStoreSkusSuccess, dataFailed []DataFailed) (err error) { + var sheetList1 []*excel.Obj2ExcelSheetConfig + var sheetList2 []*excel.Obj2ExcelSheetConfig + var downloadURL1, downloadURL2, fileName1, fileName2 string + excelConf1 := &excel.Obj2ExcelSheetConfig{ + Title: "sheet1", + Data: dataSuccess, + CaptionList: titleListStoreSkusSuccess, + } + sheetList1 = append(sheetList1, excelConf1) + excelConf2 := &excel.Obj2ExcelSheetConfig{ + Title: "sheet1", + Data: dataFailed, + CaptionList: titleListFailed, + } + sheetList2 = append(sheetList2, excelConf2) + if excelConf1 != nil { + downloadURL1, fileName1, err = UploadExeclAndPushMsg(sheetList1, "京西已更新商品") + } else { + baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!") + } + if excelConf2 != nil { + downloadURL2, fileName2, err = UploadExeclAndPushMsg(sheetList2, "缺少商品_京西") + } else { + baseapi.SugarLogger.Debug("WriteToExcel: dataFailed is nil!") + } + if err != nil { + baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName1, fileName2, err) + } else { + noticeMsg := fmt.Sprintf("[详情点我]path1=%s, path2=%s \n", globals.BackstageHost, downloadURL1, downloadURL2) + task.SetNoticeMsg(noticeMsg) + baseapi.SugarLogger.Debugf("WriteToExcel:upload %s ,%s success, downloadURL1:%s ,downloadURL2:%s", fileName1, fileName2, downloadURL1, downloadURL2) + } + return err +} + func GetWeimobOrders(ctx *jxcontext.Context, fromTime, toTime string, params map[string]interface{}) (result []*OrderList, err error) { if fromTime != "" && toTime != "" { fromTimeParam := utils.Str2Time(fromTime).UnixNano() / 1e6 @@ -942,7 +1049,7 @@ func GetWeimobOrdersExcel(ctx *jxcontext.Context, OrderNo string) (result *Weimo } downloadURL1, downloadURL2, err := WriteToExcel2(ctx, DataFineList, DataHairyList) result = &WeimobOrderSkusExcelResult{ - DownloadUrlFine: downloadURL1, + DownloadUrlFine: downloadURL1, DownloadUrlHairy: downloadURL2, } return result, err diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index 03d9d6951..8d6265932 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -119,6 +119,10 @@ func JxOperationTime2StrTime(value int16) string { return fmt.Sprintf("%02d:%02d", value/100, value%100) } +func JxOperationTime2TimeByDate(value int16, tm time.Time) (outTm time.Time) { + return utils.Str2TimeWithDefault(fmt.Sprintf("%s %02d:%02d:00", utils.Time2DateStr(tm), value/100, value%100), utils.DefaultTimeValue) +} + func GetPolygonFromCircle(lng, lat, distance float64, pointCount int) (points [][2]float64) { points = make([][2]float64, pointCount) for k := range points { diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index a8fcb9fe0..f7d454e2a 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -640,3 +640,24 @@ func UpdateStoreSkuBindSyncStatus(db *DaoDB, vendorIDs []int, storeID int) (num } return ExecuteSQL(db, sql, sqlParams...) } + +func GetStoreSkusByNameIDs(db *DaoDB, storeIDs []int, nameID int) (skuList []*StoreSkuSyncInfo, err error) { + sql := ` + SELECT a.*,c.unit,c.name + FROM store_sku_bind a + JOIN sku b ON a.sku_id = b.id + JOIN sku_name c ON b.name_id = c.id + WHERE b.name_id = ? + ` + sqlParams := []interface{}{ + nameID, + } + if len(storeIDs) > 0 { + sql += " AND a.store_id in (" + GenQuestionMarks(len(storeIDs)) + ")" + sqlParams = append(sqlParams, storeIDs) + } + sql += " AND a.status != ?" + sqlParams = append(sqlParams, model.SkuStatusDeleted) + err = GetRows(db, &skuList, sql, sqlParams...) + return skuList, err +} diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index f37383608..b8bcc7435 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -4,6 +4,7 @@ import ( "crypto/md5" "fmt" "math" + "sort" "time" "git.rosy.net.cn/baseapi/utils" @@ -12,6 +13,7 @@ import ( "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/partner" + "git.rosy.net.cn/jx-callback/business/partner/delivery" "git.rosy.net.cn/jx-callback/globals" ) @@ -19,7 +21,8 @@ const ( OrderCreateTypePre = 0 // 预创建 OrderCreateTypeNormal = 1 // 正常创建 - PayWaitingTime = 10 * time.Minute // 等待支付的最长时间 + PayWaitingTime = 10 * time.Minute // 等待支付的最长时间 + DingShiDaMinTime = 1 * time.Hour ) type JxSkuInfo struct { @@ -29,15 +32,33 @@ type JxSkuInfo struct { Price int64 `json:"price,omitempty"` // 原价 SalePrice int64 `json:"salePrice,omitempty"` // 售卖价 - Name string `json:"name"` + Name string `json:"name"` + Weight int `json:"weight"` +} + +type JxSkuInfoList []*JxSkuInfo + +func (l JxSkuInfoList) Len() int { + return len(l) +} + +func (l JxSkuInfoList) Less(i, j int) bool { + if l[i].SkuID == l[j].SkuID { + return l[i].SalePrice < l[j].SalePrice + } + return l[i].SkuID < l[j].SkuID +} + +func (l JxSkuInfoList) Swap(i, j int) { + l[i], l[j] = l[j], l[i] } type JxOrderInfo struct { - BuyerComment string + BuyerComment string `json:"buyerComment"` StoreID int `json:"storeID"` Skus []*JxSkuInfo `json:"skus"` - ExpectedDeliveredTime *time.Time `orm:"type(datetime)" json:"expectedDeliveredTime"` // 预期送达时间 + ExpectedDeliveredTimestamp int64 `json:"expectedDeliveredTimestamp"` // 预期送达时间 TotalPrice int64 `json:"totalPrice"` // 单位为分 订单总价 FreightPrice int64 `json:"freightPrice"` // 单位为分 订单配送费 @@ -46,10 +67,33 @@ type JxOrderInfo struct { OrderID int64 `json:"orderID"` StoreName string `json:"storeName"` + Weight int `json:"weight"` +} + +type DeliveryTimeItem struct { + ViewTime string `json:"viewTime"` + UnixTime int64 `json:"unixTime"` + ViewShippingFee string `json:"viewShippingFee"` +} + +type DeliveryDayTimeInfo struct { + Date string `json:"date"` + TimeList []*DeliveryTimeItem `json:"timeList"` } var ( orderNoBeginTimestamp int64 + + weekdayMap = map[int]string{ + 1: "一", + 2: "二", + 3: "三", + 4: "四", + 5: "五", + 6: "六", + 7: "七", + } + dayList = []string{"今天", "明天"} ) func init() { @@ -89,6 +133,57 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType return orderPay, err } +func time2ShortTimeStr(t time.Time) string { + return t.Format("15:04") +} + +func GetAvailableDeliverTime(ctx *jxcontext.Context, storeID int) (deliverTimerList []*DeliveryDayTimeInfo, err error) { + db := dao.GetDB() + storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX) + if err != nil { + return nil, err + } + if storeDetail.Status != model.StoreStatusOpened { + return nil, fmt.Errorf("门店:%s不是营业状态,状态是:%s", storeDetail.Name, model.StoreStatusName[storeDetail.Status]) + } + + now := time.Now() + beginDate := utils.Time2Date(now) + minDingShiDaTime := now.Add(DingShiDaMinTime) + for i := 0; i < 2; i++ { + openTime1 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime1, beginDate) + closeTime1 := jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime1, beginDate) + openTime2 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime2, beginDate) + closeTime2 := jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime2, beginDate) + timeInfo := &DeliveryDayTimeInfo{ + Date: fmt.Sprintf("%s(周%s)", dayList[i], weekdayMap[int(beginDate.Weekday())]), + } + if i == 0 { + timeInfo.TimeList = append(timeInfo.TimeList, &DeliveryTimeItem{ + ViewTime: "立即送出", + UnixTime: 0, + ViewShippingFee: "约6.6元配送费", + }) + } + deliverTimerList = append(deliverTimerList, timeInfo) + for j := 0; j < 24*3; j++ { + deliveryTime := beginDate.Add(time.Duration(j) * 20 * time.Minute) + if deliveryTime.Sub(minDingShiDaTime) >= 0 { + if (deliveryTime.Sub(openTime1) >= 0 && deliveryTime.Sub(closeTime1) <= 0) || + (storeDetail.OpenTime2 > 0 && deliveryTime.Sub(openTime2) >= 0 && deliveryTime.Sub(closeTime2) <= 0) { + timeInfo.TimeList = append(timeInfo.TimeList, &DeliveryTimeItem{ + ViewTime: time2ShortTimeStr(deliveryTime), + UnixTime: deliveryTime.Unix(), + ViewShippingFee: "约6.6元配送费", + }) + } + } + } + beginDate = beginDate.Add(24 * time.Hour) + } + return deliverTimerList, err +} + func OnPayFinished(orderPay *model.OrderPay) (err error) { order, err := partner.CurOrderManager.LoadOrder(orderPay.VendorOrderID, orderPay.VendorID) if err == nil { @@ -181,16 +276,19 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64 } // 营业状态及时间检查 - if storeDetail.Status == model.StoreStatusDisabled { + if storeDetail.Status != model.StoreStatusOpened { // model.StoreStatusDisabled { return nil, nil, fmt.Errorf("门店:%s状态是:%s", storeDetail.Name, model.StoreStatusName[storeDetail.Status]) } checkTime := time.Now() - if jxOrder.ExpectedDeliveredTime == nil { + if jxOrder.ExpectedDeliveredTimestamp == 0 { if storeDetail.Status != model.StoreStatusOpened { return nil, nil, fmt.Errorf("门店:%s不是营业状态,状态是:%s", storeDetail.Name, model.StoreStatusName[storeDetail.Status]) } } else { - checkTime = *jxOrder.ExpectedDeliveredTime + checkTime = utils.Timestamp2Time(jxOrder.ExpectedDeliveredTimestamp) + if checkTime.Sub(time.Now()) < DingShiDaMinTime { + return nil, nil, fmt.Errorf("预订单只能在1小时后") + } if utils.Time2Date(time.Now()).Sub(utils.Time2Date(checkTime)) > 24*time.Hour { return nil, nil, fmt.Errorf("预订单只能预定当天或第二天") } @@ -238,15 +336,23 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64 Count: v.Count, Price: int64(storeSkuBind.JxPrice), SalePrice: int64(storeSkuBind.JxPrice), // todo 考虑活动价 + Weight: sku.Weight, Name: jxutils.ComposeSkuName(sku.Prefix, sku.Name, sku.Comment, sku.Unit, sku.SpecQuality, sku.SpecUnit, 0), } outJxOrder.Skus = append(outJxOrder.Skus, jxSku) outJxOrder.OrderPrice += int64(v.Count) * jxSku.SalePrice + outJxOrder.Weight = v.Count * jxSku.Weight } } } - outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice - outJxOrder.ActualPayPrice = outJxOrder.TotalPrice + sort.Sort(JxSkuInfoList(outJxOrder.Skus)) + + if outJxOrder.FreightPrice, _, err = delivery.CalculateDeliveryFee(dao.GetDB(), jxOrder.StoreID, "", + jxutils.StandardCoordinate2Int(deliveryAddress.Lng), jxutils.StandardCoordinate2Int(deliveryAddress.Lat), + model.CoordinateTypeMars, outJxOrder.Weight, checkTime); err == nil { + outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice + outJxOrder.ActualPayPrice = outJxOrder.TotalPrice + } return outJxOrder, deliveryAddress, err } @@ -277,8 +383,8 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd } order.OrderCreatedAt = order.StatusTime order.VendorUserID = order.UserID - if jxOrder.ExpectedDeliveredTime != nil { - order.ExpectedDeliveredTime = *jxOrder.ExpectedDeliveredTime + if jxOrder.ExpectedDeliveredTimestamp == 0 { + order.ExpectedDeliveredTime = utils.Timestamp2Time(jxOrder.ExpectedDeliveredTimestamp) order.BusinessType = model.BusinessTypeDingshida } else { order.ExpectedDeliveredTime = utils.DefaultTimeValue diff --git a/business/partner/purchase/jx/localjx/order_test.go b/business/partner/purchase/jx/localjx/order_test.go index d9ee64cb1..6965e1146 100644 --- a/business/partner/purchase/jx/localjx/order_test.go +++ b/business/partner/purchase/jx/localjx/order_test.go @@ -3,10 +3,24 @@ package localjx import ( "testing" + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" + "git.rosy.net.cn/jx-callback/globals/testinit" ) +func init() { + testinit.Init() +} + func TestGenOrderNo(t *testing.T) { orderNo := GenOrderNo(jxcontext.AdminCtx) t.Log(orderNo) } + +func TestGetAvailableDeliverTime(t *testing.T) { + timeInfo, err := GetAvailableDeliverTime(jxcontext.AdminCtx, 100118) + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(timeInfo, false)) +} diff --git a/business/partner/purchase/jx/localjx/wxpay.go b/business/partner/purchase/jx/localjx/wxpay.go index 01ed71e43..6519d3edb 100644 --- a/business/partner/purchase/jx/localjx/wxpay.go +++ b/business/partner/purchase/jx/localjx/wxpay.go @@ -5,6 +5,7 @@ import ( "git.rosy.net.cn/baseapi/platformapi/wxpay" "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" @@ -30,6 +31,9 @@ func pay4OrderByWX(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp TimeStart: wxpay.Time2PayTime(payCreatedAt), // TimeExpire: wxpay.Time2PayTime(payCreatedAt.Add(PayWaitingTime)), } + if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini { + param.OpenID = authInfo.GetAuthID() + } result, err := api.WxpayAPI.CreateUnifiedOrder(param) if err == nil { orderPay = &model.OrderPay{ diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index c82145403..102837b7e 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -44,3 +44,17 @@ func (c *JxOrderController) Pay4Order() { return retVal, "", err }) } + +// @Title 查询网络打印机状态 +// @Description 查询网络打印机状态 +// @Param token header string true "认证token" +// @Param storeID query int true "门店ID" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetAvailableDeliverTime [get] +func (c *JxOrderController) GetAvailableDeliverTime() { + c.callGetAvailableDeliverTime(func(params *tJxorderGetAvailableDeliverTimeParams) (retVal interface{}, errCode string, err error) { + retVal, err = localjx.GetAvailableDeliverTime(params.Ctx, params.StoreID) + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index a36fc41ca..20f0c80d2 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -592,6 +592,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], + beego.ControllerComments{ + Method: "GetAvailableDeliverTime", + Router: `/GetAvailableDeliverTime`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"], beego.ControllerComments{ Method: "Pay4Order",