示例#1
0
文件: impl.go 项目: sunfmin/batchbuy
func (serv ServiceImpl) MyOrders(date string, email string) (orders []*api.Order, err error) {
	u := model.User{Email: email}

	d, err := StringToTime(date)
	orders, err = u.OrdersForApi(d)
	return
}
示例#2
0
文件: impl.go 项目: sunfmin/batchbuy
func (serv ServiceImpl) MyAvaliableProducts(date string, email string) (products []*api.Product, err error) {
	u := model.User{Email: email}
	var prods []model.Product
	d, err := StringToTime(date)
	prods, err = u.AvaliableProducts(d)
	for _, p := range prods {
		products = append(products, p.ToApi())
	}
	return
}
示例#3
0
文件: impl.go 项目: sunfmin/batchbuy
func (serv ServiceImpl) PutUser(email string, input api.UserInput) (user *api.User, err error) {
	userModel := model.User{}
	modelUserInput := model.UserInput{
		Name:       input.Name,
		Email:      input.Email,
		AvatarLink: input.AvatarLink,
	}
	fmt.Printf("%s\n", modelUserInput)
	err = userModel.Put(email, modelUserInput)
	if err != nil {
		return
	}

	user = userModel.ToApi()
	return
}