From 9b5710f23d6cbda9f2b0e650cf8916e7707d5588 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期一, 29 六月 2020 19:27:14 +0800 Subject: [PATCH] addPlateNo and findMyPlateNos --- service/userService.go | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/service/userService.go b/service/userService.go index 1fe7435..15ed042 100644 --- a/service/userService.go +++ b/service/userService.go @@ -58,6 +58,19 @@ } func (sv *UserService) AddPlateNo(userId, plateNo string) bool { + var uc models.UserCar + if uc.Exist(userId, plateNo) { + return true + } + tmp := models.UserCar{ + Id: uuid.NewV4().String(), + UserId: userId, + PlateNo: plateNo, + } + _, err := tmp.Insert() + if err == nil { + return true + } return false } -- Gitblit v1.8.0