huangjiajun 1 ano atrás
pai
commit
26160413a7
5 arquivos alterados com 83 adições e 1 exclusões
  1. +24
    -0
      db/db_sys_cfg.go
  2. +17
    -0
      db/db_user_team_total.go
  3. +7
    -0
      db/model/sys_cfg.go
  4. +10
    -0
      db/model/user_team_total.go
  5. +25
    -1
      hdl/hdl_upgrade.go

+ 24
- 0
db/db_sys_cfg.go Ver arquivo

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

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/db/model"
"xorm.io/xorm"
)

// 系统配置get
func SysCfgGetAll(Db *xorm.Engine) (*[]model.SysCfg, error) {
var cfgList []model.SysCfg
if err := Db.Cols("key,val,memo").Find(&cfgList); err != nil {
return nil, err
}
return &cfgList, nil
}

// 获取一条记录
func SysCfgGetOne(Db *xorm.Engine, key string) (*model.SysCfg, error) {
var cfgList model.SysCfg
if has, err := Db.Where("`key`=?", key).Get(&cfgList); err != nil || has == false {
return nil, err
}
return &cfgList, nil
}

+ 17
- 0
db/db_user_team_total.go Ver arquivo

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

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/db/model"
zhios_condition_statistics_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/utils"
"xorm.io/xorm"
)

func GetUserTeamTotal(eg *xorm.Engine, uid string) *model.UserTeamTotal {
var data model.UserTeamTotal
get, _ := eg.Where("uid=?", uid).Get(&data)
if get == false {
data = model.UserTeamTotal{Uid: zhios_condition_statistics_utils.StrToInt(uid)}
eg.Insert(&data)
}
return &data
}

+ 7
- 0
db/model/sys_cfg.go Ver arquivo

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

type SysCfg struct {
Key string `json:"key" xorm:"not null pk comment('键') VARCHAR(127)"`
Val string `json:"val" xorm:"comment('值') TEXT"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
}

+ 10
- 0
db/model/user_team_total.go Ver arquivo

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

type UserTeamTotal struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int `json:"uid" xorm:"default 0 unique INT(11)"`
TeamCount int `json:"team_count" xorm:"default 0 INT(11)"`
FirstCount int `json:"first_count" xorm:"default 0 INT(11)"`
SecondCount int `json:"second_count" xorm:"default 0 INT(11)"`
IsSet int `json:"is_set" xorm:"default 0 INT(11)"`
}

+ 25
- 1
hdl/hdl_upgrade.go Ver arquivo

@@ -217,6 +217,9 @@ func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks
} else {
total = item.FinishCount
}
if item.TaskType == 19 {
total = zhios_condition_statistics_utils.IntToStr(zhios_condition_statistics_utils.StrToInt(total) + 1)
}
temp["name"] = name
temp["total"] = total //需完成数
temp["finish"] = finish //已完成数
@@ -645,12 +648,13 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
FROM mall_ord_list_relate olr
JOIN mall_ord ol ON olr.oid = ol.ord_id
WHERE olr.uid = ?
AND ol.state =3 and olr.level>0 ?;
AND ol.state =3 and olr.level>0 %s;
`
str := ""
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"8", "9"}) {
str += " and ol.order_type=" + zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd)
}
sqlTpl = fmt.Sprintf(sqlTpl, str)
result, err := db.QueryNativeString(engine, sqlTpl, uid, str)
if err == nil {
total += zhios_condition_statistics_utils.StrToFloat64(result[0]["amount"])
@@ -879,6 +883,26 @@ WHERE molr.uid in(SELECT uid FROM user_relate WHERE parent_uid=%s and level=1)
}

return zhios_condition_statistics_utils.Float64ToStrByPrec(count, 2), hasPay, payOrdId
case 19:
teamCountMinData, _ := db.SysCfgGetOne(engine, "team_count_min")
teamCountMin := 15
if teamCountMinData != nil {
teamCountMin = zhios_condition_statistics_utils.StrToInt(teamCountMinData.Val)
}
teamtotal := db.GetUserTeamTotal(engine, zhios_condition_statistics_utils.AnyToString(uid))
var count = 0
if teamtotal != nil && teamtotal.FirstCount >= teamCountMin && teamtotal.SecondCount >= teamCountMin {
count++
}
sql := `SELECT * FROM user_profile up
LEFT JOIN user_team_total utt ON utt.uid=up.uid
WHERE up.parent_uid=? and utt.first_count>=? and utt.second_count>=?
`
nativeString, _ := db.QueryNativeString(engine, sql, zhios_condition_statistics_utils.AnyToString(uid), teamCountMin, teamCountMin)
if len(nativeString) > 0 {
count += len(nativeString)
}
return zhios_condition_statistics_utils.IntToStr(count), hasPay, payOrdId
default:
return "", hasPay, payOrdId
}


Carregando…
Cancelar
Salvar