Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
0403e09a9b
@ -42,7 +42,7 @@ func (a *appTester) LazyInit(service service.PttService, obs observer.Observer)
|
||||
intro := widget.NewLabel("")
|
||||
intro.Wrapping = fyne.TextWrapWord
|
||||
caseContent := container.NewBorder(
|
||||
container.NewVBox(container.NewHBox(title, widget.NewSeparator(), widget.NewButton("压测", nil)), widget.NewSeparator(), intro), nil, nil, nil, content)
|
||||
container.NewVBox(container.NewHBox(title), widget.NewSeparator(), intro), nil, nil, nil, content)
|
||||
|
||||
setNav := func(t *model.TestCase) {
|
||||
defer a.progress.Hide()
|
||||
@ -76,7 +76,7 @@ func (a *appTester) LazyInit(service service.PttService, obs observer.Observer)
|
||||
OnNotify: func(data interface{}, args ...interface{}) {
|
||||
tm := data.(time.Time)
|
||||
cost := time.Since(tm)
|
||||
logrus.WithFields(logrus.Fields{"Main": t.MainType, "Sub": t.SubType, "cost": cost}).Debug("耗时")
|
||||
// logrus.WithFields(logrus.Fields{"Main": t.MainType, "Sub": t.SubType, "cost": cost}).Debug("耗时")
|
||||
timeLbl.Text = fmt.Sprintf("耗时:%v", cost)
|
||||
timeLbl.Refresh()
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
aSel = &widget.Select{}
|
||||
gridContainer = container.NewGridWithColumns(3, aSel, tEntry, nEntry)
|
||||
|
||||
aSel.Options = []string{"选择", "attr", "item", "hero", "equi", "mapid", "pataid", "worldtask"}
|
||||
aSel.Options = []string{"选择", "attr", "item", "hero", "equi", "mapid", "pataid", "worldtask", "sociatyexp", "sociatyactivity"}
|
||||
aSel.SetSelected("选择")
|
||||
aSel.OnChanged = func(s string) {
|
||||
if s == "attr" {
|
||||
@ -61,9 +61,14 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
this.form.AppendItem(widget.NewFormItem(common.APP_TESTCASE_FORM_BINGO, gridContainer))
|
||||
|
||||
this.form.OnSubmit = func() {
|
||||
bingo := fmt.Sprintf("bingo:%s,%s,%s", aSel.Selected, ttxt, nEntry.Text)
|
||||
var bingo string
|
||||
if ttxt == "" {
|
||||
bingo = fmt.Sprintf("bingo:%s,%s", aSel.Selected, nEntry.Text)
|
||||
} else {
|
||||
bingo = fmt.Sprintf("bingo:%s,%s,%s", aSel.Selected, ttxt, nEntry.Text)
|
||||
}
|
||||
logrus.Info(bingo)
|
||||
if aSel.Selected == "选择" || nEntry.Text == "" || ttxt == "" || nEntry.Text == "0" {
|
||||
if aSel.Selected == "选择" || nEntry.Text == "0" {
|
||||
dialog.ShowError(errors.New("请填写完整且正确的数值"), this.w)
|
||||
return
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ type entryItem struct {
|
||||
icon *widget.Entry
|
||||
isApplyCheck *widget.Check
|
||||
applyLv *widget.Entry
|
||||
exp *widget.Label
|
||||
activity *widget.Label
|
||||
lv *widget.Label
|
||||
}
|
||||
|
||||
func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
@ -60,6 +63,9 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
icon: widget.NewEntry(),
|
||||
isApplyCheck: widget.NewCheck("审批", nil),
|
||||
applyLv: widget.NewEntry(),
|
||||
lv: widget.NewLabel(""),
|
||||
exp: widget.NewLabel(""),
|
||||
activity: widget.NewLabel(""),
|
||||
}
|
||||
|
||||
this.form.AppendItem(widget.NewFormItem("公会名称", item.sociatyName))
|
||||
@ -67,6 +73,9 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
this.form.AppendItem(widget.NewFormItem("图标", item.icon))
|
||||
this.form.AppendItem(widget.NewFormItem("审批", item.isApplyCheck))
|
||||
this.form.AppendItem(widget.NewFormItem("入会等级", item.applyLv))
|
||||
this.form.AppendItem(widget.NewFormItem("等级", item.lv))
|
||||
this.form.AppendItem(widget.NewFormItem("经验", item.exp))
|
||||
this.form.AppendItem(widget.NewFormItem("活跃值", item.activity))
|
||||
|
||||
//加载公会信息
|
||||
this.loadSociaty = func() {
|
||||
@ -258,6 +267,9 @@ func (this *SociatyMineView) sociatyRender(item *entryItem) {
|
||||
item.icon.Text = this.sociaty.Icon
|
||||
item.isApplyCheck.Checked = this.sociaty.IsApplyCheck
|
||||
item.applyLv.Text = cast.ToString(this.sociaty.ApplyLv)
|
||||
item.lv.Text = cast.ToString(this.sociaty.Lv)
|
||||
item.exp.Text = cast.ToString(this.sociaty.Exp)
|
||||
item.activity.Text = cast.ToString(this.sociaty.Activity)
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,6 +317,9 @@ func (this *SociatyMineView) dataListener(item *entryItem) {
|
||||
item.icon.Text = rsp.Sociaty.Icon
|
||||
item.isApplyCheck.Checked = rsp.Sociaty.IsApplyCheck
|
||||
item.applyLv.Text = cast.ToString(rsp.Sociaty.ApplyLv)
|
||||
item.lv.Text = cast.ToString(rsp.Sociaty.Lv)
|
||||
item.exp.Text = cast.ToString(rsp.Sociaty.Exp)
|
||||
item.activity.Text = cast.ToString(rsp.Sociaty.Activity)
|
||||
this.form.Refresh()
|
||||
},
|
||||
})
|
||||
|
@ -244,6 +244,8 @@ const ( //Rpc
|
||||
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
|
||||
// 公会信息
|
||||
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
|
||||
// 公会更新
|
||||
Rpc_ModuleSociatyUpdate core.Rpc_Key = "Rpc_ModuleSociatyUpdate"
|
||||
)
|
||||
|
||||
//事件类型定义处
|
||||
|
@ -207,7 +207,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
}
|
||||
|
||||
module1.(comm.IMoonFantasy).TriggerMF(session, datas[1])
|
||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
} else if len(datas) == 2 && (datas[0] == "arena") { // 设置竞技场用户积分
|
||||
module1, err := this.service.GetModule(comm.ModuleArena)
|
||||
if err != nil {
|
||||
@ -219,7 +219,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
return
|
||||
}
|
||||
module1.(comm.IArena).SetUserIntegral(session, int32(num))
|
||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
} else if len(datas) == 2 && (datas[0] == "sociatyexp") { // 设置工会经验
|
||||
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
||||
if err != nil {
|
||||
@ -231,7 +231,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
return
|
||||
}
|
||||
module1.(comm.ISociaty).BingoSetExp(session, int32(num))
|
||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
} else if len(datas) == 2 && (datas[0] == "sociatyactivity") { // 设置工会活跃度
|
||||
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
||||
if err != nil {
|
||||
@ -243,7 +243,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
return
|
||||
}
|
||||
module1.(comm.ISociaty).BingoSetActivity(session, int32(num))
|
||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||
} else if len(datas) == 1 && (datas[0] == "alltask") { // 设置工会活跃度
|
||||
module, err := this.service.GetModule(comm.ModuleWorldtask)
|
||||
if err != nil {
|
||||
@ -254,6 +254,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
this.Error("bingo 世界任务", log.Fields{"params": datas, "err": err.Error()})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -328,9 +328,26 @@ func (this *ModelSociaty) isRight(uid string, sociaty *pb.DBSociaty, jobs ...pb.
|
||||
return false
|
||||
}
|
||||
|
||||
// 更新公会
|
||||
// 更新公会经验
|
||||
func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error {
|
||||
return this.ChangeList("", sociatyId, update)
|
||||
if this.moduleSociaty.IsCross() {
|
||||
return this.ChangeList(comm.RDS_EMPTY, sociatyId, update)
|
||||
} else {
|
||||
req := &SociatyUpdateParam{
|
||||
SociatyId: sociatyId,
|
||||
Update: update,
|
||||
}
|
||||
if err := this.moduleSociaty.service.AcrossClusterRpcCall(
|
||||
context.Background(),
|
||||
this.moduleSociaty.GetCrossTag(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_ModuleSociatyUpdate),
|
||||
req,
|
||||
&pb.EmptyResp{}); err != nil {
|
||||
this.moduleSociaty.Errorln(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 退出公会
|
||||
|
@ -59,6 +59,7 @@ func (this *Sociaty) OnInstallComp() {
|
||||
func (this *Sociaty) Start() (err error) {
|
||||
err = this.ModuleBase.Start()
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociaty), this.RpcGetSociaty)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociatyUpdate), this.RpcUpdateSociaty)
|
||||
this.globalConf = this.configure.GetGlobalConf()
|
||||
if this.globalConf == nil {
|
||||
err = errors.New("global config not found")
|
||||
@ -156,17 +157,66 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
|
||||
func (this *Sociaty) RpcGetSociaty(ctx context.Context, req *pb.RPCGeneralReqA1, reply *pb.DBSociaty) error {
|
||||
this.Debug("Rpc_ModuleSociaty", log.Fields{"req": req})
|
||||
sociaty := this.modelSociaty.getSociaty(req.Param1)
|
||||
*reply = *sociaty
|
||||
log.Debug("跨服公会", log.Fields{"sociaty": reply})
|
||||
reply.Id = sociaty.Id
|
||||
reply.Lv = sociaty.Lv
|
||||
reply.Exp = sociaty.Exp
|
||||
reply.Members = sociaty.Members
|
||||
reply.DismissCD = sociaty.DismissCD
|
||||
reply.Name = sociaty.Name
|
||||
reply.Icon = sociaty.Icon
|
||||
reply.Notice = sociaty.Notice
|
||||
reply.DismissTime = sociaty.DismissTime
|
||||
reply.IsApplyCheck = sociaty.IsApplyCheck
|
||||
reply.SignIds = sociaty.SignIds
|
||||
reply.LastSignCount = sociaty.LastSignCount
|
||||
reply.ApplyLv = sociaty.ApplyLv
|
||||
reply.Activity = sociaty.Activity
|
||||
reply.AccuseTime = sociaty.AccuseTime
|
||||
reply.ApplyRecord = sociaty.ApplyRecord
|
||||
return nil
|
||||
}
|
||||
|
||||
type SociatyUpdateParam struct {
|
||||
SociatyId string
|
||||
Update map[string]interface{}
|
||||
}
|
||||
|
||||
//跨服更新数据
|
||||
func (this *Sociaty) RpcUpdateSociaty(ctx context.Context, req *SociatyUpdateParam, reply *pb.DBSociaty) error {
|
||||
return this.modelSociaty.ChangeList(comm.RDS_EMPTY, req.SociatyId, req.Update)
|
||||
}
|
||||
|
||||
// 设置工会经验
|
||||
func (this *Sociaty) BingoSetExp(session comm.IUserSession, exp int32) error {
|
||||
return nil
|
||||
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||
if sociaty == nil || sociaty.Id == "" {
|
||||
log.Warn("未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
||||
return comm.NewCustomError(pb.ErrorCode_SociatyNoFound)
|
||||
}
|
||||
sociaty.Exp += exp
|
||||
update := map[string]interface{}{
|
||||
"exp": sociaty.Exp,
|
||||
}
|
||||
|
||||
// 设置工会经验
|
||||
func (this *Sociaty) BingoSetActivity(session comm.IUserSession, activity int32) error {
|
||||
return nil
|
||||
err := this.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return this.modelSociaty.changeLv(sociaty)
|
||||
}
|
||||
|
||||
// 设置工会活跃度
|
||||
func (this *Sociaty) BingoSetActivity(session comm.IUserSession, activity int32) error {
|
||||
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||
if sociaty == nil || sociaty.Id == "" {
|
||||
log.Warn("未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
||||
return comm.NewCustomError(pb.ErrorCode_SociatyNoFound)
|
||||
}
|
||||
|
||||
activity += sociaty.Activity
|
||||
update := map[string]interface{}{
|
||||
"activity": activity,
|
||||
}
|
||||
return this.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||
}
|
||||
|
@ -162,7 +162,39 @@ func (this *Worldtask) GetMyWorldtask(uid string) *pb.DBWorldtask {
|
||||
}
|
||||
|
||||
func (this *Worldtask) BingoAllTask(session comm.IUserSession) error {
|
||||
return nil
|
||||
uid := session.GetUserId()
|
||||
mytask := &pb.DBWorldtask{}
|
||||
mytask.LastTaskIds = make(map[int32]*pb.Worldtask)
|
||||
|
||||
tasklist := this.worldtaskConf.GetDataList()
|
||||
// 更新数据
|
||||
update := map[string]interface{}{}
|
||||
for _, conf := range tasklist {
|
||||
//世界任务配置
|
||||
if conf.Des == 2 {
|
||||
wt := &pb.Worldtask{
|
||||
TaskId: conf.Key,
|
||||
TaskType: conf.Des,
|
||||
}
|
||||
mytask.LastTaskIds[conf.Group] = wt
|
||||
mytask.TaskList = append(mytask.TaskList, wt)
|
||||
}
|
||||
}
|
||||
|
||||
update = map[string]interface{}{
|
||||
"lastTaskIds": mytask.LastTaskIds,
|
||||
"taskList": mytask.TaskList,
|
||||
}
|
||||
|
||||
if err := this.modelWorldtask.Change(uid, update); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rsp := &pb.WorldtaskFinishIdsPush{
|
||||
TaskList: mytask.TaskList,
|
||||
}
|
||||
|
||||
return session.SendMsg(string(this.GetType()), "finishids", rsp)
|
||||
}
|
||||
|
||||
// bingo世界任务跳跃 支持回退
|
||||
|
Loading…
Reference in New Issue
Block a user