From 7eda9be6f0021f2df46a9cb66d87fe23d5d3f904 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 12 八月 2020 10:19:01 +0800 Subject: [PATCH] push to users those who bind clientId --- service/userService.go | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/service/userService.go b/service/userService.go index 0bd2356..8f66c41 100644 --- a/service/userService.go +++ b/service/userService.go @@ -57,6 +57,16 @@ //瀹㈡埛绔痗id缁戝畾鍒悕 if cid != "" { go func() { + var uc models.UserClient + if !uc.ExistByCid(phoneNum, cid) { + new := models.UserClient{ + Id:uuid.NewV4().String(), + PhoneNum: phoneNum, + ClientId: cid, + BindTime: time.Now().Format("2006-01-02 15:04:05"), + } + new.Insert() + } bindR, bindE := BindAlias(cid, phoneNum) fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) }() @@ -86,6 +96,16 @@ //瀹㈡埛绔痗id缁戝畾鍒悕 if cid != "" { go func() { + var uc models.UserClient + if !uc.ExistByCid(phoneNum, cid) { + new := models.UserClient{ + Id:uuid.NewV4().String(), + PhoneNum: phoneNum, + ClientId: cid, + BindTime: time.Now().Format("2006-01-02 15:04:05"), + } + new.Insert() + } bindR, bindE := BindAlias(cid, phoneNum) fmt.Println("bind cid:",cid, "phoneNum:",phoneNum,"result:", bindR, "err:", bindE) }() -- Gitblit v1.8.0