49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package activity
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetHdDataCheck(session comm.IUserSession, req *pb.ActivityGetHdDataReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// 活动活动
|
|
func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdDataReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
result []*pb.DBActivityData
|
|
activity *pb.DBHuodong
|
|
err error
|
|
)
|
|
curTime := configure.Now().Unix()
|
|
for _, id := range req.Oid {
|
|
if activity, err = this.module.modelhdList.getHdListByHdId(id); err != nil {
|
|
if activity.Stime <= curTime && curTime <= activity.Etime {
|
|
continue
|
|
}
|
|
}
|
|
key := fmt.Sprintf("%s:%s", session.GetUserId(), id)
|
|
list, _ := this.module.modelhdData.getHddataByOid(session.GetUserId(), key)
|
|
if activity.Itype == comm.HdTypeSign && !utils.IsToday(list.Lasttime) {
|
|
list.Lasttime = curTime
|
|
list.Val += 1
|
|
update := make(map[string]interface{})
|
|
update["lasttime"] = list.Lasttime
|
|
update["val"] = list.Val
|
|
this.module.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
|
}
|
|
result = append(result, list)
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), "gethddata", &pb.ActivityGetHdDataResp{
|
|
Data: result,
|
|
})
|
|
return
|
|
}
|