Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -2,6 +2,7 @@ package orderman
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
@@ -184,6 +185,26 @@ func (c *OrderManager) OnOrderMsg(order *model.GoodsOrder, vendorStatus, remark
|
||||
return err
|
||||
}
|
||||
|
||||
func setFakeOrderFlag(db *dao.DaoDB, order *model.GoodsOrder) {
|
||||
if order.DeliveryType == model.OrderDeliveryTypeSelfTake {
|
||||
if realMobile := jxutils.GetRealMobile4Order(order); realMobile != "" {
|
||||
if configList, err := dao.QueryConfigs(db, model.ConfigSysFakeOrderMobiles, model.ConfigTypeSys, ""); err == nil && len(configList) > 0 {
|
||||
isMatch := false
|
||||
mobileList := strings.Split(configList[0].Value, ",")
|
||||
for _, v := range mobileList {
|
||||
if v == realMobile {
|
||||
isMatch = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if isMatch {
|
||||
order.Flag |= model.OrderFlagMaskFake
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao.DaoDB) (isDuplicated bool, err error) {
|
||||
globals.SugarLogger.Debugf("SaveOrder orderID:%s, VendorStoreID:%s", order.VendorOrderID, order.VendorStoreID)
|
||||
// 忽略查找JX信息错误
|
||||
@@ -192,6 +213,7 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
|
||||
order.WaybillVendorID = model.VendorIDUnknown
|
||||
order.OrderFinishedAt = utils.DefaultTimeValue
|
||||
|
||||
setFakeOrderFlag(db, order)
|
||||
// cms.HandleOrder4Consignee(order)
|
||||
|
||||
dao.Begin(db)
|
||||
@@ -271,16 +293,11 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
||||
orderSkus := order.Skus
|
||||
|
||||
vendorSkuIDs := make([]int64, 0)
|
||||
skuIDMap := make(map[int]int)
|
||||
for _, v := range orderSkus {
|
||||
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
||||
if intVendorSkuID != 0 {
|
||||
vendorSkuIDs = append(vendorSkuIDs, intVendorSkuID)
|
||||
}
|
||||
|
||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||
skuIDMap[skuID] = 1
|
||||
}
|
||||
}
|
||||
if len(vendorSkuIDs) > 0 {
|
||||
tableName := "t2"
|
||||
@@ -311,17 +328,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
||||
skumapper[v.VendorSkuID] = v
|
||||
}
|
||||
|
||||
// var skuPriceMap map[int64]*dao.PromotionStoreSku
|
||||
var actStoreSkuMap *jxutils.ActStoreSkuMap
|
||||
if len(skuIDMap) > 0 {
|
||||
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
|
||||
return err
|
||||
}
|
||||
actStoreSkuMap = jxutils.NewActStoreSkuMap(actStoreSkuList, false)
|
||||
}
|
||||
|
||||
skuIDMap := make(map[int]int)
|
||||
for _, v := range orderSkus {
|
||||
v.VendorOrderID = order.VendorOrderID
|
||||
v.VendorID = order.VendorID
|
||||
@@ -342,12 +349,25 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
|
||||
}
|
||||
}
|
||||
|
||||
if actStoreSkuMap != nil {
|
||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||
v.EarningPrice = actStoreSku.EarningPrice
|
||||
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
|
||||
v.StoreSubID = actStoreSku.ActID
|
||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||
skuIDMap[skuID] = 1
|
||||
}
|
||||
}
|
||||
|
||||
if len(skuIDMap) > 0 {
|
||||
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
|
||||
return err
|
||||
}
|
||||
if actStoreSkuMap := jxutils.NewActStoreSkuMap(actStoreSkuList, false); actStoreSkuMap != nil {
|
||||
for _, v := range orderSkus {
|
||||
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
|
||||
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
|
||||
v.EarningPrice = actStoreSku.EarningPrice
|
||||
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
|
||||
v.StoreSubID = actStoreSku.ActID
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ func (c *OrderManager) replyOrderComment(orderComment *model.OrderComment) (err
|
||||
content := config.comments[rand.Intn(len(config.comments))]
|
||||
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, delaySeconds:%d, content:%s", orderComment.VendorOrderID, delaySeconds, content)
|
||||
utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() {
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(orderComment.VendorID); handler != nil {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderComment.VendorID); handler != nil {
|
||||
if err = handler.ReplyOrderComment(jxcontext.AdminCtx, orderComment, content); err != nil {
|
||||
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, error:%v", orderComment.VendorOrderID, err)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ type StoresOrderSaleInfo struct {
|
||||
EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int, isIncludeFake bool) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%d", storeID)
|
||||
if lastHours > maxLastHours {
|
||||
lastHours = maxLastHours
|
||||
@@ -52,14 +52,24 @@ func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, l
|
||||
}
|
||||
|
||||
db := dao.GetDB()
|
||||
err = dao.GetRows(db, &countInfo, `
|
||||
sql := `
|
||||
SELECT t1.lock_status, t1.status, COUNT(*) count
|
||||
FROM goods_order t1
|
||||
WHERE t1.vendor_id <> 2 AND IF(t1.vendor_id = ?, t1.store_id, IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) ) = ?
|
||||
AND t1.order_created_at >= ?
|
||||
AND t1.order_created_at >= ?`
|
||||
sqlParams := []interface{}{
|
||||
model.VendorIDWSC,
|
||||
storeID,
|
||||
time.Now().Add(-time.Duration(lastHours) * time.Hour),
|
||||
}
|
||||
if !isIncludeFake {
|
||||
sql += " AND (t1.flag & ?) = 0"
|
||||
sqlParams = append(sqlParams, model.OrderFlagMaskFake)
|
||||
}
|
||||
sql += `
|
||||
GROUP BY 1,2
|
||||
ORDER BY 1,2
|
||||
`, model.VendorIDWSC, storeID, time.Now().Add(-time.Duration(lastHours)*time.Hour))
|
||||
ORDER BY 1,2`
|
||||
err = dao.GetRows(db, &countInfo, sql, sqlParams...)
|
||||
if err == nil {
|
||||
return countInfo, nil
|
||||
}
|
||||
@@ -133,7 +143,7 @@ func (c *OrderManager) GetOrderInfo(ctx *jxcontext.Context, vendorOrderID string
|
||||
if err == nil && num > 0 {
|
||||
order = orders[0]
|
||||
if isRefresh && vendorID == model.VendorIDJD {
|
||||
tmpOrder, err2 := partner.GetPurchasePlatformFromVendorID(vendorID).GetOrder(vendorOrderID)
|
||||
tmpOrder, err2 := partner.GetPurchaseOrderHandlerFromVendorID(vendorID).GetOrder(vendorOrderID)
|
||||
if err = err2; err == nil {
|
||||
order.CurrentConsigneeMobile = tmpOrder.ConsigneeMobile
|
||||
} else {
|
||||
@@ -219,7 +229,7 @@ func (c *OrderManager) ExportMTWaybills(ctx *jxcontext.Context, fromDateStr, toD
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, fromDateStr, toDateStr string, isDateFinish bool, params map[string]interface{}, offset, pageSize int) (orders []*model.GoodsOrderExt, totalCount int, err error) {
|
||||
func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku, isIncludeFake bool, fromDateStr, toDateStr string, isDateFinish bool, params map[string]interface{}, offset, pageSize int) (orders []*model.GoodsOrderExt, totalCount int, err error) {
|
||||
globals.SugarLogger.Debugf("getOrders from:%s to:%s", fromDateStr, toDateStr)
|
||||
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
@@ -359,6 +369,10 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from
|
||||
sqlParams = append(sqlParams, cities)
|
||||
}
|
||||
}
|
||||
if !isIncludeFake {
|
||||
sqlWhere += " AND (t1.flag & ?) = 0"
|
||||
sqlParams = append(sqlParams, model.OrderFlagMaskFake)
|
||||
}
|
||||
}
|
||||
if params["vendorIDs"] != nil {
|
||||
var vendorIDs []int
|
||||
@@ -398,9 +412,9 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from
|
||||
return orders, totalCount, err
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr string, isDateFinish bool, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||
func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fromDateStr, toDateStr string, isDateFinish bool, params map[string]interface{}, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||
globals.SugarLogger.Debugf("GetOrders from:%s to:%s", fromDateStr, toDateStr)
|
||||
orders, totalCount, err := c.getOrders(ctx, false, fromDateStr, toDateStr, isDateFinish, params, offset, pageSize)
|
||||
orders, totalCount, err := c.getOrders(ctx, false, isIncludeFake, fromDateStr, toDateStr, isDateFinish, params, offset, pageSize)
|
||||
if err == nil {
|
||||
pagedInfo = &model.PagedInfo{
|
||||
TotalCount: totalCount,
|
||||
@@ -422,7 +436,7 @@ func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateS
|
||||
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
switch step {
|
||||
case 0:
|
||||
orders, _, err = c.getOrders(ctx, true, fromDateStr, toDateStr, true, mapParams, 0, -1)
|
||||
orders, _, err = c.getOrders(ctx, true, true, fromDateStr, toDateStr, true, mapParams, 0, -1)
|
||||
case 1:
|
||||
afsSkuMap, err = c.getAfsOrderSkuInfo4ExportOrders(ctx, fromDateStr, toDateStr)
|
||||
case 2:
|
||||
@@ -1113,7 +1127,7 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
|
||||
task1 := tasksch.NewParallelTask("AmendMissingOrders ListOrders", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorDate := batchItemList[0].(*tDateVendorPair)
|
||||
if handler, _ := partner.GetPurchasePlatformFromVendorID(vendorDate.VendorID).(partner.IPurchasePlatformStoreSkuHandler); handler != nil {
|
||||
if handler, _ := partner.GetPurchaseOrderHandlerFromVendorID(vendorDate.VendorID).(partner.IPurchasePlatformStoreSkuHandler); handler != nil {
|
||||
orderIDs, err2 := handler.ListOrders(ctx, task, vendorDate.QueryDate, vendorStoreIDMap[vendorDate.VendorID])
|
||||
if err = err2; err == nil && len(orderIDs) > 0 {
|
||||
var orderList []*tOrderVendorPair
|
||||
@@ -1152,7 +1166,7 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
|
||||
task2 := tasksch.NewParallelTask("AmendMissingOrders GetOrders", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
pair := batchItemList[0].(*tOrderVendorPair)
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(pair.VendorID); handler != nil {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil {
|
||||
order, err2 := handler.GetOrder(pair.VendorOrderID)
|
||||
if err = err2; err == nil {
|
||||
isDuplicated, err2 := c.SaveOrder(order, false, dao.GetDB())
|
||||
@@ -1204,7 +1218,7 @@ func (c *OrderManager) RefreshOrderFinancial(ctx *jxcontext.Context, fromTime, t
|
||||
task := tasksch.NewParallelTask("RefreshOrderFinancial", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
order := batchItemList[0].(*model.GoodsOrder)
|
||||
handler := partner.GetPurchasePlatformFromVendorID(order.VendorID)
|
||||
handler := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID)
|
||||
if handler != nil {
|
||||
remoteOrder, err2 := handler.GetOrder(order.VendorOrderID)
|
||||
if err = err2; err == nil {
|
||||
|
||||
@@ -23,7 +23,7 @@ func (c *BaseScheduler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusNew {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogErrorWithInfo(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).AcceptOrRefuseOrder(order, isAcceptIt, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).AcceptOrRefuseOrder(order, isAcceptIt, userName)
|
||||
}, "AcceptOrRefuseOrder orderID:%s, isAcceptIt:%t", order.VendorOrderID, isAcceptIt)
|
||||
}
|
||||
} else {
|
||||
@@ -38,7 +38,7 @@ func (c *BaseScheduler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bool
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusAccepted {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogErrorWithInfo(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).PickupGoods(order, isSelfDelivery, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).PickupGoods(order, isSelfDelivery, userName)
|
||||
}, "PickupGoods orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
@@ -58,7 +58,7 @@ func (c *BaseScheduler) Swtich2SelfDeliver(order *model.GoodsOrder, userName str
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status >= model.OrderStatusFinishedPickup && order.Status <= model.OrderStatusDelivering {
|
||||
if order.DeliveryFlag&model.OrderDeliveryFlagMaskPurcahseDisabled == 0 && c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogErrorWithInfo(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).Swtich2SelfDeliver(order, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).Swtich2SelfDeliver(order, userName)
|
||||
}, "Swtich2SelfDeliver orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
if err == nil { // 因为有些平台转自送后,不会再发送订单在配送中消息过来,所以成功后就强制设置状态为配送中
|
||||
@@ -83,7 +83,7 @@ func (c *BaseScheduler) Swtich2SelfDelivered(order *model.GoodsOrder, userName s
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusDelivering {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).Swtich2SelfDelivered(order, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).Swtich2SelfDelivered(order, userName)
|
||||
}, "Swtich2SelfDelivered orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
@@ -103,7 +103,7 @@ func (c *BaseScheduler) SelfDeliverDelivering(order *model.GoodsOrder, userName
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusFinishedPickup {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelivering(order, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivering(order, userName)
|
||||
}, "SelfDeliverDelivering orderID:%s", order.VendorOrderID)
|
||||
if err == nil { // 因为有些平台设置配送中后,不会发送订单在配送中消息过来,所以成功后就强制设置状态为配送中
|
||||
order.Status = model.OrderStatusDelivering
|
||||
@@ -127,7 +127,7 @@ func (c *BaseScheduler) SelfDeliverDelivered(order *model.GoodsOrder, userName s
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusDelivering {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return partner.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelivered(order, userName)
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivered(order, userName)
|
||||
}, "SelfDeliverDelivered orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"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/purchase/jd"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
@@ -131,21 +132,21 @@ func (c *BaseScheduler) GetStoreDeliveryType(order *model.GoodsOrder, storeMap *
|
||||
|
||||
func (c *BaseScheduler) AdjustOrder(ctx *jxcontext.Context, order *model.GoodsOrder, removedSkuList []*model.OrderSku, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).AdjustOrder(ctx, order, removedSkuList, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).AdjustOrder(ctx, order, removedSkuList, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CancelOrder(ctx, order, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).CancelOrder(ctx, order, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) AcceptOrRefuseFailedGetOrder(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).AcceptOrRefuseFailedGetOrder(ctx, order, isAcceptIt)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).AcceptOrRefuseFailedGetOrder(ctx, order, isAcceptIt)
|
||||
}
|
||||
if err == nil {
|
||||
flag := model.OrderFlagAgreeFailedGetGoods
|
||||
@@ -159,7 +160,7 @@ func (c *BaseScheduler) AcceptOrRefuseFailedGetOrder(ctx *jxcontext.Context, ord
|
||||
|
||||
func (c *BaseScheduler) CallPMCourier(ctx *jxcontext.Context, order *model.GoodsOrder) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CallCourier(ctx, order)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).CallCourier(ctx, order)
|
||||
}
|
||||
if err == nil {
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, model.OrderFlagMaskCallPMCourier)
|
||||
@@ -169,7 +170,7 @@ func (c *BaseScheduler) CallPMCourier(ctx *jxcontext.Context, order *model.Goods
|
||||
|
||||
func (c *BaseScheduler) ConfirmReceiveGoods(ctx *jxcontext.Context, order *model.GoodsOrder) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).ConfirmReceiveGoods(ctx, order)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).ConfirmReceiveGoods(ctx, order)
|
||||
}
|
||||
if err == nil {
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, model.OrderFlagMaskFailedDeliver)
|
||||
@@ -179,7 +180,7 @@ func (c *BaseScheduler) ConfirmReceiveGoods(ctx *jxcontext.Context, order *model
|
||||
|
||||
func (c *BaseScheduler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).AgreeOrRefuseCancel(ctx, order, isAcceptIt, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).AgreeOrRefuseCancel(ctx, order, isAcceptIt, reason)
|
||||
}
|
||||
if err == nil {
|
||||
flag := model.OrderFlagAgreeUserApplyCancel
|
||||
@@ -203,7 +204,7 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s
|
||||
afsOrder, err := partner.CurOrderManager.LoadAfsOrder(afsOrderID, vendorID)
|
||||
if err == nil {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(vendorID).AgreeOrRefuseRefund(ctx, afsOrder, approveType, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(vendorID).AgreeOrRefuseRefund(ctx, afsOrder, approveType, reason)
|
||||
}
|
||||
if err == nil {
|
||||
flag := model.AfsOrderFlagAgreeUserRefund
|
||||
@@ -222,7 +223,7 @@ func (c *BaseScheduler) ConfirmReceivedReturnGoods(ctx *jxcontext.Context, afsOr
|
||||
afsOrder, err := partner.CurOrderManager.LoadAfsOrder(afsOrderID, vendorID)
|
||||
if err == nil {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(vendorID).ConfirmReceivedReturnGoods(ctx, afsOrder)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(vendorID).ConfirmReceivedReturnGoods(ctx, afsOrder)
|
||||
}
|
||||
if err == nil {
|
||||
dao.SetAfsOrderFlag(dao.GetDB(), ctx.GetUserName(), afsOrderID, vendorID, model.AfsOrderFlagMaskReturnGoods)
|
||||
@@ -233,30 +234,33 @@ func (c *BaseScheduler) ConfirmReceivedReturnGoods(ctx *jxcontext.Context, afsOr
|
||||
|
||||
func (c *BaseScheduler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).PartRefundOrder(ctx, order, refundSkuList, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).PartRefundOrder(ctx, order, refundSkuList, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) RefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error) {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).RefundOrder(ctx, order, reason)
|
||||
err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).RefundOrder(ctx, order, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) ConfirmSelfTake(ctx *jxcontext.Context, vendorOrderID string, vendorID int, selfTakeCode string) (err error) {
|
||||
if vendorID != model.VendorIDJD {
|
||||
return fmt.Errorf("当前只支持%s平台订单", model.VendorChineseNames[model.VendorIDJD])
|
||||
}
|
||||
if selfTakeCode == "135246" {
|
||||
if selfTakeCode, err = jd.CurPurchaseHandler.GetSelfTakeCode(ctx, vendorOrderID); err != nil {
|
||||
return fmt.Errorf("获取订单:%s自提货码失败,原始错误:%s", vendorOrderID, err.Error())
|
||||
}
|
||||
if selfTakeCode == "" {
|
||||
return fmt.Errorf("订单:%s看起来不是一个自提订单,如果确认是自提订单,请联系开发", vendorOrderID)
|
||||
if vendorID == model.VendorIDJD {
|
||||
if selfTakeCode == "135246" {
|
||||
if selfTakeCode, err = jd.CurPurchaseHandler.GetSelfTakeCode(ctx, vendorOrderID); err != nil {
|
||||
return fmt.Errorf("获取订单:%s自提货码失败,原始错误:%s", vendorOrderID, err.Error())
|
||||
}
|
||||
if selfTakeCode == "" {
|
||||
return fmt.Errorf("订单:%s看起来不是一个自提订单,如果确认是自提订单,请联系开发", vendorOrderID)
|
||||
}
|
||||
}
|
||||
err = jd.CurPurchaseHandler.ConfirmSelfTake(ctx, vendorOrderID, selfTakeCode)
|
||||
} else if vendorID == model.VendorIDJX {
|
||||
err = jx.CurPurchaseHandler.ConfirmSelfTake(ctx, vendorOrderID, selfTakeCode)
|
||||
} else {
|
||||
err = fmt.Errorf("自提核销不支持%s平台订单", model.VendorChineseNames[vendorID])
|
||||
}
|
||||
err = jd.CurPurchaseHandler.ConfirmSelfTake(ctx, vendorOrderID, selfTakeCode)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ func init() {
|
||||
partner.CurOrderManager.OnOrderMsg(order, "自动接单失败", err.Error())
|
||||
// 为了解决京东新消息与接单消息乱序的问题
|
||||
if errWithCode, ok := err.(*utils.ErrorWithCode); ok && errWithCode.Level() == 1 && errWithCode.IntCode() == -1 {
|
||||
if order2, err2 := partner.GetPurchasePlatformFromVendorID(order.VendorID).GetOrder(order.VendorOrderID); err2 == nil && order2.Status > order.Status {
|
||||
if order2, err2 := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).GetOrder(order.VendorOrderID); err2 == nil && order2.Status > order.Status {
|
||||
order.Status = order2.Status
|
||||
jxutils.CallMsgHandlerAsync(func() {
|
||||
sch.OnOrderStatusChanged(order, model.Order2Status(order2), false)
|
||||
@@ -350,6 +350,12 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod
|
||||
s.orderMap.Delete(jxutils.GetUniversalOrderIDFromOrderStatus(status))
|
||||
}
|
||||
}
|
||||
if !isPending {
|
||||
if status.Status == model.OrderStatusAgreeFailedGetGoods || status.Status == model.OrderStatusDeliverFailed {
|
||||
s.updateOrderByBill(order, nil, true)
|
||||
s.removeWaybillFromMap(savedOrderInfo, order.VendorID)
|
||||
}
|
||||
}
|
||||
}
|
||||
if order.LockStatus != model.OrderStatusUnknown {
|
||||
s.stopTimer(savedOrderInfo)
|
||||
@@ -795,6 +801,8 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa
|
||||
})
|
||||
}
|
||||
globals.SugarLogger.Debugf("resetTimer, orderID:%s, statusType:%d, status:%d, timeout:%v", order.VendorOrderID, statusType, status, timeout)
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("resetTimer, orderID:%s, statusType:%d, status:%d, should not set timer", order.VendorOrderID, statusType, status)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("resetTimer bypass2, orderID:%s statusType:%d status:%v, config:%s", order.VendorOrderID, statusType, status, utils.Format4Output(config, true))
|
||||
@@ -856,7 +864,7 @@ func (s *DefScheduler) mergeOrderStatusConfig(savedOrderInfo *WatchOrderInfo, st
|
||||
}
|
||||
}
|
||||
if vendorActionParams == nil {
|
||||
vendorActionParams = partner.GetPurchasePlatformFromVendorID(order.VendorID).GetStatusActionTimeout(order, statusType, status)
|
||||
vendorActionParams = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).GetStatusActionTimeout(order, statusType, status)
|
||||
}
|
||||
// 自动拣货TIMER
|
||||
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusAccepted {
|
||||
@@ -905,6 +913,7 @@ func (s *DefScheduler) mergeOrderStatusConfig(savedOrderInfo *WatchOrderInfo, st
|
||||
}
|
||||
|
||||
func (s *DefScheduler) handleAutoAcceptOrder(orderID string, vendorID int, userMobile string, jxStoreID int, db orm.Ormer, handler func(accepted bool) error) int {
|
||||
globals.SugarLogger.Debugf("handleAutoAcceptOrder order:%s, vendorID:%d", orderID, vendorID)
|
||||
handleType := 0
|
||||
if userMobile != "" {
|
||||
if db == nil {
|
||||
@@ -915,17 +924,17 @@ func (s *DefScheduler) handleAutoAcceptOrder(orderID string, vendorID int, userM
|
||||
}
|
||||
if err := db.Read(user, "Mobile"); err != nil {
|
||||
if err != orm.ErrNoRows {
|
||||
globals.SugarLogger.Errorf("read data error:%v, data:%v, vendorID:%d", err, user, vendorID)
|
||||
globals.SugarLogger.Errorf("handleAutoAcceptOrder orderID:%s, read data error:%v, data:%v, vendorID:%d", orderID, err, user, vendorID)
|
||||
}
|
||||
// 在访问数据库出错的情况下,也需要自动接单
|
||||
handleType = 1
|
||||
} else {
|
||||
// 强制拒单
|
||||
globals.SugarLogger.Infof("force reject order:%s, vendorID:%d", orderID, vendorID)
|
||||
globals.SugarLogger.Infof("handleAutoAcceptOrder force reject order:%s, vendorID:%d", orderID, vendorID)
|
||||
handleType = -1
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("order:%s, vendorID:%d, mobile is empty, should accept order", orderID, vendorID)
|
||||
globals.SugarLogger.Infof("handleAutoAcceptOrder order:%s, vendorID:%d, mobile is empty, should accept order", orderID, vendorID)
|
||||
handleType = 1
|
||||
}
|
||||
if handleType == 1 {
|
||||
@@ -1020,7 +1029,7 @@ func (s *DefScheduler) handleWaybillTip(savedOrderInfo *WatchOrderInfo) {
|
||||
if !utils.IsTimeZero(savedOrderInfo.pmWaybillCreatedAt) &&
|
||||
!savedOrderInfo.isAddWaybillTipDisabled {
|
||||
if tipFee := s.getWaybillTip(savedOrderInfo); tipFee > 0 {
|
||||
if handler, ok := partner.GetPurchasePlatformFromVendorID(order.VendorID).(partner.IAddWaybillTip); ok && handler != nil {
|
||||
if handler, ok := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).(partner.IAddWaybillTip); ok && handler != nil {
|
||||
var remark string
|
||||
vendorStatus := fmt.Sprintf("设置小费:%s", jxutils.IntPrice2StandardCurrencyString(tipFee))
|
||||
if curTipFee, err := handler.GetWaybillTip(jxcontext.AdminCtx, order); err == nil {
|
||||
|
||||
@@ -196,7 +196,7 @@ func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, ms
|
||||
for _, v := range receiveMsgUsersMap[msgType] {
|
||||
user, err2 := dao.GetUserByID(db, "name", v)
|
||||
if err2 == nil {
|
||||
msg.SendUserMessage(dingdingapi.MsgTyeText, user.GetID(), msgType, msgContent)
|
||||
msg.SendUserMessage(dingdingapi.MsgTyeText, user, msgType, msgContent)
|
||||
} else if err == nil {
|
||||
err = err2
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
||||
@@ -99,14 +99,6 @@ var (
|
||||
"11:00:00",
|
||||
"15:00:00",
|
||||
}
|
||||
|
||||
mobileGroupMap = map[string]map[string]int{
|
||||
"18650801532": map[string]int{ // 陈磊
|
||||
"13540967462": 1, // 蒋龙丹
|
||||
"13708196093": 1, // 顾子杭
|
||||
"13980795039": 1, // 赵凌兰
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// todo 门店绑定信息可以考虑以数组形式返回,而不是现在这样
|
||||
@@ -1537,9 +1529,9 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
|
||||
}
|
||||
curSnapshotMap := make(map[string]*model.VendorStoreSnapshot)
|
||||
curSnapshotMap2 := make(map[int]map[int]*model.VendorStoreSnapshot)
|
||||
alarmSnapshotMap := make(map[int][]*model.VendorStoreSnapshot)
|
||||
curSnapshotGroupMap := make(map[int][]*model.VendorStoreSnapshot)
|
||||
|
||||
alarmSnapshotMap := make(map[int][]*model.VendorStoreSnapshot)
|
||||
txtAlarmSnapshotMap := make(map[int][]*model.VendorStoreSnapshot)
|
||||
// 之前是开店当前是关店的,或营业时间缩短的
|
||||
for _, v := range curSnapshotList {
|
||||
@@ -1579,6 +1571,7 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
|
||||
|
||||
db := dao.GetDB()
|
||||
storeDetailMap := make(map[int]*dao.StoreDetail)
|
||||
userMap2 := make(map[string]*model.User)
|
||||
userMap := make(map[string]map[int]int)
|
||||
userMapTxt := make(map[string][]*model.VendorStoreSnapshot)
|
||||
for storeID, list := range alarmSnapshotMap {
|
||||
@@ -1586,132 +1579,126 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
|
||||
if storeDetail != nil {
|
||||
storeDetailMap[storeID] = storeDetail
|
||||
|
||||
// userList, _ := GetRoleUserList(ctx, autils.NewStoreBossRole(storeID))
|
||||
// for _, mobile := range []string{storeDetail.Tel1, storeDetail.MarketManPhone, storeDetail.OperatorPhone} {
|
||||
// if mobile != "" {
|
||||
// if user, err2 := dao.GetUserByID(db, "mobile", mobile); err2 == nil {
|
||||
// userList = append(userList, user.GetID())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for _, userID := range userList {
|
||||
// if userID != "" {
|
||||
// if userMap[userID] == nil {
|
||||
// userMap[userID] = make(map[int]int)
|
||||
// }
|
||||
// userMap[userID][storeID] = 1
|
||||
// if txtAlarmSnapshotMap[storeID] != nil {
|
||||
// userMapTxt[userID] = append(userMapTxt[userID], txtAlarmSnapshotMap[storeID]...)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
for _, mobile := range []string{storeDetail.Tel1, storeDetail.MarketManPhone, storeDetail.OperatorPhone} {
|
||||
var userList []*model.User
|
||||
if roleUserIDList, err := GetRoleUserList(ctx, autils.NewStoreBossRole(storeID)); err == nil && len(roleUserIDList) > 0 {
|
||||
userList, _, _ = dao.GetUsers(db, 0, "", roleUserIDList, "", "", 0, -1)
|
||||
}
|
||||
for _, mobile := range []string{storeDetail.Tel1, storeDetail.Tel2, storeDetail.MarketManPhone, storeDetail.OperatorPhone} {
|
||||
if mobile != "" {
|
||||
if userMap[mobile] == nil {
|
||||
userMap[mobile] = make(map[int]int)
|
||||
if user, err2 := dao.GetUserByID(db, "mobile", mobile); err2 == nil {
|
||||
userList = append(userList, user)
|
||||
}
|
||||
userMap[mobile][storeID] = 1
|
||||
|
||||
}
|
||||
}
|
||||
processedUser := make(map[string]int)
|
||||
for _, user := range userList {
|
||||
userID := user.GetID()
|
||||
if processedUser[userID] == 0 {
|
||||
processedUser[userID] = 1
|
||||
if userMap[userID] == nil {
|
||||
userMap[userID] = make(map[int]int)
|
||||
userMap2[userID] = user
|
||||
}
|
||||
userMap[userID][storeID] = 1
|
||||
if txtAlarmSnapshotMap[storeID] != nil {
|
||||
userMapTxt[mobile] = append(userMapTxt[mobile], txtAlarmSnapshotMap[storeID]...)
|
||||
userMapTxt[userID] = append(userMapTxt[userID], txtAlarmSnapshotMap[storeID]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var mobileList []string
|
||||
for mobile := range userMap {
|
||||
if mobile != "" && !shouldSkipMobile4SendStoreStatusInfo(mobile) {
|
||||
mobileList = append(mobileList, mobile)
|
||||
}
|
||||
var userList []*model.User
|
||||
for _, user := range userMap2 {
|
||||
userList = append(userList, user)
|
||||
}
|
||||
|
||||
if len(mobileList) > 0 {
|
||||
if len(userList) > 0 {
|
||||
const fixTitle = "门店状态变化"
|
||||
title := fmt.Sprintf("%s:%s-->%s", fixTitle, utils.Time2Str(prevSnapshotList[0].SnapshotAt), utils.Time2Str(curSnapshotList[0].SnapshotAt))
|
||||
task := tasksch.NewParallelTask("SendAlarmVendorSnapshot", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
mobile := batchItemList[0].(string)
|
||||
var dataList []map[string]interface{}
|
||||
captionList := []string{"京西门店ID", "门店名", "城市"}
|
||||
isFirstRow := true
|
||||
for storeID := range userMap[mobile] {
|
||||
prevAlarmMap := prevSnapshotMap2[storeID]
|
||||
curAlarmMap := curSnapshotMap2[storeID]
|
||||
data := map[string]interface{}{
|
||||
"京西门店ID": storeID,
|
||||
"门店名": storeDetailMap[storeID].Store.Name,
|
||||
"城市": storeDetailMap[storeID].CityName,
|
||||
}
|
||||
for _, vendorID := range []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM} {
|
||||
if isFirstRow {
|
||||
captionList = append(captionList, model.VendorChineseNames[vendorID]+"ID",
|
||||
model.VendorChineseNames[vendorID]+"之前状态", model.VendorChineseNames[vendorID]+"当前状态",
|
||||
model.VendorChineseNames[vendorID]+"之前营业时间", model.VendorChineseNames[vendorID]+"当前营业时间")
|
||||
user := batchItemList[0].(*model.User)
|
||||
var excelURL string
|
||||
if user.Type&model.UserTypeOperator != 0 {
|
||||
var dataList []map[string]interface{}
|
||||
captionList := []string{"京西门店ID", "门店名", "城市"}
|
||||
isFirstRow := true
|
||||
for storeID := range userMap[user.GetID()] {
|
||||
prevAlarmMap := prevSnapshotMap2[storeID]
|
||||
curAlarmMap := curSnapshotMap2[storeID]
|
||||
data := map[string]interface{}{
|
||||
"京西门店ID": storeID,
|
||||
"门店名": storeDetailMap[storeID].Store.Name,
|
||||
"城市": storeDetailMap[storeID].CityName,
|
||||
}
|
||||
if prevAlarmMap != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = ""
|
||||
if prevSnapshot := prevAlarmMap[vendorID]; prevSnapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = prevSnapshot.VendorStoreID
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = model.StoreStatusName[prevSnapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = jxutils.OperationTimeStr4VendorStore(prevSnapshot)
|
||||
if snapshot := curSnapshotMap[prevSnapshot.GenMapKey()]; snapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = model.StoreStatusName[snapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = jxutils.OperationTimeStr4VendorStore(snapshot)
|
||||
}
|
||||
} else {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = ""
|
||||
for _, vendorID := range []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM} {
|
||||
if isFirstRow {
|
||||
captionList = append(captionList, model.VendorChineseNames[vendorID]+"ID",
|
||||
model.VendorChineseNames[vendorID]+"之前状态", model.VendorChineseNames[vendorID]+"当前状态",
|
||||
model.VendorChineseNames[vendorID]+"之前营业时间", model.VendorChineseNames[vendorID]+"当前营业时间")
|
||||
}
|
||||
} else if curAlarmMap != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = ""
|
||||
if curSnapshot := curAlarmMap[vendorID]; curSnapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = curSnapshot.VendorStoreID
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = model.StoreStatusName[curSnapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = jxutils.OperationTimeStr4VendorStore(curSnapshot)
|
||||
} else {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = ""
|
||||
if prevAlarmMap != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = ""
|
||||
if prevSnapshot := prevAlarmMap[vendorID]; prevSnapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = prevSnapshot.VendorStoreID
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = model.StoreStatusName[prevSnapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = jxutils.OperationTimeStr4VendorStore(prevSnapshot)
|
||||
if snapshot := curSnapshotMap[prevSnapshot.GenMapKey()]; snapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = model.StoreStatusName[snapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = jxutils.OperationTimeStr4VendorStore(snapshot)
|
||||
}
|
||||
} else {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = ""
|
||||
}
|
||||
} else if curAlarmMap != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"之前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"之前营业时间"] = ""
|
||||
if curSnapshot := curAlarmMap[vendorID]; curSnapshot != nil {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = curSnapshot.VendorStoreID
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = model.StoreStatusName[curSnapshot.Status]
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = jxutils.OperationTimeStr4VendorStore(curSnapshot)
|
||||
} else {
|
||||
data[model.VendorChineseNames[vendorID]+"ID"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"当前状态"] = ""
|
||||
data[model.VendorChineseNames[vendorID]+"当前营业时间"] = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dataList = append(dataList, data)
|
||||
dataList = append(dataList, data)
|
||||
|
||||
isFirstRow = false
|
||||
}
|
||||
excelConf := &excel.Obj2ExcelSheetConfig{
|
||||
Title: fixTitle,
|
||||
Data: dataList,
|
||||
CaptionList: captionList,
|
||||
}
|
||||
excelBin := excel.Obj2Excel([]*excel.Obj2ExcelSheetConfig{excelConf})
|
||||
keyPart := []string{
|
||||
"store_status",
|
||||
mobile,
|
||||
time.Now().Format("20060102T150405") + ".xlsx",
|
||||
}
|
||||
key := "export/" + strings.Join(keyPart, "_")
|
||||
excelURL, err2 := jxutils.UploadExportContent(excelBin, key)
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Warnf("SendAlarmVendorSnapshot, send %s failed with error:%v", key, err2)
|
||||
}
|
||||
|
||||
var txtAlarm []string
|
||||
for _, v := range userMapTxt[mobile] {
|
||||
curSnapshot := curSnapshotMap[v.GenMapKey()]
|
||||
storeDetail := storeDetailMap[v.StoreID]
|
||||
curStoreStatus := "无店"
|
||||
curOpTimeStr := "无店"
|
||||
if curSnapshot != nil {
|
||||
curStoreStatus = model.StoreStatusName[curSnapshot.Status]
|
||||
curOpTimeStr = jxutils.OperationTimeStr4VendorStore(curSnapshot)
|
||||
isFirstRow = false
|
||||
}
|
||||
txtAlarm = append(txtAlarm, fmt.Sprintf(`## 门店: %s(%d)
|
||||
excelConf := &excel.Obj2ExcelSheetConfig{
|
||||
Title: fixTitle,
|
||||
Data: dataList,
|
||||
CaptionList: captionList,
|
||||
}
|
||||
excelBin := excel.Obj2Excel([]*excel.Obj2ExcelSheetConfig{excelConf})
|
||||
keyPart := []string{
|
||||
"store_status",
|
||||
user.GetMobile(),
|
||||
time.Now().Format("20060102T150405") + ".xlsx",
|
||||
}
|
||||
key := "export/" + strings.Join(keyPart, "_")
|
||||
excelURL, err = jxutils.UploadExportContent(excelBin, key)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Warnf("SendAlarmVendorSnapshot, %s upload %s failed with error:%v", user.GetName(), key, err)
|
||||
}
|
||||
var txtAlarm []string
|
||||
|
||||
for _, v := range userMapTxt[user.GetID()] {
|
||||
curSnapshot := curSnapshotMap[v.GenMapKey()]
|
||||
storeDetail := storeDetailMap[v.StoreID]
|
||||
curStoreStatus := "无店"
|
||||
curOpTimeStr := "无店"
|
||||
if curSnapshot != nil {
|
||||
curStoreStatus = model.StoreStatusName[curSnapshot.Status]
|
||||
curOpTimeStr = jxutils.OperationTimeStr4VendorStore(curSnapshot)
|
||||
}
|
||||
txtAlarm = append(txtAlarm, fmt.Sprintf(`## 门店: %s(%d)
|
||||
- 城市: %s
|
||||
- 平台: %s
|
||||
- 平台ID: %s
|
||||
@@ -1720,33 +1707,33 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
|
||||
- 之前营业时间: %s
|
||||
- 当前营业时间: %s
|
||||
`, storeDetail.Store.Name, v.StoreID, storeDetail.CityName, model.VendorChineseNames[v.VendorID], v.VendorStoreID, model.StoreStatusName[v.Status], curStoreStatus, jxutils.OperationTimeStr4VendorStore(v), curOpTimeStr))
|
||||
}
|
||||
alarmTextStr := "# " + title + " \n" + fmt.Sprintf("[详情点我](%s/billshow/?normal=true&path=%s) \n", globals.BackstageHost, excelURL) + strings.Join(txtAlarm, " \n")
|
||||
sendStoreStatusInfo2Mobile(user, dingdingapi.MsgTypeMarkdown, title, alarmTextStr)
|
||||
} else if len(userMapTxt[user.GetID()]) > 0 {
|
||||
var txtAlarm []string
|
||||
for _, v := range userMapTxt[user.GetID()] {
|
||||
curSnapshot := curSnapshotMap[v.GenMapKey()]
|
||||
// storeDetail := storeDetailMap[v.StoreID]
|
||||
curStoreStatus := "下线"
|
||||
if curSnapshot != nil {
|
||||
curStoreStatus = model.StoreStatusName[curSnapshot.Status]
|
||||
}
|
||||
txtAlarm = append(txtAlarm, fmt.Sprintf("您的门店:%s,平台:%s,%s了", v.StoreName, model.VendorChineseNames[v.VendorID], curStoreStatus))
|
||||
}
|
||||
alarmTextStr := strings.Join(txtAlarm, ",\n")
|
||||
sendStoreStatusInfo2Mobile(user, dingdingapi.MsgTyeText, title, alarmTextStr)
|
||||
}
|
||||
alarmTextStr := "# " + title + " \n" + fmt.Sprintf("[详情点我](%s/billshow/?normal=true&path=%s) \n", globals.BackstageHost, excelURL) + strings.Join(txtAlarm, " \n")
|
||||
sendStoreStatusInfo2Mobile(mobile, title, alarmTextStr)
|
||||
return nil, nil
|
||||
}, mobileList)
|
||||
}, userList)
|
||||
tasksch.HandleTask(task, parentTask, true).Run()
|
||||
_, err = task.GetResult(0)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func shouldSkipMobile4SendStoreStatusInfo(mobile string) bool {
|
||||
return userProvider.GetUser(mobile, auth2.AuthTypeMobile) == nil
|
||||
}
|
||||
|
||||
func sendStoreStatusInfo2Mobile(mobile, title, txtAlarm string) {
|
||||
mobileList := []string{mobile}
|
||||
for mobile := range mobileGroupMap[mobile] {
|
||||
mobileList = append(mobileList, mobile)
|
||||
}
|
||||
|
||||
for _, mobile := range mobileList {
|
||||
if user := userProvider.GetUser(mobile, auth2.AuthTypeMobile); user != nil {
|
||||
globals.SugarLogger.Debugf("sendStoreStatusInfo2Mobile %s, txtAlarm:\n%s", mobile, txtAlarm)
|
||||
msg.SendUserMessage(dingdingapi.MsgTypeMarkdown, user.GetID(), title, txtAlarm)
|
||||
}
|
||||
}
|
||||
func sendStoreStatusInfo2Mobile(user *model.User, msgType, title, txtAlarm string) {
|
||||
msg.SendUserMessage(msgType, user, title, txtAlarm)
|
||||
}
|
||||
|
||||
func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs []int, isAsync bool) (err error) {
|
||||
|
||||
@@ -20,8 +20,8 @@ func TestGetStoresVendorSnapshot(t *testing.T) {
|
||||
|
||||
func TestSendAlarmVendorSnapshot(t *testing.T) {
|
||||
db := dao.GetDB()
|
||||
prevSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-07-16 10:00:00"))
|
||||
curSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-07-16 11:00:00"))
|
||||
prevSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-09-09 10:00:00"))
|
||||
curSnapshotList, _ := dao.GetVendorStoreSnapshot(db, utils.Str2Time("2019-09-09 11:00:00"))
|
||||
err := SendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, prevSnapshotList, curSnapshotList)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -380,6 +380,19 @@ func GetRoleUserList(ctx *jxcontext.Context, r *authz.RoleInfo) (userIDList []st
|
||||
return api2.RoleMan.GetRoleUserList(r)
|
||||
}
|
||||
|
||||
func GetRolesUserList(ctx *jxcontext.Context, rList []*authz.RoleInfo) (userIDMap map[string][]string, err error) {
|
||||
userIDMap = make(map[string][]string)
|
||||
for _, r := range rList {
|
||||
userIDList, err2 := api2.RoleMan.GetRoleUserList(r)
|
||||
if err = err2; err == nil {
|
||||
userIDMap[r.GetFullName()] = userIDList
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return userIDMap, err
|
||||
}
|
||||
|
||||
func checkUserType(userID string, userType int8) (err error) {
|
||||
userList, _, err := dao.GetUsers(dao.GetDB(), 0, "", []string{userID}, "", "", 0, 0)
|
||||
if err != nil {
|
||||
|
||||
@@ -1055,7 +1055,7 @@ func CreateConsumerFromOrders(ctx *jxcontext.Context, vendorIDs []int, fromDate,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
order := batchItemList[0].(*GoodsOrderWithOriginal)
|
||||
if isForce || order.UserID == "" {
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(order.VendorID); handler != nil {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID); handler != nil {
|
||||
var updateFields []string
|
||||
if isForce || order.VendorUserID == "" {
|
||||
var order2 *model.GoodsOrder
|
||||
|
||||
49
business/jxutils/ddmsg/ddmsg.go
Normal file
49
business/jxutils/ddmsg/ddmsg.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package ddmsg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/dingding"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func SendDDUserMessage(msgType, ddUserID, title, content string) (err error) {
|
||||
globals.SugarLogger.Debugf("SendDDUserMessage ddUserID:%s, title:%s, content:%s", ddUserID, title, content)
|
||||
if globals.IsProductEnv() {
|
||||
if msgType == dingdingapi.MsgTyeText {
|
||||
err = api.DingDingAPI.CorpAsyncSendSimple(ddUserID, content)
|
||||
} else if msgType == dingdingapi.MsgTypeMarkdown {
|
||||
err = api.DingDingAPI.CorpAsyncSendMarkdown([]string{ddUserID}, nil, false, title, content)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func SendUserMessage(msgType, userID, title, content string) (err error) {
|
||||
globals.SugarLogger.Debugf("SendUserMessage userID:%s, title:%s, content:%s", userID, title, content)
|
||||
authList, err := auth2.GetUserBindAuthInfo(userID)
|
||||
findOneMethod := false
|
||||
if err == nil {
|
||||
for _, auth := range authList {
|
||||
if auth.Type == dingding.AuthTypeStaff || auth.Type == weixin.AuthTypeMP {
|
||||
findOneMethod = true
|
||||
if msgType == dingdingapi.MsgTypeMarkdown && len(content) > dingdingapi.MaxWorkContentLen {
|
||||
content = content[:dingdingapi.MaxWorkContentLen-4] + "..."
|
||||
}
|
||||
err = SendDDUserMessage(msgType, auth.AuthID, title, content)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !findOneMethod {
|
||||
err = fmt.Errorf("用户[%s]找不到至少一个有效的通讯方式", userID)
|
||||
}
|
||||
if err != nil {
|
||||
globals.SugarLogger.Infof("SendUserMessage userID:%s, title:%s, content:%s failed with error:%v", userID, title, content, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -136,6 +136,8 @@ func GetPossibleVendorIDFromVendorOrderID(vendorOrderID string) (vendorID int) {
|
||||
vendorID = model.VendorIDMTWM
|
||||
} else if orderIDLen == len("5287873015048") {
|
||||
vendorID = model.VendorIDWSC
|
||||
} else if orderIDLen == len("1000004390") {
|
||||
vendorID = model.VendorIDJX
|
||||
}
|
||||
}
|
||||
return vendorID
|
||||
@@ -667,6 +669,8 @@ func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder {
|
||||
sku.SkuID = 0
|
||||
}
|
||||
sku.OrderCreatedAt = order.OrderCreatedAt
|
||||
sku.VendorID = order.VendorID
|
||||
sku.VendorOrderID = order.VendorOrderID
|
||||
order.SkuCount++
|
||||
order.GoodsCount += sku.Count
|
||||
order.SalePrice += sku.SalePrice * int64(sku.Count)
|
||||
|
||||
@@ -3,33 +3,39 @@ package msg
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/dingding"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func SendUserMessage(msgType, userID, title, content string) (err error) {
|
||||
const weixinTemplateID4StoreStatusChanged = "Fl0vOnBKTQqRFx3-shGKxdCnxMdQXNeODzgkuwd7oxw"
|
||||
|
||||
// todo msgType不依赖于钉钉
|
||||
func SendUserMessage(msgType string, user *model.User, title, content string) (err error) {
|
||||
userID := user.GetID()
|
||||
globals.SugarLogger.Debugf("SendUserMessage userID:%s, title:%s, content:%s", userID, title, content)
|
||||
authList, err := auth2.GetUserBindAuthInfo(userID)
|
||||
findOneMethod := false
|
||||
if err == nil {
|
||||
if title != "" {
|
||||
content = title + "\n" + content
|
||||
}
|
||||
for _, auth := range authList {
|
||||
if auth.Type == dingding.AuthTypeStaff {
|
||||
if auth.Type == dingding.AuthTypeStaff || auth.Type == weixin.AuthTypeMP {
|
||||
findOneMethod = true
|
||||
if len(content) > dingdingapi.MaxWorkContentLen {
|
||||
content = content[:dingdingapi.MaxWorkContentLen-4] + "..."
|
||||
}
|
||||
if globals.IsProductEnv() {
|
||||
if msgType == dingdingapi.MsgTyeText {
|
||||
err = api.DingDingAPI.CorpAsyncSendSimple(auth.AuthID, content)
|
||||
} else if msgType == dingdingapi.MsgTypeMarkdown {
|
||||
err = api.DingDingAPI.CorpAsyncSendMarkdown([]string{auth.AuthID}, nil, false, title, content)
|
||||
if auth.Type == dingding.AuthTypeStaff {
|
||||
if title != "" {
|
||||
content = title + "\n" + content
|
||||
}
|
||||
err = ddmsg.SendDDUserMessage(msgType, auth.AuthID, title, content)
|
||||
} else if auth.Type == weixin.AuthTypeMP && msgType != dingdingapi.MsgTypeMarkdown {
|
||||
err = weixinmsg.NotifyStoreStatusChanged(auth.AuthID, title, content)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/msg"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
@@ -442,7 +442,7 @@ func (t *BaseTask) run(taskHandler func()) {
|
||||
} else {
|
||||
content += ",\n" + t.Error()
|
||||
}
|
||||
msg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "异步任务完成", content)
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "异步任务完成", content)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -61,6 +61,8 @@ const (
|
||||
|
||||
WX_AFS_ORDER_WAIT4APPROVE_TEMPLATE_ID = "X29udtANvhX6x1Lyh-T40NGNjRXBbUj5oSBTfDhZAqU"
|
||||
WX_AFS_ORDER_STATUS_CHANGED_TEMPLATE_ID = "99T33rrXX0VboO1hljs4x8dDoLiSj3QX_rOikPHIXkg"
|
||||
|
||||
WS_NOTIFY_STORE_STATUS_CHHANGED_TEMPLATE_ID = "Fl0vOnBKTQqRFx3-shGKxdCnxMdQXNeODzgkuwd7oxw"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -80,7 +82,6 @@ var (
|
||||
debugOpenIDMap = map[string]int{
|
||||
"oYN_usk0AeGc_C6VEZfmFQP5VHMQ": 1, // 周小扬
|
||||
"oYN_ust9hXKEvEv0X6Mq6nlAWs_E": 1, // me
|
||||
"oYN_usvnObzrPweIgHTad9-uMf78": 1, // 老赵
|
||||
}
|
||||
)
|
||||
|
||||
@@ -177,7 +178,7 @@ func SmartMessageTemplateSend(userOpenID, templateID, downloadURL, miniPageURL s
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("SmartMessageTemplateSend openID:%s, templateID:%s, downloadURL:%s, miniProgram:%s", userOpenID, templateID, downloadURL, utils.Format4Output(miniProgram, true))
|
||||
if globals.ReallySendWeixinMsg {
|
||||
if globals.ReallySendWeixinMsg || debugOpenIDMap[userOpenID] == 1 {
|
||||
if err = api.WeixinAPI.CBMessageTemplateSend(userOpenID, templateID, downloadURL, miniProgram, data); err != nil {
|
||||
globals.SugarLogger.Debugf("SmartMessageTemplateSend openID:%s, templateID:%s, downloadURL:%s, miniProgram:%s, failed with error:%v", userOpenID, templateID, downloadURL, utils.Format4Output(miniProgram, true), err)
|
||||
}
|
||||
@@ -555,3 +556,33 @@ func genJdCommentRemark(comment *legacymodel.JxBadComments) string {
|
||||
sb.WriteString(comment.Scorecontent)
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
func NotifyStoreStatusChanged(openUserID, title, content string) (err error) {
|
||||
SmartMessageTemplateSend(openUserID, WS_NOTIFY_STORE_STATUS_CHHANGED_TEMPLATE_ID, "", "", map[string]interface{}{
|
||||
"first": map[string]interface{}{
|
||||
"value": title,
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword1": map[string]interface{}{
|
||||
"value": "",
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword2": map[string]interface{}{
|
||||
"value": utils.Time2Str(time.Now()),
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword3": map[string]interface{}{
|
||||
"value": content,
|
||||
"color": WX_HIGHLEVEL_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword4": map[string]interface{}{
|
||||
"value": "",
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"remark": map[string]interface{}{
|
||||
"value": "",
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -267,6 +267,8 @@ const (
|
||||
OrderFlagMaskFailedDeliver = 32
|
||||
OrderFlagMaskCallPMCourier = 64 // 取货失败后召唤平台配送
|
||||
OrderFlagMaskSetDelivered = 128 // 设置送达
|
||||
|
||||
OrderFlagMaskFake = 256 // 假订单,即刷单用的
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -338,6 +340,10 @@ func IsOrderImportantStatus(status int) bool {
|
||||
return IsOrderMainStatus(status) || IsOrderLockStatus(status) || IsOrderUnlockStatus(status)
|
||||
}
|
||||
|
||||
func IsSpecialVendorID(vendorID int) bool {
|
||||
return vendorID == VendorIDWSC || vendorID == VendorIDJX
|
||||
}
|
||||
|
||||
func WaybillVendorID2Mask(vendorID int) (mask int8) {
|
||||
if vendorID == VendorIDDada {
|
||||
mask = OrderDeliveryFlagMaskDada
|
||||
|
||||
@@ -56,7 +56,7 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []stri
|
||||
sql += " AND t1.auth_id2 = ?"
|
||||
sqlParams = append(sqlParams, authID2)
|
||||
}
|
||||
|
||||
sql += " ORDER BY t1.type"
|
||||
err = GetRows(db, &authList, sql, sqlParams...)
|
||||
return authList, err
|
||||
}
|
||||
|
||||
@@ -399,10 +399,10 @@ func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.Sto
|
||||
|
||||
func FakeGetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.StoreMap, err error) {
|
||||
vendorID2 := vendorID
|
||||
if vendorID == model.VendorIDWSC {
|
||||
vendorID2 = model.VendorIDJD // 微商城的属性以京东属性为准(以免再绑定)
|
||||
if model.IsSpecialVendorID(vendorID) {
|
||||
vendorID2 = model.VendorIDJD // 微商城与京西的属性以京东属性为准(以免再绑定)
|
||||
}
|
||||
if storeMap, err = GetStoreMapByStoreID(db, storeID, vendorID2); vendorID == model.VendorIDWSC && IsNoRowsError(err) {
|
||||
if storeMap, err = GetStoreMapByStoreID(db, storeID, vendorID2); model.IsSpecialVendorID(vendorID) && IsNoRowsError(err) {
|
||||
err = nil
|
||||
storeMap = &model.StoreMap{
|
||||
StoreID: storeID,
|
||||
@@ -416,6 +416,9 @@ func FakeGetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model
|
||||
IsSync: 1,
|
||||
}
|
||||
}
|
||||
if storeMap != nil && vendorID == model.VendorIDJX {
|
||||
storeMap.DeliveryType = model.StoreDeliveryTypeByStore
|
||||
}
|
||||
return storeMap, err
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ type PageShop struct {
|
||||
RecentOrderNum int `orm:"size(48)" json:"recentOrderNum"` // 月订单量
|
||||
SkuCount int `orm:"size(48)" json:"skuCount"` // 商品总量
|
||||
BusinessType string `orm:"size(48)" json:"businessType"` // 经营范围
|
||||
|
||||
LicenceCode string `orm:"size(32)" json:"licenceCode"` // 营业执照
|
||||
LicenceImg string `orm:"size(255)" json:"licenceImg"` // 营业执照图片
|
||||
}
|
||||
|
||||
func (*PageShop) TableUnique() [][]string {
|
||||
|
||||
@@ -7,6 +7,10 @@ const (
|
||||
ConfigTypeRole = "Role"
|
||||
)
|
||||
|
||||
const (
|
||||
ConfigSysFakeOrderMobiles = "FakeOrderMobiles" // 假订单手机
|
||||
)
|
||||
|
||||
var (
|
||||
ConfigTypeName = map[string]string{
|
||||
ConfigTypeSys: "系统",
|
||||
|
||||
@@ -2,8 +2,10 @@ package netspider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ditu"
|
||||
@@ -22,10 +24,10 @@ const (
|
||||
func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, cityCode, radius, gridWith int) (pageStoreList []*model.PageShop, err error) {
|
||||
coordList := ditu.GetCityCoordinateList(cityCode, radius, gridWith)
|
||||
if len(coordList) > 0 {
|
||||
task := tasksch.NewParallelTask("GetCityShops", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
task := tasksch.NewParallelTask(fmt.Sprintf("GetCityShops:%d", cityCode), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorID := batchItemList[0].(int)
|
||||
storeList, err2 := getStoreListByCoordinates(ctx, task, vendorID, utils.Int2Str(cityCode), coordList)
|
||||
storeList, err2 := getStoreListByCoordinates(ctx, task, vendorID, cityCode, coordList)
|
||||
if err = err2; err == nil {
|
||||
retVal = storeList
|
||||
}
|
||||
@@ -39,8 +41,6 @@ func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []
|
||||
}
|
||||
err = nil
|
||||
for _, v := range list {
|
||||
v2 := v.(*model.PageShop)
|
||||
v2.CityCode = cityCode
|
||||
dao.WrapAddIDCULDEntity(v, ctx.GetUserName())
|
||||
pageStoreList = append(pageStoreList, v.(*model.PageShop))
|
||||
}
|
||||
@@ -48,7 +48,32 @@ func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []
|
||||
return pageStoreList, err
|
||||
}
|
||||
|
||||
func getStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID int, cityInfo string, coordList []*ditu.Coordinate) (storeList []*model.PageShop, err error) {
|
||||
func getStorePageInfo(ctx *jxcontext.Context, handler partner.IPurchasePlatformNetSpiderHandler, cityCode int, vendorStoreID string) (storePageInfo *model.PageShop, err error) {
|
||||
storePageInfo, err = handler.GetStorePageInfo(ctx, vendorStoreID)
|
||||
if err == nil && storePageInfo != nil {
|
||||
if !(storePageInfo.Lng != 0 && storePageInfo.Lat != 0) {
|
||||
storePageInfo.Lng, storePageInfo.Lat, storePageInfo.DistrictCode = api.AutonaviAPI.GetCoordinateFromAddress(storePageInfo.Address, utils.Int2Str(cityCode))
|
||||
if storePageInfo.DistrictCode == 0 && cityCode != 0 {
|
||||
storePageInfo.Lng, storePageInfo.Lat, storePageInfo.DistrictCode = api.AutonaviAPI.GetCoordinateFromAddress(storePageInfo.Address, "")
|
||||
}
|
||||
} else if storePageInfo.DistrictCode == 0 {
|
||||
storePageInfo.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(storePageInfo.Lng, storePageInfo.Lat)
|
||||
}
|
||||
if storePageInfo.CityCode == 0 {
|
||||
if storePageInfo.DistrictCode != 0 {
|
||||
if place, err := dao.GetPlaceByCode(dao.GetDB(), storePageInfo.DistrictCode); err == nil {
|
||||
storePageInfo.CityCode = place.ParentCode
|
||||
}
|
||||
}
|
||||
if storePageInfo.CityCode == 0 {
|
||||
storePageInfo.CityCode = cityCode
|
||||
}
|
||||
}
|
||||
}
|
||||
return storePageInfo, err
|
||||
}
|
||||
|
||||
func getStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, cityCode int, coordList []*ditu.Coordinate) (storeList []*model.PageShop, err error) {
|
||||
if len(coordList) > 0 {
|
||||
if handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformNetSpiderHandler); handler != nil {
|
||||
mainStoreIDList, _ := handler.GetStoreIDListByCoordinates(ctx, coordList[0])
|
||||
@@ -79,7 +104,7 @@ func getStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
||||
task2 := tasksch.NewParallelTask(fmt.Sprintf("GetStoreListByCoordinate[%s] get detail", model.VendorChineseNames[vendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeID := batchItemList[0].(string)
|
||||
storePageInfo, err := handler.GetStorePageInfo(ctx, cityInfo, storeID)
|
||||
storePageInfo, err := getStorePageInfo(ctx, handler, cityCode, storeID)
|
||||
if err == nil && storePageInfo != nil {
|
||||
return []interface{}{storePageInfo}, nil
|
||||
}
|
||||
@@ -100,7 +125,7 @@ func getStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeList []int, radius, gridWith int, isAsync bool) (hint string, err error) {
|
||||
func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeList []int, radius, gridWith int, isShuffle, isAsync bool) (hint string, err error) {
|
||||
db := dao.GetDB()
|
||||
if len(cityCodeList) == 0 {
|
||||
placeList, err2 := dao.GetPlacesByCond(db, dao.EnableCondAll)
|
||||
@@ -110,7 +135,11 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
for _, v := range placeList {
|
||||
cityCodeList = append(cityCodeList, v.Code)
|
||||
}
|
||||
// cityCodeList = []int{510100}
|
||||
}
|
||||
if isShuffle {
|
||||
rand.Shuffle(len(cityCodeList), func(i, j int) {
|
||||
cityCodeList[i], cityCodeList[j] = cityCodeList[j], cityCodeList[i]
|
||||
})
|
||||
}
|
||||
if len(vendorIDs) == 0 {
|
||||
vendorIDs = []int{model.VendorIDJD, model.VendorIDEBAI}
|
||||
@@ -122,9 +151,9 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
gridWith = DefGridWith
|
||||
}
|
||||
|
||||
task := tasksch.NewSeqTask("GetAndStoreCitiesShops", ctx,
|
||||
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
cityCode := cityCodeList[step]
|
||||
task := tasksch.NewParallelTask(fmt.Sprintf("GetAndStoreCitiesShops:%v", vendorIDs), tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
cityCode := batchItemList[0].(int)
|
||||
globals.SugarLogger.Debugf("process city:%d", cityCode)
|
||||
shopList, err := GetCityShops(ctx, task, vendorIDs, cityCode, radius, gridWith)
|
||||
if err == nil {
|
||||
@@ -150,8 +179,8 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("process city:%d, len(shopList):%d, err:%v", cityCode, len(shopList), err)
|
||||
return nil, nil // 强制继续
|
||||
}, len(cityCodeList))
|
||||
return nil, err
|
||||
}, cityCodeList)
|
||||
tasksch.ManageTask(task).Run()
|
||||
if !isAsync {
|
||||
_, err = task.GetResult(0)
|
||||
@@ -174,7 +203,7 @@ func RefreshPageStore(ctx *jxcontext.Context) (err error) {
|
||||
}
|
||||
for _, v := range shopList {
|
||||
if handler, _ := partner.GetPurchasePlatformFromVendorID(v.VendorID).(partner.IPurchasePlatformNetSpiderHandler); handler != nil {
|
||||
storePageInfo, err2 := handler.GetStorePageInfo(ctx, "", v.VendorStoreID)
|
||||
storePageInfo, err2 := getStorePageInfo(ctx, handler, v.CityCode, v.VendorStoreID)
|
||||
if err2 == nil {
|
||||
v.RecentOrderNum = storePageInfo.RecentOrderNum
|
||||
v.SkuCount = storePageInfo.SkuCount
|
||||
|
||||
@@ -80,6 +80,7 @@ var (
|
||||
CurStoreManager IStoreManager
|
||||
|
||||
PurchasePlatformHandlers map[int]IPurchasePlatformHandler
|
||||
PurchaseOrderHandlers map[int]IPurchasePlatformOrderHandler
|
||||
)
|
||||
|
||||
type IOrderManager interface {
|
||||
@@ -194,6 +195,7 @@ func (p *BasePurchasePlatform) GetStatusActionTimeout(order *model.GoodsOrder, s
|
||||
|
||||
func init() {
|
||||
PurchasePlatformHandlers = make(map[int]IPurchasePlatformHandler)
|
||||
PurchaseOrderHandlers = make(map[int]IPurchasePlatformOrderHandler)
|
||||
DeliveryPlatformHandlers = make(map[int]*DeliveryPlatformHandlerInfo)
|
||||
}
|
||||
|
||||
@@ -221,10 +223,22 @@ func RegisterPurchasePlatform(handler IPurchasePlatformHandler) {
|
||||
PurchasePlatformHandlers[vendorID] = handler
|
||||
}
|
||||
|
||||
func RegisterPurchaseOrderHandler(vendorID int, handler IPurchasePlatformOrderHandler) {
|
||||
PurchaseOrderHandlers[vendorID] = handler
|
||||
}
|
||||
|
||||
func GetPurchasePlatformFromVendorID(vendorID int) IPurchasePlatformHandler {
|
||||
return PurchasePlatformHandlers[vendorID]
|
||||
}
|
||||
|
||||
func GetPurchaseOrderHandlerFromVendorID(vendorID int) (handler IPurchasePlatformOrderHandler) {
|
||||
handler = PurchasePlatformHandlers[vendorID]
|
||||
if handler == nil {
|
||||
handler = PurchaseOrderHandlers[vendorID]
|
||||
}
|
||||
return handler
|
||||
}
|
||||
|
||||
func GetPurchasePlatformVendorIDs() (vendorIDs []int) {
|
||||
for k := range PurchasePlatformHandlers {
|
||||
vendorIDs = append(vendorIDs, k)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
type IPurchasePlatformNetSpiderHandler interface {
|
||||
GetStoreIDListByCoordinates(ctx *jxcontext.Context, coord *ditu.Coordinate) (storeIDList []string, err error)
|
||||
GetStorePageInfo(ctx *jxcontext.Context, cityInfo, storeID string) (storePageInfo *model.PageShop, err error)
|
||||
GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error)
|
||||
|
||||
// GetStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask, cityInfo string, coordList []*ditu.Coordinate) (storeList []*model.PageShop, err error)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ebai
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ditu"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -21,12 +22,12 @@ func (c *PurchaseHandler) GetStoreIDListByCoordinates(ctx *jxcontext.Context, co
|
||||
return storeIDList, nil
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, storeID string) (storePageInfo *model.PageShop, err error) {
|
||||
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error) {
|
||||
shopInfo, err2 := api.EbaiAPI.GetStoreInfo2(storeID)
|
||||
if err = err2; err == nil && shopInfo != nil {
|
||||
districtCode := 0
|
||||
// districtCode := api.AutonaviAPI.GetCoordinateDistrictCode(shopInfo.Longitude, shopInfo.Latitude)
|
||||
return &model.PageShop{
|
||||
// 饿百扒下来的坐标是加了密的,不能用
|
||||
// lng, lat, _ := api.AutonaviAPI.CoordinateConvert(shopInfo.Longitude/100000, shopInfo.Latitude/100000, autonavi.CoordSysBaidu)
|
||||
storePageInfo = &model.PageShop{
|
||||
Name: shopInfo.Name,
|
||||
VendorID: model.VendorIDEBAI,
|
||||
VendorStoreID: storeID,
|
||||
@@ -34,9 +35,9 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, sto
|
||||
VendorStatus: utils.Int2Str(shopInfo.BusinessStatus),
|
||||
|
||||
Address: shopInfo.Address,
|
||||
Lng: shopInfo.Longitude / 100000,
|
||||
Lat: shopInfo.Latitude / 100000,
|
||||
DistrictCode: districtCode,
|
||||
Lng: 0,
|
||||
Lat: 0,
|
||||
DistrictCode: 0,
|
||||
|
||||
Tel1: shopInfo.Phone,
|
||||
|
||||
@@ -44,7 +45,21 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, sto
|
||||
SkuCount: shopInfo.SkuCount,
|
||||
BusinessType: shopInfo.Category,
|
||||
ShopScore: float64(shopInfo.ShopScore),
|
||||
}, nil
|
||||
}
|
||||
storePageInfo.LicenceCode, storePageInfo.LicenceImg = getLicenceInfoFromShopInfo(shopInfo)
|
||||
}
|
||||
return nil, err
|
||||
return storePageInfo, err
|
||||
}
|
||||
|
||||
func getLicenceInfoFromShopInfo(storeInfo *ebaiapi.PageShopInfo) (licenceCode, licenceImg string) {
|
||||
for _, v := range storeInfo.MedicineQualification {
|
||||
if v.AptitudeType == "101" { // 营业执照
|
||||
licenceCode = v.LicenseNumber
|
||||
if len(v.AptitudePhoto) > 0 {
|
||||
licenceImg = v.AptitudePhoto[0]
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return licenceCode, licenceImg
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
}
|
||||
}
|
||||
|
||||
deliveryGeo := userMap["coord"].(map[string]interface{})
|
||||
deliveryGeo := userMap["coord_amap"].(map[string]interface{})
|
||||
originalLng := utils.Interface2Float64WithDefault(deliveryGeo["longitude"], 0.0) // 饿百的订单在过一段时间后,经纬度信息会变成字符串"**"
|
||||
originalLat := utils.Interface2Float64WithDefault(deliveryGeo["latitude"], 0.0)
|
||||
lng, lat, err2 := api.AutonaviAPI.CoordinateConvert(originalLng, originalLat, autonavi.CoordSysBaidu)
|
||||
|
||||
@@ -387,6 +387,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||
params["address"] = store.Address
|
||||
// todo 饿百 开店审核通过后不允许修改商户信息
|
||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
||||
// todo 这里应该要做坐标转换吧
|
||||
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
|
||||
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
|
||||
params["coord_type"] = ebaiapi.CoordTypeAutonavi
|
||||
|
||||
@@ -27,13 +27,9 @@ func (c *PurchaseHandler) GetStoreIDListByCoordinates(ctx *jxcontext.Context, co
|
||||
return storeIDList, nil
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, storeID string) (storePageInfo *model.PageShop, err error) {
|
||||
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error) {
|
||||
shopInfo, err2 := api.JdPageAPI.GetStoreInfo2(storeID)
|
||||
if err = err2; err == nil && shopInfo != nil {
|
||||
var lng, lat float64
|
||||
districtCode := 0
|
||||
// 由于高德API免费有调用次数限制,暂时不取坐标信息
|
||||
// lng, lat, districtCode := api.AutonaviAPI.GetCoordinateFromAddress(shopInfo.StoreInfo.StoreAddress, cityInfo)
|
||||
return &model.PageShop{
|
||||
Name: shopInfo.StoreInfo.StoreName,
|
||||
VendorID: model.VendorIDJD,
|
||||
@@ -42,9 +38,9 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, sto
|
||||
VendorStatus: utils.Int2Str(shopInfo.StoreInfo.StationStatus),
|
||||
|
||||
Address: shopInfo.StoreInfo.StoreAddress,
|
||||
Lng: lng,
|
||||
Lat: lat,
|
||||
DistrictCode: districtCode,
|
||||
Lng: 0,
|
||||
Lat: 0,
|
||||
DistrictCode: 0,
|
||||
|
||||
Tel1: shopInfo.StoreInfo.StoreTel,
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package jx
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
appKey = "4A86853D-E4B6-454E-940A-B68ECDA2B73E"
|
||||
|
||||
MsgTypeOrder = "order"
|
||||
SubMsgTypeOrderNew = "newOrder"
|
||||
SubMsgTypeOrderAdjust = "adjustOrder"
|
||||
SubMsgTypeOrderApplyCancel = "applyCancel"
|
||||
// SubMsgTypeOrderApplayRefund = "applyRefund"
|
||||
MsgTypeOrder = "order"
|
||||
)
|
||||
|
||||
type CallbackResponse struct {
|
||||
@@ -23,6 +24,7 @@ type CallbackMsg struct {
|
||||
SubMsgType string `json:"subMsgType"`
|
||||
ThingID string `json:"thingID"`
|
||||
Data string `json:"data"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
func OnCallbackMsg(msg *CallbackMsg) (retVal, errCode string, err error) {
|
||||
@@ -34,3 +36,16 @@ func OnCallbackMsg(msg *CallbackMsg) (retVal, errCode string, err error) {
|
||||
}
|
||||
return retVal, errCode, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) postFakeMsg(orderNo string, status int) {
|
||||
msg := &CallbackMsg{
|
||||
AppKey: appKey,
|
||||
MsgType: MsgTypeOrder,
|
||||
SubMsgType: utils.Int2Str(status),
|
||||
ThingID: orderNo,
|
||||
Timestamp: time.Now().Unix(),
|
||||
}
|
||||
utils.CallFuncAsync(func() {
|
||||
OnCallbackMsg(msg)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ func init() {
|
||||
CurPurchaseHandler = new(PurchaseHandler)
|
||||
// 不能注册京西
|
||||
// partner.RegisterPurchasePlatform(CurPurchaseHandler)
|
||||
partner.RegisterPurchaseOrderHandler(CurPurchaseHandler.GetVendorID(), CurPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
99
business/partner/purchase/jx/jxapi.go
Normal file
99
business/partner/purchase/jx/jxapi.go
Normal file
@@ -0,0 +1,99 @@
|
||||
package jx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
type API struct {
|
||||
token string
|
||||
appKey string
|
||||
appSecret string
|
||||
client *http.Client
|
||||
config *platformapi.APIConfig
|
||||
}
|
||||
|
||||
const (
|
||||
ResponseCodeSuccess = 200
|
||||
)
|
||||
|
||||
const (
|
||||
prodURL = "https://www.jingxicaishi.com/index.php/Weimendian/index"
|
||||
)
|
||||
|
||||
var (
|
||||
exceedLimitCodes = map[int]int{}
|
||||
canRetryCodes = map[int]int{}
|
||||
)
|
||||
|
||||
var (
|
||||
jxAPI *API
|
||||
)
|
||||
|
||||
func NewAPI(token, appKey, appSecret string, config ...*platformapi.APIConfig) *API {
|
||||
curConfig := platformapi.DefAPIConfig
|
||||
if len(config) > 0 {
|
||||
curConfig = *config[0]
|
||||
}
|
||||
return &API{
|
||||
token: token,
|
||||
appKey: appKey,
|
||||
appSecret: appSecret,
|
||||
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||
config: &curConfig,
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
jxAPI = NewAPI("", "", "")
|
||||
}
|
||||
|
||||
func (a *API) AccessAPI(apiStr string, jxParams map[string]interface{}, traceInfo string) (retVal map[string]interface{}, err error) {
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||
func() *http.Request {
|
||||
params := utils.MergeMaps(jxParams, map[string]interface{}{
|
||||
"timestamp": utils.GetCurTimeStr(),
|
||||
})
|
||||
var request *http.Request
|
||||
if false {
|
||||
|
||||
} else {
|
||||
fullURL := prodURL + "/" + apiStr
|
||||
// baseapi.SugarLogger.Debug(utils.Map2URLValues(params).Encode())
|
||||
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(params).Encode()))
|
||||
request.Header.Set("charset", "UTF-8")
|
||||
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
}
|
||||
if traceInfo != "" {
|
||||
request.Header.Set(platformapi.KeyTrackInfo, traceInfo)
|
||||
}
|
||||
// request.Close = true //todo 为了性能考虑还是不要关闭
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
if jsonResult1 == nil {
|
||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||
}
|
||||
code := int(utils.Interface2Int64WithDefault(jsonResult1["code"], 0))
|
||||
if code == ResponseCodeSuccess {
|
||||
retVal = jsonResult1
|
||||
return platformapi.ErrLevelSuccess, nil
|
||||
}
|
||||
newErr := utils.NewErrorIntCode(jsonResult1["msg"].(string), code)
|
||||
if _, ok := exceedLimitCodes[code]; ok {
|
||||
return platformapi.ErrLevelExceedLimit, newErr
|
||||
} else if _, ok := canRetryCodes[code]; ok {
|
||||
return platformapi.ErrLevelRecoverableErr, newErr
|
||||
} else {
|
||||
baseapi.SugarLogger.Debugf("jx AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
return platformapi.ErrLevelCodeIsNotOK, newErr
|
||||
}
|
||||
})
|
||||
return retVal, err
|
||||
}
|
||||
31
business/partner/purchase/jx/jxapi_order.go
Normal file
31
business/partner/purchase/jx/jxapi_order.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package jx
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
var (
|
||||
orderStatusMap = map[int]int{
|
||||
model.OrderStatusFinishedPickup: 7,
|
||||
model.OrderStatusDelivering: 8,
|
||||
// 4,
|
||||
model.OrderStatusFinished: 3,
|
||||
model.OrderStatusCanceled: 3,
|
||||
}
|
||||
)
|
||||
|
||||
func translateOrderStatus(status int) (outStatus int) {
|
||||
return status //orderStatusMap[status]
|
||||
}
|
||||
|
||||
func (a *API) NotifyOrderStatusChanged(order *model.GoodsOrder) (err error) {
|
||||
status := translateOrderStatus(order.Status)
|
||||
if status > 0 {
|
||||
_, err = a.AccessAPI("orderChangeStatus", map[string]interface{}{
|
||||
"orderid": order.VendorOrderID,
|
||||
"status": status,
|
||||
"data": "", //string(utils.MustMarshal(order)),
|
||||
}, "")
|
||||
}
|
||||
return err
|
||||
}
|
||||
21
business/partner/purchase/jx/jxapi_order_test.go
Normal file
21
business/partner/purchase/jx/jxapi_order_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package jx
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
_ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
)
|
||||
|
||||
func TestNotifyOrderStatusChanged(t *testing.T) {
|
||||
order, err := partner.CurOrderManager.LoadOrder("920931913000041", model.VendorIDJX)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = jxAPI.NotifyOrderStatusChanged(order)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -25,22 +25,47 @@ func (c *PurchaseHandler) OnOrderMsg(msg *CallbackMsg) (retVal, errCode string,
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) onOrderMsg(msg *CallbackMsg) (retVal, errCode string, err error) {
|
||||
if msg.SubMsgType == SubMsgTypeOrderNew || msg.SubMsgType == SubMsgTypeOrderAdjust {
|
||||
subMsgType := int(utils.Str2Int64WithDefault(msg.SubMsgType, 0))
|
||||
if subMsgType == model.OrderStatusNew || subMsgType == model.OrderStatusAdjust {
|
||||
var order *Data4Neworder
|
||||
if err = utils.UnmarshalUseNumber([]byte(msg.Data), &order); err == nil {
|
||||
retVal, errCode, err = c.onOrderNew(msg, order)
|
||||
retVal, errCode, err = c.onOrderNew(msg, subMsgType, order)
|
||||
}
|
||||
} else {
|
||||
status := c.callbackMsg2Status(msg)
|
||||
err = partner.CurOrderManager.OnOrderStatusChanged(status)
|
||||
}
|
||||
return retVal, errCode, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) onOrderNew(msg *CallbackMsg, order *Data4Neworder) (retVal, errCode string, err error) {
|
||||
func (c *PurchaseHandler) callbackMsg2Status(msg *CallbackMsg) *model.OrderStatus {
|
||||
orderStatus := &model.OrderStatus{
|
||||
VendorOrderID: msg.ThingID,
|
||||
VendorID: model.VendorIDJX,
|
||||
OrderType: model.OrderTypeOrder,
|
||||
RefVendorOrderID: msg.ThingID,
|
||||
RefVendorID: model.VendorIDJX,
|
||||
VendorStatus: msg.SubMsgType,
|
||||
Status: int(utils.Str2Int64WithDefault(msg.SubMsgType, 0)),
|
||||
StatusTime: utils.Timestamp2Time(msg.Timestamp),
|
||||
Remark: "",
|
||||
}
|
||||
return orderStatus
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) onOrderNew(msg *CallbackMsg, subMsgType int, order *Data4Neworder) (retVal, errCode string, err error) {
|
||||
globals.SugarLogger.Debugf("onOrderNew orderID:%s", msg.ThingID)
|
||||
order.StoreID = int(utils.Str2Int64WithDefault(order.VendorStoreID, 0))
|
||||
order.GoodsOrder.Skus = order.Skus
|
||||
order.VendorID = model.VendorIDJX
|
||||
for _, v := range order.GoodsOrder.Skus {
|
||||
v.SkuID = int(utils.Str2Int64WithDefault(v.VendorSkuID, 0))
|
||||
}
|
||||
jxutils.RefreshOrderSkuRelated(&order.GoodsOrder)
|
||||
orderStatus := model.Order2Status(&order.GoodsOrder)
|
||||
if msg.SubMsgType == SubMsgTypeOrderNew {
|
||||
if subMsgType == model.OrderStatusNew {
|
||||
err = partner.CurOrderManager.OnOrderNew(&order.GoodsOrder, orderStatus)
|
||||
} else {
|
||||
} else if subMsgType == model.OrderStatusAdjust {
|
||||
err = partner.CurOrderManager.OnOrderAdjust(&order.GoodsOrder, orderStatus)
|
||||
}
|
||||
return retVal, errCode, err
|
||||
@@ -55,10 +80,20 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
||||
if isAcceptIt {
|
||||
order.Status = model.OrderStatusAccepted
|
||||
} else {
|
||||
order.Status = model.OrderStatusCanceled
|
||||
}
|
||||
c.postFakeMsg(order.VendorOrderID, order.Status)
|
||||
jxAPI.NotifyOrderStatusChanged(order)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string) (err error) {
|
||||
order.Status = model.OrderStatusFinishedPickup
|
||||
c.postFakeMsg(order.VendorOrderID, order.Status)
|
||||
jxAPI.NotifyOrderStatusChanged(order)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -83,11 +118,17 @@ func (c *PurchaseHandler) Swtich2SelfDelivered(order *model.GoodsOrder, userName
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) SelfDeliverDelivering(order *model.GoodsOrder, userName string) (err error) {
|
||||
order.Status = model.OrderStatusDelivering
|
||||
c.postFakeMsg(order.VendorOrderID, order.Status)
|
||||
jxAPI.NotifyOrderStatusChanged(order)
|
||||
return err
|
||||
}
|
||||
|
||||
// 京东送达接口都是一样的
|
||||
func (c *PurchaseHandler) SelfDeliverDelivered(order *model.GoodsOrder, userName string) (err error) {
|
||||
order.Status = model.OrderStatusFinished
|
||||
c.postFakeMsg(order.VendorOrderID, order.Status)
|
||||
jxAPI.NotifyOrderStatusChanged(order)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -118,3 +159,13 @@ func (c *PurchaseHandler) GetWaybillTip(ctx *jxcontext.Context, order *model.Goo
|
||||
func (c *PurchaseHandler) AddWaybillTip(ctx *jxcontext.Context, order *model.GoodsOrder, tipFee2Add int64) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) ConfirmSelfTake(ctx *jxcontext.Context, vendorOrderID, selfTakeCode string) (err error) {
|
||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJX)
|
||||
if err == nil {
|
||||
order.Status = model.OrderStatusFinished
|
||||
c.postFakeMsg(order.VendorOrderID, order.Status)
|
||||
jxAPI.NotifyOrderStatusChanged(order)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -122,6 +122,17 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
OriginalData: string(utils.MustMarshal(result)),
|
||||
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["total"])),
|
||||
}
|
||||
pickType := int(utils.Interface2Int64WithDefault(result["pick_type"], 0))
|
||||
if pickType == mtwmapi.OrderPickTypeSelf {
|
||||
order.DeliveryType = model.OrderDeliveryTypeSelfTake
|
||||
} else {
|
||||
logisticsCode := utils.Interface2String(result["logistics_code"])
|
||||
if logisticsCode == mtwmapi.PeiSongTypeSelf {
|
||||
order.DeliveryType = model.OrderDeliveryTypeStoreSelf
|
||||
} else {
|
||||
order.DeliveryType = model.OrderDeliveryTypePlatform
|
||||
}
|
||||
}
|
||||
openUID := utils.Interface2Int64WithDefault(result["openUid"], 0)
|
||||
if openUID > 0 {
|
||||
order.VendorUserID = utils.Int64ToStr(openUID)
|
||||
|
||||
@@ -16,7 +16,7 @@ mtwmAppID = "589"
|
||||
mtwmSecret = "a81eb3df418d83d6a1a4b7c572156d2f"
|
||||
mtwmCallbackURL = "http://callback.jxc4.com"
|
||||
|
||||
autonaviKey = "4427170f870af2110becb8852d36ab08"
|
||||
autonaviKey = "ef64f638f31e05cb7bde28790f7309fe"
|
||||
|
||||
baidunaviAK = "eL94zToVOdGDTkNQxV8dnEQ1ZRcB2UKb"
|
||||
baidunaviSK = "ZG0OOpOsOVURUwAkkmoHQFKRCbzn0zGb"
|
||||
|
||||
@@ -132,6 +132,37 @@ func (c *User2Controller) GetRoleUserList() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 批量得到角色包括的用户列表
|
||||
// @Description 批量得到角色包括的用户列表
|
||||
// @Param token header string true "认证token"
|
||||
// @Param roleNames query string true "角色名"
|
||||
// @Param storeIDs query string false "门店ID(如果是全局角色不用填)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetRolesUserList [get]
|
||||
func (c *User2Controller) GetRolesUserList() {
|
||||
c.callGetRolesUserList(func(params *tUser2GetRolesUserListParams) (retVal interface{}, errCode string, err error) {
|
||||
var roleNames []string
|
||||
var storeIDs []int
|
||||
if err = jxutils.Strings2Objs(params.RoleNames, &roleNames, params.StoreIDs, &storeIDs); err == nil {
|
||||
var roleList []*authz.RoleInfo
|
||||
for _, roleName := range roleNames {
|
||||
if len(storeIDs) == 0 {
|
||||
roleList = append(roleList, autils.NewRole(roleName, 0))
|
||||
} else {
|
||||
if roleName == authz.StoreRoleBoss {
|
||||
for _, storeID := range storeIDs {
|
||||
roleList = append(roleList, autils.NewRole(roleName, storeID))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
retVal, err = cms.GetRolesUserList(params.Ctx, roleList)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 给指定用户添加角色列表
|
||||
// @Description 给指定用户添加角色列表
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
@@ -173,27 +173,13 @@ func (c *OrderController) CancelWaybill() {
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Param isIncludeFake query bool false "是否包括假订单"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreOrderCountInfo [get]
|
||||
func (c *OrderController) GetStoreOrderCountInfo() {
|
||||
c.callGetStoreOrderCountInfo(func(params *tOrderGetStoreOrderCountInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到门店订单信息2
|
||||
// @Description 得到门店订单信息2
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreOrderCountInfo2 [get]
|
||||
func (c *OrderController) GetStoreOrderCountInfo2() {
|
||||
c.callGetStoreOrderCountInfo2(func(params *tOrderGetStoreOrderCountInfo2Params) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours)
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours, params.IsIncludeFake)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
@@ -289,6 +275,7 @@ func (c *OrderController) ExportMTWaybills() {
|
||||
// @Param statuss query string false "订单状态列表[1,2,3],缺省不限制"
|
||||
// @Param lockStatuss query string false "订单锁定状态列表[1,2,3],缺省不限制"
|
||||
// @Param cities query string false "城市code列表[1,2,3],缺省不限制"
|
||||
// @Param isIncludeFake query bool false "是否包括假订单"
|
||||
// @Param offset query int false "结果起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -296,7 +283,7 @@ func (c *OrderController) ExportMTWaybills() {
|
||||
// @router /GetOrders [get]
|
||||
func (c *OrderController) GetOrders() {
|
||||
c.callGetOrders(func(params *tOrderGetOrdersParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = orderman.FixedOrderManager.GetOrders(params.Ctx, params.FromDate, params.ToDate, params.IsDateFinish, params.MapData, params.Offset, params.PageSize)
|
||||
retVal, err = orderman.FixedOrderManager.GetOrders(params.Ctx, params.IsIncludeFake, params.FromDate, params.ToDate, params.IsDateFinish, params.MapData, params.Offset, params.PageSize)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,13 +11,14 @@ type NetSpiderController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 同步商家商品信息
|
||||
// @Description 同步商家商品信息
|
||||
// @Title 从网页拉取平台门店信息
|
||||
// @Description 从网页拉取平台门店信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorIDs formData string false "厂商ID列表"
|
||||
// @Param cityCodes formData string false "城市列表,缺省为后台启用了的城市"
|
||||
// @Param radius formData int false "区域半径(市或街道的半径会自动增加或缩小),单位为米,缺省8000米"
|
||||
// @Param gridWith formData int false "网格大小,单位为米,缺省为2000米"
|
||||
// @Param isShuffle formData bool false "是否将城市列表随机打乱"
|
||||
// @Param isAsync formData bool false "是否异步"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
@@ -27,7 +28,7 @@ func (c *NetSpiderController) GetAndStoreCitiesShops() {
|
||||
var vendorIDs, cityCodes []int
|
||||
err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs, params.CityCodes, &cityCodes)
|
||||
if err == nil {
|
||||
retVal, err = netspider.GetAndStoreCitiesShops(params.Ctx, vendorIDs, cityCodes, params.Radius, params.GridWith, params.IsAsync)
|
||||
retVal, err = netspider.GetAndStoreCitiesShops(params.Ctx, vendorIDs, cityCodes, params.Radius, params.GridWith, params.IsShuffle, params.IsAsync)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
@@ -1791,6 +1791,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetRolesUserList",
|
||||
Router: `/GetRolesUserList`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreRoleList",
|
||||
|
||||
Reference in New Issue
Block a user