ソースを参照

update 一个圈圈

master
dengbiao 4ヶ月前
コミット
07ae15a5b8
2個のファイルの変更14行の追加15行の削除
  1. +5
    -0
      md/mq.go
  2. +9
    -15
      rule/one_circles/one_circles_sign_in_green_energy_settlement.go

+ 5
- 0
md/mq.go ファイルの表示

@@ -4,6 +4,7 @@ const OneCirclesExchange = "one.circles"

const (
OneCirclesRoutKeyForSignIn = "sign_in" // 签到
OneCirclesRoutKeyForSignInUpdateRecords = "sign_in_update_records" // 签到更新记录
OneCirclesRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红
OneCirclesRoutKeyForAutoExchangeGreenEnergyToPerson = "auto_exchange_green_energy_to_person_1" // 自动兑换个人绿色能量
OneCirclesRoutKeyForAutoExchangeGreenEnergyToTeam = "auto_exchange_green_energy_to_team" // 自动兑换团队绿色能量
@@ -17,6 +18,10 @@ type OneCirclesStructForSignIn struct {
Id int64 `json:"id"`
EndTime string `json:"end_time"`
}
type UpdateOneCirclesStructForSignInRecords struct {
Id int64 `json:"id"`
Uid int `json:"uid"`
}

type OneCirclesStructForAutoExchangeGreenEnergy struct {
MasterId string `json:"master_id"`


+ 9
- 15
rule/one_circles/one_circles_sign_in_green_energy_settlement.go ファイルの表示

@@ -72,18 +72,7 @@ func SettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, ch *rabbi
return
}

func HandleSettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, id int64, uid int, endTime string) (err error) {
//var signRecord model.OneCirclesGreenEnergySignIn
//has, err00000 := engine.Where("id =?", id).Get(&signRecord)
//if err00000 != nil {
// fmt.Println("err:::::0000000", err00000)
// return err00000
//}
//if !has {
// //不活跃不需要奖励
// return errors.New("未查询到对应记录")
//}

func HandleSettlementSignInGreenEnergy(ch *rabbit.Channel, engine *xorm.Engine, masterId string, id int64, uid int, endTime string) (err error) {
//1、查找 `one_circles_green_energy_basic_setting` 基础设置
oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetPrice(engine, masterId)
if err != nil {
@@ -214,9 +203,14 @@ func HandleSettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, id
}

//6、更新 `one_circles_green_energy_sign_in` 中的 is_completed 状态
_, err = session.Where("id = ?", id).Update(&model.OneCirclesGreenEnergySignIn{
IsCompleted: 1,
})
//_, err = session.Where("id = ?", id).Update(&model.OneCirclesGreenEnergySignIn{
// IsCompleted: 1,
//})
//TODO::推入rabbitmq 异步处理
ch.Publish(md.OneCirclesExchange, md.UpdateOneCirclesStructForSignInRecords{
Uid: uid,
Id: id,
}, md.OneCirclesRoutKeyForSignInUpdateRecords)

err = session.Commit()
if err != nil {


読み込み中…
キャンセル
保存