上传商城代码
This commit is contained in:
parent
9c3c1ab798
commit
260842c0d5
@ -112,6 +112,8 @@ type (
|
|||||||
AddNewEquipments(session IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode)
|
AddNewEquipments(session IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode)
|
||||||
//创建装备
|
//创建装备
|
||||||
NewEquipment(uid, cid string) (code pb.ErrorCode, equip *pb.DB_Equipment)
|
NewEquipment(uid, cid string) (code pb.ErrorCode, equip *pb.DB_Equipment)
|
||||||
|
//添加装备
|
||||||
|
AddEquipment(equip *pb.DB_Equipment) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
IMainline interface {
|
IMainline interface {
|
||||||
// 修改章节信息
|
// 修改章节信息
|
||||||
|
@ -140,6 +140,28 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *modelEquipmentComp) addEquipment(equip *pb.DB_Equipment) (err error) {
|
||||||
|
var (
|
||||||
|
model *db.DBModel
|
||||||
|
)
|
||||||
|
if this.module.IsCross() {
|
||||||
|
if model, err = this.module.GetDBNoduleByUid(equip.UId, this.TableName, this.Expired); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
} else {
|
||||||
|
if err = model.AddList(equip.UId, equip.Id, equip); err != nil {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err = this.AddList(equip.UId, equip.Id, equip); err != nil {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//删除装备
|
//删除装备
|
||||||
func (this *modelEquipmentComp) DelEquipments(uId string, eIds []string) (change []*pb.DB_Equipment, err error) {
|
func (this *modelEquipmentComp) DelEquipments(uId string, eIds []string) (change []*pb.DB_Equipment, err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -145,6 +145,18 @@ func (this *Equipment) NewEquipment(uid, cid string) (code pb.ErrorCode, equip *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//创建新的装备
|
||||||
|
func (this *Equipment) AddEquipment(equip *pb.DB_Equipment) (code pb.ErrorCode) {
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err = this.modelEquipment.addEquipment(equip); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//Evens--------------------------------------------------------------------------------------------------------------------------------
|
//Evens--------------------------------------------------------------------------------------------------------------------------------
|
||||||
//推送道具变化消息
|
//推送道具变化消息
|
||||||
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
||||||
|
@ -62,14 +62,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
|
|||||||
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success {
|
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !conf.Preview {
|
|
||||||
if code = this.module.DispenseRes(session, give, true); code != pb.ErrorCode_Success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
switch req.ShopType {
|
switch req.ShopType {
|
||||||
case pb.ShopType_GoldShop:
|
case pb.ShopType_GoldShop:
|
||||||
filed = "goldShop"
|
filed = "goldShop"
|
||||||
@ -103,6 +95,15 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
|
|||||||
}
|
}
|
||||||
record.Buy[req.GoodsId] += req.BuyNum
|
record.Buy[req.GoodsId] += req.BuyNum
|
||||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: record})
|
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: record})
|
||||||
|
if !conf.Preview {
|
||||||
|
if code = this.module.DispenseRes(session, give, true); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if code = this.module.equip.AddEquipment(record.Preview[req.GoodsId]); code == pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//随机任务
|
//随机任务
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user