@@ -16,3 +16,6 @@ func SecondFreeQualificationRecordInsertOne(Db *xorm.Engine, m *model.SecondNewc | |||
func ThirdFreeQualificationRecordInsertOne(Db *xorm.Engine, m *model.ThirdNewcomersQualificationRecord) (int64, error) { | |||
return Db.InsertOne(m) | |||
} | |||
func FourFreeQualificationRecordInsertOne(Db *xorm.Engine, m *model.FourNewcomersQualificationRecord) (int64, error) { | |||
return Db.InsertOne(m) | |||
} |
@@ -65,7 +65,13 @@ func SecondGetAllPriceTypeList(Db *xorm.Engine) ([]model.SecondNewcomersFreePric | |||
} | |||
return priceType, nil | |||
} | |||
func FourGetAllPriceTypeList(Db *xorm.Engine) ([]model.FourNewcomersFreePriceType, error) { | |||
var priceType []model.FourNewcomersFreePriceType | |||
if err := Db.Find(&priceType); err != nil { | |||
return nil, logx.Warn(err) | |||
} | |||
return priceType, nil | |||
} | |||
func SecondGetPriceTypeById(Db *xorm.Engine, id int) *model.SecondNewcomersFreePriceType { | |||
var price model.SecondNewcomersFreePriceType | |||
if _, err := Db.Where("`is_del` = 0 and `is_show` = 1 and id=?", id).Get(&price); err != nil { | |||
@@ -111,3 +117,71 @@ func SecondFreePriceTypeByID(Db *xorm.Engine, id interface{}) (*model.SecondNewc | |||
return m, nil | |||
} | |||
func UserThirdPartyFindByID(Db *xorm.Engine, id interface{}) (*model.UserThirdParty, error) { | |||
var m model.UserThirdParty | |||
if has, err := Db.Where("uid = ?", id).Get(&m); err != nil || has == false { | |||
return nil, logx.Warn(err) | |||
} | |||
return &m, nil | |||
} | |||
func UserThirdPartyUpdate(Db *xorm.Engine, uid interface{}, userProfile *model.UserThirdParty, forceCols ...string) (int64, error) { | |||
var ( | |||
affected int64 | |||
err error | |||
) | |||
if forceCols != nil { | |||
affected, err = Db.Where("uid=?", uid).Cols(forceCols...).Update(userProfile) | |||
} else { | |||
affected, err = Db.Where("uid=?", uid).AllCols().Update(userProfile) | |||
} | |||
if err != nil { | |||
return 0, logx.Warn(err) | |||
} | |||
return affected, nil | |||
} | |||
func FourFreeProductByID(Db *xorm.Engine, gid, skuId, provider string) (*model.FourNewcomersFreeProduct, error) { | |||
m := new(model.FourNewcomersFreeProduct) | |||
var has bool | |||
var err error | |||
if utils.InArr(provider, []string{md.PVD_TB, md.PVD_TM}) && php2go.IsNumeric(gid) == false { | |||
gidArr := strings.Split(gid, "-") | |||
if len(gidArr) == 2 { | |||
gid = gidArr[1] | |||
} | |||
has, err = Db.Where("good_id LIKE ?", "%-"+gid).Get(m) | |||
} else if utils.InArr(provider, []string{md.PVD_JD}) && php2go.IsNumeric(gid) == false { | |||
gidArr := strings.Split(gid, "_") | |||
if len(gidArr) == 2 { | |||
gid = gidArr[1] | |||
} | |||
has, err = Db.Where("good_id LIKE ?", "%"+gid).Get(m) | |||
} else { | |||
sess := Db.Where("good_id=?", gid) | |||
if skuId != "" { | |||
sess.Or("good_id=?", skuId) | |||
} | |||
has, err = sess.Get(m) | |||
} | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !has { | |||
return nil, errors.New("Not Found") | |||
} | |||
return m, nil | |||
} | |||
func FourFreePriceTypeByID(Db *xorm.Engine, id interface{}) (*model.FourNewcomersFreePriceType, error) { | |||
m := new(model.FourNewcomersFreePriceType) | |||
has, err := Db.ID(id).Get(m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !has { | |||
return nil, errors.New("Not Found") | |||
} | |||
return m, nil | |||
} |
@@ -0,0 +1,19 @@ | |||
package model | |||
type FourNewcomersFreePriceType struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(10)"` | |||
PriceName string `json:"price_name" xorm:"not null comment('价格类型') VARCHAR(255)"` | |||
NeedQuan int `json:"need_quan" xorm:"not null default 0 comment('需要的福利券') INT(11)"` | |||
CreatedAt int `json:"created_at" xorm:"not null default 0 INT(11)"` | |||
UpdatedAt int `json:"updated_at" xorm:"not null default 0 INT(11)"` | |||
IsShow int `json:"is_show" xorm:"not null default 1 comment('是否开启') TINYINT(1)"` | |||
IsDel int `json:"is_del" xorm:"not null default 0 INT(11)"` | |||
Auth string `json:"auth" xorm:"not null comment('权限') TEXT"` | |||
NeedUseQuan int `json:"need_use_quan" xorm:"default 1 comment('是否需要使用免单券 0否 1是') INT(1)"` | |||
NeedLimitBuy int `json:"need_limit_buy" xorm:"default 0 comment('是否限购') INT(1)"` | |||
LimitBuyCondition string `json:"limit_buy_condition" xorm:"default '' comment('限购条件') VARCHAR(255)"` | |||
CommissionId string `json:"commission_id" xorm:"default '' VARCHAR(255)"` | |||
LimitStr string `json:"limit_str" xorm:"default '' VARCHAR(255)"` | |||
BuyStr string `json:"buy_str" xorm:"default '' VARCHAR(255)"` | |||
CommissionData string `json:"commission_data" xorm:"default '' VARCHAR(500)"` | |||
} |
@@ -0,0 +1,34 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type FourNewcomersFreeProduct struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(10)"` | |||
GoodId string `json:"good_id" xorm:"not null default '' comment('平台商品ID') unique(IDX_ITEMID) VARCHAR(255)"` | |||
Source string `json:"source" xorm:"not null default 'taobao' comment('来源平台') unique(IDX_ITEMID) VARCHAR(255)"` | |||
SecondSource string `json:"second_source" xorm:"not null default 'taobao' comment('来源平台') VARCHAR(255)"` | |||
SourceUrl string `json:"source_url" xorm:"not null default '' comment('用户输入地址') VARCHAR(255)"` | |||
PriceType int `json:"price_type" xorm:"not null default 0 comment('所属价格类型') TINYINT(1)"` | |||
OriginalPrice string `json:"original_price" xorm:"not null default 0.00 comment('原价') DECIMAL(10,2)"` | |||
CouponPrice string `json:"coupon_price" xorm:"not null default 0.00 comment('优惠券价格') DECIMAL(10,2)"` | |||
ReturnMoney string `json:"return_money" xorm:"not null default 0.00 comment('返还的钱') DECIMAL(10,2)"` | |||
Money string `json:"money" xorm:"not null default 0.00 comment('实付金额') DECIMAL(10,2)"` | |||
Stock int `json:"stock" xorm:"not null default 0 comment('库存数量') INT(11)"` | |||
Sale int `json:"sale" xorm:"not null default 0 comment('卖掉的数量') INT(11)"` | |||
EndTime time.Time `json:"end_time" xorm:"not null comment('结束时间') DATETIME"` | |||
IsShow int `json:"is_show" xorm:"not null default 1 comment('是否上架') TINYINT(1)"` | |||
IsDel int `json:"is_del" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` | |||
CreatedAt int `json:"created_at" xorm:"not null default 0 INT(11)"` | |||
UpdatedAt int `json:"updated_at" xorm:"not null default 0 INT(11)"` | |||
Title string `json:"title" xorm:"not null default '' comment('标题') VARCHAR(255)"` | |||
StartTime time.Time `json:"start_time" xorm:"not null comment('开始时间') DATETIME"` | |||
Pictures string `json:"pictures" xorm:"not null default '' comment('图片地址') VARCHAR(255)"` | |||
CouponUrl string `json:"coupon_url" xorm:"not null default '' comment('优惠券链接') VARCHAR(255)"` | |||
Commission string `json:"commission" xorm:"not null default '' comment('') VARCHAR(255)"` | |||
ActivityId string `json:"activity_id" xorm:"not null default '' comment('') VARCHAR(255)"` | |||
Amount int `json:"amount" xorm:"not null default 0 comment('总数') INT(11)"` | |||
ReturnType int `json:"return_type" xorm:"default 0 comment('0平台补贴 1 淘礼金补贴') INT(1)"` | |||
OwnbuyReturnType int `json:"ownbuy_return_type" xorm:"default 0 comment('自购补贴:1开启、0关闭') INT(1)"` | |||
} |
@@ -0,0 +1,21 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type FourNewcomersQualificationRecord struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(10)"` | |||
Uid int `json:"uid" xorm:"not null default 0 INT(11)"` | |||
Source int `json:"source" xorm:"not null default 0 comment('1为注册获得 | |||
2为分享获得 | |||
3为消费扣除 | |||
4为后台修改 | |||
来源标识') TINYINT(4)"` | |||
SourceText string `json:"source_text" xorm:"not null default '' comment('来源') VARCHAR(255)"` | |||
ChangeNum int `json:"change_num" xorm:"not null default 0 comment('变更值') INT(11)"` | |||
AfterChangeNum int `json:"after_change_num" xorm:"not null default 0 comment('变更后值') INT(11)"` | |||
OrderId int64 `json:"order_id" xorm:"not null default 0 comment('新人免单订单ID(与order_list主键对应)') BIGINT(20)"` | |||
CreatedAt time.Time `json:"created_at" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') TIMESTAMP"` | |||
UpdatedAt time.Time `json:"updated_at" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` | |||
} |
@@ -15,6 +15,7 @@ type OrdList struct { | |||
OrderType int `xorm:"not null default 0 TINYINT(1)" json:"order_type"` | |||
PriceType int `xorm:"not null default 0 INT(1)" json:"price_type"` | |||
SecondPriceType int `xorm:"not null default 0 INT(1)" json:"second_price_type"` | |||
FourPriceType int `xorm:"not null default 0 INT(1)" json:"four_price_type"` | |||
ThirdPriceType int `xorm:"not null default 0 INT(1)" json:"third_price_type"` | |||
OrderCompare int `xorm:"not null default 0 TINYINT(1)" json:"order_compare"` | |||
SubsidyFee float64 `xorm:"not null default 0.00 DOUBLE(8,2)" json:"subsidy_fee"` | |||
@@ -0,0 +1,11 @@ | |||
package model | |||
type UserThirdParty struct { | |||
Uid int `json:"uid" xorm:"not null pk autoincr comment('主键ID') INT(10)"` | |||
ThirdPartyJdMiniOpenid string `json:"third_party_jd_mini_openid" xorm:"not null default '' VARCHAR(255)"` | |||
ThirdPartyAlipayAppletOpenid string `json:"third_party_alipay_applet_openid" xorm:"not null default '' VARCHAR(255)"` | |||
ThirdPartyAlipayAppletUnionid string `json:"third_party_alipay_applet_unionid" xorm:"not null default '' VARCHAR(255)"` | |||
ThirdPartyAlipayAppletUid string `json:"third_party_alipay_applet_uid" xorm:"not null default '' VARCHAR(255)"` | |||
FourFreeRemainTime int `json:"four_free_remain_time" xorm:"not null default 0 comment('免单剩余次数') INT(11)"` | |||
FourFreeCumulativeTime int `json:"four_free_cumulative_time" xorm:"not null default 0 comment('免单累计次数') INT(11)"` | |||
} |
@@ -128,6 +128,31 @@ func PlanOpts(eg *xorm.Engine) map[string]*plan.PlanOpt { | |||
allRewardPlan = append(allRewardPlan, tmp) | |||
} | |||
} | |||
fourList, _ := db.FourGetAllPriceTypeList(eg) | |||
for _, v := range fourList { | |||
var oneRewardPlan map[string]string | |||
err := json.Unmarshal([]byte(v.CommissionData), &oneRewardPlan) | |||
if err == nil { | |||
var tmp = &model.PlanReward{ | |||
Id: 0, | |||
Pvd: "fourFree_" + utils.IntToStr(v.Id), | |||
PvdRate: utils.StrToFloat64(oneRewardPlan["pvd_rate"]) / 100, | |||
SysRate: utils.StrToFloat64(oneRewardPlan["sys_rate"]) / 100, | |||
RegionRate: utils.StrToFloat64(oneRewardPlan["region_rate"]) / 100, | |||
GlobalRate: utils.StrToFloat64(oneRewardPlan["global_rate"]) / 100, | |||
SettleMode: utils.StrToInt(oneRewardPlan["settle_mode"]), | |||
PlanCommissionId: utils.StrToInt(oneRewardPlan["plan_commission_id"]), | |||
PlanSettleId: utils.StrToInt(oneRewardPlan["plan_settle_id"]), | |||
State: 1, | |||
Source: 1, | |||
IntegralOpen: utils.StrToInt(oneRewardPlan["integral_open"]), | |||
MerchantRate: utils.StrToFloat32(oneRewardPlan["merchant_rate"]) / 100, | |||
PushHandRate: utils.StrToFloat32(oneRewardPlan["push_hand_rate"]) / 100, | |||
OrderBeforeRate: utils.StrToFloat64(oneRewardPlan["order_before_rate"]) / 100, | |||
} | |||
allRewardPlan = append(allRewardPlan, tmp) | |||
} | |||
} | |||
moreList, _ := db.MoreGetAllPriceTypeList(eg) | |||
for _, v := range moreList { | |||
var oneRewardPlan map[string]string | |||
@@ -233,10 +233,11 @@ func parsePids(eg *xorm.Engine, masterId, pvd string, pids []string) map[int]*md | |||
case md.PVD_JD, md.PVD_PDD, md.PVD_JDOwn: | |||
var ( | |||
jdPddSelfUid []int | |||
jdPddShareUid []int | |||
jdPddFreeUid []int | |||
jdPddCloudUid []int | |||
jdPddSelfUid []int | |||
jdPddShareUid []int | |||
jdPddFreeUid []int | |||
jdPddFourFreeUid []int | |||
jdPddCloudUid []int | |||
) | |||
var user1 = map[int]*md.UserPid{} | |||
for _, v := range pids { | |||
@@ -264,6 +265,9 @@ func parsePids(eg *xorm.Engine, masterId, pvd string, pids []string) map[int]*md | |||
} else if types == "free" { | |||
orderType = md.OrderTypeFree | |||
jdPddFreeUid = append(jdPddFreeUid, id) | |||
} else if types == "fourf" { | |||
orderType = 15 | |||
jdPddFourFreeUid = append(jdPddFourFreeUid, id) | |||
} else if types == "cloud" { | |||
orderType = 10 | |||
jdPddCloudUid = append(jdPddCloudUid, id) | |||
@@ -308,6 +312,15 @@ func parsePids(eg *xorm.Engine, masterId, pvd string, pids []string) map[int]*md | |||
} | |||
} | |||
} | |||
if jdPddFourFreeUid != nil { | |||
//活动自购 因为用的是渠道id 要这样判断下 | |||
users, err := db.DbsUserProfileFindByIDs(eg, jdPddFourFreeUid...) | |||
if users != nil && err == nil { | |||
for _, v := range *users { | |||
user[v.Uid] = user1[v.Uid] | |||
} | |||
} | |||
} | |||
//有些可能数据库没有 | |||
if jdPddCloudUid != nil { | |||
//活动自购 因为用的是渠道id 要这样判断下 | |||
@@ -37,7 +37,7 @@ func commCheckUser(eg *xorm.Engine, existOrd model.OrdList, ords map[string]md.O | |||
} | |||
} | |||
} | |||
if strings.Contains(existOrd.PvdPid, "free") || strings.Contains(pid, "free") || existOrd.PriceType > 0 || existOrd.SecondPriceType > 0 || existOrd.ThirdPriceType > 0 { | |||
if strings.Contains(existOrd.PvdPid, "free") || strings.Contains(pid, "free") || existOrd.PriceType > 0 || existOrd.SecondPriceType > 0 || existOrd.ThirdPriceType > 0 || existOrd.FourPriceType > 0 { | |||
fmt.Println("免单不走这里") | |||
return | |||
@@ -856,3 +856,59 @@ func orderSecondFreeCheck(eg *xorm.Engine, v *md.OrderInfo, oid int64, uid int, | |||
} | |||
return m | |||
} | |||
func orderFourFreeCheck(eg *xorm.Engine, v *md.OrderInfo, oid int64, uid int, isNeedReduct int) *model.FourNewcomersFreeProduct { | |||
m, err := db.FourFreeProductByID(eg, v.ItemId, v.SkuId, v.Pvd) | |||
if err != nil || m == nil { | |||
logx.Warn(err) | |||
return nil | |||
} | |||
if strings.Contains(v.Pid, "fourFree_") { | |||
mt, err := db.FourFreePriceTypeByID(eg, m.PriceType) | |||
if err != nil || mt == nil { | |||
logx.Warn(err) | |||
return nil | |||
} | |||
// 查找用户剩余的免单资格数 | |||
profile, err := db.UserThirdPartyFindByID(eg, uid) | |||
if err != nil || profile == nil { | |||
logx.Warn(err) | |||
return m | |||
} | |||
//判断要不要扣免单券 | |||
if isNeedReduct == 1 { | |||
if mt.NeedUseQuan == 1 { | |||
// 更新剩余次数 | |||
if mt.NeedQuan > profile.FourFreeRemainTime { | |||
return m | |||
} | |||
profile.FourFreeRemainTime = profile.FourFreeRemainTime - mt.NeedQuan | |||
_, err = db.UserThirdPartyUpdate(eg, profile.Uid, profile, "four_free_remain_time") | |||
if err != nil { | |||
logx.Warn(err) | |||
return m | |||
} | |||
// 插入日志记录 | |||
go db.FourFreeQualificationRecordInsertOne(eg, &model.FourNewcomersQualificationRecord{ | |||
Uid: profile.Uid, | |||
Source: 3, | |||
SourceText: "消费扣除", | |||
OrderId: oid, | |||
ChangeNum: -mt.NeedQuan, | |||
AfterChangeNum: profile.FourFreeRemainTime, | |||
CreatedAt: time.Now(), | |||
UpdatedAt: time.Now(), | |||
}) | |||
} | |||
m.Stock-- | |||
if m.Stock < 0 { | |||
m.Stock = 0 | |||
} | |||
m.Sale++ | |||
eg.Where("id=?", m.Id).Cols("stock,sale").Update(m) | |||
} | |||
return m | |||
} | |||
return m | |||
} |
@@ -116,6 +116,9 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
if vv.OrderType == 15 { | |||
prefix = "relationfree_" | |||
} | |||
if vv.OrderType == 20 { | |||
prefix = "fourfree_" | |||
} | |||
if vv.OrderType == md.OrderTypeTljFree { | |||
prefix = "tljfree_" | |||
} | |||
@@ -272,6 +275,17 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
eg.Where("id=?", m.Id).Cols("sale,stock").Update(m) | |||
} | |||
} | |||
if v.State != 4 && v.FourPriceType > 0 { | |||
m, _ := db.FourFreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd) | |||
if m != nil { | |||
m.Stock++ | |||
m.Sale-- | |||
if m.Sale < 0 { | |||
m.Sale = 0 | |||
} | |||
eg.Where("id=?", m.Id).Cols("sale,stock").Update(m) | |||
} | |||
} | |||
if v.State == 4 && v.PriceType > 0 { | |||
m, _ := db.FreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd) | |||
//直接退回账号了 定制 | |||
@@ -577,7 +591,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
optPvd = md.PVD_KUAISHOULIVE | |||
} | |||
} | |||
if !strings.Contains(v.Pid, "moreFree") && !strings.Contains(v.Pid, "shareSeFree") && !strings.Contains(v.Pid, "seFree") && !strings.Contains(v.Pid, "cloud") && !strings.Contains(v.Pid, "share") && !strings.Contains(v.Pid, "self") && !strings.Contains(v.Pid, "free") && !strings.Contains(v.Pid, "actself") && !strings.Contains(v.Pid, "wechatactself") && !strings.Contains(v.Pid, "wechatactselfnew") && !strings.Contains(v.Pid, "wechatactshare") { | |||
if !strings.Contains(v.Pid, "fourFree") && !strings.Contains(v.Pid, "moreFree") && !strings.Contains(v.Pid, "shareSeFree") && !strings.Contains(v.Pid, "seFree") && !strings.Contains(v.Pid, "cloud") && !strings.Contains(v.Pid, "share") && !strings.Contains(v.Pid, "self") && !strings.Contains(v.Pid, "free") && !strings.Contains(v.Pid, "actself") && !strings.Contains(v.Pid, "wechatactself") && !strings.Contains(v.Pid, "wechatactselfnew") && !strings.Contains(v.Pid, "wechatactshare") { | |||
continue | |||
} | |||
var oid int64 | |||
@@ -611,6 +625,15 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
optPvd = "seFree_" + utils.IntToStr(freeOrder.PriceType) | |||
} | |||
} | |||
if v.OrderType == 20 { //多方案 | |||
if user == nil || user.Uid == 0 { //判断免单的如果没有用户不跟这个订单 | |||
continue | |||
} | |||
freeOrder := orderFourFreeCheck(eg, &v, oid, user.Uid, 0) | |||
if freeOrder != nil { | |||
optPvd = "fourFree_" + utils.IntToStr(freeOrder.PriceType) | |||
} | |||
} | |||
var uid = 0 | |||
@@ -773,7 +796,8 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
} | |||
priceType := 0 | |||
secondPriceType := 0 | |||
if !strings.Contains(v.Pid, "moreFree") && !strings.Contains(v.Pid, "shareSeFree") && !strings.Contains(v.Pid, "seFree") && !strings.Contains(v.Pid, "cloud") && !strings.Contains(v.Pid, "share") && !strings.Contains(v.Pid, "self") && !strings.Contains(v.Pid, "free") && !strings.Contains(v.Pid, "actself") && !strings.Contains(v.Pid, "wechatactself") && !strings.Contains(v.Pid, "wechatactselfnew") && !strings.Contains(v.Pid, "wechatactshare") { | |||
fourPriceType := 0 | |||
if !strings.Contains(v.Pid, "fourFree") && !strings.Contains(v.Pid, "moreFree") && !strings.Contains(v.Pid, "shareSeFree") && !strings.Contains(v.Pid, "seFree") && !strings.Contains(v.Pid, "cloud") && !strings.Contains(v.Pid, "share") && !strings.Contains(v.Pid, "self") && !strings.Contains(v.Pid, "free") && !strings.Contains(v.Pid, "actself") && !strings.Contains(v.Pid, "wechatactself") && !strings.Contains(v.Pid, "wechatactselfnew") && !strings.Contains(v.Pid, "wechatactshare") { | |||
continue | |||
} | |||
var oid = v.Oid | |||
@@ -813,6 +837,19 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
opt = opts[optPvd] | |||
} | |||
} | |||
if v.OrderType == 20 { | |||
if user == nil || user.Uid == 0 { //判断免单的如果没有用户不跟这个订单 | |||
continue | |||
} | |||
//TODO | |||
freeOrder := orderFourFreeCheck(eg, &v, oid, user.Uid, 1) | |||
if freeOrder != nil { | |||
fourPriceType = freeOrder.PriceType | |||
// 切换免单活动的分佣方案, 如1元购等 | |||
optPvd = "fourFree_" + utils.IntToStr(freeOrder.PriceType) | |||
opt = opts[optPvd] | |||
} | |||
} | |||
var lvUser *comm_plan.LvUser | |||
var pvdFee float64 | |||
var sysFee float64 | |||
@@ -875,7 +912,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
} | |||
} | |||
if v.OrderType == 15 || v.OrderType == 11 || v.OrderType == md.OrderTypeFree || v.OrderType == md.OrderTypeWechatActSelf || v.OrderType == md.OrderTypeWechatActSelfNew || v.OrderType == md.OrderTypeActSelf { | |||
if v.OrderType == 20 || v.OrderType == 15 || v.OrderType == 11 || v.OrderType == md.OrderTypeFree || v.OrderType == md.OrderTypeWechatActSelf || v.OrderType == md.OrderTypeWechatActSelfNew || v.OrderType == md.OrderTypeActSelf { | |||
v.OrderType = md.OrderTypeSelf | |||
} | |||
if v.OrderType == 12 { | |||
@@ -896,8 +933,12 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
newPvd = md.PVD_JD | |||
orderFormType = 1 | |||
} | |||
//TODO 待确认 | |||
ServiceUid := "" | |||
NewServiceAwardDividendRelationDb := implement.NewServiceAwardDividendRelationDb(eg) | |||
relation, _ := NewServiceAwardDividendRelationDb.GetServiceAwardDividendRelationByUid(uid) | |||
if relation != nil { | |||
ServiceUid = utils.IntToStr(relation.BindUid) | |||
} | |||
// 插入新订单 | |||
newOrd := &model.OrdList{ | |||
ServiceUid: utils.StrToInt(ServiceUid), | |||
@@ -917,6 +958,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, | |||
OrderType: v.OrderType, | |||
PriceType: priceType, | |||
SecondPriceType: secondPriceType, | |||
FourPriceType: fourPriceType, | |||
SubsidyFee: subsidyFee, | |||
SubsidyRate: subsidyRate, | |||
UserCommission: profit, | |||