修复任务重置更新
This commit is contained in:
parent
d11d389910
commit
be2f00eb0e
@ -37,6 +37,7 @@ func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
|
||||
// task list button
|
||||
taskListBtn := widget.NewButtonWithIcon("任务列表", theme.ConfirmIcon(), func() {
|
||||
this.itemList.Reset()
|
||||
if err := service.GetPttService().SendToClient(t.MainType, t.SubType, &pb.TaskListReq{
|
||||
TaskTag: cast.ToInt32(tagSelect.Selected),
|
||||
}); err != nil {
|
||||
@ -46,13 +47,14 @@ func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
|
||||
// task receive button
|
||||
receiveBtn := widget.NewButtonWithIcon("任务领取", theme.ConfirmIcon(), func() {
|
||||
if len(this.itemList.SelItemIds) != 1 {
|
||||
selId := this.itemList.SelItemId
|
||||
if selId == "" {
|
||||
dialog.ShowError(errors.New("请选择一项"), this.w)
|
||||
return
|
||||
}
|
||||
if err := service.GetPttService().SendToClient(
|
||||
t.MainType, "receive",
|
||||
&pb.TaskReceiveReq{Id: this.itemList.SelItemIds[0], TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
&pb.TaskReceiveReq{Id: selId, TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
@ -114,7 +114,6 @@ type (
|
||||
CrossSearchUser(nickname string) ([]*pb.DBUser, error)
|
||||
// 搜索远程用户
|
||||
SearchRmoteUser(nickname string) ([]*pb.DBUser, error)
|
||||
|
||||
}
|
||||
//武器模块
|
||||
IEquipment interface {
|
||||
@ -163,6 +162,8 @@ type (
|
||||
RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBRtaskRecord) error
|
||||
// 删除任务条件数据
|
||||
RemoveCondi(uid string, condiId int32) error
|
||||
// 更新任务条件数据
|
||||
ChangeCondi(uid string, data map[int32]*pb.RtaskData) error
|
||||
//任务触发
|
||||
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
|
||||
// 初始化条件数据
|
||||
|
@ -99,4 +99,4 @@ func (this *ModelRtaskRecord) initCondiData(uid string) error {
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
@ -425,6 +425,17 @@ func (this *ModuleRtask) RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) ChangeCondi(uid string, data map[int32]*pb.RtaskData) error {
|
||||
if len(data) > 0 {
|
||||
update := map[string]interface{}{
|
||||
"vals": data,
|
||||
}
|
||||
return this.modelRtaskRecord.Change(uid, update)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
//接收区服worker发起的秘境事件
|
||||
func (this *ModuleRtask) Rpc_ModuleRtaskSendTask(ctx context.Context, args *pb.RPCRTaskReq, reply *pb.EmptyResp) (err error) {
|
||||
this.Debug("Rpc_ModuleRtaskSendTask", log.Fields{"args": args.String()})
|
||||
|
@ -224,21 +224,24 @@ func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string
|
||||
//清空任务
|
||||
func (this *ModelTask) clearTask(uid string, taskTag ...comm.TaskTag) {
|
||||
if len(taskTag) == 0 {
|
||||
this.moduleTask.Errorf("least one param for taskTag")
|
||||
this.moduleTask.Error("TaskTag参数缺失", log.Fields{"uid": uid, "params": taskTag})
|
||||
return
|
||||
}
|
||||
taskList := this.getTaskListByTag(uid, taskTag[0])
|
||||
dr := this.moduleTask.ModuleRtask.GetCondiData(uid)
|
||||
for _, v := range taskList {
|
||||
if err := this.moduleTask.modelTask.DelListlds(uid, v.Id); err != nil {
|
||||
this.moduleTask.Errorf("uid: %v err:%v", uid, err)
|
||||
this.moduleTask.Error("清除任务", log.Fields{"uid": uid, "taskId": v.Id})
|
||||
return
|
||||
}
|
||||
//删除任务条件数据
|
||||
dr := this.moduleTask.ModuleRtask.GetCondiData(uid)
|
||||
if dr != nil && dr.Vals!=nil{
|
||||
if dr != nil && dr.Vals != nil {
|
||||
delete(dr.Vals, v.TypeId)
|
||||
}
|
||||
}
|
||||
if err := this.moduleTask.ModuleRtask.ChangeCondi(uid, dr.Vals); err != nil {
|
||||
this.moduleTask.Error("更新任务条件数据", log.Fields{"uid": uid})
|
||||
}
|
||||
}
|
||||
|
||||
//进入卡牌攻略
|
||||
|
Loading…
Reference in New Issue
Block a user