Quellcode durchsuchen

update 共富制度

tags/v1.2.5
DengBiao vor 2 Jahren
Ursprung
Commit
45523bb586
2 geänderte Dateien mit 8 neuen und 9 gelöschten Zeilen
  1. +1
    -1
      db/model/user_public_platoon_relation.go
  2. +7
    -8
      rule/public_platoon_relate_commission.go

+ 1
- 1
db/model/user_public_platoon_relation.go Datei anzeigen

@@ -18,5 +18,5 @@ type UserPublicPlatoonRelation struct {
WaitForSettlementDate string `json:"wait_for_settlement_date" xorm:"not null default '' comment('待结算时间(0000-00)') CHAR(50)"` WaitForSettlementDate string `json:"wait_for_settlement_date" xorm:"not null default '' comment('待结算时间(0000-00)') CHAR(50)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
NewestPublicPlatoon int `json:"newest_public_platoon" xorm:"not null default 0 comment('最新公排') TINYINT(1)"`
NewestPublicPlatoon int `json:"newest_public_platoon" xorm:"not null default 1 comment('最新公排') INT(11)"`
} }

+ 7
- 8
rule/public_platoon_relate_commission.go Datei anzeigen

@@ -169,19 +169,18 @@ func AddPublicPlatoonRelateCommission(engine *xorm.Engine, AddPublicPlatoonRelat
*/ */
func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoonSetting model.UserPublicPlatoonSetting) (model.UserPublicPlatoonRelation, error) { func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoonSetting model.UserPublicPlatoonSetting) (model.UserPublicPlatoonRelation, error) {
var userPublicPlatoonRelation model.UserPublicPlatoonRelation var userPublicPlatoonRelation model.UserPublicPlatoonRelation
//1、 查找当前 user_public_platoon_relation 中 `newest_public_platoon` 的位置
m, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{
"key": "newest_public_platoon",
"value": 1,
})

//1、 查找当前 user_public_platoon_relation 中 `position` 最大的记录
var m model.UserPublicPlatoonRelation
has, err := engine.OrderBy("newest_public_platoon desc").Get(&m)
if err != nil { if err != nil {
return userPublicPlatoonRelation, err return userPublicPlatoonRelation, err
} }
if m == nil {
if has == false {
return userPublicPlatoonRelation, errors.New("查询 user_public_platoon_relation 记录失败") return userPublicPlatoonRelation, errors.New("查询 user_public_platoon_relation 记录失败")
} }


//TODO::判断 `newest_public_platoon + userPublicPlatoonSetting.SeveralTimes(几乘)` OR `newest_public_platoon + 1`
//TODO::判断 `position + userPublicPlatoonSetting.SeveralTimes(几乘)` OR `position + 1`
var position, position1, position2 int var position, position1, position2 int
position1 = m.Position + 1 position1 = m.Position + 1
position2 = m.Position + userPublicPlatoonSetting.SeveralTimes position2 = m.Position + userPublicPlatoonSetting.SeveralTimes
@@ -243,7 +242,7 @@ func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoon
userPublicPlatoonRelation.JoinAt = now userPublicPlatoonRelation.JoinAt = now
userPublicPlatoonRelation.CreateAt = now userPublicPlatoonRelation.CreateAt = now
userPublicPlatoonRelation.UpdateAt = now userPublicPlatoonRelation.UpdateAt = now
userPublicPlatoonRelation.NewestPublicPlatoon = 1
userPublicPlatoonRelation.NewestPublicPlatoon = m.NewestPublicPlatoon + 1
_, err = db.UserPublicPlatoonRelationInsert(engine, &userPublicPlatoonRelation) _, err = db.UserPublicPlatoonRelationInsert(engine, &userPublicPlatoonRelation)
if err != nil { if err != nil {
return model.UserPublicPlatoonRelation{}, err return model.UserPublicPlatoonRelation{}, err


Laden…
Abbrechen
Speichern