Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2023-03-28 14:47:50 +08:00
9 changed files with 115 additions and 12 deletions

View File

@@ -427,7 +427,7 @@ func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) {
if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil {
user, err := dao.GetUserByID(dao.GetDB(), "mobile", mobile)
if err != nil {
return errors.New("此接口有执行顺序请先调用注册登录接口【第一步Login第二TiktokDecrypt】")
return errors.New("此接口有执行顺序请先调用注册登录接口【第一步Login第二TiktokDecrypt】")
}
authInfo.AuthBindInfo.UserID = user.UserID
//handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())

View File

@@ -2035,12 +2035,18 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) {
}
// 查询门店爆款商品,当门店存在爆款时,取消之前的力荐商品,将新的爆款设置为力荐商品
//if k == mtwmapi.RetailActTypeSecKill && len(actList) > 0 {
// allActivityList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
// activationActivityList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
// allActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
// activationActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
// loseActivitySkuIdList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品
// for _, ac := range actList {
// allActivityList = append(allActivityList, utils.Int64ToStr(ac.ItemID))
// if ac.Status == 1 {
// activationActivityList = append(activationActivityList, utils.Int64ToStr(ac.ItemID))
// allActivitySkuIdList = append(allActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
// // 已经生效的爆款活动
// if ac.Status == 1 && ac.SkuId != "" {
// activationActivitySkuIdList = append(activationActivitySkuIdList, utils.Int64ToStr(ac.ItemID))
// }
// // 已经失效的爆款活动
// if ac.Status == 0 && ac.SkuId != "" {
// loseActivitySkuIdList = append(loseActivitySkuIdList, ac.SkuId)
// }
// }
// // 取消当前力荐商品

View File

@@ -1149,7 +1149,13 @@ type aa struct {
// 根据名称获取商品分类[京东]
func getCategoryByName(name string) string {
handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDJD).(partner.IPurchasePlatformStoreSkuHandler)
vendorCategoryId, _ := handler.GetSkuCategoryIdByName("320406", name)
vendorOrgCode := ""
if beego.BConfig.RunMode == "jxgy" {
vendorOrgCode = "339032"
} else {
vendorOrgCode = "320406"
}
vendorCategoryId, _ := handler.GetSkuCategoryIdByName(vendorOrgCode, name)
return vendorCategoryId
}
@@ -1163,7 +1169,13 @@ func getCategoryByImg(img ...string) string {
imgs = append(imgs, v)
}
handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDDD).(partner.IPurchasePlatformStoreSkuHandler)
vendorCategoryId, _ := handler.GetSkuCategoryIdByName("57939570", strings.Join(imgs, "|"))
vendorOrgCode := ""
if beego.BConfig.RunMode == "jxgy" {
vendorOrgCode = "57939570"
} else {
vendorOrgCode = "57939570"
}
vendorCategoryId, _ := handler.GetSkuCategoryIdByName(vendorOrgCode, strings.Join(imgs, "|"))
return vendorCategoryId
}
@@ -1262,12 +1274,20 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n
if payload["mtwmCategoryID"] != nil {
mtwmCategoryID = payload["mtwmCategoryID"].(string)
}
if payload["categoryID2"] != nil {
if payload["categoryID2"] != nil && !utils.IsNil(payload["categoryID2"]) {
jxCategoryIDNumber, err := payload["categoryID2"].(json.Number).Int64()
if err != nil {
return false
}
jxCategoryID = int(jxCategoryIDNumber)
} else if payload["categoryID"] != nil && !utils.IsNil(payload["categoryID"]) {
jxCategoryIDNumber, err := payload["categoryID"].(json.Number).Int64()
if err != nil {
return false
}
jxCategoryID = int(jxCategoryIDNumber)
} else {
jxCategoryID = 0
}
if jdCategoryId != "" {

View File

@@ -1762,6 +1762,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
panic(r)
}
}()
if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map只有Status改变才需要同步到厂商
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
model.FieldStoreID: storeID,

View File

