客户结构体
package model
import "fmt"
type Customer struct {
Id int
Name string
Gender string
Age int
Phone string
Email string
}
func NewCustomer(id int,name string,gender string,age int,phone string,email string) Customer {
return Customer{
id,
name,
gender,
age,
phone,
email,
}
}
func NewCustomer2(name string,gender string,age int,phone string,email string) Customer {
return Customer{
Name:name,
Gender: gender,
Age: age,
Phone: phone,
Email: email,
}
}
func (this Customer)GetInfo() string {
info := fmt.Sprintln(this.Id,this.Name,this.Gender,this.Age, this.Phone,this.Email)
return info
}
客户管理结构体以及操作方法
package service
import "客户信息管理系统/src/model"
type CustomerService struct {
customers []model.Customer
customerNum int
}
func (this *CustomerService) List() []model.Customer {
return this.customers
}
func NewCustomerService() *CustomerService {
customerService := &CustomerService{
}
customerService.customerNum = 1
customer := model.<