diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 1528ba1..e2be1db 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -162,9 +162,29 @@ type TeamMemInfo struct { MemList []int } +//玩家投资信心 +type TeamDevoteInfo struct { + UserId int `json:"userid"` + Type int `json:"type"` + Assets int `json:"assets"` +} + +//玩家buff +type TeamBuffInfo struct { + BeginTime int + EndTime int +} + +// +type TeamAllBuff struct { + Type int + BuffInfo []TeamBuffInfo +} + //队伍建筑信息 type TeamBuildingInfo struct { - + Devote []TeamDevoteInfo + Buff []TeamAllBuff } type CreateTeamInfo struct { @@ -235,6 +255,59 @@ type QuitTeamResp struct { Result CommonResult `json:"result"` } +type UpdateTeamBuildReq struct{ + Token string `json:"token"` + Build_type int `json:"build_type"` + Assets int `json:"assets"` + Muti int `json:"muti"` +} + +type QuitTeamDesc struct { + Build_list []TeamDevoteInfo `json:"build_list"` +} + +type QuitTeamResult struct { + Code int `json:"code"` + Data QuitTeamDesc `json:"data"` +} + +type UpdateTeamBuildResp struct { + Status string `json:"status"` + Result QuitTeamResult `json:"result"` +} + + + +type AddTeamBuffReq struct{ + Token string `json:"token"` + Build_type int `json:"build_type"` + Muti int `json:"muti"` +} + +type BuffTimeInfo struct { + Buff_begin_time int `json:"buff_begin_time"` + Buff_end_time int `json:"buff_end_time"` +} + +type AddTeamBuffSpec struct { + Build_type int `json:"build_type"` + Buff_time []BuffTimeInfo `json:"buff_time"` +} + +type AddTeamBuffDesc struct { + Build_list []AddTeamBuffSpec `json:"build_list"` +} + +type AddTeamBuffResult struct { + Code int `json:"code"` + Data AddTeamBuffDesc `json:"data"` +} + +type AddTeamBuffResp struct { + Status string `json:"status"` + Result AddTeamBuffResult `json:"result"` +} + //********************************************************************************************************** diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index d87bf38..4d8e284 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -7,6 +7,7 @@ import ( "encoding/json" "net/http" "strconv" + "time" ) func SetHeader(w http.ResponseWriter) { @@ -15,6 +16,82 @@ func SetHeader(w http.ResponseWriter) { w.Header().Set("Access-Control-Allow-Headers", "Content-Type,Uuid") } +func (tinfo *TeamInfo) DoAddBuffTimee(btype int,muti int,resp *AddTeamBuffResp) { + addtime := 1800*muti + index := 0 + for k,val := range tinfo.BInfo.Buff { + if val.Type == btype { + index = k + } + } + + for i:=0;i= nowtime { + tinfo.BInfo.Buff[index].BuffInfo[len(tinfo.BInfo.Buff[index].BuffInfo)-1].EndTime += addTime + } else { + var tmp TeamBuffInfo + tmp.BeginTime = nowtime + tmp.EndTime = nowtime + addTime + tinfo.BInfo.Buff[index].BuffInfo = append(tinfo.BInfo.Buff[index].BuffInfo,tmp) + } + }else { + tinfo.BInfo.Buff[index].BuffInfo[len(tinfo.BInfo.Buff[index].BuffInfo)-1].EndTime += 86399 + } + + //删除掉无用的 + yestime := nowtime-86400 + for i:=0;i