公会bug

This commit is contained in:
wh_zcy 2022-11-07 21:22:30 +08:00
parent 68ffda04ee
commit aeb93e6b50
15 changed files with 207 additions and 85 deletions

View File

@ -6,8 +6,6 @@ import (
"go_dreamfactory/utils"
"google.golang.org/protobuf/proto"
cfg "go_dreamfactory/sys/configure/structs"
)
func (this *apiComp) RandlistCheck(session comm.IUserSession, req *pb.FriendRandlistReq) (code pb.ErrorCode) {
@ -43,6 +41,16 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
continue
}
//检查目标v中的申请列表中是否有自己
target := this.moduleFriend.modelFriend.GetFriend(v.Uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
continue
}
//将黑名单中的玩家过滤
if _, ok := utils.Findx(self.BlackIds, v.Uid); ok {
continue
@ -89,14 +97,6 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
}
this.moduleFriend.DispenseRes(session, []*cfg.Gameatn{
{
A: "attr",
T: "gold",
N: 10,
},
}, true)
rsp := &pb.FriendRandlistResp{
List: userList,
}

View File

@ -74,7 +74,9 @@ func (this *apiComp) Advreceive(session comm.IUserSession, req *pb.GrowtaskAdvRe
}
}
rsp := &pb.GrowtaskAdvReceiveResp{}
rsp := &pb.GrowtaskAdvReceiveResp{
TaskType: req.TaskType,
}
if err := session.SendMsg(string(this.module.GetType()), GrowtaskSubTypeAdvreceive, rsp); err != nil {
code = pb.ErrorCode_SystemError

View File

@ -28,11 +28,12 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.GrowtaskListReq) (c
return
}
g := this.module.modelGrowtask.list(uid, req.TaskType, gt)
g, curTaskId := this.module.modelGrowtask.list(uid, req.TaskType, gt)
rsp := &pb.GrowtaskListResp{
TaskList: g,
CurTaskType: gt.CurTaskType,
AdvReceive: gt.AdvReceive,
CurTaskId: curTaskId,
}
session.SendMsg(string(this.module.GetType()), GrowtaskSubTypeList, rsp)

View File

