41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package library
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetFetterListCheck(session comm.IUserSession, req *pb.LibraryGetFetterListReq) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) GetFetterList(session comm.IUserSession, req *pb.LibraryGetFetterListReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
|
|
if code = this.GetFetterListCheck(session, req); code != pb.ErrorCode_Success {
|
|
return // 参数校验失败直接返回
|
|
}
|
|
rsp := &pb.LibraryGetFetterListResp{}
|
|
|
|
rsp.Data = this.module.GetHeroFetterList(session.GetUserId())
|
|
for _, v := range rsp.Data {
|
|
if !utils.IsToday(v.Ctime) {
|
|
update := map[string]interface{}{}
|
|
v.Ctime = configure.Now().Unix()
|
|
v.Givecount = 0
|
|
update["givecount"] = 0
|
|
update["ctime"] = v.Ctime
|
|
|
|
if err := this.module.modelFetter.ChangeList(session.GetUserId(), v.Id, update); err != nil {
|
|
this.module.Errorf("modelFetter ChangeList error: %v", err)
|
|
}
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), LibraryGetFetterListResp, rsp)
|
|
|
|
return
|
|
}
|