@@ -229,7 +229,7 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
outAuthInfo, err = auth2.BindUser(inAuthInfo, user)
}
} else if dao.IsDuplicateError(err) {
if user.LastLoginType != "" && user.LastLoginType == alipay.AuthType {
if user.LastLoginType == alipay.AuthType {
if user2, _ := dao.GetUserByID(dao.GetDB(), "mobile", user.GetMobile()); user2 != nil {
user.UserID = user2.GetID()
outAuthInfo, err = auth2.BindUser(inAuthInfo, user)

View File

@@ -100,7 +100,17 @@ func (c *Auth2Controller) SendVerifyCode() {
func (c *Auth2Controller) TiktokDecrypt() {
c.callTiktokDecrypt(func(params *tAuth2TiktokDecryptParams) (interface{}, string, error) {
phone, err := auth2.DecryptUserMsg(params.SessionKey, params.Iv, params.Msg, params.LoginType)
return phone, "", err
isExist := false
if phone != "" {
if user, err := dao.GetUserByID(dao.GetDB(), "mobile", phone); err == nil {
if user != nil {
isExist = true
} else {
isExist = false
}
}
}
return map[string]interface{}{"mobile": phone, "isExist": isExist}, "", err
})
}

View File

@@ -4,8 +4,10 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
"github.com/astaxie/beego/server/web"
"time"
)
type JxOrderController struct {
@@ -54,6 +56,61 @@ func (c *JxOrderController) Pay4Order() {
})
}
// @Title 请求支付京西商城订单,门店自提订单
// @Description 请求支付京西商城订单,门店自提订单
// @Param token header string true "认证token"
// @Param subAppID formData string false "appID"
// @Param payType formData int true "支付类型"
// @Param vendorPayType formData string true "平台支付类型"
// @Param payMoney formData int true "自提支付金额"
// @Param storeId formData int true "提货门店id"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /Pay4StoreMyselfDeliverOrder [post]
func (c *JxOrderController) Pay4StoreMyselfDeliverOrder() {
c.callPay4StoreMyselfDeliverOrder(func(params *tJxorderPay4StoreMyselfDeliverOrderParams) (interface{}, string, error) {
orderDetail, _ := dao.GetStoreDetail(dao.GetDB(), params.StoreId, 0, "")
jxOrder := &localjx.JxOrderInfo{
BuyerComment: "门店自提单",
StoreID: params.StoreId,
Skus: []*localjx.JxSkuInfo{
&localjx.JxSkuInfo{
SkuID: 8030743,
Count: params.PayMoney,
Price: 1,
SalePrice: 1,
Name: "自定义支付购买",
Weight: 1,
GroupSign: false,
DefendPrice: 0,
},
},
ExpectedDeliveredTimestamp: time.Now().Unix(),
TotalPrice: int64(params.PayMoney),
FreightPrice: 0,
OrderPrice: int64(params.PayMoney),
ActualPayPrice: int64(params.PayMoney),
OrderID: 0,
StoreName: orderDetail.Name,
Weight: 500,
FromStoreID: 0,
EarningType: model.EarningTypePoints,
OrderType: model.OrderTypeNormal,
IsBuyNowPrice: 0,
IsPriceDefend: 0,
OrderID2: "",
UserID: params.Ctx.GetUserID(),
}
outJxOrder, err := localjx.CreateOrder(params.Ctx, jxOrder, int64(142), 1, 0, true, nil)
if err != nil {
return nil, "", err
}
retVal, err := localjx.Pay4Order(params.Ctx, outJxOrder.OrderID, params.PayType, params.VendorPayType, params.SubAppID)
return retVal, "", err
})
}
// @Title 请求支付京西商城相关用户支付项目
// @Description 请求支付京西商城相关用户支付项目
// @Param token header string true "认证token"

View File

@@ -270,6 +270,7 @@ func Init() {
if WeixinMiniAppID3 = beego.AppConfig.DefaultString("weixinMiniAppID3", ""); WeixinMiniAppID3 != "" {
WeixinApp = weixinapi.New(WeixinMiniAppID3, beego.AppConfig.DefaultString("weixinMiniSecret3", ""))
}
WeixinApp2 = weixinapi.New("wxf3657c94aa01a3f0", "ce2b9c4cf991d72a09f67bab4d359015") // 暂时写死的
if WeixinMiniAppIDsc = beego.AppConfig.DefaultString("weixinMiniAppIDsc", ""); WeixinMiniAppIDsc != "" {

View File

@@ -910,7 +910,15 @@ func init() {
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
web.ControllerComments{
Method: "Pay4Order",
Router: `/Pay4Order`,
Router: `4Order`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
web.ControllerComments{
Method: "Pay4StoreMyselfDeliverOrder",
Router: `Pay4StoreMyselfDeliverOrder`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,