This commit is contained in:
wh_zcy 2023-03-23 11:05:32 +08:00
parent 50781b87a3
commit 755693518a
5 changed files with 70 additions and 53 deletions

View File

@ -108,12 +108,12 @@ func (d *DispatchView) CreateView(t *model.TestCase) fyne.CanvasObject {
logrus.Debug("heroId参数不能为空")
return
}
heroIds := []string{}
if hero1.Text!=""{
if hero1.Text != "" {
heroIds = append(heroIds, hero1.Text)
}
if hero2.Text!=""{
if hero2.Text != "" {
heroIds = append(heroIds, hero2.Text)
}
if err := service.GetPttService().SendToClient(
@ -179,7 +179,8 @@ func (a *DispatchView) noticeList() {
return
}
a.noticeLabl.SetText(fmt.Sprintf("公告等级:%v 免费次数:%v 刷新次数:%v 任务数:%v 周任务数:%v 周奖励领取:%v",
a.noticeLabl.SetText(fmt.Sprintf("门票:%v 公告等级:%v 免费次数:%v 刷新次数:%v 任务数:%v 周任务数:%v 周奖励领取:%v",
rsp.Ticket,
rsp.Dispatch.Lv,
rsp.Dispatch.FreeCount,
rsp.Dispatch.RefreshCount,

View File

@ -41,7 +41,7 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
Lv: 1, //公告初始升级
FreeCount: freeCount,
Tasks: tasks,
CreateTime: configure.Now().Unix(),
UpdateTime: configure.Now().Unix(),
}
update := map[string]interface{}{
@ -53,15 +53,23 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
return
}
d.Nb = nb
rsp.Ticket = ticketCount
} else {
//周任务重置
n := utils.DiffDays(d.Nb.CreateTime, configure.Now().Unix())
n := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
day := a.module.configure.GetGlobalConf().DispatchWeektaskcheck
if int32(n) >= day {
d.Nb.WeekCount = 0
d.Nb.WeekReceived = []int32{}
d.Nb.UpdateTime = configure.Now().Unix()
}
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
if one >= 1 {
d.Ticket = a.module.configure.GetGlobalConf().DispatchNumoftimes
}
rsp.Ticket = d.Ticket
a.module.modelDispatch.updateNotice(session.GetUserId(), d)
}

View File

@ -51,7 +51,7 @@ func (this *modelDispatch) initDispatch(uid string, dispatch *pb.DBDispatch) *pb
Lv: 1, //公告初始升级
FreeCount: freeCount,
Tasks: tasks,
CreateTime: configure.Now().Unix(),
UpdateTime: configure.Now().Unix(),
},
}
@ -180,8 +180,6 @@ func (this *modelDispatch) taskRandom(uid string, dispatch *pb.DBDispatch) (task
tasks = append(tasks[:i], tasks[i+1:]...)
i--
randCount++
} else {
tasks = append(tasks, tasks[i])
}
}
//追加随机

View File

@ -98,7 +98,7 @@ type Noticeboard struct {
WeekCount int32 `protobuf:"varint,6,opt,name=weekCount,proto3" json:"weekCount" bson:"weekCount"` //周任务数
TaskCount int32 `protobuf:"varint,7,opt,name=taskCount,proto3" json:"taskCount" bson:"taskCount"` //任务数
WeekReceived []int32 `protobuf:"varint,8,rep,packed,name=weekReceived,proto3" json:"weekReceived" bson:"weekReceived"` ////已领取的周任务索引ID
CreateTime int64 `protobuf:"varint,9,opt,name=createTime,proto3" json:"createTime" bson:"createTime"` //创建时间
UpdateTime int64 `protobuf:"varint,9,opt,name=updateTime,proto3" json:"updateTime" bson:"updateTime"` //创建时间
}
func (x *Noticeboard) Reset() {
@ -189,9 +189,9 @@ func (x *Noticeboard) GetWeekReceived() []int32 {
return nil
}
func (x *Noticeboard) GetCreateTime() int64 {
func (x *Noticeboard) GetUpdateTime() int64 {
if x != nil {
return x.CreateTime
return x.UpdateTime
}
return 0
}
@ -310,9 +310,9 @@ var file_dispatch_dispatch_db_proto_rawDesc = []byte{
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x77, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x77, 0x65, 0x65,
0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x0c, 0x44, 0x69,
0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x0c, 0x44, 0x69,
0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61,
0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,

View File

@ -65,6 +65,7 @@ type DispatchNoticeResp struct {
unknownFields protoimpl.UnknownFields
Dispatch *Noticeboard `protobuf:"bytes,1,opt,name=dispatch,proto3" json:"dispatch"`
Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket"`
}
func (x *DispatchNoticeResp) Reset() {
@ -106,6 +107,13 @@ func (x *DispatchNoticeResp) GetDispatch() *Noticeboard {
return nil
}
func (x *DispatchNoticeResp) GetTicket() int32 {
if x != nil {
return x.Ticket
}
return 0
}
//刷新公告
type DispatchRefreshReq struct {
state protoimpl.MessageState
@ -641,48 +649,50 @@ var file_dispatch_dispatch_msg_proto_rawDesc = []byte{
0x74, 0x63, 0x68, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x64,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x69, 0x73,
0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3e,
0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x56,
0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65,
0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62,
0x6f, 0x61, 0x72, 0x64, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x14,
0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73,
0x68, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x66,
0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
0x66, 0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66,
0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x43, 0x0a,
0x0f, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x73, 0x70,
0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x77,
0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x61, 0x77, 0x61,
0x72, 0x64, 0x22, 0x2c, 0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65,
0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x6f, 0x61, 0x72, 0x64, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16,
0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74,
0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x13,
0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52,
0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x66, 0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x43, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63,
0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
0x22, 0x39, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65,
0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54,
0x61, 0x73, 0x6b, 0x52, 0x73, 0x70, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22, 0x18, 0x0a, 0x16, 0x44,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69,
0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3f, 0x0a, 0x17, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63,
0x68, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x12, 0x24, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10,
0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x73, 0x70,
0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x41, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74,
0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0x28, 0x0a, 0x0e, 0x44, 0x69, 0x73,
0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69,
0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53,
0x75, 0x63, 0x63, 0x22, 0x29, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x57,
0x65, 0x65, 0x6b, 0x52, 0x65, 0x63, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03,
0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69, 0x64, 0x78, 0x22, 0x2a,
0x0a, 0x16, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x57, 0x65, 0x65, 0x6b, 0x52, 0x65,
0x63, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x78, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69, 0x64, 0x78, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x08, 0x52, 0x07, 0x65, 0x78, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x2c, 0x0a, 0x12, 0x44, 0x69,
0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70,
0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12,
0x22, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x73, 0x70, 0x52, 0x03,
0x72, 0x73, 0x70, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x41,
0x75, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3f, 0x0a,
0x17, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63,
0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x73, 0x70, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x41,
0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x71, 0x12,
0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49,
0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64,
0x73, 0x22, 0x28, 0x0a, 0x0e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52,
0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x29, 0x0a, 0x15, 0x44,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x57, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x63, 0x69, 0x76,
0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x69, 0x64, 0x78, 0x22, 0x2a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74,
0x63, 0x68, 0x57, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x63, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69,
0x64, 0x78, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (