Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -435,5 +435,5 @@ func DisableUser(userID, operatorUserName string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetUserBindAuthInfo(userID string) (authList []*model.AuthBind, err error) {
|
func GetUserBindAuthInfo(userID string) (authList []*model.AuthBind, err error) {
|
||||||
return dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, "", nil)
|
return dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, nil, "", "")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ func (a *DefAuther) GetUserType() (userType int8) {
|
|||||||
func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []string, openID, unionID string, authDetail interface{}) (authBindEx *auth2.AuthBindEx, err error) {
|
func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []string, openID, unionID string, authDetail interface{}) (authBindEx *auth2.AuthBindEx, err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
var authBind *model.AuthBind
|
var authBind *model.AuthBind
|
||||||
if authBind, err = dao.GetAuthBind(db, "", model.AuthBindTypeAuth, curAuthType, openID); err == nil { // 直接找到了
|
if authBind, err = dao.GetAuthBind(db, model.AuthBindTypeAuth, curAuthType, openID); err == nil { // 直接找到了
|
||||||
authBindEx = &auth2.AuthBindEx{
|
authBindEx = &auth2.AuthBindEx{
|
||||||
AuthBind: *authBind,
|
AuthBind: *authBind,
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []st
|
|||||||
} else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID
|
} else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID
|
||||||
if unionID != "" { // 且有unionID
|
if unionID != "" { // 且有unionID
|
||||||
var authBindList []*model.AuthBind
|
var authBindList []*model.AuthBind
|
||||||
if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionID, unionAuthTypeList); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, "", unionID); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
||||||
authBind = authBindList[0]
|
authBind = authBindList[0]
|
||||||
authBind.Type = curAuthType
|
authBind.Type = curAuthType
|
||||||
authBind.AuthID = openID
|
authBind.AuthID = openID
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func init() {
|
|||||||
func (a *Auther) VerifySecret(userID, passMD5 string) (authBindEx *auth2.AuthBindEx, err error) {
|
func (a *Auther) VerifySecret(userID, passMD5 string) (authBindEx *auth2.AuthBindEx, err error) {
|
||||||
globals.SugarLogger.Debugf("localpass VerifySecret userID:%s", userID)
|
globals.SugarLogger.Debugf("localpass VerifySecret userID:%s", userID)
|
||||||
var authBind *model.AuthBind
|
var authBind *model.AuthBind
|
||||||
if authBind, err = dao.GetAuthBind(dao.GetDB(), "", model.AuthBindTypeAuth, AuthType, userID); err == nil {
|
if authBind, err = dao.GetAuthBind(dao.GetDB(), model.AuthBindTypeAuth, AuthType, userID); err == nil {
|
||||||
if err = a.checkPassword(authBind, passMD5); err == nil {
|
if err = a.checkPassword(authBind, passMD5); err == nil {
|
||||||
authBindEx = &auth2.AuthBindEx{
|
authBindEx = &auth2.AuthBindEx{
|
||||||
AuthBind: *authBind,
|
AuthBind: *authBind,
|
||||||
@@ -55,7 +55,7 @@ func (a *Auther) ChangePassword(userID, oldPassMD5, newPassMD5 string) (err erro
|
|||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
salt := utils.GetUUID()
|
salt := utils.GetUUID()
|
||||||
encryptPwd := a.encryptPassword(newPassMD5, salt)
|
encryptPwd := a.encryptPassword(newPassMD5, salt)
|
||||||
if authBind, err = dao.GetAuthBind(db, "", model.AuthBindTypeAuth, AuthType, userID); err == nil {
|
if authBind, err = dao.GetAuthBind(db, model.AuthBindTypeAuth, AuthType, userID); err == nil {
|
||||||
if err = a.checkPassword(authBind, oldPassMD5); err == nil || authBind.AuthSecret == "" { // 如果原密码为空,不判断原密码,代表重置密码
|
if err = a.checkPassword(authBind, oldPassMD5); err == nil || authBind.AuthSecret == "" { // 如果原密码为空,不判断原密码,代表重置密码
|
||||||
_, err = dao.UpdateEntityLogically(db, authBind, map[string]interface{}{
|
_, err = dao.UpdateEntityLogically(db, authBind, map[string]interface{}{
|
||||||
"AuthSecret": encryptPwd,
|
"AuthSecret": encryptPwd,
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ func NewRole(name string, storeID int) (r *authz.RoleInfo) {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewStoreBossRole(storeID int) (r *authz.RoleInfo) {
|
||||||
|
return NewRole(authz.StoreRoleBoss, storeID)
|
||||||
|
}
|
||||||
|
|
||||||
func NewRoleByModel(conf *model.NewConfig) (r *authz.RoleInfo) {
|
func NewRoleByModel(conf *model.NewConfig) (r *authz.RoleInfo) {
|
||||||
if conf.Type != model.ConfigTypeRole {
|
if conf.Type != model.ConfigTypeRole {
|
||||||
r = NewRole(conf.Key, 0)
|
r = NewRole(conf.Key, 0)
|
||||||
|
|||||||
@@ -110,13 +110,28 @@ func (c *OrderManager) OnOrderAdjust(order *model.GoodsOrder, orderStatus *model
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = utils.CallFuncLogError(func() error {
|
previousOrder := &model.GoodsOrder{
|
||||||
_, err = db.Db.Raw("DELETE FROM goods_order WHERE vendor_order_id = ? AND vendor_id = ?", order.VendorOrderID, order.VendorID).Exec()
|
VendorOrderID: order.VendorOrderID,
|
||||||
return err
|
VendorID: order.VendorID,
|
||||||
}, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
}
|
||||||
if err != nil {
|
if err = dao.GetEntity(db, previousOrder, model.FieldVendorOrderID, model.FieldVendorID); err != nil && !dao.IsNoRowsError(err) {
|
||||||
|
globals.SugarLogger.Warnf("OnOrderAdjust, order:%s GetEntity failed with error:%v", order.VendorOrderID, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
adjustCount := int8(0)
|
||||||
|
if err == nil {
|
||||||
|
adjustCount = previousOrder.AdjustCount
|
||||||
|
if _, err = dao.DeleteEntity(db, previousOrder); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
globals.SugarLogger.Warnf("OnOrderAdjust, but previous order:%s doesn't exist", order.VendorOrderID)
|
||||||
|
}
|
||||||
|
// err = utils.CallFuncLogError(func() error {
|
||||||
|
// _, err = db.Db.Raw("DELETE FROM goods_order WHERE vendor_order_id = ? AND vendor_id = ?", order.VendorOrderID, order.VendorID).Exec()
|
||||||
|
// return err
|
||||||
|
// }, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
||||||
|
order.AdjustCount = adjustCount + 1
|
||||||
isDuplicated, err = c.SaveOrder(order, true, db)
|
isDuplicated, err = c.SaveOrder(order, true, db)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -346,16 +361,21 @@ func (c *OrderManager) updateOrderOtherInfo(order *model.GoodsOrder, db *dao.Dao
|
|||||||
globals.SugarLogger.Debugf("updateOrderOtherInfo orderID:%s, VendorStoreID:%s", order.VendorOrderID, order.VendorStoreID)
|
globals.SugarLogger.Debugf("updateOrderOtherInfo orderID:%s, VendorStoreID:%s", order.VendorOrderID, order.VendorStoreID)
|
||||||
|
|
||||||
payPercentage := 0
|
payPercentage := 0
|
||||||
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, order.VendorID)
|
if order.VendorID != model.VendorIDJX {
|
||||||
if err != nil {
|
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, order.VendorID)
|
||||||
globals.SugarLogger.Warnf("updateOrderOtherInfo GetStoreDetailByVendorStoreID orderID:%s, VendorStoreID:%s, error:%v", order.VendorOrderID, order.VendorStoreID, err)
|
if err != nil {
|
||||||
if !dao.IsNoRowsError(err) {
|
globals.SugarLogger.Warnf("updateOrderOtherInfo GetStoreDetailByVendorStoreID orderID:%s, VendorStoreID:%s, error:%v", order.VendorOrderID, order.VendorStoreID, err)
|
||||||
return err
|
if !dao.IsNoRowsError(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = nil
|
||||||
|
} else {
|
||||||
|
order.JxStoreID = storeDetail.Store.ID
|
||||||
|
payPercentage = storeDetail.PayPercentage
|
||||||
}
|
}
|
||||||
err = nil
|
|
||||||
} else {
|
} else {
|
||||||
order.JxStoreID = storeDetail.Store.ID
|
order.JxStoreID = order.StoreID
|
||||||
payPercentage = storeDetail.PayPercentage
|
payPercentage = 100
|
||||||
}
|
}
|
||||||
if err = c.updateOrderSkuOtherInfo(order, db, payPercentage); err == nil {
|
if err = c.updateOrderSkuOtherInfo(order, db, payPercentage); err == nil {
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cms
|
|||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||||
"git.rosy.net.cn/jx-callback/business/authz"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
@@ -111,7 +110,7 @@ func TransferLegacyWeixins(mobile string) (err error) {
|
|||||||
}
|
}
|
||||||
if v.JxStoreID > 0 { // 运营就不加到门店老板组里了
|
if v.JxStoreID > 0 { // 运营就不加到门店老板组里了
|
||||||
if user.Type&model.UserTypeOperator == 0 {
|
if user.Type&model.UserTypeOperator == 0 {
|
||||||
api2.RoleMan.AddRole4User(user.GetID(), autils.NewRole(authz.StoreRoleBoss, v.JxStoreID))
|
api2.RoleMan.AddRole4User(user.GetID(), autils.NewStoreBossRole(v.JxStoreID))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if mobile != "" {
|
if mobile != "" {
|
||||||
@@ -119,7 +118,7 @@ func TransferLegacyWeixins(mobile string) (err error) {
|
|||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
for _, role := range rList {
|
for _, role := range rList {
|
||||||
if role.StoreID > 0 {
|
if role.StoreID > 0 {
|
||||||
api2.RoleMan.DeleteRole4User(user.GetID(), autils.NewRole(authz.StoreRoleBoss, role.StoreID))
|
api2.RoleMan.DeleteRole4User(user.GetID(), autils.NewStoreBossRole(role.StoreID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api2"
|
"git.rosy.net.cn/jx-callback/globals/api2"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/authz"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
|
_ "git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
|
||||||
_ "git.rosy.net.cn/jx-callback/business/partner/purchase/elm"
|
_ "git.rosy.net.cn/jx-callback/business/partner/purchase/elm"
|
||||||
@@ -23,7 +22,7 @@ func TestTransferLegacyWeixins(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCasbin(t *testing.T) {
|
func TestCasbin(t *testing.T) {
|
||||||
userList, err := api2.RoleMan.GetRoleUserList(autils.NewRole(authz.StoreRoleBoss, 100324))
|
userList, err := api2.RoleMan.GetRoleUserList(autils.NewStoreBossRole(100324))
|
||||||
t.Log(utils.Format4Output(userList, false))
|
t.Log(utils.Format4Output(userList, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -1585,6 +1585,27 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
|
|||||||
storeDetail, _ := dao.GetStoreDetail(db, storeID, list[0].VendorID)
|
storeDetail, _ := dao.GetStoreDetail(db, storeID, list[0].VendorID)
|
||||||
if storeDetail != nil {
|
if storeDetail != nil {
|
||||||
storeDetailMap[storeID] = storeDetail
|
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} {
|
for _, mobile := range []string{storeDetail.Tel1, storeDetail.MarketManPhone, storeDetail.OperatorPhone} {
|
||||||
if mobile != "" {
|
if mobile != "" {
|
||||||
if userMap[mobile] == nil {
|
if userMap[mobile] == nil {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ func TryAddStoreBossRole4User(ctx *jxcontext.Context, user *model.User) (err err
|
|||||||
if storeList, err := dao.GetStoreList(dao.GetDB(), nil, []string{userMobile}, ""); err == nil && len(storeList) > 0 {
|
if storeList, err := dao.GetStoreList(dao.GetDB(), nil, []string{userMobile}, ""); err == nil && len(storeList) > 0 {
|
||||||
roleList := make([]*authz.RoleInfo, len(storeList))
|
roleList := make([]*authz.RoleInfo, len(storeList))
|
||||||
for k, v := range storeList {
|
for k, v := range storeList {
|
||||||
roleList[k] = autils.NewRole(authz.StoreRoleBoss, v.ID)
|
roleList[k] = autils.NewStoreBossRole(v.ID)
|
||||||
}
|
}
|
||||||
err = AddRoles4User(ctx, user.GetID(), roleList)
|
err = AddRoles4User(ctx, user.GetID(), roleList)
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ func TryAddStoreBossRole4StoreByMobile(ctx *jxcontext.Context, storeID int, mobi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(userIDs) > 0 {
|
if len(userIDs) > 0 {
|
||||||
role := autils.NewRole(authz.StoreRoleBoss, storeID)
|
role := autils.NewStoreBossRole(storeID)
|
||||||
err = AddUsers4Role(ctx, role, userIDs)
|
err = AddUsers4Role(ctx, role, userIDs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,6 +161,10 @@ func TryAddStoreBossRole4StoreByMobile(ctx *jxcontext.Context, storeID int, mobi
|
|||||||
|
|
||||||
func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
||||||
var user *model.User
|
var user *model.User
|
||||||
|
mobileNumber := jxutils.GetRealMobile4Order(order)
|
||||||
|
if mobileNumber == "" && order.VendorUserID == "" {
|
||||||
|
return fmt.Errorf("订单:%s手机号与平台用户标识都是空", order.VendorOrderID)
|
||||||
|
}
|
||||||
authType := jxutils.GetAuthType4Vendor(order.VendorID)
|
authType := jxutils.GetAuthType4Vendor(order.VendorID)
|
||||||
if authType == "" {
|
if authType == "" {
|
||||||
msg := fmt.Sprintf("平台ID:%d当前不被支持,请联系开发", order.VendorID)
|
msg := fmt.Sprintf("平台ID:%d当前不被支持,请联系开发", order.VendorID)
|
||||||
@@ -169,7 +173,6 @@ func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
oeratorName := order.VendorOrderID
|
oeratorName := order.VendorOrderID
|
||||||
mobileNumber := jxutils.GetRealMobile4Order(order)
|
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
if mobileNumber != "" {
|
if mobileNumber != "" {
|
||||||
userList, _, err2 := dao.GetUsers(db, 0, "", nil, "", mobileNumber, 0, 0)
|
userList, _, err2 := dao.GetUsers(db, 0, "", nil, "", mobileNumber, 0, 0)
|
||||||
@@ -182,15 +185,15 @@ func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vendorUserID := order.VendorUserID
|
vendorUserID := order.VendorUserID
|
||||||
if err == nil && vendorUserID != "" {
|
if vendorUserID != "" {
|
||||||
authInfo, err2 := dao.GetAuthBind(db, "", model.AuthBindTypeID, authType, vendorUserID)
|
authInfo, err2 := dao.GetAuthBind(db, model.AuthBindTypeID, authType, vendorUserID)
|
||||||
if err = err2; err != nil && !dao.IsNoRowsError(err) {
|
if err = err2; err != nil && !dao.IsNoRowsError(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
vendorUserID = ""
|
vendorUserID = ""
|
||||||
if user == nil {
|
if user == nil {
|
||||||
if user, err = dao.GetUserByID(db, "UserID", authInfo.UserID); err != nil {
|
if user, err = dao.GetUserByID(db, "user_id", authInfo.UserID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,6 +202,7 @@ func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Remark = "fromOrder"
|
||||||
if user == nil {
|
if user == nil {
|
||||||
user = &model.User{
|
user = &model.User{
|
||||||
UserID2: mobileNumber,
|
UserID2: mobileNumber,
|
||||||
@@ -206,20 +210,19 @@ func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
|||||||
Mobile: &mobileNumber,
|
Mobile: &mobileNumber,
|
||||||
Type: model.UserTypeConsumer,
|
Type: model.UserTypeConsumer,
|
||||||
Address: order.ConsigneeAddress,
|
Address: order.ConsigneeAddress,
|
||||||
Remark: order.VendorOrderID,
|
Remark: Remark,
|
||||||
}
|
}
|
||||||
setUserAddress(db, user, order)
|
setUserAddress(db, user, order)
|
||||||
|
|
||||||
if user.GetID2() == "" {
|
if user.GetID2() == "" {
|
||||||
user.UserID2 = vendorUserID
|
user.UserID2 = order.VendorUserID
|
||||||
}
|
}
|
||||||
if user.GetID2() == "" {
|
if user.GetID2() == "" {
|
||||||
user.UserID2 = order.VendorUserID
|
user.UserID2 = order.VendorOrderID
|
||||||
}
|
}
|
||||||
|
|
||||||
user.Type = model.UserTypeConsumer
|
user.Type = model.UserTypeConsumer
|
||||||
err = CreateUser(user, oeratorName)
|
err = CreateUser(user, oeratorName)
|
||||||
globals.SugarLogger.Debug(err)
|
|
||||||
} else {
|
} else {
|
||||||
if user.GetMobile() == "" && mobileNumber != "" {
|
if user.GetMobile() == "" && mobileNumber != "" {
|
||||||
user.Mobile = &mobileNumber
|
user.Mobile = &mobileNumber
|
||||||
@@ -234,6 +237,7 @@ func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
|||||||
BindType: model.AuthBindTypeID,
|
BindType: model.AuthBindTypeID,
|
||||||
AuthID: vendorUserID,
|
AuthID: vendorUserID,
|
||||||
Type: authType,
|
Type: authType,
|
||||||
|
Remark: Remark,
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(authBind, oeratorName)
|
dao.WrapAddIDCULDEntity(authBind, oeratorName)
|
||||||
authBind.Status = model.AuthBindStatusNormal
|
authBind.Status = model.AuthBindStatusNormal
|
||||||
@@ -310,7 +314,7 @@ func OnDingDingMsg(msg map[string]interface{}) (callbackResponse *dingdingapi.Ca
|
|||||||
for _, userID := range msg[dingdingapi.KeyUserID].([]interface{}) {
|
for _, userID := range msg[dingdingapi.KeyUserID].([]interface{}) {
|
||||||
userIDStr := utils.Interface2String(userID)
|
userIDStr := utils.Interface2String(userID)
|
||||||
globals.SugarLogger.Debugf("OnDingDingMsg dingding user:%s left company", userIDStr)
|
globals.SugarLogger.Debugf("OnDingDingMsg dingding user:%s left company", userIDStr)
|
||||||
if authBind, err = dao.GetAuthBind(db, "", model.AuthBindTypeAuth, dingding.AuthTypeStaff, userIDStr); err == nil { // 直接找到了
|
if authBind, err = dao.GetAuthBind(db, model.AuthBindTypeAuth, dingding.AuthTypeStaff, userIDStr); err == nil { // 直接找到了
|
||||||
globals.SugarLogger.Debugf("OnDingDingMsg dingding user:%s, userID:%s left company", userIDStr, authBind.UserID)
|
globals.SugarLogger.Debugf("OnDingDingMsg dingding user:%s, userID:%s left company", userIDStr, authBind.UserID)
|
||||||
if err = DisableUser(jxcontext.AdminCtx, authBind.UserID); err != nil {
|
if err = DisableUser(jxcontext.AdminCtx, authBind.UserID); err != nil {
|
||||||
globals.SugarLogger.Errorf("OnDingDingMsg failed with error:%v", err)
|
globals.SugarLogger.Errorf("OnDingDingMsg failed with error:%v", err)
|
||||||
|
|||||||
@@ -999,3 +999,108 @@ func RefreshMtpsWaybillFee(ctx *jxcontext.Context, isAsync, isContinueWhenError
|
|||||||
}
|
}
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateConsumerFromOrders(ctx *jxcontext.Context, vendorIDs []int, fromDate, toDate time.Time, isForce, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
if utils.IsTimeZero(fromDate) {
|
||||||
|
return "", fmt.Errorf("fromDate必须指定")
|
||||||
|
}
|
||||||
|
if utils.IsTimeZero(toDate) {
|
||||||
|
toDate = time.Now()
|
||||||
|
}
|
||||||
|
fromDate = utils.Time2Date(fromDate)
|
||||||
|
toDate = utils.Time2Date(toDate)
|
||||||
|
if len(vendorIDs) == 0 {
|
||||||
|
vendorIDs = partner.GetPurchasePlatformVendorIDs()
|
||||||
|
}
|
||||||
|
var dateList []time.Time
|
||||||
|
curDate := fromDate
|
||||||
|
for {
|
||||||
|
if toDate.Sub(curDate) < 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
dateList = append(dateList, curDate)
|
||||||
|
curDate = curDate.Add(24 * time.Hour)
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsOrderWithOriginal struct {
|
||||||
|
model.GoodsOrder
|
||||||
|
OriginalData string `orm:"type(text)" json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
db := dao.GetDB()
|
||||||
|
rootTask := tasksch.NewParallelTask("从订单中创建消费者账户", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
curDate := batchItemList[0].(time.Time)
|
||||||
|
sql := `
|
||||||
|
SELECT t1.*, t2.original_data
|
||||||
|
FROM goods_order t1
|
||||||
|
LEFT JOIN goods_order_original t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id
|
||||||
|
WHERE t1.order_created_at >= ? AND t1.order_created_at < ?`
|
||||||
|
sqlParams := []interface{}{
|
||||||
|
curDate,
|
||||||
|
curDate.Add(24 * time.Hour),
|
||||||
|
}
|
||||||
|
if len(vendorIDs) > 0 {
|
||||||
|
sql += " AND t1.vendor_id IN (" + dao.GenQuestionMarks(len(vendorIDs)) + ")"
|
||||||
|
sqlParams = append(sqlParams, vendorIDs)
|
||||||
|
}
|
||||||
|
if !isForce {
|
||||||
|
sql += " AND t1.user_id = ''"
|
||||||
|
}
|
||||||
|
var orderList []*GoodsOrderWithOriginal
|
||||||
|
if err = dao.GetRows(db, &orderList, sql, sqlParams...); err == nil {
|
||||||
|
if len(orderList) > 0 {
|
||||||
|
// 并发必须是1,否则在HandleOrder4Consignee中可能导致主键重,错误
|
||||||
|
subTask := tasksch.NewParallelTask(fmt.Sprintf("处理日期:%s的订单", utils.Time2DateStr(curDate)), tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
|
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 {
|
||||||
|
var updateFields []string
|
||||||
|
if isForce || order.VendorUserID == "" {
|
||||||
|
var order2 *model.GoodsOrder
|
||||||
|
if order.OriginalData != "" {
|
||||||
|
var orderData map[string]interface{}
|
||||||
|
if utils.UnmarshalUseNumber([]byte(order.OriginalData), &orderData) == nil {
|
||||||
|
order2 = handler.Map2Order(orderData)
|
||||||
|
if order2.VendorUserID == "" {
|
||||||
|
order2 = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if order2 == nil && order.VendorID == model.VendorIDMTWM && time.Now().Sub(curDate) < 60*24*time.Hour {
|
||||||
|
order2, err = handler.GetOrder(order.VendorOrderID)
|
||||||
|
}
|
||||||
|
if order2 != nil {
|
||||||
|
if order2.VendorUserID != "" && order.VendorUserID != order2.VendorUserID {
|
||||||
|
updateFields = append(updateFields, "VendorUserID")
|
||||||
|
order.VendorUserID = order2.VendorUserID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if err = cms.HandleOrder4Consignee(&order.GoodsOrder); err == nil {
|
||||||
|
updateFields = append(updateFields, "UserID")
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if len(updateFields) > 0 {
|
||||||
|
dao.UpdateEntity(db, &order.GoodsOrder, updateFields...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}, orderList)
|
||||||
|
tasksch.HandleTask(subTask, task, true).Run()
|
||||||
|
_, err = subTask.GetResult(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}, dateList)
|
||||||
|
tasksch.HandleTask(rootTask, nil, true).Run()
|
||||||
|
if !isAsync {
|
||||||
|
_, err = rootTask.GetResult(0)
|
||||||
|
} else {
|
||||||
|
hint = rootTask.ID
|
||||||
|
}
|
||||||
|
return hint, err
|
||||||
|
}
|
||||||
|
|||||||
4
business/jxutils/cache/redis/redis_test.go
vendored
4
business/jxutils/cache/redis/redis_test.go
vendored
@@ -16,7 +16,7 @@ func init() {
|
|||||||
cacher = New("localhost", 6379, "")
|
cacher = New("localhost", 6379, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
type FuckYou struct {
|
type TestType struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ func TestIt(t *testing.T) {
|
|||||||
t.Fatal("should not get nothing")
|
t.Fatal("should not get nothing")
|
||||||
}
|
}
|
||||||
|
|
||||||
result := new(FuckYou)
|
result := new(TestType)
|
||||||
cacher.GetAs("key", result)
|
cacher.GetAs("key", result)
|
||||||
if result.Key != "value" {
|
if result.Key != "value" {
|
||||||
t.Fatal("should get value")
|
t.Fatal("should get value")
|
||||||
|
|||||||
@@ -427,14 +427,14 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err e
|
|||||||
if db == nil {
|
if db == nil {
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
}
|
}
|
||||||
openID := ""
|
openIDs := []string{}
|
||||||
storeID := 0
|
storeID := 0
|
||||||
remark := ""
|
remark := ""
|
||||||
|
|
||||||
if !globals.DisableWXAuth1 {
|
if !globals.DisableWXAuth1 {
|
||||||
wxinfo, err := dao.GetUserStoreInfo(db, "tel", mobile)
|
wxinfo, err := dao.GetUserStoreInfo(db, "tel", mobile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
openID = wxinfo.OpenID
|
openIDs = []string{wxinfo.OpenID}
|
||||||
storeID = wxinfo.JxStoreID
|
storeID = wxinfo.JxStoreID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,9 +449,11 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if userID != "" {
|
if userID != "" {
|
||||||
authBind, err2 := dao.GetAuthBind(db, userID, model.AuthBindTypeAuth, weixin.AuthTypeMP, "")
|
authBindList, err2 := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "")
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
openID = authBind.AuthID
|
for _, v := range authBindList {
|
||||||
|
openIDs = append(openIDs, v.AuthID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
roleList, err2 := api2.RoleMan.GetUserRoleList(userID)
|
roleList, err2 := api2.RoleMan.GetUserRoleList(userID)
|
||||||
if err = err2; err == nil && len(roleList) > 0 {
|
if err = err2; err == nil && len(roleList) > 0 {
|
||||||
@@ -460,7 +462,7 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if openID != "" {
|
if len(openIDs) > 0 {
|
||||||
if storeID > 0 {
|
if storeID > 0 {
|
||||||
store := &model.Store{}
|
store := &model.Store{}
|
||||||
store.ID = storeID
|
store.ID = storeID
|
||||||
@@ -475,7 +477,9 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err e
|
|||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if globals.EnableStoreWrite {
|
if globals.EnableStoreWrite {
|
||||||
err = api.WeixinAPI.CBUpdateRemark(openID, remark)
|
for _, openID := range openIDs {
|
||||||
|
err = api.WeixinAPI.CBUpdateRemark(openID, remark)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,7 +682,7 @@ func GetRealMobile4Order(order *model.GoodsOrder) (mobileNumber string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetAuthType4Vendor(vendorID int) (authType string) {
|
func GetAuthType4Vendor(vendorID int) (authType string) {
|
||||||
authType = model.VendorNames[vendorID]
|
authType = dao.ConvertJsonFieldPrefix(model.VendorNames[vendorID])
|
||||||
if authType != "" {
|
if authType != "" {
|
||||||
authType = "vendor." + authType
|
authType = "vendor." + authType
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ var (
|
|||||||
|
|
||||||
func SendSMSMsg(mobileList []string, signName, templateCode string, templateParam map[string]interface{}) (err error) {
|
func SendSMSMsg(mobileList []string, signName, templateCode string, templateParam map[string]interface{}) (err error) {
|
||||||
errList := errlist.New()
|
errList := errlist.New()
|
||||||
|
mobileList = jxutils.StringMap2List(jxutils.StringList2Map(mobileList))
|
||||||
for _, mobileNum := range mobileList {
|
for _, mobileNum := range mobileList {
|
||||||
if mobileNum != "" {
|
if mobileNum != "" {
|
||||||
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||||
"git.rosy.net.cn/jx-callback/business/authz"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||||
@@ -116,11 +115,13 @@ func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if globals.EnableWXAuth2 {
|
if globals.EnableWXAuth2 {
|
||||||
if userIDList, err2 := api2.RoleMan.GetRoleUserList(autils.NewRole(authz.StoreRoleBoss, storeID)); err2 == nil {
|
if userIDList, err2 := api2.RoleMan.GetRoleUserList(autils.NewStoreBossRole(storeID)); err2 == nil {
|
||||||
for _, v := range userIDList {
|
for _, v := range userIDList {
|
||||||
if authInfo, err2 := dao.GetAuthBind(db, v, model.AuthBindTypeAuth, weixin.AuthTypeMP, ""); err2 == nil {
|
if authList, err2 := dao.GetUserBindAuthInfo(db, v, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", ""); err2 == nil {
|
||||||
retVal = append(retVal, authInfo.AuthID)
|
for _, v := range authList {
|
||||||
openIDMap[authInfo.AuthID] = 1
|
retVal = append(retVal, v.AuthID)
|
||||||
|
openIDMap[v.AuthID] = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ const (
|
|||||||
type AuthBind struct {
|
type AuthBind struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
AuthID string `orm:"size(48);column(auth_id)" json:"authID"`
|
||||||
BindType int8 `json:"bindType"`
|
BindType int8 `json:"bindType"`
|
||||||
Type string `orm:"size(16)" json:"type"`
|
Type string `orm:"size(16)" json:"type"`
|
||||||
Status int8 `json:"status"`
|
|
||||||
|
|
||||||
AuthID string `orm:"size(48);column(auth_id)" json:"authID"`
|
UserID string `orm:"size(48);column(user_id);index" json:"userID"`
|
||||||
|
Status int8 `json:"status"`
|
||||||
AuthID2 string `orm:"size(48);column(auth_id2);index" json:"authID2"`
|
AuthID2 string `orm:"size(48);column(auth_id2);index" json:"authID2"`
|
||||||
AuthSecret string `orm:"size(48)" json:"-"`
|
AuthSecret string `orm:"size(48)" json:"-"`
|
||||||
AuthSecret2 string `orm:"size(48)" json:"-"`
|
AuthSecret2 string `orm:"size(48)" json:"-"`
|
||||||
@@ -31,7 +31,7 @@ type AuthBind struct {
|
|||||||
|
|
||||||
func (*AuthBind) TableUnique() [][]string {
|
func (*AuthBind) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"UserID", "Type", "DeletedAt"},
|
// []string{"UserID", "Type", "DeletedAt"}, // 这个其实UserID是属性,而不是key
|
||||||
[]string{"AuthID", "Type", "DeletedAt"},
|
[]string{"AuthID", "Type", "BindType", "DeletedAt"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,41 +7,27 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAuthBind(db *DaoDB, userID string, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
|
func GetAuthBind(db *DaoDB, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
|
||||||
if userID == "" && authID == "" {
|
if bindType == model.AuthBindTypeAll || authType == "" || authID == "" {
|
||||||
return nil, errors.New("userID, authID, authID2不能全为空")
|
return nil, errors.New("bindType不是能all, authType和authID都要有值")
|
||||||
}
|
}
|
||||||
sql := `
|
sql := `
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM auth_bind t1
|
FROM auth_bind t1
|
||||||
WHERE t1.deleted_at = ? AND t1.status = ?
|
WHERE t1.deleted_at = ? AND t1.status = ? AND t1.bind_type = ? AND t1.type = ? AND t1.auth_id = ?`
|
||||||
`
|
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
model.AuthBindStatusNormal,
|
model.AuthBindStatusNormal,
|
||||||
}
|
bindType,
|
||||||
if userID != "" {
|
authType,
|
||||||
sql += " AND t1.user_id = ?"
|
authID,
|
||||||
sqlParams = append(sqlParams, userID)
|
|
||||||
}
|
|
||||||
if bindType != model.AuthBindTypeAll {
|
|
||||||
sql += " AND t1.bind_type = ?"
|
|
||||||
sqlParams = append(sqlParams, bindType)
|
|
||||||
}
|
|
||||||
if authType != "" {
|
|
||||||
sql += " AND t1.type = ?"
|
|
||||||
sqlParams = append(sqlParams, authType)
|
|
||||||
}
|
|
||||||
if authID != "" {
|
|
||||||
sql += " AND t1.auth_id = ?"
|
|
||||||
sqlParams = append(sqlParams, authID)
|
|
||||||
}
|
}
|
||||||
// globals.SugarLogger.Debugf("GetAuthBind sql:%s, sqlParams:%s", sql, utils.Format4Output(sqlParams, false))
|
// globals.SugarLogger.Debugf("GetAuthBind sql:%s, sqlParams:%s", sql, utils.Format4Output(sqlParams, false))
|
||||||
err = GetRow(db, &authBind, sql, sqlParams...)
|
err = GetRow(db, &authBind, sql, sqlParams...)
|
||||||
return authBind, err
|
return authBind, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, authID2 string, typeList []string) (authList []*model.AuthBind, err error) {
|
func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []string, authID, authID2 string) (authList []*model.AuthBind, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM auth_bind t1
|
FROM auth_bind t1
|
||||||
@@ -58,14 +44,18 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, authID2 string,
|
|||||||
sql += " AND t1.bind_type = ?"
|
sql += " AND t1.bind_type = ?"
|
||||||
sqlParams = append(sqlParams, bindType)
|
sqlParams = append(sqlParams, bindType)
|
||||||
}
|
}
|
||||||
if authID2 != "" {
|
|
||||||
sql += " AND t1.auth_id2 = ?"
|
|
||||||
sqlParams = append(sqlParams, authID2)
|
|
||||||
}
|
|
||||||
if len(typeList) > 0 {
|
if len(typeList) > 0 {
|
||||||
sql += " AND t1.type IN (" + GenQuestionMarks(len(typeList)) + ")"
|
sql += " AND t1.type IN (" + GenQuestionMarks(len(typeList)) + ")"
|
||||||
sqlParams = append(sqlParams, typeList)
|
sqlParams = append(sqlParams, typeList)
|
||||||
}
|
}
|
||||||
|
if authID != "" {
|
||||||
|
sql += " AND t1.auth_id = ?"
|
||||||
|
sqlParams = append(sqlParams, authID)
|
||||||
|
}
|
||||||
|
if authID2 != "" {
|
||||||
|
sql += " AND t1.auth_id2 = ?"
|
||||||
|
sqlParams = append(sqlParams, authID2)
|
||||||
|
}
|
||||||
|
|
||||||
err = GetRows(db, &authList, sql, sqlParams...)
|
err = GetRows(db, &authList, sql, sqlParams...)
|
||||||
return authList, err
|
return authList, err
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ type GoodsOrder struct {
|
|||||||
SalePrice int64 `json:"salePrice"` // 售卖价
|
SalePrice int64 `json:"salePrice"` // 售卖价
|
||||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||||
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
|
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
|
||||||
|
DiscountMoney int64 `json:"discountMoney"` // 订单总优惠金额
|
||||||
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+
|
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴)1+
|
||||||
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
|
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
|
||||||
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
|
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
|
||||||
@@ -55,6 +56,7 @@ type GoodsOrder struct {
|
|||||||
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
||||||
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
||||||
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
||||||
|
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
|
||||||
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
||||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ func (p *PurchaseHandler) GetOrder4PartRefund(vendorOrderID string) (order *mode
|
|||||||
order = p.Map2Order(result1)
|
order = p.Map2Order(result1)
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
order.Skus = p.partRefund2OrderDetailSkuList(utils.Interface2String(result2["order_id"]), result2["order_detail"])
|
order.Skus = p.partRefund2OrderDetailSkuList(utils.Interface2String(result2["order_id"]), result2["order_detail"])
|
||||||
order.Skus = append(order.Skus, getZengSkus(vendorOrderID, result1)...)
|
giftSkus, discountMoney := getZengSkus(vendorOrderID, result1)
|
||||||
|
order.DiscountMoney = discountMoney
|
||||||
|
order.Skus = append(order.Skus, giftSkus...)
|
||||||
order.ActualPayPrice = utils.MustInterface2Int64(result2["user_fee"])
|
order.ActualPayPrice = utils.MustInterface2Int64(result2["user_fee"])
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
} else if err2Ext, ok := err2.(*utils.ErrorWithCode); !ok || err2Ext.IntCode() != ebaiapi.ErrOrderIsNotPartRefund {
|
} else if err2Ext, ok := err2.(*utils.ErrorWithCode); !ok || err2Ext.IntCode() != ebaiapi.ErrOrderIsNotPartRefund {
|
||||||
@@ -112,11 +114,12 @@ func (p *PurchaseHandler) GetOrder4PartRefund(vendorOrderID string) (order *mode
|
|||||||
return order, err
|
return order, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func getZengSkus(orderID string, orderMan map[string]interface{}) (skus []*model.OrderSku) {
|
func getZengSkus(orderID string, orderMan map[string]interface{}) (skus []*model.OrderSku, discountMoney int64) {
|
||||||
discounts, _ := orderMan["discount"].([]interface{})
|
discounts, _ := orderMan["discount"].([]interface{})
|
||||||
for _, v := range discounts {
|
for _, v := range discounts {
|
||||||
discount := v.(map[string]interface{})
|
discount := v.(map[string]interface{})
|
||||||
if utils.Interface2String(discount["type"]) == ebaiapi.OrderSkuDiscountTypeZeng {
|
discountType := utils.Interface2String(discount["type"])
|
||||||
|
if discountType == ebaiapi.OrderSkuDiscountTypeZeng {
|
||||||
sku := &model.OrderSku{
|
sku := &model.OrderSku{
|
||||||
VendorOrderID: orderID,
|
VendorOrderID: orderID,
|
||||||
VendorID: model.VendorIDEBAI,
|
VendorID: model.VendorIDEBAI,
|
||||||
@@ -128,8 +131,9 @@ func getZengSkus(orderID string, orderMan map[string]interface{}) (skus []*model
|
|||||||
}
|
}
|
||||||
skus = append(skus, sku)
|
skus = append(skus, sku)
|
||||||
}
|
}
|
||||||
|
discountMoney += utils.Interface2Int64WithDefault(discount["fee"], 0)
|
||||||
}
|
}
|
||||||
return skus
|
return skus, discountMoney
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) partRefund2OrderDetailSkuList(orderID string, orderDetail2 interface{}) (skuList []*model.OrderSku) {
|
func (p *PurchaseHandler) partRefund2OrderDetailSkuList(orderID string, orderDetail2 interface{}) (skuList []*model.OrderSku) {
|
||||||
@@ -247,7 +251,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
// }
|
// }
|
||||||
order.Skus = append(order.Skus, sku)
|
order.Skus = append(order.Skus, sku)
|
||||||
}
|
}
|
||||||
order.Skus = append(order.Skus, getZengSkus(vendorOrderID, orderData)...)
|
giftSkus, discountMoney := getZengSkus(vendorOrderID, orderData)
|
||||||
|
order.DiscountMoney = discountMoney
|
||||||
|
order.Skus = append(order.Skus, giftSkus...)
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
@@ -319,7 +325,7 @@ func (p *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s
|
|||||||
if err = api.EbaiAPI.OrderSwitchselfdelivery(order.VendorOrderID); err != nil {
|
if err = api.EbaiAPI.OrderSwitchselfdelivery(order.VendorOrderID); err != nil {
|
||||||
if utils.IsErrMatch(err, "301251", nil) {
|
if utils.IsErrMatch(err, "301251", nil) {
|
||||||
if deliveryStatus, err2 := api.EbaiAPI.OrderDeliveryGet(order.VendorOrderID); err2 == nil {
|
if deliveryStatus, err2 := api.EbaiAPI.OrderDeliveryGet(order.VendorOrderID); err2 == nil {
|
||||||
if utils.Interface2String(deliveryStatus["status"]) == ebaiapi.WaybillStatusSelfDelivery {
|
if utils.Int64ToStr(utils.MustInterface2Int64(deliveryStatus["status"])) == ebaiapi.WaybillStatusSelfDelivery {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
|
|||||||
baiduShopID := utils.Str2Int64(vendorStoreID)
|
baiduShopID := utils.Str2Int64(vendorStoreID)
|
||||||
result, err := api.EbaiAPI.ShopGet("", baiduShopID)
|
result, err := api.EbaiAPI.ShopGet("", baiduShopID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
retVal := &dao.StoreDetail{
|
retVal := &dao.StoreDetail{
|
||||||
Store: model.Store{
|
Store: model.Store{
|
||||||
Address: utils.Interface2String(result["address"]),
|
Address: utils.Interface2String(result["address"]),
|
||||||
@@ -370,21 +370,25 @@ func ebaiOpTime2Jx(businessTime interface{}) (opTimeList []int16) {
|
|||||||
|
|
||||||
func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||||
params := fillOpTimeParams(nil, store.GetOpTimeList())
|
params := fillOpTimeParams(nil, store.GetOpTimeList())
|
||||||
// if store.Tel2 != "" {
|
tel := store.Tel1
|
||||||
// params["ivr_phone"] = store.Tel2
|
if tel == "" {
|
||||||
// }
|
tel = store.Tel2
|
||||||
// params["phone"] = store.Tel1
|
}
|
||||||
|
if tel != "" {
|
||||||
|
params["phone"] = tel
|
||||||
|
params["ivr_phone"] = tel
|
||||||
|
}
|
||||||
if store.VendorStoreID != "" {
|
if store.VendorStoreID != "" {
|
||||||
params["baidu_shop_id"] = store.VendorStoreID
|
params["baidu_shop_id"] = store.VendorStoreID
|
||||||
}
|
}
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreName*/) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreName*/) != 0 {
|
||||||
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
||||||
}
|
}
|
||||||
|
params["address"] = store.Address
|
||||||
// todo 饿百 开店审核通过后不允许修改商户信息
|
// todo 饿百 开店审核通过后不允许修改商户信息
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
||||||
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
|
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
|
||||||
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
|
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
|
||||||
params["address"] = store.Address
|
|
||||||
params["coord_type"] = ebaiapi.CoordTypeAutonavi
|
params["coord_type"] = ebaiapi.CoordTypeAutonavi
|
||||||
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
|
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
|
||||||
params["delivery_region"] = deliveryRegion
|
params["delivery_region"] = deliveryRegion
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
|||||||
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||||
if globals.EnableEbaiStoreWrite {
|
if globals.EnableEbaiStoreWrite {
|
||||||
err = api.EbaiAPI.ShopCategoryUpdate(utils.Int2Str(storeID), utils.Str2Int64WithDefault(storeCat.VendorCatID, 0), formatCatName(storeCat.Name), jxCatSeq2Ebai(storeCat.Seq))
|
err = api.EbaiAPI.ShopCategoryUpdate(utils.Int2Str(storeID), utils.Str2Int64WithDefault(storeCat.VendorCatID, 0), formatCatName(storeCat.Name), jxCatSeq2Ebai(storeCat.Seq))
|
||||||
|
// todo, 饿百将一个分类重复改名,也会报分类名重复错,特殊处理一下,不过因为GetStoreCategory其实会拉取所有的门店分类,是比较耗时的操作
|
||||||
|
if utils.IsErrMatch(err, "1", []string{"分类名称已经存在"}) {
|
||||||
|
if cat, err2 := p.GetStoreCategory(ctx, storeID, vendorStoreID, storeCat.Name); err2 == nil {
|
||||||
|
if cat.VendorCatID == storeCat.VendorCatID {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,11 @@ func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
}
|
}
|
||||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(originalLng)
|
order.ConsigneeLng = jxutils.StandardCoordinate2Int(originalLng)
|
||||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(originalLat)
|
order.ConsigneeLat = jxutils.StandardCoordinate2Int(originalLat)
|
||||||
// discounts := result["discount"].(map[string]interface{})
|
discounts, _ := result["discount"].([]interface{})
|
||||||
|
for _, v := range discounts {
|
||||||
|
discount := v.(map[string]interface{})
|
||||||
|
order.DiscountMoney += utils.Interface2Int64WithDefault(discount["discountPrice"], 0)
|
||||||
|
}
|
||||||
for _, product2 := range result["product"].([]interface{}) {
|
for _, product2 := range result["product"].([]interface{}) {
|
||||||
product := product2.(map[string]interface{})
|
product := product2.(map[string]interface{})
|
||||||
sku := &model.OrderSku{
|
sku := &model.OrderSku{
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
panic(fmt.Sprintf("mtwm Map2Order vendorID:%s failed with error:%v", vendorOrderID, err))
|
panic(fmt.Sprintf("mtwm Map2Order vendorID:%s failed with error:%v", vendorOrderID, err))
|
||||||
}
|
}
|
||||||
for _, extra := range extraList {
|
for _, extra := range extraList {
|
||||||
|
order.DiscountMoney += jxutils.StandardPrice2Int(extra.ReduceFee)
|
||||||
if extra.Type == mtwmapi.ExtrasPromotionTypeTaoCanZeng || extra.Type == mtwmapi.ExtrasPromotionTypeManZeng {
|
if extra.Type == mtwmapi.ExtrasPromotionTypeTaoCanZeng || extra.Type == mtwmapi.ExtrasPromotionTypeManZeng {
|
||||||
sku := &model.OrderSku{
|
sku := &model.OrderSku{
|
||||||
VendorOrderID: order.VendorOrderID,
|
VendorOrderID: order.VendorOrderID,
|
||||||
|
|||||||
@@ -107,31 +107,32 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
errList := errlist.New()
|
errList := errlist.New()
|
||||||
// remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
|
|
||||||
// if err != nil {
|
remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
|
||||||
// return err
|
if err != nil {
|
||||||
// }
|
return err
|
||||||
// params := map[string]interface{}{
|
|
||||||
// "name": utils.Interface2String(remoteStoreInfo["name"]), //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
|
|
||||||
// "phone": storeDetail.Tel1,
|
|
||||||
// "shipping_fee": jxutils.IntPrice2Standard(int64(storeDetail.DeliveryFee)),
|
|
||||||
// "shipping_time": openTimeJX2Mtwm(openTime),
|
|
||||||
// "third_tag_name": "蔬菜",
|
|
||||||
// }
|
|
||||||
// if true { //storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreAddress) != 0 {
|
|
||||||
// params["address"] = storeDetail.Address
|
|
||||||
// params["longitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lng)
|
|
||||||
// params["latitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lat)
|
|
||||||
// }
|
|
||||||
// params["open_level"] = openLevel
|
|
||||||
// params["is_online"] = isOnline
|
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
|
||||||
// if globals.EnableMtwmStoreWrite {
|
|
||||||
// err = api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params)
|
|
||||||
// }
|
|
||||||
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
|
||||||
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
|
|
||||||
}
|
}
|
||||||
|
openLevel, isOnline := bizStatusJX2Mtwm(storeDetail.Status)
|
||||||
|
params := map[string]interface{}{
|
||||||
|
"name": remoteStoreInfo.Name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
|
||||||
|
"address": storeDetail.Address,
|
||||||
|
"longitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Longitude)),
|
||||||
|
"latitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Latitude)),
|
||||||
|
"phone": storeDetail.Tel1,
|
||||||
|
"shipping_fee": remoteStoreInfo.ShippingFee,
|
||||||
|
"shipping_time": remoteStoreInfo.ShippingTime,
|
||||||
|
"open_level": openLevel,
|
||||||
|
"is_online": isOnline,
|
||||||
|
"third_tag_name": remoteStoreInfo.ThirdTagName,
|
||||||
|
}
|
||||||
|
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||||
|
if globals.EnableMtwmStoreWrite {
|
||||||
|
errList.AddErr(api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params))
|
||||||
|
}
|
||||||
|
|
||||||
|
// if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
|
// errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
|
||||||
|
// }
|
||||||
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ func (c *SyncController) SyncStoresSkus() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Title 同步商家商品信息
|
// @Title 同步商家分类信息
|
||||||
// @Description 同步商家商品信息
|
// @Description 同步商家分类信息
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeIDs formData string true "门店ID列表"
|
// @Param storeIDs formData string true "门店ID列表"
|
||||||
// @Param vendorIDs formData string true "厂商ID列表"
|
// @Param vendorIDs formData string true "厂商ID列表"
|
||||||
|
|||||||
@@ -316,3 +316,28 @@ func (c *TempOpController) CheckSkuDiffBetweenJxAndVendor() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 通过订单创建消费者用户
|
||||||
|
// @Description 通过订单创建消费者用户
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param fromDate formData string true "开始日期"
|
||||||
|
// @Param vendorIDs formData string false "运营商ID列表(京东0 美团1 饿百3)"
|
||||||
|
// @Param toDate formData string false "结束日期(缺省不限制)"
|
||||||
|
// @Param isForce formData bool false "是否强制"
|
||||||
|
// @Param isAsync formData bool false "是否异步操作"
|
||||||
|
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /CreateConsumerFromOrders [post]
|
||||||
|
func (c *TempOpController) CreateConsumerFromOrders() {
|
||||||
|
c.callCreateConsumerFromOrders(func(params *tTempopCreateConsumerFromOrdersParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
var vendorIDs []int
|
||||||
|
timeList, err := jxutils.BatchStr2Time(params.FromDate, params.ToDate)
|
||||||
|
if err == nil {
|
||||||
|
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs); err == nil {
|
||||||
|
retVal, err = tempop.CreateConsumerFromOrders(params.Ctx, vendorIDs, timeList[0], timeList[1], params.IsForce, params.IsAsync, params.IsContinueWhenError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
16
main.go
16
main.go
@@ -118,14 +118,14 @@ func main() {
|
|||||||
globals.SugarLogger.Errorf("RefreshWeixinToken failed with error:%s", err)
|
globals.SugarLogger.Errorf("RefreshWeixinToken failed with error:%s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := tasks.RefreshElmToken(); err != nil {
|
// if err := tasks.RefreshElmToken(); err != nil {
|
||||||
globals.SugarLogger.Errorf("RefreshElmToken failed with error:%s", err)
|
// globals.SugarLogger.Errorf("RefreshElmToken failed with error:%s", err)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if err := tasks.RefreshWeimobToken(); err != nil {
|
// if err := tasks.RefreshWeimobToken(); err != nil {
|
||||||
globals.SugarLogger.Errorf("RefreshWeimobToken failed with error:%s", err)
|
// globals.SugarLogger.Errorf("RefreshWeimobToken failed with error:%s", err)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if err := tasks.RefreshYilianyunToken(); err != nil {
|
if err := tasks.RefreshYilianyunToken(); err != nil {
|
||||||
globals.SugarLogger.Errorf("RefreshYilianyunToken failed with error:%s", err)
|
globals.SugarLogger.Errorf("RefreshYilianyunToken failed with error:%s", err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1665,6 +1665,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "CreateConsumerFromOrders",
|
||||||
|
Router: `/CreateConsumerFromOrders`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:TempOpController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "PrintMsg",
|
Method: "PrintMsg",
|
||||||
|
|||||||
Reference in New Issue
Block a user