소스 검색

更新

master
huangjiajun 10 달 전
부모
커밋
32eb14d193
5개의 변경된 파일55개의 추가작업 그리고 6개의 파일을 삭제
  1. +15
    -0
      db/db_one_circles_user_lv_time.go
  2. +11
    -0
      db/model/one_circles_user_lv_time.go
  3. +1
    -0
      go.mod
  4. +7
    -0
      go.sum
  5. +21
    -6
      hdl/hdl_upgrade.go

+ 15
- 0
db/db_one_circles_user_lv_time.go 파일 보기

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

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

func GetOneCirclesUserLvTime(eg *xorm.Engine, uid interface{}) *model.OneCirclesUserLvTime {
var data model.OneCirclesUserLvTime
get, err := eg.Where("uid=?", uid).Get(&data)
if get == false || err != nil {
return nil
}
return &data
}

+ 11
- 0
db/model/one_circles_user_lv_time.go 파일 보기

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

import (
"time"
)

type OneCirclesUserLvTime struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
Date time.Time `json:"date" xorm:"not null comment('日期') DATETIME"`
}

+ 1
- 0
go.mod 파일 보기

@@ -3,6 +3,7 @@ module code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git
go 1.15

require (
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240118152737-08e0d2709655 // indirect
github.com/syyongx/php2go v0.9.6
go.uber.org/zap v1.13.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0


+ 7
- 0
go.sum 파일 보기

@@ -1,5 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240118152737-08e0d2709655 h1:Bc0n1k4V1uNBhYLtt3rU8oxRb6uxkXVwbXWImx1J6M4=
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240118152737-08e0d2709655/go.mod h1:Q/C2vLPgAWDPyKyll2sFRWdJsw26nZknL+mjGGB1uuw=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE=
@@ -71,6 +73,7 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
@@ -96,6 +99,7 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -188,6 +192,7 @@ github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0f
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -319,6 +324,7 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
@@ -426,6 +432,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=


+ 21
- 6
hdl/hdl_upgrade.go 파일 보기

@@ -5,6 +5,7 @@ import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/db/model"
"code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/md"
zhios_condition_statistics_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/utils"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles"
"errors"
"fmt"
"time"
@@ -37,7 +38,7 @@ func CommUplv(blockStarChain string, eg *xorm.Engine, dbName string, user *model
levelArriveAt := user.LevelArriveAt
oldLevel := user.Level
uid := zhios_condition_statistics_utils.IntToStr(user.Uid)
result, _, payOrdId := IsCompleteSchemeTask(blockStarChain, eg, user, DataDetail.AgentType, DataDetail.IsChangeTime)
result, _, payOrdId := IsCompleteSchemeTask(blockStarChain, eg, user, DataDetail.AgentType, DataDetail.IsChangeTime, dbName)
AutoAudit := 0
if result {
level, err := db.UserLevelByID(eg, zhios_condition_statistics_utils.StrToInt(DataDetail.AgentType))
@@ -143,7 +144,7 @@ func CommUplv(blockStarChain string, eg *xorm.Engine, dbName string, user *model
}

// IsCompleteSchemeTask 根据传入的 level 判断是否可以升级
func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *model.User, level, IsChangeTime string) (bool, bool, int64) {
func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *model.User, level, IsChangeTime, dbName string) (bool, bool, int64) {
uid := zhios_condition_statistics_utils.IntToStr(user.Uid)
userLevel, err := db.UserLevelByID(engine, user.Level)
if err != nil {
@@ -172,10 +173,10 @@ func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *mode
return false, false, 0
}

return CheckSchemeTasksComplete(blockStarChain, engine, schemeTasks, uid, becomeLevel, level, "")
return CheckSchemeTasksComplete(blockStarChain, engine, schemeTasks, uid, becomeLevel, level, "", dbName)
}

func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks *[]model.UserLevelUpgradeTask, uid interface{}, scheme *model.UserLevel, level string, regionalId string) (bool, bool, int64) {
func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks *[]model.UserLevelUpgradeTask, uid interface{}, scheme *model.UserLevel, level string, regionalId, dbName string) (bool, bool, int64) {
//分离出 必做/选做 途径(任务组) && 分离出 必做/选做
var tasksGroup []map[string]interface{}
mustTasks := make(map[string][]interface{})
@@ -209,7 +210,7 @@ func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks

name := GetTaskName(item.TaskType)

finish, hasPay, payOrdId := GetFinishCount(blockStarChain, engine, uid, &item, level, regionalId, allLvMap)
finish, hasPay, payOrdId := GetFinishCount(blockStarChain, engine, uid, &item, level, regionalId, allLvMap, dbName)
total := "" // 总共需完成的数
if item.TaskType == 6 {
// 当是付费条件是否,total的指标只能是1
@@ -337,6 +338,8 @@ func GetTaskName(id int) string {
return "小区累计自营消费金额"
case 20:
return "累计收益(结算)"
case 22:
return "连续活跃"
default:
return "无效名称"
}
@@ -345,7 +348,7 @@ func GetTaskName(id int) string {
//

// GetFinishCount is 计算规定时间内完成的指标的数量
func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask, level string, regionalId string, allLvMap map[int]*model.UserLevel) (string, bool, int64) {
func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask, level string, regionalId string, allLvMap map[int]*model.UserLevel, dbName string) (string, bool, int64) {
t := time.Now()
hasPay := false
var payOrdId int64
@@ -367,6 +370,18 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
}
}
return zhios_condition_statistics_utils.Float64ToStr(money), hasPay, payOrdId
case 22:
lvTime := db.GetOneCirclesUserLvTime(engine, uid)
stime := time.Date(t.Year(), t.Month(), t.Day()-1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05")
if lvTime != nil && lvTime.Date.IsZero() == false {
stime = lvTime.Date.Format("2006-01-02 15:04:05")
}
etime := t.Format("2006-01-02 15:04:05")
_, days, activity := one_circles.CalcUserContinuousDailyActivityDays(engine, dbName, int(zhios_condition_statistics_utils.AnyToInt64(uid)), stime, etime)
if activity == false {
days = 0
}
return zhios_condition_statistics_utils.IntToStr(days), hasPay, payOrdId
case 1:
// 累计自购数
total, err := db.OrderListCountByUIDByOrderTypeByTimeNew(engine, uid, task)


불러오는 중...
취소
저장