公会埋点

This commit is contained in:
wh_zcy 2023-05-25 17:51:04 +08:00
parent 5ded8e1488
commit 0892a6c8e9
4 changed files with 68 additions and 56 deletions

View File

@ -11,20 +11,20 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"sync/atomic"
cfg "go_dreamfactory/sys/configure/structs"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
"github.com/tidwall/gjson"
)
type RtaskTestView struct {
@ -35,6 +35,7 @@ type RtaskTestView struct {
flag bool
msgs []string
reportPath string //Json Data数据路径
loadCount int32
}
func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
@ -84,7 +85,7 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
//"F:\\projects\\workspace\\go_dreamfactory\\bin\\json"
jsonPathEntry := widget.NewEntry()
jsonPathEntry.SetText("F:\\projects\\workspace\\go_dreamfactory\\bin\\json")
jsonPathEntry.SetText("F:\\")
reportEntry := widget.NewEntry()
reportEntry.SetText("F:\\")
@ -101,16 +102,34 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.reportPath = reportEntry.Text
var wg sync.WaitGroup
if tb, err := cfg.NewTables(commCfg.Loader); err == nil {
for _, v := range tb.RdtaskCondi.GetDataList() {
b, err := ioutil.ReadFile(filepath.Join(commCfg.Path, "game_rdtaskcondi.json"))
if err != nil {
logrus.Error(err)
return
}
r := gjson.ParseBytes(b)
for _, line := range r.Array() {
logrus.Debug(line.String())
id := line.Get("id").Int()
rtype := line.Get("type").Int()
data1 := line.Get("data1").Int()
data2 := line.Get("data2").Int()
data3 := line.Get("data3").Int()
data4 := line.Get("data4").Int()
data5 := line.Get("data5").Int()
wg.Add(1)
params := []int32{v.Data1, v.Data2, v.Data3, v.Data4, v.Data5}
params := []int32{int32(data1), int32(data2), int32(data3), int32(data4), int32(data5)}
var p []int32
for _, v := range params {
if v > 0 {
p = append(p, v)
}
}
logrus.Debugf("id:%v rtype:%v params:%v", id, rtype, p)
go func(condId, rtype int32, p []int32) {
defer wg.Done()
if err := service.GetPttService().SendToClient(
@ -124,32 +143,24 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
logrus.Error(err)
return
}
// logrus.Debugf("执行任务 id:%v rtype:%v params:%v", condId, rtype, p)
// msgs = append(msgs, fmt.Sprintf("condId:%v rtype:%v params:%v", condId, rtype, p))
}(v.Id, v.Type, p)
}(int32(id), int32(rtype), p)
wg.Wait()
}
}
go func() {
for msg := range this.resultChan {
// logrus.Debug("add msg")
this.msgs = append(this.msgs, msg)
// old := atomic.LoadInt32(&this.resultCount)
// n := old - 1
// if atomic.CompareAndSwapInt32(&this.resultCount, old, n) {
// break
// }
atomic.AddInt32(&this.loadCount, 1)
}
}()
go func() {
var flag bool
for !flag {
count := atomic.LoadInt32(&this.resultCount)
logrus.Debug("count:", count)
if count == 100 {
lcount := atomic.LoadInt32(&this.loadCount)
// logrus.Debug("count:", count)
if count == lcount {
logrus.Debug("结束")
record := strings.Join(this.msgs, "\n")
var buf bytes.Buffer

View File

@ -669,6 +669,7 @@ const (
Rtype185 TaskType = 185 //完成X次每日1健(接取任务后每完成1次每日1健便进度加一)
Rtype186 TaskType = 186
Rtype187 TaskType = 187
Rtype188 TaskType = 188 //玩家创建1个工会
)
const (

View File

@ -79,8 +79,8 @@ func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondHan
func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle) {
for _, v := range this.configure.getRtaskCondis(int32(tt)) {
switch tt {
// 大于1个参数且第一个参数累计第二个参数等于
case comm.Rtype1, comm.Rtype16, comm.Rtype17, comm.Rtype50, comm.Rtype125, comm.Rtype126, comm.Rtype127:
// 两个参数 大于1个参数且第一个参数累计第二个参数等于
case comm.Rtype1, comm.Rtype16, comm.Rtype17, comm.Rtype50, comm.Rtype125, comm.Rtype126, comm.Rtype127, comm.Rtype187:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyMultiEqual,
@ -118,23 +118,22 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 一个参数且累计
case comm.Rtype7, comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15,
comm.Rtype18, comm.Rtype19, comm.Rtype23, comm.Rtype24,
comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38,
comm.Rtype39, comm.Rtype47, comm.Rtype51, comm.Rtype53,
comm.Rtype54, comm.Rtype57, comm.Rtype60,
comm.Rtype62, comm.Rtype64, comm.Rtype87, comm.Rtype88, comm.Rtype89, comm.Rtype90,
comm.Rtype91, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype97, comm.Rtype104,
comm.Rtype96, comm.Rtype98, comm.Rtype99, comm.Rtype102, comm.Rtype103, comm.Rtype105,
comm.Rtype106, comm.Rtype108, comm.Rtype113, comm.Rtype114, comm.Rtype115, comm.Rtype116,
comm.Rtype117, comm.Rtype118, comm.Rtype119, comm.Rtype120, comm.Rtype121, comm.Rtype123,
comm.Rtype124,
comm.Rtype128, comm.Rtype130, comm.Rtype131, comm.Rtype132, comm.Rtype135,
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146,
comm.Rtype147, comm.Rtype148, comm.Rtype149, comm.Rtype152, comm.Rtype153, comm.Rtype154,
comm.Rtype156, comm.Rtype161, comm.Rtype165, comm.Rtype166, comm.Rtype167,
case comm.Rtype7,
comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15, comm.Rtype18, comm.Rtype19,
comm.Rtype23, comm.Rtype24, comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38, comm.Rtype39,
comm.Rtype47,
comm.Rtype51, comm.Rtype53, comm.Rtype54, comm.Rtype57,
comm.Rtype60, comm.Rtype62, comm.Rtype64, comm.Rtype87, comm.Rtype88, comm.Rtype89,
comm.Rtype90, comm.Rtype91, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype97, comm.Rtype96, comm.Rtype98, comm.Rtype99,
comm.Rtype104, comm.Rtype102, comm.Rtype103, comm.Rtype105, comm.Rtype106, comm.Rtype108,
comm.Rtype113, comm.Rtype114, comm.Rtype115, comm.Rtype116, comm.Rtype117, comm.Rtype118, comm.Rtype119,
comm.Rtype120, comm.Rtype121, comm.Rtype123, comm.Rtype124, comm.Rtype128,
comm.Rtype130, comm.Rtype131, comm.Rtype132, comm.Rtype135,
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146, comm.Rtype147, comm.Rtype148, comm.Rtype149,
comm.Rtype152, comm.Rtype153, comm.Rtype154, comm.Rtype156,
comm.Rtype161, comm.Rtype165, comm.Rtype166, comm.Rtype167,
comm.Rtype171, comm.Rtype172, comm.Rtype173, comm.Rtype175, comm.Rtype177,
comm.Rtype181, comm.Rtype182, comm.Rtype183, comm.Rtype184, comm.Rtype185, comm.Rtype186, comm.Rtype187:
comm.Rtype181, comm.Rtype182, comm.Rtype183, comm.Rtype184, comm.Rtype185, comm.Rtype186, comm.Rtype188:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,

View File

@ -136,6 +136,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
return
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype188, 1))
// 初始化玩家公会任务
go func() {
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {