随机顾客奖励发放

This commit is contained in:
meixiongfeng 2023-09-13 17:41:34 +08:00
parent d63f01cdfb
commit 5bcdcc4709
7 changed files with 120 additions and 117 deletions

View File

@ -1,9 +1,9 @@
[ [
{ {
"key": 1, "key": 1,
"id": "20030001", "id": "20030003",
"grow": 1,
"type": 1, "type": 1,
"interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -13,9 +13,9 @@
}, },
{ {
"key": 2, "key": 2,
"id": "20030001", "id": "20030003",
"grow": 1, "type": 1,
"type": 2, "interact": 2,
"exp": 300, "exp": 300,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -25,9 +25,9 @@
}, },
{ {
"key": 3, "key": 3,
"id": "20030001", "id": "20030003",
"grow": 2, "type": 2,
"type": 1, "interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -37,9 +37,9 @@
}, },
{ {
"key": 4, "key": 4,
"id": "20030001", "id": "20030003",
"grow": 2,
"type": 2, "type": 2,
"interact": 2,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -55,9 +55,9 @@
}, },
{ {
"key": 5, "key": 5,
"id": "20030001", "id": "20030003",
"grow": 2, "type": 2,
"type": 3, "interact": 3,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -67,9 +67,9 @@
}, },
{ {
"key": 6, "key": 6,
"id": "20030001", "id": "20030003",
"grow": 2, "type": 2,
"type": 4, "interact": 4,
"exp": 100, "exp": 100,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -79,9 +79,9 @@
}, },
{ {
"key": 7, "key": 7,
"id": "20030001", "id": "20030003",
"grow": 3, "type": 3,
"type": 1, "interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -91,9 +91,9 @@
}, },
{ {
"key": 8, "key": 8,
"id": "20030001", "id": "20030003",
"grow": 3, "type": 3,
"type": 2, "interact": 2,
"exp": 300, "exp": 300,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -109,9 +109,9 @@
}, },
{ {
"key": 9, "key": 9,
"id": "20030002", "id": "20030001",
"grow": 1,
"type": 1, "type": 1,
"interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -121,9 +121,9 @@
}, },
{ {
"key": 10, "key": 10,
"id": "20030002", "id": "20030001",
"grow": 1, "type": 1,
"type": 2, "interact": 2,
"exp": 300, "exp": 300,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -133,9 +133,9 @@
}, },
{ {
"key": 11, "key": 11,
"id": "20030002", "id": "20030001",
"grow": 2, "type": 2,
"type": 1, "interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -145,9 +145,9 @@
}, },
{ {
"key": 12, "key": 12,
"id": "20030002", "id": "20030001",
"grow": 2,
"type": 2, "type": 2,
"interact": 2,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -157,9 +157,9 @@
}, },
{ {
"key": 13, "key": 13,
"id": "20030002", "id": "20030001",
"grow": 2, "type": 2,
"type": 3, "interact": 3,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -169,9 +169,9 @@
}, },
{ {
"key": 14, "key": 14,
"id": "20030002", "id": "20030001",
"grow": 2, "type": 2,
"type": 4, "interact": 4,
"exp": 100, "exp": 100,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -181,9 +181,9 @@
}, },
{ {
"key": 15, "key": 15,
"id": "20030002", "id": "20030001",
"grow": 3, "type": 3,
"type": 1, "interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -193,9 +193,9 @@
}, },
{ {
"key": 16, "key": 16,
"id": "20030002", "id": "20030001",
"grow": 3, "type": 3,
"type": 2, "interact": 2,
"exp": 300, "exp": 300,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -205,9 +205,9 @@
}, },
{ {
"key": 17, "key": 17,
"id": "20030003", "id": "20030002",
"grow": 1,
"type": 1, "type": 1,
"interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -217,9 +217,9 @@
}, },
{ {
"key": 18, "key": 18,
"id": "20030003", "id": "20030002",
"grow": 2,
"type": 2, "type": 2,
"interact": 2,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -229,9 +229,9 @@
}, },
{ {
"key": 19, "key": 19,
"id": "20030003", "id": "20030002",
"grow": 3, "type": 3,
"type": 1, "interact": 1,
"exp": 200, "exp": 200,
"time": 1, "time": 1,
"cd": 0, "cd": 0,
@ -241,9 +241,9 @@
}, },
{ {
"key": 20, "key": 20,
"id": "20030003", "id": "20030002",
"grow": 3, "type": 3,
"type": 2, "interact": 2,
"exp": 300, "exp": 300,
"time": 1, "time": 1,
"cd": 0, "cd": 0,

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
} }
// 返回概率下的套装 // 返回概率下的套装

View File

@ -13,8 +13,8 @@ import "errors"
type GameDragonPlayData struct { type GameDragonPlayData struct {
Key int32 Key int32
Id string Id string
Grow int32
Type int32 Type int32
Interact int32
Exp int32 Exp int32
Time int32 Time int32
Cd int32 Cd int32
@ -32,8 +32,8 @@ func (*GameDragonPlayData) GetTypeId() int32 {
func (_v *GameDragonPlayData)Deserialize(_buf map[string]interface{}) (err error) { func (_v *GameDragonPlayData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["grow"].(float64); !_ok_ { err = errors.New("grow error"); return }; _v.Grow = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["interact"].(float64); !_ok_ { err = errors.New("interact error"); return }; _v.Interact = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cd"].(float64); !_ok_ { err = errors.New("cd error"); return }; _v.Cd = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cd"].(float64); !_ok_ { err = errors.New("cd error"); return }; _v.Cd = int32(_tempNum_) }