上传装备回收接口业务逻辑代码

This commit is contained in:
liwei1dao 2023-02-17 10:46:09 +08:00
parent f4dd29bf2c
commit 5ccab5bc12
3 changed files with 2791 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -254,16 +254,16 @@ func (this *Equipment) RecycleEquipments(session comm.IUserSession, equs []strin
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
return return
} }
if confs[i].Sale == nil || len(confs[i].Sale) == 0 { if confs[i].SmithySale == nil || len(confs[i].SmithySale) == 0 {
code = pb.ErrorCode_EquipmentNoCanSell code = pb.ErrorCode_EquipmentNoCanSell
return return
} }
sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale)) sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale))
for n, s := range confs[i].Sale { for n, s := range confs[i].SmithySale {
_s := &cfg.Gameatn{ _s := &cfg.Gameatn{
A: s.A, A: s.A,
T: s.T, T: s.T,
N: s.N + int32(math.Floor(float64(s.N*(v.Lv-1))*float64(confs[i].Salecoef))), N: int32(math.Floor(float64(s.N) * float64(discount) / float64(100))),
} }
sale[i][n] = _s sale[i][n] = _s
} }

View File

@ -27,6 +27,7 @@ type GameEquipData struct {
Ico string Ico string
UseSkip int32 UseSkip int32
Sale []*Gameatn Sale []*Gameatn
SmithySale []*Gameatn
Salecoef float32 Salecoef float32
} }
@ -92,6 +93,20 @@ func (_v *GameEquipData)Deserialize(_buf map[string]interface{}) (err error) {
} }
} }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["smithy_sale"].([]interface{}); !_ok_ { err = errors.New("smithy_sale error"); return }
_v.SmithySale = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
_v.SmithySale = append(_v.SmithySale, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["salecoef"].(float64); !_ok_ { err = errors.New("salecoef error"); return }; _v.Salecoef = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["salecoef"].(float64); !_ok_ { err = errors.New("salecoef error"); return }; _v.Salecoef = float32(_tempNum_) }
return return
} }