Parcourir la source

update

master
DengBiao il y a 10 mois
Parent
révision
a7e95b3742
3 fichiers modifiés avec 33 ajouts et 4 suppressions
  1. +19
    -0
      db/db_one_circles_public_platoon_free_punish_with_user.go
  2. +6
    -0
      db/model/one_circles_public_platoon_free_punish_with_user.go
  3. +8
    -4
      rule/one_circles/one_circles_public_platoon_user_relation_commission.go

+ 19
- 0
db/db_one_circles_public_platoon_free_punish_with_user.go Voir le fichier

@@ -0,0 +1,19 @@
package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model"
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx"
"xorm.io/xorm"
)

func FindAllOneCirclesPublicPlatoonFreePunishWithUser(Db *xorm.Engine) (resp map[int]*model.OneCirclesPublicPlatoonFreePunishWithUser, err error) {
var m []model.OneCirclesPublicPlatoonFreePunishWithUser
err = Db.Where("1=1").Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
for _, v := range m {
resp[v.Uid] = &v
}
return
}

+ 6
- 0
db/model/one_circles_public_platoon_free_punish_with_user.go Voir le fichier

@@ -0,0 +1,6 @@
package model

type OneCirclesPublicPlatoonFreePunishWithUser struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
}

+ 8
- 4
rule/one_circles/one_circles_public_platoon_user_relation_commission.go Voir le fichier

@@ -738,8 +738,8 @@ func OneCirclesDealCommonWealthPunish(engine *xorm.Engine, uid int, reason strin
return
}
if params == nil {
err = errors.New("未查询到公排关系记录")
_ = session.Rollback()
fmt.Println("未查询到公排关系记录!!!!!!!")
return
}

//TODO::判断是否为推荐用户
@@ -835,6 +835,10 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string)
if oneCirclesPublicPlatoonBasicSetting == nil {
return errors.New("公排制度未开启")
}
mapOneCirclesPublicPlatoonFreePunishWithUser, err := db.FindAllOneCirclesPublicPlatoonFreePunishWithUser(engine)
if err != nil {
return err
}
if oneCirclesPublicPlatoonBasicSetting.SystemPunishReplace == 1 {
systemPunishReplaceValue := oneCirclesPublicPlatoonBasicSetting.SystemPunishReplaceValue
startDate := now.AddDate(0, 0, -systemPunishReplaceValue).Format("2006-01-02") + " 00:00:00"
@@ -842,7 +846,7 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string)
var pageSize = 100
for {
var users []model.User
err = engine.Limit(pageSize, (page-1)*pageSize).Desc("id").Find(&users)
err = engine.Limit(pageSize, (page-1)*pageSize).Desc("uid").Find(&users)
if err != nil {
return err
}
@@ -852,7 +856,7 @@ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string)
for _, user := range users {
var list []model.OneCirclesGreenEnergySignIn
err = engine.Where("start_time >= ?", startDate).And("uid = ?", user.Uid).Find(&list)
if len(list) <= 0 {
if len(list) <= 0 && mapOneCirclesPublicPlatoonFreePunishWithUser[user.Uid] == nil {
//进行处罚
err, _ = OneCirclesDealCommonWealthPunish(engine, user.Uid, "公排处罚")
if err != nil {


Chargement…
Annuler
Enregistrer