@ -85,9 +85,12 @@ func (this *ModelGrowtask) getUserGrowtask(uid string) (*pb.DBGrowtask, error) {
}
// 任务列表
func (this *ModelGrowtask) list(uid string, taskType int32, gt *pb.DBGrowtask) []*pb.Growtask {
func (this *ModelGrowtask) list(uid string, taskType int32, gt *pb.DBGrowtask) ([]*pb.Growtask, int32) {
var curList []*pb.Growtask
var (
curList []*pb.Growtask
curTaskId int32
)
getList := func(list []*pb.Growtask) []*pb.Growtask {
taskStatusMap := make(map[int32]pb.GrowtaskStatus) //任务状态
@ -97,7 +100,19 @@ func (this *ModelGrowtask) list(uid string, taskType int32, gt *pb.DBGrowtask) [
taskStatusMap[v.Id] = pb.GrowtaskStatus_Finish
continue
}
taskStatusMap[v.Id] = v.Status
//上个任务是否完成
pre := this.preTaskStatus(v.PreTask, v.TaskType-1, gt)
if pre != nil {
if v.TaskType-1 >= 1 &&
pre.Status == pb.GrowtaskStatus_Finish &&
pre.TaskType == v.TaskType-1 { //非初级
taskStatusMap[v.PreTask] = pb.GrowtaskStatus_Finish
}
} else {
taskStatusMap[v.Id] = v.Status
}
//任务完成
if code := this.moduleGrowtask.ModuleRtask.CheckCondi(uid, v.Fstask); code == pb.ErrorCode_Success {
if v.PreTask == 0 {
@ -129,30 +144,69 @@ func (this *ModelGrowtask) list(uid string, taskType int32, gt *pb.DBGrowtask) [
return list
}
getCurTaskId := func(list []*pb.Growtask) (curTaskId int32) {
for _, v := range list {
if v.Status == pb.GrowtaskStatus_Ongoing ||
v.Status == pb.GrowtaskStatus_Wait {
curTaskId = v.Id
return
}
}
return
}
if gt.Uid != "" {
update := map[string]interface{}{}
switch taskType {
case 1:
curList = getList(gt.InitTaskList)
update["initTaskList"] = curList
curTaskId = getCurTaskId(curList)
case 2:
curList = getList(gt.MidTaskList)
update["midTaskList"] = curList
curTaskId = getCurTaskId(curList)
case 3:
curList = getList(gt.HighTaskList)
update["highTaskList"] = curList
curTaskId = getCurTaskId(curList)
}
//更新
if len(update) > 0 {
if err := this.Change(uid, update); err != nil {
log.Errorf("更新任务列表 err:%v", err)
return nil
return nil, 0
}
}
}
return curList
return curList, curTaskId
}
// 获取上一个任务状态
func (this *ModelGrowtask) preTaskStatus(preTaskId int32, preTaskType int32, gt *pb.DBGrowtask) *pb.Growtask {
switch preTaskType {
case 1:
for _, v := range gt.InitTaskList {
if v.Id == preTaskId {
return v
}
}
case 2:
for _, v := range gt.MidTaskList {
if v.Id == preTaskId {
return v
}
}
case 3:
for _, v := range gt.HighTaskList {
if v.Id == preTaskId {
return v
}
}
}
return nil
}
// 领取子任务奖励

View File

@ -30,7 +30,7 @@ func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActi
}
}()
sociatyTask := this.module.modelSociatyTask.taskList(uid, sociaty.Id)
sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id)
if sociatyTask.SociatyId != "" {
var activityList []*pb.SociatyActivity

View File

@ -42,6 +42,9 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
return
}
// 发邮件
this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{uid})
//审核通过推送
this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{
Uid: uid,

View File

@ -44,7 +44,7 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
// 发邮件
receiver := this.module.modelSociaty.getMemberIds(sociaty)
this.module.modelSociaty.sendMail(receiver)
this.module.modelSociaty.sendMail("GuildExpel", []string{sociaty.Name}, receiver)
//清除玩家sociatyId
update := map[string]interface{}{

View File

@ -3,6 +3,7 @@ package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"google.golang.org/protobuf/proto"
)
@ -37,6 +38,18 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co
return
}
// 初始玩家公会任务
sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id)
if sociatyTask.SociatyId != "" {
if utils.IsFirstTody(sociatyTask.LastUpdateTime) {
if err := this.module.modelSociatyTask.deleTask(sociaty.Id, uid); err == nil {
if err = this.module.modelSociatyTask.initSociatyTask(uid, sociaty.Id); err != nil {
this.module.Errorf("初始化玩家攻击任务失败 err:%v", err)
}
}
}
}
// 获取会长
master := this.module.modelSociaty.getMasterInfo(sociaty)
if master != nil {

View File

@ -29,7 +29,7 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList
}
}()
sociatyTask := this.module.modelSociatyTask.taskList(uid, sociaty.Id)
sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id)
if sociatyTask.SociatyId != "" {
var taskList []*pb.SociatyTask

View File

@ -337,6 +337,8 @@ func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error {
this.getMemberIds(sociaty)...); err != nil {
log.Errorf("公会解散推送 err:%v", err)
}
//发邮件
this.sendMail("GuildDissolution", []string{sociaty.Name}, this.getMemberIds(sociaty))
return nil
}
@ -379,20 +381,21 @@ func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
return err
}
// 发邮件
this.sendMail(this.getMemberIds(sociaty))
// 记录日志
this.moduleSociaty.modelSociatyLog.addLog(Log_Add, sociaty.Id, uid)
return nil
}
// 发邮件给公会成员
func (this *ModelSociaty) sendMail(receiver []string) error {
// if module, err := this.moduleSociaty.service.GetModule(comm.ModuleMail); err == nil {
// if mail, ok := module.(comm.Imail); ok {
// mail.SendNewMail(&pb.DBMailData{}, receiver...)
// }
// }
func (this *ModelSociaty) sendMail(confId string, params []string, receiver []string) error {
if module, err := this.moduleSociaty.service.GetModule(comm.ModuleMail); err == nil {
if mail, ok := module.(comm.Imail); ok {
mail.SendNewMail(&pb.DBMailData{
Cid: confId,
Param: params,
}, receiver...)
}
}
return nil
}
@ -916,8 +919,8 @@ func (this *ModelSociaty) memberClear(sociaty *pb.DBSociaty) error {
}
}
//发送邮件
if err := this.moduleSociaty.modelSociaty.sendMail(receiver); err != nil {
log.Errorf("邮件发送失败 sociatyId: %s err:%v", sociaty.Id, err)
}
// if err := this.moduleSociaty.modelSociaty.sendMail(receiver); err != nil {
// log.Errorf("邮件发送失败 sociatyId: %s err:%v", sociaty.Id, err)
// }
return nil
}

