修改为批量领
This commit is contained in:
parent
d474f153a6
commit
52b75ba114
@ -50,13 +50,14 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
|
|||||||
|
|
||||||
//receive button
|
//receive button
|
||||||
receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() {
|
receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() {
|
||||||
if len(this.itemList.SelItemIds) != 1 {
|
selItemId := this.itemList.SelItemId
|
||||||
|
if selItemId == "" {
|
||||||
dialog.ShowError(errors.New("请选择一项"), this.w)
|
dialog.ShowError(errors.New("请选择一项"), this.w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := service.GetPttService().SendToClient(
|
if err := service.GetPttService().SendToClient(
|
||||||
t.MainType, "activereceive",
|
t.MainType, "activereceive",
|
||||||
&pb.TaskActiveReceiveReq{Id: this.itemList.SelItemIds[0], TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
&pb.TaskActiveReceiveReq{Id: selItemId, TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -94,7 +95,7 @@ func (this *TaskActiveListView) dataListener() {
|
|||||||
for _, v := range rsp.List {
|
for _, v := range rsp.List {
|
||||||
item := common.Item{
|
item := common.Item{
|
||||||
Id: cast.ToString(v.Id),
|
Id: cast.ToString(v.Id),
|
||||||
Text: fmt.Sprintf("%s R:%d", cast.ToString(v.RId), v.Received),
|
Text: fmt.Sprintf("任务ID:%s 领取状态:%d", cast.ToString(v.RId), v.Received),
|
||||||
}
|
}
|
||||||
this.itemList.AddItem(item)
|
this.itemList.AddItem(item)
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,16 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
// code = pb.ErrorCode_TaskReceived
|
// code = pb.ErrorCode_TaskReceived
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ue == nil {
|
||||||
|
code = pb.ErrorCode_UserExpandNull
|
||||||
|
return
|
||||||
|
}
|
||||||
var rewards []*cfg.Gameatn
|
var rewards []*cfg.Gameatn
|
||||||
// 玩家的
|
// 玩家的
|
||||||
activeList := this.moduleTask.modelTaskActive.getActiveListByTag(uid, comm.TaskTag(req.TaskTag))
|
activeList := this.moduleTask.modelTaskActive.getActiveListByTag(uid, comm.TaskTag(req.TaskTag))
|
||||||
@ -49,33 +58,18 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get user expand
|
// get user expand
|
||||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
|
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ue == nil {
|
|
||||||
code = pb.ErrorCode_UserExpandNull
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
update := make(map[string]interface{})
|
update := make(map[string]interface{})
|
||||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||||
if ue.Activeday >= conf.Active {
|
if ue.Activeday < conf.Active {
|
||||||
update["received"] = 1
|
continue
|
||||||
} else {
|
|
||||||
code = pb.ErrorCode_TaskActiveNoenough
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||||
if ue.Activeweek >= conf.Active {
|
if ue.Activeweek < conf.Active {
|
||||||
update["received"] = 1
|
continue
|
||||||
} else {
|
|
||||||
code = pb.ErrorCode_TaskActiveNoenough
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update["received"] = 1
|
||||||
if len(update) > 0 {
|
if len(update) > 0 {
|
||||||
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(),
|
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(),
|
||||||
v.Id,
|
v.Id,
|
||||||
@ -102,7 +96,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
Id: req.Id,
|
Id: req.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
err = session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user