饿鲜达商品库合并测试,订单分账修改
This commit is contained in:
@@ -1444,11 +1444,60 @@ func DeleteSkuNameExPrefixOverdue(db *dao.DaoDB) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func SumExianDaDepot() (err error) {
|
||||
// result, err := api.EbaiAPI.GetExianDaSkuDepot()
|
||||
// for _, v := range result {
|
||||
// v.ElemeGoodsID
|
||||
// v.ImageURL
|
||||
// }
|
||||
func SumExianDaDepot(ctx *jxcontext.Context) (err error) {
|
||||
db := dao.GetDB()
|
||||
result, err := api.EbaiAPI.GetExianDaSkuDepot()
|
||||
for _, v := range result {
|
||||
skus, err := api.EbaiAPI.GetExianDaSku(utils.Str2Int64(v.ElemeGoodsID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
prefix, name, _, specUnit, unit, specQuality := jxutils.SplitSkuName(v.GoodsName)
|
||||
skuName := &model.SkuName{
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
CategoryID: skus.CategoryIDThird,
|
||||
IsGlobal: 1,
|
||||
Unit: unit,
|
||||
SpecQuality: specQuality,
|
||||
SpecUnit: specUnit,
|
||||
Price: 100,
|
||||
Img: v.ImageURL,
|
||||
Upc: &v.UpcID,
|
||||
Status: model.SkuStatusNormal,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(skuName, ctx.GetUserName())
|
||||
err = dao.CreateEntity(db, &skuName)
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
return err
|
||||
}
|
||||
sku := &model.Sku{
|
||||
NameID: skuName.ID,
|
||||
SpecQuality: specQuality,
|
||||
SpecUnit: specUnit,
|
||||
Weight: int(utils.Str2Int64(skus.Weight)),
|
||||
Status: model.SkuStatusNormal,
|
||||
ExdSkuID: v.ElemeGoodsID,
|
||||
ExdSkuName: v.GoodsName,
|
||||
ExdUpc: int(utils.Str2Int64(v.UpcID)),
|
||||
ExdCategoryThirdID: skus.CategoryIDThird,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(sku, ctx.GetUserName())
|
||||
err = dao.CreateEntity(db, &sku)
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
return err
|
||||
}
|
||||
dao.Commit(db)
|
||||
break
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -201,6 +201,17 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
|
||||
user.Avatar = inAuthInfo.GetAvatar()
|
||||
}
|
||||
}
|
||||
//注册时默认商城用户就加入分账接收方
|
||||
if strings.Contains(ctx.GetRequest().Referer(), "wx4b5930c13f8b1170") {
|
||||
param := &wxpayapi.ProfitSharingReceiverParam{
|
||||
Receiver: wxpayapi.CData(`{
|
||||
"type":"` + wxpayapi.AccountTypeOpen + `",
|
||||
"account":"` + inAuthInfo.GetAuthID() + `",
|
||||
"relation_type":" ` + wxpayapi.Relation + `"
|
||||
}`),
|
||||
}
|
||||
_, err = api.WxpayAPI.AddProfitSharingReceiver(param)
|
||||
}
|
||||
if err = CreateUser(user, utils.LimitUTF8StringLen(createName, 32)); err == nil {
|
||||
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
|
||||
TryAddStoreBossRole4User(ctx, user)
|
||||
@@ -380,6 +391,7 @@ func CreateUser(user *model.User, creatorName string) (err error) {
|
||||
dao.WrapAddIDCULDEntity(user, creatorName)
|
||||
user.UserID = utils.GetUUID()
|
||||
user.Status = model.UserStatusNormal
|
||||
user.DividePercentage = 5
|
||||
return dao.CreateEntity(nil, user)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user