This commit is contained in:
liwei1dao 2023-09-13 17:51:43 +08:00
commit 7cf6ce5960
5 changed files with 64 additions and 61 deletions

View File

@ -9,7 +9,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -22,7 +22,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -35,7 +35,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -48,7 +48,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -61,7 +61,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -74,7 +74,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -87,7 +87,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -100,7 +100,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -113,7 +113,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -126,7 +126,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -139,7 +139,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -152,7 +152,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -165,7 +165,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -178,7 +178,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -191,7 +191,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -204,7 +204,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -217,7 +217,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -230,7 +230,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -243,7 +243,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -256,7 +256,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -269,7 +269,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -282,7 +282,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -295,7 +295,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -308,7 +308,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -321,7 +321,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -334,7 +334,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -347,7 +347,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -360,7 +360,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -373,7 +373,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -386,7 +386,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -399,7 +399,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -412,7 +412,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -425,7 +425,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -438,7 +438,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -451,7 +451,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -464,7 +464,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -477,7 +477,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -490,7 +490,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -503,7 +503,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
}, },
{ {
@ -516,7 +516,7 @@
"mtsid": { "mtsid": {
"a": "mts", "a": "mts",
"t": "20030001", "t": "20030001",
"n": 25 "n": 8
} }
} }
] ]

View File

@ -25335,7 +25335,6 @@
"Target": 1, "Target": 1,
"ChildSkill": { "ChildSkill": {
"Id": [ "Id": [
223003311,
223003312, 223003312,
223003314 223003314
] ]
@ -25369,7 +25368,6 @@
"Target": 1, "Target": 1,
"ChildSkill": { "ChildSkill": {
"Id": [ "Id": [
223003311,
223003322, 223003322,
223003314 223003314
] ]
@ -25403,7 +25401,6 @@
"Target": 1, "Target": 1,
"ChildSkill": { "ChildSkill": {
"Id": [ "Id": [
223003311,
223003332, 223003332,
223003314 223003314
] ]
@ -25437,7 +25434,6 @@
"Target": 1, "Target": 1,
"ChildSkill": { "ChildSkill": {
"Id": [ "Id": [
223003311,
223003342, 223003342,
223003314 223003314
] ]
@ -25471,7 +25467,6 @@
"Target": 1, "Target": 1,
"ChildSkill": { "ChildSkill": {
"Id": [ "Id": [
223003311,
223003352, 223003352,
223003314 223003314
] ]

View File

@ -21,7 +21,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SmithyRefuseReq)
return return
} }
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId) cus, _, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
if err != nil { if err != nil {
var errCustom = new(comm.CustomError) var errCustom = new(comm.CustomError)
if errors.As(err, &errCustom) { if errors.As(err, &errCustom) {

View File

@ -22,12 +22,14 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
if errdata = this.SellCheck(session, req); errdata != nil { if errdata = this.SellCheck(session, req); errdata != nil {
return return
} }
var (
rewardId int32
)
//校验customer类型因为有的类型是不能进入交易逻辑的 //校验customer类型因为有的类型是不能进入交易逻辑的
this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId())) this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId()))
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId) cus, rewardId, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
if err != nil { if err != nil {
var customErr = new(comm.CustomError) var customErr = new(comm.CustomError)
if errors.As(err, &customErr) { if errors.As(err, &customErr) {
@ -41,7 +43,7 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
return return
} }
} }
conf, err := this.module.configure.GetSmithyCustomerConf(1) conf, err := this.module.configure.GetSmithyCustomerConf(rewardId)
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, Code: pb.ErrorCode_ConfigNoFound,

View File

@ -134,10 +134,15 @@ func (s *modelTrade) removeCustomer(cus *pb.DBCustomer, customerId string) *pb.D
} }
// 随机新顾客 // 随机新顾客
func (s *modelTrade) updateCustomer(uid string, customerId string) (*pb.DBCustomer, error) { func (s *modelTrade) updateCustomer(uid string, customerId string) (cus *pb.DBCustomer, cusid int32, err error) {
cus, err := s.getDBCustomer(uid)
cus, err = s.getDBCustomer(uid)
if err == nil { if err == nil {
cus = s.removeCustomer(cus, customerId) //cus = s.removeCustomer(cus, customerId)
if v, ok := cus.Customers[customerId]; ok {
cusid = v.CustomerId
delete(cus.Customers, customerId)
}
cus.Total++ cus.Total++
//上限 //上限
limit := s.module.modelStove.StoveSkillAddCustomer(uid) limit := s.module.modelStove.StoveSkillAddCustomer(uid)
@ -150,15 +155,16 @@ func (s *modelTrade) updateCustomer(uid string, customerId string) (*pb.DBCustom
"total": cus.Total, "total": cus.Total,
"lastRefreshTime": cus.LastRefreshTime, "lastRefreshTime": cus.LastRefreshTime,
} }
if err := s.Change(uid, update); err != nil { if err = s.Change(uid, update); err != nil {
return nil, err return
} }
return cus, nil return
} }
randCustomerId := s.getCustomerRandom() randCustomerId := s.getCustomerRandom()
conf, err := s.module.configure.GetSmithyCustomerConf(randCustomerId) conf, err1 := s.module.configure.GetSmithyCustomerConf(randCustomerId)
if err != nil { if err1 != nil {
return nil, comm.NewCustomError(pb.ErrorCode_ConfigNoFound) err = comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
return
} }
suiteId := s.GetSuitRandom(uid, conf.CustomerType) suiteId := s.GetSuitRandom(uid, conf.CustomerType)
if suiteId != 0 { if suiteId != 0 {
@ -177,11 +183,11 @@ func (s *modelTrade) updateCustomer(uid string, customerId string) (*pb.DBCustom
"total": cus.Total, "total": cus.Total,
"lastRefreshTime": cus.LastRefreshTime, "lastRefreshTime": cus.LastRefreshTime,
} }
if err := s.Change(uid, update); err != nil { if err = s.Change(uid, update); err != nil {
return nil, err return
} }
} }
return cus, nil return
} }
// 返回概率下的套装 // 返回概率下的套装