修改为批量领
This commit is contained in:
parent
d474f153a6
commit
52b75ba114
@ -50,13 +50,14 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
|
||||
|
||||
//receive button
|
||||
receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() {
|
||||
if len(this.itemList.SelItemIds) != 1 {
|
||||
selItemId := this.itemList.SelItemId
|
||||
if selItemId == "" {
|
||||
dialog.ShowError(errors.New("请选择一项"), this.w)
|
||||
return
|
||||
}
|
||||
if err := service.GetPttService().SendToClient(
|
||||
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)
|
||||
return
|
||||
}
|
||||
@ -94,7 +95,7 @@ func (this *TaskActiveListView) dataListener() {
|
||||
for _, v := range rsp.List {
|
||||
item := common.Item{
|
||||
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)
|
||||
}
|
||||
|
@ -36,7 +36,16 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
// code = pb.ErrorCode_TaskReceived
|
||||
// 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
|
||||
// 玩家的
|
||||
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
|
||||
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{})
|
||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||
if ue.Activeday >= conf.Active {
|
||||
update["received"] = 1
|
||||
} else {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
return
|
||||
if ue.Activeday < conf.Active {
|
||||
continue
|
||||
}
|
||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||
if ue.Activeweek >= conf.Active {
|
||||
update["received"] = 1
|
||||
} else {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
return
|
||||
if ue.Activeweek < conf.Active {
|
||||
continue
|
||||
}
|
||||
}
|
||||
update["received"] = 1
|
||||
if len(update) > 0 {
|
||||
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(),
|
||||
v.Id,
|
||||
@ -102,7 +96,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
Id: req.Id,
|
||||
}
|
||||
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
||||
err = session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user