Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
package cms
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals/api/apimanager"
|
||||
@@ -949,6 +950,7 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s
|
||||
}
|
||||
|
||||
func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interface{}, isExd bool) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("==========payload %s", utils.Format4Output(payload, false))
|
||||
userName := ctx.GetUserName()
|
||||
skuName := &model.SkuName{}
|
||||
skuName.ID = nameID
|
||||
@@ -1024,6 +1026,9 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
globals.SugarLogger.Debugf("UpdateEntityLogically 1 := %s", utils.Format4Output(skuName, false))
|
||||
globals.SugarLogger.Debugf("UpdateEntityLogically 2 := %s", utils.Format4Output(valid, false))
|
||||
globals.SugarLogger.Debugf("UpdateEntityLogically 3 := %s", userName)
|
||||
// valid[model.FieldJdSyncStatus] = model.SyncFlagModifiedMask | skuName.JdSyncStatus
|
||||
if num, err = dao.UpdateEntityLogically(db, skuName, valid, userName, nil); err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1035,6 +1040,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
if utils.Interface2Int64WithDefault(payload["isGlobal"], 0) == 0 && payload["places"] != nil {
|
||||
if places, ok := payload["places"].([]interface{}); ok {
|
||||
if _, err = dao.DeleteSkuNamePlace(db, nameID, nil); err != nil {
|
||||
@@ -1080,6 +1086,28 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
return 0, err
|
||||
}
|
||||
if len(skuIDs) > 0 {
|
||||
// 判断是否改价
|
||||
nowPrice, _ := payload["price"].(json.Number).Int64()
|
||||
if skuName.Price != int(nowPrice) && nowPrice != 0 {
|
||||
|
||||
for _, v1 := range payload["skus"].([]interface{}) {
|
||||
v := v1.(map[string]interface{})
|
||||
skuInfo := &aa{}
|
||||
if err := utils.Map2StructByJson(v, skuInfo, false); err != nil {
|
||||
globals.SugarLogger.Debugf("errr %v", err)
|
||||
continue
|
||||
}
|
||||
var skuPrice int64 = 0
|
||||
if payload["unit"] == "份" { // 商品规格等于份的时候,标准重量保持为500g
|
||||
skuPrice = int64(float64(skuInfo.SpecQuality) / float64(500) * float64(nowPrice))
|
||||
} else {
|
||||
skuPrice = nowPrice
|
||||
}
|
||||
SetUpdateSkuPriceIfChange(db, skuPrice, nowPrice, skuInfo.Id)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新skuIds对应在store_sku_bind中的价格体系,解决老版本改价之前关注的商品,在价格修改后,store_sku_bind中京西价未修改的问题
|
||||
if _, err = SetStoreSkuSyncStatus2(db, nil, partner.GetSingleStoreVendorIDs(), skuIDs, model.SyncFlagModifiedMask); err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
return 0, err
|
||||
@@ -1106,6 +1134,21 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
return num, err
|
||||
}
|
||||
|
||||
type aa struct {
|
||||
Id int `json:"id"`
|
||||
SpecQuality int `json:"specQuality"`
|
||||
SpecUnit string `json:"specUnit"`
|
||||
Weight int `json:"weight"`
|
||||
Status string `json:"status"`
|
||||
Comment string `json:"comment"`
|
||||
MinOrderCount int `json:"minOrderCount"`
|
||||
LadderBoxNum int `json:"ladderBoxNum"`
|
||||
LadderBoxPrice int `json:"ladderBoxPrice"`
|
||||
EclpID string `json:"eclpID"`
|
||||
CategoryID []interface{} `json:"categoryID"`
|
||||
ExdSkuID string `json:"exdSkuID"`
|
||||
}
|
||||
|
||||
func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, nameID int, payload map[string]interface{}, skuNameExt *model.SkuNameExt, isDelete bool) (flag bool) {
|
||||
if isDelete {
|
||||
skuVendorCatMaps, _ := dao.GetSkuVendorCategoryMaps(db, []int{nameID}, nil, nil)
|
||||
@@ -1189,6 +1232,13 @@ func SetStoreSkuSyncStatus2(db *dao.DaoDB, storeIDs []int, vendorIDs, skuIDs []i
|
||||
return num, nil
|
||||
}
|
||||
|
||||
func SetUpdateSkuPriceIfChange(db *dao.DaoDB, skuPrice, nowPrice int64, skuId int) error {
|
||||
sql := ` UPDATE store_sku_bind s SET s.price = ?,s.unit_price = ? WHERE s.sku_id = ? AND s.deleted_at = ?`
|
||||
param := []interface{}{skuPrice, nowPrice, skuId, utils.DefaultTimeValue}
|
||||
_, err := dao.ExecuteSQL(db, sql, param...)
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateSkuImg(ctx *jxcontext.Context, skuID int, payload map[string]interface{}) (string, error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
|
||||
@@ -1628,9 +1628,11 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
}
|
||||
}
|
||||
//删除抖店映射
|
||||
if _, err1 := dao.ExecuteSQL(db, "DELETE FROM freight_template WHERE freight_template.store_id = ? ", storeID); err != nil {
|
||||
//if vendorID == model.VendorIDDD {
|
||||
if _, err1 := dao.ExecuteSQL(db, "DELETE FROM freight_template WHERE freight_template.store_id = ? ", storeID); err1 != nil {
|
||||
err = fmt.Errorf("%v,%v", err, err1)
|
||||
}
|
||||
//}
|
||||
return num, err
|
||||
}
|
||||
|
||||
@@ -4453,6 +4455,7 @@ func RefreshTiktokShopToken(ctx *jxcontext.Context) (err error) {
|
||||
v.UpdatedAt = time.Now()
|
||||
v.StoreBrandName = "定时任务更新"
|
||||
dao.UpdateEntity(db, v, "Token", "UpdatedAt", "StoreBrandName")
|
||||
tiktok_store.HttpToGuoYuan(utils.Struct2MapByJson(v), "token")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,11 +184,9 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla
|
||||
switch step {
|
||||
case 0:
|
||||
if singleStoreHandler != nil {
|
||||
globals.SugarLogger.Debugf("==SyncStoreCategories===")
|
||||
_, err = SyncStoreCategories(ctx, task, vendorID, storeID, vendorStoreID, nameIDs, skuIDs, false, isContinueWhenError)
|
||||
}
|
||||
case 1:
|
||||
globals.SugarLogger.Debugf("==syncStoreSkuNew===")
|
||||
err = syncStoreSkuNew(ctx, task, causeFlag, false, vendorID, storeID, vendorOrgCode, nameIDs, skuIDs, excludeSkuIDs, useVendorPriceDirectly, isContinueWhenError)
|
||||
}
|
||||
return result, err
|
||||
|
||||
@@ -245,11 +245,6 @@ func Init() {
|
||||
orderman.FixedOrderManager.AmendMissingOrders(jxcontext.AdminCtx, []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDDD}, 0, curDate, curDate, true, true)
|
||||
}, 5*time.Second, 10*time.Minute)
|
||||
|
||||
//刷新抖音门店token
|
||||
ScheduleTimerFuncByInterval(func() {
|
||||
cms.RefreshTiktokShopToken(jxcontext.AdminCtx)
|
||||
}, 60*time.Second, 30*time.Minute)
|
||||
|
||||
// 抖音更新门店商品
|
||||
if beego.BConfig.RunMode != "jxgy" {
|
||||
ScheduleTimerFunc("RefreshSyncSkuList", func() {
|
||||
@@ -257,6 +252,13 @@ func Init() {
|
||||
}, []string{"11:30:00"})
|
||||
}
|
||||
|
||||
//刷新抖音门店token
|
||||
if beego.BConfig.RunMode != "jxgy" {
|
||||
ScheduleTimerFuncByInterval(func() {
|
||||
cms.RefreshTiktokShopToken(jxcontext.AdminCtx)
|
||||
}, 60*time.Second, 30*time.Minute)
|
||||
}
|
||||
|
||||
// 定时任务刷新当前订单的物流信息
|
||||
ScheduleTimerFunc("RefreshMaterialLogistics", func() {
|
||||
bidding.LoadingLogistics(nil)
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
package enterprise_msg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
enterprise "git.rosy.net.cn/baseapi/platformapi/enterprise_wechat"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
var enterpriseUserIdMap = map[string]string{
|
||||
"18080188338": "ShiFeng",
|
||||
"13541389991": "ZhuMin",
|
||||
"18982250714": "LaoZhaoTongXue",
|
||||
"15680070110": "LiRongWei",
|
||||
"18582617275": "TangXiaoLei",
|
||||
"18583684218": "JingXiCaiShi-YanXiaoKang18583684218",
|
||||
"17344357115": "YuanYe",
|
||||
"18011597879": "YunYing7879",
|
||||
"13608076295": "ZhangJiaLin",
|
||||
"18981810340": "LiuLei",
|
||||
"18744776542": "WuTingQi",
|
||||
"17358644830": "ShengTianBanZi1376",
|
||||
"15729837802": "ZhangShuWei",
|
||||
"1": "2f43b42fd833d1e77420a8dae7419000", // 未设置号码
|
||||
"15928865396": "HeJiaMeng2",
|
||||
"18780171617": "TianQinXin",
|
||||
"17381914617": "TianQinXin2",
|
||||
"15881105234": "WenShiQi",
|
||||
"18080188338": "ShiFeng",
|
||||
"13541389991": "ZhuMin",
|
||||
"18982250714": "LaoZhaoTongXue",
|
||||
"15680070110": "LiRongWei",
|
||||
"18582617275": "TangXiaoLei",
|
||||
"18583684218": "JingXiCaiShi-YanXiaoKang18583684218",
|
||||
"17344357115": "YuanYe",
|
||||
"18011597879": "YunYing7879",
|
||||
"13608076295": "ZhangJiaLin",
|
||||
"18981810340": "LiuLei",
|
||||
"187447 76542": "WuTingQi",
|
||||
"17358644830": "ShengTianBanZi1376",
|
||||
"15729837802": "ZhangShuWei",
|
||||
"1": "2f43b42fd833d1e77420a8dae7419000", // 未设置号码
|
||||
"15928865396": "HeJiaMeng2",
|
||||
"18780171617": "TianQinXin",
|
||||
"17381914617": "TianQinXin2",
|
||||
"15881105234": "WenShiQi",
|
||||
}
|
||||
|
||||
// SendUserMessage 发送文本卡片
|
||||
@@ -35,11 +36,32 @@ func SendUserMessage(phone, title, description, url string) error {
|
||||
if id, ok := enterpriseUserIdMap[phone]; ok {
|
||||
enterpriseUserId = id
|
||||
} else {
|
||||
enterpriseUserId, err = api.EnterpriseChatMin.GetUserIdByMobile(phone)
|
||||
userList, err := api.EnterpriseChatMin.GetEnterpriseStaffInfo(enterprise.ParentDepartmentId)
|
||||
if err != nil {
|
||||
enterpriseUserId = enterpriseUserIdMap["18981810340"]
|
||||
globals.SugarLogger.Errorf("获取企业微信全职人员信息错误 : %v", err)
|
||||
return err
|
||||
}
|
||||
for _, v := range userList {
|
||||
if v.Mobile == "" {
|
||||
api.EnterpriseChatMin.SendMsgToUserTypeText(&enterprise.SendTextMsgReq{
|
||||
Touser: "ShiFeng",
|
||||
Msgtype: enterprise.MsgTypeText,
|
||||
Agentid: enterprise.EnterpriseAgentid,
|
||||
Text: struct {
|
||||
Content string `json:"content"`
|
||||
}{Content: fmt.Sprintf("用户[%s]未添加企业微信联系电话,请联系添加电话号码[企业微信联系电话与京西系统保持一致!]", v.Name)},
|
||||
Safe: 0,
|
||||
EnableIdTrans: 0,
|
||||
EnableDuplicateCheck: 0,
|
||||
DuplicateCheckInterval: 0,
|
||||
})
|
||||
continue
|
||||
}
|
||||
if v.Mobile == phone {
|
||||
enterpriseUserId = v.Userid
|
||||
}
|
||||
enterpriseUserIdMap[v.Mobile] = v.Userid
|
||||
}
|
||||
enterpriseUserIdMap[phone] = enterpriseUserId
|
||||
}
|
||||
|
||||
err = api.EnterpriseChatMin.SendMsgToUserTypeText(&enterprise.SendTextMsgReq{
|
||||
@@ -55,24 +77,6 @@ func SendUserMessage(phone, title, description, url string) error {
|
||||
DuplicateCheckInterval: 0,
|
||||
})
|
||||
return err
|
||||
//
|
||||
//msg := &enterprise.EnterpriseSendMsgReq{
|
||||
// Touser: enterpriseUserId,
|
||||
// Msgtype: enterprise.MsgTypeTextCard,
|
||||
// Agentid: enterprise.EnterpriseAgentid,
|
||||
// Textcard: enterprise.TextCardObject{
|
||||
// Title: title,
|
||||
// Description: description,
|
||||
// Url: url,
|
||||
// Btntxt: "详情",
|
||||
// },
|
||||
//}
|
||||
//return api.EnterpriseChatMin.SendMsgToUser(msg)
|
||||
}
|
||||
|
||||
// SendUserMessageText 发送文本消息
|
||||
func SendUserMessageText() {
|
||||
|
||||
}
|
||||
|
||||
func SendEnterpriseUserMessage(msgType, phone, title, content string) (err error) {
|
||||
|
||||
@@ -118,7 +118,7 @@ type StoreSkuBind struct {
|
||||
YbID int64 `orm:"column(yb_id);index"`
|
||||
JdsID int64 `orm:"column(jds_id);index"`
|
||||
JdsWareID int64 `orm:"column(jds_ware_id)"`
|
||||
//GmID string `orm:"column(gm_id)"`
|
||||
// GmID string `orm:"column(gm_id)"`
|
||||
// WscID int64 `orm:"column(wsc_id);index"` // 表示微盟skuId
|
||||
// WscID2 int64 `orm:"column(wsc_id2);index"` // 表示微盟goodsId
|
||||
DdID int64 `orm:"column(dd_id);index"` // 子品主商品id
|
||||
|
||||
@@ -387,17 +387,19 @@ func (p *PurchaseHandler) ConfirmReceiveGoods(ctx *jxcontext.Context, order *mod
|
||||
// 将订单从购物平台配送转为自送
|
||||
func (p *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName string) (err error) {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if err = api.EbaiAPI.OrderSwitchselfdelivery(order.VendorOrderID); err != nil {
|
||||
if strings.Contains(err.Error(), "301251") {
|
||||
api.EbaiAPI.OrderCancelDelivery(order.VendorOrderID) // 取消呼叫众包骑手
|
||||
}
|
||||
if utils.IsErrMatch(err, "301251", nil) {
|
||||
if deliveryStatus, err2 := api.EbaiAPI.OrderDeliveryGet(order.VendorOrderID); err2 == nil {
|
||||
deliveryStatus := utils.Int64ToStr(utils.MustInterface2Int64(deliveryStatus["status"]))
|
||||
if deliveryStatus == ebaiapi.WaybillStatusSelfDelivery {
|
||||
err = nil
|
||||
} else if deliveryStatus == ebaiapi.WaybillStatusDeliveryCancled {
|
||||
p.trySyncCancelStatus(order.VendorOrderID)
|
||||
if order.DeliveryType == model.OrderDeliveryTypePlatform {
|
||||
if err = api.EbaiAPI.OrderSwitchselfdelivery(order.VendorOrderID); err != nil {
|
||||
if strings.Contains(err.Error(), "301251") {
|
||||
api.EbaiAPI.OrderCancelDelivery(order.VendorOrderID) // 取消呼叫众包骑手
|
||||
}
|
||||
if utils.IsErrMatch(err, "301251", nil) {
|
||||
if deliveryStatus, err2 := api.EbaiAPI.OrderDeliveryGet(order.VendorOrderID); err2 == nil {
|
||||
deliveryStatus := utils.Int64ToStr(utils.MustInterface2Int64(deliveryStatus["status"]))
|
||||
if deliveryStatus == ebaiapi.WaybillStatusSelfDelivery {
|
||||
err = nil
|
||||
} else if deliveryStatus == ebaiapi.WaybillStatusDeliveryCancled {
|
||||
p.trySyncCancelStatus(order.VendorOrderID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,29 +14,31 @@ import (
|
||||
|
||||
// OnOrderMsg 抖音
|
||||
func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackResponse) {
|
||||
globals.SugarLogger.Debugf("GetCallbackOrderId tiktok msg %s", utils.Format4Output(msg, false))
|
||||
if CurPurchaseHandler != nil {
|
||||
orderId, shopId, _ := api.TiktokStore.GetCallbackOrderId(msgId, msg)
|
||||
globals.SugarLogger.Debugf("shopId %d", shopId)
|
||||
//if shopId != 0 {
|
||||
//storeDetail, err := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int64ToStr(shopId), model.VendorIDDD, "")
|
||||
//globals.SugarLogger.Debugf("==storeDetail=: %s", utils.Format4Output(storeDetail, false))
|
||||
//globals.SugarLogger.Debugf("==err=: %s", utils.Format4Output(err, false))
|
||||
//if err != nil || storeDetail == nil || storeDetail.Store.ID == 0 {
|
||||
// // 当前订单所属门店不属于菜市时,将消息推送到果园
|
||||
// gyMsg := map[string]interface{}{"tag": msgId, "msg_id": utils.Int64ToStr(time.Now().Unix()) + msgId, "data": msg}
|
||||
// // 通知到果园
|
||||
// gyResult, err := HttpToGuoYuan(gyMsg, "order")
|
||||
// if err != nil {
|
||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
||||
// }
|
||||
// result, _ := ioutil.ReadAll(gyResult.Body)
|
||||
// var guoYuan *tiktokShop.CallbackResponse
|
||||
// if err := json.Unmarshal(result, guoYuan); err != nil {
|
||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
||||
// }
|
||||
// return guoYuan
|
||||
globals.SugarLogger.Debugf("order_id %s,%s", orderId, shopId)
|
||||
//orderDetail, err := GetTiktokApi(utils.Int64ToStr(shopId), 0, "").GetTiktokOrderDetail(orderId)
|
||||
//if err != nil {
|
||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
||||
//}
|
||||
//vendorStoreID := orderDetail.ShopId
|
||||
//if vendorStoreID != 0 {
|
||||
// storeDetail, err := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int64ToStr(vendorStoreID), model.VendorIDDD, "")
|
||||
// if err != nil || storeDetail == nil || storeDetail.Store.ID == 0 {
|
||||
// // 当前订单所属门店不属于菜市时,将消息推送到果园
|
||||
// gyMsg := map[string]interface{}{"tag": msgId, "msg_id": utils.Int64ToStr(time.Now().Unix()) + msgId, "data": msg}
|
||||
// // 通知到果园
|
||||
// gyResult, err := HttpToGuoYuan(gyMsg, "order")
|
||||
// if err != nil {
|
||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
||||
// }
|
||||
// result, _ := ioutil.ReadAll(gyResult.Body)
|
||||
// var guoYuan *tiktokShop.CallbackResponse
|
||||
// if err := json.Unmarshal(result, guoYuan); err != nil {
|
||||
// return tiktokShop.Err2CallbackResponse(err, "")
|
||||
// }
|
||||
// return guoYuan
|
||||
// }
|
||||
//}
|
||||
jxutils.CallMsgHandler(func() {
|
||||
response = CurPurchaseHandler.onOrderMsg(msgId, orderId, msg)
|
||||
@@ -46,6 +48,7 @@ func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackRes
|
||||
}
|
||||
|
||||
func HttpToGuoYuan(param map[string]interface{}, requestType string) (*http.Response, error) {
|
||||
globals.SugarLogger.Debugf("=========param %s", utils.Format4Output(param, false))
|
||||
paramData, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -58,7 +61,8 @@ func HttpToGuoYuan(param map[string]interface{}, requestType string) (*http.Resp
|
||||
case "order": // 订单相关
|
||||
url = "http://callback-jxgy.jxc4.com/tiktok/callbackTiktokOrderMsg"
|
||||
case "token": // 授权相关
|
||||
case "wayBill": // 授权相关
|
||||
url = "http://callback-jxgy.jxc4.com/tiktokShop/jxcsToGyTiktokToken"
|
||||
case "wayBill": // 运单消息
|
||||
|
||||
}
|
||||
httpReq, err := http.NewRequest(http.MethodPost, url, body)
|
||||
|
||||
@@ -221,19 +221,11 @@ func (p *PurchaseHandler) getUploadImgPoiCode() (poiCode string) {
|
||||
}
|
||||
|
||||
func getAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *tiktok_api.API) {
|
||||
apiObj = partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API)
|
||||
//if appOrgCode == globals.TiktokShopCode {
|
||||
// var storeDetail *dao.StoreDetail
|
||||
// if storeID != 0 {
|
||||
// storeDetail, _ = dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDDD, appOrgCode)
|
||||
// } else if vendorStoreID != "" {
|
||||
// storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDDD, appOrgCode)
|
||||
// }
|
||||
// if storeDetail != nil {
|
||||
// apiObj.SetToken(storeDetail.MtwmToken)
|
||||
// }
|
||||
//}
|
||||
return apiObj
|
||||
return partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API)
|
||||
}
|
||||
|
||||
func GetTiktokApi(appOrgCode string, storeID int, vendorStoreID string) *tiktok_api.API {
|
||||
return getAPI(appOrgCode, storeID, vendorStoreID)
|
||||
}
|
||||
|
||||
func getAPIWithoutToken(appOrgCode string) (apiObj *tiktok_api.API) {
|
||||
|
||||
@@ -703,21 +703,22 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
api := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "")
|
||||
if globals.EnableDdStoreWrite {
|
||||
if isAgree {
|
||||
errList := make([]string, 0, 0)
|
||||
// 同意仅退款
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeOnlyRefundApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeOnlyRefundApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeToReturnOneApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeToReturnOneApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeToReturnTwoApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuAgreeToReturnTwoApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
@@ -729,17 +730,17 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod
|
||||
} else {
|
||||
errList := make([]string, 0, 0)
|
||||
// 拒绝退款
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseOnlyRefundApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseOnlyRefundApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseToReturnOneApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseToReturnOneApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseToReturnTwoApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
if err = api.AfterSaleOperate(tiktokShop.AfterSaleEmuRefuseToReturnTwoApply, afsOrder.AfsOrderID, reason, utils.Str2Int64(order.VendorStoreID)); err != nil {
|
||||
errList = append(errList, err.Error())
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@@ -81,3 +81,17 @@ func (c *BiddingController) GetStoreBindStatus() {
|
||||
return nil, "", nil
|
||||
})
|
||||
}
|
||||
|
||||
// NeedDeleteGetStoreBindStatus 查询门店是否绑定成功,成功之后创建本地门店
|
||||
// 查询门店是否绑定成功,成功之后创建本地门店
|
||||
// @Title 查询门店是否绑定成功,成功之后创建本地门店
|
||||
// @Description 查询门店是否绑定成功,成功之后创建本地门店
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /NeedDeleteGetStoreBindStatus [get]
|
||||
func (c *BiddingController) NeedDeleteGetStoreBindStatus() {
|
||||
c.callNeedDeleteGetStoreBindStatus(func(params *tBindNeedDeleteGetStoreBindStatusParams) (interface{}, string, error) {
|
||||
dd := bidding.QueryNeedDeleteSku()
|
||||
return dd, "", nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -150,9 +150,28 @@ func (c *TiktokShopController) TokenMsg() {
|
||||
return
|
||||
}
|
||||
|
||||
// 授权码发生变化,通知到果园
|
||||
{
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
func (c *TiktokShopController) JxcsToGyTiktokToken() {
|
||||
data, err := ioutil.ReadAll(c.Ctx.Request.Body)
|
||||
if err != nil {
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
param := &model.VendorOrgCode{}
|
||||
if err := json.Unmarshal(data, param); err != nil {
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
if err := common.AddVendorOrgCode(nil, param); err != nil {
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
||||
|
||||
@@ -12,8 +12,8 @@ type VersionController struct {
|
||||
// @Title 添加小程序的版本控制
|
||||
// @Description 添加小程序的版本控制
|
||||
// @Param token header string true "认证token"
|
||||
// @Param appId header string true "小程序id"
|
||||
// @Param version header string true "小程序版本"
|
||||
// @Param appId query string true "小程序id"
|
||||
// @Param version query string true "小程序版本"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddVersionController [post]
|
||||
@@ -27,8 +27,8 @@ func (c *VersionController) AddVersionController() {
|
||||
// @Title 修改小程序的版本控制
|
||||
// @Description 修改小程序的版本控制
|
||||
// @Param token header string true "认证token"
|
||||
// @Param appId header string true "小程序id"
|
||||
// @Param version header string true "小程序版本"
|
||||
// @Param appId query string true "小程序id"
|
||||
// @Param version query string true "小程序版本"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateVersionController [post]
|
||||
@@ -42,7 +42,7 @@ func (c *VersionController) UpdateVersionController() {
|
||||
// @Title 获取版本控制
|
||||
// @Description 获取版本控制
|
||||
// @Param token header string false "认证token"
|
||||
// @Param appId header string false "小程序id"
|
||||
// @Param appId query string false "小程序id"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetVersionController [get]
|
||||
|
||||
@@ -4197,6 +4197,14 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:BiddingController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:BiddingController"],
|
||||
web.ControllerComments{
|
||||
Method: "NeedDeleteGetStoreBindStatus",
|
||||
Router: `/NeedDeleteGetStoreBindStatus`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
// 版本设置
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:VersionController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:VersionController"],
|
||||
|
||||
Reference in New Issue
Block a user