Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c039753296
@ -22,9 +22,10 @@ func (this *apiComp) CreateOrderCheck(session comm.IUserSession, req *pb.Gourmet
|
|||||||
///美食城创建订单
|
///美食城创建订单
|
||||||
func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.GourmetCreateOrderReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.GourmetCreateOrderReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
res []*cfg.Gameatn // 订单消耗
|
res []*cfg.Gameatn // 订单消耗
|
||||||
costTime int32
|
costTime int32
|
||||||
szTime map[int32]int32 // 记录每个类型的订单耗时 key 是技能组type value 订单耗时
|
szTime map[int32]int32 // 记录每个类型的订单耗时 key 是技能组type value 订单耗时
|
||||||
|
privilegeAddItme int32 // 特权额外增加的时间
|
||||||
)
|
)
|
||||||
szTime = make(map[int32]int32, 0)
|
szTime = make(map[int32]int32, 0)
|
||||||
code = this.CreateOrderCheck(session, req)
|
code = this.CreateOrderCheck(session, req)
|
||||||
@ -70,8 +71,9 @@ func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.GourmetCreat
|
|||||||
if cfgCom == nil {
|
if cfgCom == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
privilegeAddItme = this.module.ModulePrivilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType8)
|
||||||
_gourmet.OrderCostTime += costTime
|
_gourmet.OrderCostTime += costTime
|
||||||
if cfgCom.Gourmet < _gourmet.OrderCostTime { // 大于总时长是不允许的
|
if cfgCom.Gourmet+privilegeAddItme < _gourmet.OrderCostTime { // 大于总时长是不允许的
|
||||||
code = pb.ErrorCode_GourmetMoreOrderTime
|
code = pb.ErrorCode_GourmetMoreOrderTime
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package hunting
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/mgo"
|
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ func (this *modelHunting) modifyHuntingDataByObjId(uid string, data map[string]i
|
|||||||
// 获取列表信息
|
// 获取列表信息
|
||||||
func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err error) {
|
func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err error) {
|
||||||
result = &pb.DBHunting{}
|
result = &pb.DBHunting{}
|
||||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err {
|
if err = this.Get(uid, result); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ func (this *apiComp) CreateOrderCheck(session comm.IUserSession, req *pb.SmithyC
|
|||||||
|
|
||||||
func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreateOrderReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreateOrderReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
costTime int32
|
costTime int32
|
||||||
|
privilegeAddItme int32 // 特权额外增加的时间
|
||||||
)
|
)
|
||||||
|
|
||||||
code = this.CreateOrderCheck(session, req)
|
code = this.CreateOrderCheck(session, req)
|
||||||
@ -83,7 +84,8 @@ func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreate
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
_smithy.OrderCostTime += costTime
|
_smithy.OrderCostTime += costTime
|
||||||
if cfgCom.SmithyMaxtime < _smithy.OrderCostTime { // 大于总时长是不允许的
|
privilegeAddItme = this.module.ModulePrivilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType10)
|
||||||
|
if cfgCom.SmithyMaxtime+privilegeAddItme < _smithy.OrderCostTime { // 大于总时长是不允许的
|
||||||
code = pb.ErrorCode_GourmetMoreOrderTime
|
code = pb.ErrorCode_GourmetMoreOrderTime
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -352,9 +352,10 @@ func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]inte
|
|||||||
|
|
||||||
// 退出公会
|
// 退出公会
|
||||||
func (this *ModelSociaty) quit(uid string, sociaty *pb.DBSociaty) error {
|
func (this *ModelSociaty) quit(uid string, sociaty *pb.DBSociaty) error {
|
||||||
for i, m := range sociaty.Members {
|
for i:=0;i<len(sociaty.Members);i++{
|
||||||
if m.Uid == uid {
|
if sociaty.Members[i].Uid == uid {
|
||||||
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
|
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
|
||||||
|
i--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
@ -385,9 +386,10 @@ func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error {
|
|||||||
|
|
||||||
//删除请求记录
|
//删除请求记录
|
||||||
func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) error {
|
func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) error {
|
||||||
for i, ar := range sociaty.ApplyRecord {
|
for i:=0;i<len(sociaty.ApplyRecord);i++{
|
||||||
if ar.Uid == uid {
|
if sociaty.ApplyRecord[i].Uid == uid {
|
||||||
sociaty.ApplyRecord = append(sociaty.ApplyRecord[:i], sociaty.ApplyRecord[i+1:]...)
|
sociaty.ApplyRecord = append(sociaty.ApplyRecord[:i], sociaty.ApplyRecord[i+1:]...)
|
||||||
|
i--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
@ -511,12 +513,13 @@ func (this *ModelSociaty) assign(srcId, targetId string, sociaty *pb.DBSociaty)
|
|||||||
// targetId 踢出目标
|
// targetId 踢出目标
|
||||||
// 不允许踢出会长
|
// 不允许踢出会长
|
||||||
func (this *ModelSociaty) discharge(targetId string, sociaty *pb.DBSociaty) error {
|
func (this *ModelSociaty) discharge(targetId string, sociaty *pb.DBSociaty) error {
|
||||||
for i, m := range sociaty.Members {
|
for i:=0;i<len(sociaty.Members);i++ {
|
||||||
if m.Uid == targetId {
|
if sociaty.Members[i].Uid == targetId {
|
||||||
if m.Job == pb.SociatyJob_PRESIDENT {
|
if sociaty.Members[i].Job == pb.SociatyJob_PRESIDENT {
|
||||||
return comm.NewCustomError(pb.ErrorCode_SociatyMasterNoDiss)
|
return comm.NewCustomError(pb.ErrorCode_SociatyMasterNoDiss)
|
||||||
}
|
}
|
||||||
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
|
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
|
||||||
|
i--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
|
@ -130,9 +130,10 @@ func (this *ModelTaskActive) clearTask(uid string, taskTag ...comm.TaskTag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
data := this.getActiveListByTag(uid, taskTag[0])
|
data := this.getActiveListByTag(uid, taskTag[0])
|
||||||
for i, v := range data {
|
for i:=0; i<len(data); i++ {
|
||||||
if v.Tag == int32(taskTag[0]) {
|
if data[i].Tag == int32(taskTag[0]) {
|
||||||
data = append(data[:i], data[i+1:]...)
|
data = append(data[:i], data[i+1:]...)
|
||||||
|
i--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
|
Loading…
Reference in New Issue
Block a user