饿鲜达商品分类id增加,每日打款修改authid
This commit is contained in:
@@ -1204,24 +1204,19 @@ func getSkuSaleStatus(inSkuBind *StoreSkuBindSkuInfo, skuNameBindInfo *StoreSkuB
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddEventDetail(db *dao.DaoDB, ctx *jxcontext.Context, operateType, thingID, thingType, storeID int, beforeData, afterData string) (err error) {
|
func AddEventDetail(db *dao.DaoDB, ctx *jxcontext.Context, operateType, thingID, thingType, storeID int, beforeData, afterData string) (err error) {
|
||||||
req := ctx.GetRequest()
|
if ctx.GetUserName() == "jxadmin" {
|
||||||
if req != nil {
|
return err
|
||||||
url := req.URL.Path
|
|
||||||
apiFunction := url[strings.LastIndex(url, "/")+1 : len(url)]
|
|
||||||
if ctx.GetUserName() == "jxadmin" && !strings.Contains(apiFunction, "AutoPayForPopluarMan") {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
operateEventDetail := &model.OperateEventDetail{
|
|
||||||
OperateType: operateType,
|
|
||||||
ThingID: thingID,
|
|
||||||
ThingType: thingType,
|
|
||||||
StoreID: storeID,
|
|
||||||
AccessUUID: ctx.GetTrackInfo()[0:strings.Index(ctx.GetTrackInfo(), ",")],
|
|
||||||
BeforeData: beforeData,
|
|
||||||
AfterData: afterData,
|
|
||||||
}
|
|
||||||
err = event.AddOperateEventDetail(db, operateEventDetail)
|
|
||||||
}
|
}
|
||||||
|
operateEventDetail := &model.OperateEventDetail{
|
||||||
|
OperateType: operateType,
|
||||||
|
ThingID: thingID,
|
||||||
|
ThingType: thingType,
|
||||||
|
StoreID: storeID,
|
||||||
|
AccessUUID: ctx.GetTrackInfo()[0:strings.Index(ctx.GetTrackInfo(), ",")],
|
||||||
|
BeforeData: beforeData,
|
||||||
|
AfterData: afterData,
|
||||||
|
}
|
||||||
|
err = event.AddOperateEventDetail(db, operateEventDetail)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ var (
|
|||||||
"UpdateStoreCourierMap": "门店修改三方配送平台绑定信息",
|
"UpdateStoreCourierMap": "门店修改三方配送平台绑定信息",
|
||||||
"Login": "登录",
|
"Login": "登录",
|
||||||
"RegisterUser": "注册",
|
"RegisterUser": "注册",
|
||||||
|
"AutoPayForPopluarMan": "每日订单打款",
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiStoresVendorMap = map[int]int{
|
MultiStoresVendorMap = map[int]int{
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
|
|||||||
params["upc"] = storeSku.Upc
|
params["upc"] = storeSku.Upc
|
||||||
params["name"] = storeSku.Name
|
params["name"] = storeSku.Name
|
||||||
params["cat3_id"] = storeSku.ExdCategoryThirdID
|
params["cat3_id"] = storeSku.ExdCategoryThirdID
|
||||||
|
params["category_id"] = utils.Str2Int64(storeSku.VendorCatID)
|
||||||
}
|
}
|
||||||
if storeSku.DescImg != "" {
|
if storeSku.DescImg != "" {
|
||||||
params["rtf"] = storeSku.DescImg
|
params["rtf"] = storeSku.DescImg
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ const (
|
|||||||
DingShiDaMinTime = 1 * time.Hour
|
DingShiDaMinTime = 1 * time.Hour
|
||||||
|
|
||||||
specialStoreID = 100274
|
specialStoreID = 100274
|
||||||
|
|
||||||
|
wxAppID = "wx4b5930c13f8b1170"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JxSkuInfo struct {
|
type JxSkuInfo struct {
|
||||||
@@ -676,8 +678,9 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context) (err error) {
|
|||||||
errMsg string
|
errMsg string
|
||||||
errCode string
|
errCode string
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
fromDateStr = time.Now().AddDate(0, 0, -3).Format("2006-1-2") + " 00:00:00"
|
fromDateStr = time.Now().AddDate(0, 0, -5).Format("2006-1-2") + " 00:00:00"
|
||||||
toDateStr = time.Now().AddDate(0, 0, -3).Format("2006-1-2") + " 23:59:59"
|
toDateStr = time.Now().AddDate(0, 0, -5).Format("2006-1-2") + " 23:59:59"
|
||||||
|
mapResult = make(map[string]interface{})
|
||||||
)
|
)
|
||||||
result, err := dao.GetOrdersForJxPay(db, utils.Str2Time(fromDateStr), utils.Str2Time(toDateStr))
|
result, err := dao.GetOrdersForJxPay(db, utils.Str2Time(fromDateStr), utils.Str2Time(toDateStr))
|
||||||
for _, goods := range result {
|
for _, goods := range result {
|
||||||
@@ -695,47 +698,57 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
user2, err := dao.GetUserByID(db, "mobile", user.ParentMobile)
|
user2, err := dao.GetUserByID(db, "mobile", user.ParentMobile)
|
||||||
auth, err := dao.GetUserBindAuthInfo(db, user2.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "")
|
auths, err := dao.GetUserBindAuthInfo(db, user2.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(auth) == 0 {
|
if len(auths) == 0 {
|
||||||
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user2.UserID)
|
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user2.UserID)
|
||||||
} else {
|
} else {
|
||||||
|
var openID string
|
||||||
|
for _, auth := range auths {
|
||||||
|
if auth.TypeID == wxAppID {
|
||||||
|
openID = auth.AuthID
|
||||||
|
}
|
||||||
|
}
|
||||||
payPrice1 = int(goods.ActualPayPrice) * user2.DividePercentage / 100
|
payPrice1 = int(goods.ActualPayPrice) * user2.DividePercentage / 100
|
||||||
//表示这个人之前有欠款,意思是取消订单退款时,这个推广人的分成收不回来,算作欠款,打钱的时候要扣除
|
//表示这个人之前有欠款,意思是取消订单退款时,这个推广人的分成收不回来,算作欠款,打钱的时候要扣除
|
||||||
//表示这个人之前有小于3毛钱的款没有打(微信付款api付款最低3毛),记录下来加到以后的款项中
|
//表示这个人之前有小于3毛钱的款没有打(微信付款api付款最低3毛),记录下来加到以后的款项中
|
||||||
rPrice := payPrice1 - user2.Arrears + user2.Profit
|
rPrice := payPrice1 - user2.Arrears + user2.Profit
|
||||||
err = updateUserAndTransfers(db, param, user2, auth[0].AuthID, rPrice)
|
err = updateUserAndTransfers(db, param, user2, openID, rPrice)
|
||||||
mapAfter := map[string]interface{}{
|
if err != nil {
|
||||||
"user_id": user2.UserID,
|
errMsg += err.Error()
|
||||||
"price": rPrice,
|
|
||||||
"open_id": auth[0].AuthID,
|
|
||||||
"name": user2.Name,
|
|
||||||
"mobile": user2.Mobile,
|
|
||||||
}
|
}
|
||||||
err = cms.AddEventDetail(db, ctx, model.OperateAdd, user2.ID, model.ThingTypeUser, goods.StoreID, "", cms.BuildDiffData(mapAfter))
|
mapResult["打款人1"] = user2.Name
|
||||||
|
mapResult["打款人金额1"] = rPrice
|
||||||
|
mapResult["打款人电话1"] = user2.Mobile
|
||||||
|
mapResult["打款人1userID"] = user2.UserID
|
||||||
}
|
}
|
||||||
if user2.ParentMobile != "" {
|
if user2.ParentMobile != "" {
|
||||||
user3, err := dao.GetUserByID(db, "mobile", user2.ParentMobile)
|
user3, err := dao.GetUserByID(db, "mobile", user2.ParentMobile)
|
||||||
auth, err := dao.GetUserBindAuthInfo(db, user3.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "")
|
auths, err := dao.GetUserBindAuthInfo(db, user3.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(auth) == 0 {
|
if len(auths) == 0 {
|
||||||
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user3.UserID)
|
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user3.UserID)
|
||||||
} else {
|
} else {
|
||||||
|
var openID string
|
||||||
|
for _, auth := range auths {
|
||||||
|
if auth.TypeID == wxAppID {
|
||||||
|
openID = auth.AuthID
|
||||||
|
}
|
||||||
|
}
|
||||||
payPrice2 = (int(goods.ActualPayPrice) - payPrice1) * user3.DividePercentage / 100
|
payPrice2 = (int(goods.ActualPayPrice) - payPrice1) * user3.DividePercentage / 100
|
||||||
rPrice := payPrice2 - user3.Arrears + user3.Profit
|
rPrice := payPrice2 - user3.Arrears + user3.Profit
|
||||||
err = updateUserAndTransfers(db, param, user3, auth[0].AuthID, rPrice)
|
err = updateUserAndTransfers(db, param, user3, openID, rPrice)
|
||||||
mapAfter := map[string]interface{}{
|
if err != nil {
|
||||||
"user_id": user3.UserID,
|
errMsg += err.Error()
|
||||||
"price": rPrice,
|
|
||||||
"open_id": auth[0].AuthID,
|
|
||||||
"name": user3.Name,
|
|
||||||
"mobile": user3.Mobile,
|
|
||||||
}
|
}
|
||||||
err = cms.AddEventDetail(db, ctx, model.OperateAdd, user3.ID, model.ThingTypeUser, goods.StoreID, "", cms.BuildDiffData(mapAfter))
|
mapResult["打款人2"] = user3.Name
|
||||||
|
mapResult["打款人金额2"] = rPrice
|
||||||
|
mapResult["打款人电话2"] = user3.Mobile
|
||||||
|
mapResult["打款人2userID"] = user3.UserID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -744,11 +757,12 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context) (err error) {
|
|||||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "每日打款错误", errMsg)
|
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "每日打款错误", errMsg)
|
||||||
}
|
}
|
||||||
if err != nil || errMsg != "" {
|
if err != nil || errMsg != "" {
|
||||||
|
errMsg += err.Error()
|
||||||
errCode = model.ErrCodeGeneralFailed
|
errCode = model.ErrCodeGeneralFailed
|
||||||
} else {
|
} else {
|
||||||
errCode = model.ErrCodeSuccess
|
errCode = model.ErrCodeSuccess
|
||||||
}
|
}
|
||||||
err = event.AddOperateEvent(ctx, ctx.GetTrackInfo(), `{"fromDateStr":`+fromDateStr+`,"toDateStr":`+toDateStr+`}`, errCode, err.Error(), 0)
|
err = event.AddOperateEvent(ctx, ctx.GetTrackInfo(), cms.BuildDiffData(mapResult), errCode, errMsg, 0)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user