View File

@ -7,6 +7,7 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"time"
)
type ModelSociatyTask struct {
@ -58,11 +59,12 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
}
}
sociatyTask.TaskList = taskList
sociatyTask.LastUpdateTime = time.Now().Unix()
return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask)
}
//任务列表
func (this *ModelSociatyTask) taskList(uid, sociatyId string) (task *pb.DBSociatyTask) {
func (this *ModelSociatyTask) getUserTask(uid, sociatyId string) (task *pb.DBSociatyTask) {
task = &pb.DBSociatyTask{}
this.GetListObj(sociatyId, uid, task)
return

View File

@ -76,6 +76,7 @@ type GrowtaskListResp struct {
TaskList []*Growtask `protobuf:"bytes,1,rep,name=taskList,proto3" json:"taskList"`
CurTaskType int32 `protobuf:"varint,2,opt,name=curTaskType,proto3" json:"curTaskType"` // 进行中的任务类型
AdvReceive int32 `protobuf:"varint,3,opt,name=advReceive,proto3" json:"advReceive"` //已领取的进阶奖励ID
CurTaskId int32 `protobuf:"varint,4,opt,name=curTaskId,proto3" json:"curTaskId"` // 当前未完成的任务ID
}
func (x *GrowtaskListResp) Reset() {
@ -131,6 +132,13 @@ func (x *GrowtaskListResp) GetAdvReceive() int32 {
return 0
}
func (x *GrowtaskListResp) GetCurTaskId() int32 {
if x != nil {
return x.CurTaskId
}
return 0
}
//子任务奖励领取
type GrowtaskReceiveReq struct {
state protoimpl.MessageState
@ -330,28 +338,30 @@ var file_growtask_growtask_msg_proto_rawDesc = []byte{
0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x0f, 0x47, 0x72, 0x6f,
0x77, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08,
0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x7b, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x77,
0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x08,
0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09,
0x2e, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c,
0x69, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x54, 0x61, 0x73,
0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65,
0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x64, 0x76, 0x52, 0x65,
0x63, 0x65, 0x69, 0x76, 0x65, 0x22, 0x2c, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73,
0x6b, 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, 0x2d, 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52,
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61,
0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x99, 0x01, 0x0a, 0x10, 0x47, 0x72, 0x6f,
0x77, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a,
0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x09, 0x2e, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b,
0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x54,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x54, 0x61,
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x76, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x64, 0x76, 0x52,
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x75, 0x72, 0x54, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x75, 0x72, 0x54, 0x61,
0x73, 0x6b, 0x49, 0x64, 0x22, 0x2c, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b,
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, 0x33, 0x0a, 0x15, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64,
0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x74,
0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74,
0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x16, 0x47, 0x72, 0x6f, 0x77, 0x74,
0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73,
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x49, 0x64, 0x22, 0x2d, 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65,
0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 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, 0x33, 0x0a, 0x15, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76,
0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61,
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61,
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x16, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61,
0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -35,6 +35,7 @@ type DBMailData struct {
Reward bool `protobuf:"varint,8,opt,name=Reward,proto3" json:"Reward"` // 附件领取状态
Items []*UserAssets `protobuf:"bytes,9,rep,name=Items,proto3" json:"Items"` // 附件
Cid string `protobuf:"bytes,10,opt,name=Cid,proto3" json:"Cid"` // 邮件的配置表ID
Param []string `protobuf:"bytes,11,rep,name=Param,proto3" json:"Param"`
}
func (x *DBMailData) Reset() {
@ -139,12 +140,19 @@ func (x *DBMailData) GetCid() string {
return ""
}
func (x *DBMailData) GetParam() []string {
if x != nil {
return x.Param
}
return nil
}
var File_mail_mail_db_proto protoreflect.FileDescriptor
var file_mail_mail_db_proto_rawDesc = []byte{
0x0a, 0x12, 0x6d, 0x61, 0x69, 0x6c, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0xff, 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12,
0x22, 0x95, 0x02, 0x0a, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12,
0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x4f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65,
@ -160,8 +168,9 @@ var file_mail_mail_db_proto_rawDesc = []byte{
0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73,
0x12, 0x10, 0x0a, 0x03, 0x43, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x43,
0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0b, 0x20, 0x03, 0x28,
0x09, 0x52, 0x05, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -504,10 +504,11 @@ type DBSociatyTask struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId"` //@go_tags(`bson:"sociatyId") 公会ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
TaskList []*SociatyTask `protobuf:"bytes,3,rep,name=taskList,proto3" json:"taskList" bson:"taskList"` //任务列表
ActivityList []*SociatyActivity `protobuf:"bytes,4,rep,name=activityList,proto3" json:"activityList" bson:"activityList"` //活跃度列表
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId"` //@go_tags(`bson:"sociatyId") 公会ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
TaskList []*SociatyTask `protobuf:"bytes,3,rep,name=taskList,proto3" json:"taskList" bson:"taskList"` //任务列表
ActivityList []*SociatyActivity `protobuf:"bytes,4,rep,name=activityList,proto3" json:"activityList" bson:"activityList"` //活跃度列表
LastUpdateTime int64 `protobuf:"varint,5,opt,name=lastUpdateTime,proto3" json:"lastUpdateTime" bson:"lastUpdateTime"` //上次初始时间
}
func (x *DBSociatyTask) Reset() {
@ -570,6 +571,13 @@ func (x *DBSociatyTask) GetActivityList() []*SociatyActivity {
return nil
}
func (x *DBSociatyTask) GetLastUpdateTime() int64 {
if x != nil {
return x.LastUpdateTime
}
return 0
}
// 任务
type SociatyTask struct {
state protoimpl.MessageState
@ -818,7 +826,7 @@ var file_sociaty_sociaty_db_proto_rawDesc = []byte{
0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a,
0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x6f,
0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x9f,
0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xc7,
0x01, 0x0a, 0x0d, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, 0x6b,
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x10,
@ -829,29 +837,31 @@ var file_sociaty_sociaty_db_proto_rawDesc = []byte{
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x10, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74,
0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 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, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0x39, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0d, 0x44,
0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x1c, 0x0a, 0x09,
0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e,
0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a,
0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65,
0x2a, 0x50, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x09,
0x0a, 0x05, 0x4e, 0x4f, 0x4a, 0x4f, 0x42, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d,
0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02,
0x12, 0x11, 0x0a, 0x0d, 0x56, 0x49, 0x43, 0x45, 0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e,
0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54,
0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x12, 0x26, 0x0a, 0x0e, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69,
0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 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, 0x28, 0x05, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x39, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61,
0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x52, 0x61, 0x6e, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x50, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x4f, 0x4a, 0x4f, 0x42, 0x10,
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a,
0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x56, 0x49, 0x43, 0x45,
0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x50,
0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -26,6 +26,21 @@ func IsAfterWeek(d int64) bool {
return nowt.Unix() >= at
}
// 是否今日首次
func IsFirstTody(timestamp int64) bool {
now := time.Now()
if timestamp == 0 || timestamp > now.Unix() {
return false
}
tt := time.Unix(timestamp, 0)
if !IsToday(timestamp) {
if tt.Before(now) {
return true
}
}
return false
}
// 获取当前时间戳下一天0点时间戳
func GetZeroTime(curTime int64) int64 {
currentTime := time.Unix(curTime, 0)