修复铁匠铺代码
This commit is contained in:
parent
8e8105297b
commit
8fc82bc128
@ -109,12 +109,21 @@ func (s *modelTrade) addCustomer(uid string, num int32) (*pb.DBCustomer, error)
|
|||||||
|
|
||||||
// 移除顾客
|
// 移除顾客
|
||||||
func (s *modelTrade) removeCustomer(cus *pb.DBCustomer, customerId int32) *pb.DBCustomer {
|
func (s *modelTrade) removeCustomer(cus *pb.DBCustomer, customerId int32) *pb.DBCustomer {
|
||||||
for i, v := range cus.Customers {
|
var (
|
||||||
if v.CustomerId == customerId {
|
temp []*pb.CustomerInfo = make([]*pb.CustomerInfo, 0)
|
||||||
cus.Customers = append(cus.Customers[:i], cus.Customers[i+1:]...)
|
)
|
||||||
i--
|
for _, v := range cus.Customers {
|
||||||
|
if v.CustomerId != customerId {
|
||||||
|
temp = append(temp, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cus.Customers = temp
|
||||||
|
// for i, v := range cus.Customers {
|
||||||
|
// if v.CustomerId == customerId {
|
||||||
|
// cus.Customers = append(cus.Customers[:i], cus.Customers[i+1:]...)
|
||||||
|
// i--
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return cus
|
return cus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user