liuxiaolong
2020-09-01 37f69af50f54e1a15cbfbf8d652fb1042618fb78
service/userService.go
@@ -7,7 +7,9 @@
   "errors"
   "fmt"
   "github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi"
   "github.com/astaxie/beego"
   "github.com/satori/go.uuid"
   "strings"
   "sync"
   "time"
)
@@ -82,6 +84,7 @@
               UserId: u.Id,
               PhoneNum: phoneNum,
               PlateNos: plateNos,
               IsAdmin: isAdmin(phoneNum),
            }, nil
         } else {
            fmt.Println("u.Insert err:", e)
@@ -127,6 +130,7 @@
            UserId: tmpUser.Id,
            PhoneNum: phoneNum,
            PlateNos: plateNos,
            IsAdmin: isAdmin(phoneNum),
         }, nil
      }
   } else {
@@ -134,6 +138,18 @@
   }
}
func isAdmin(phoneNum string) bool {
   managers := beego.AppConfig.String("nightManagerPhones")
   arr := strings.Split(managers, ",")
   for _,s := range arr {
      if s == phoneNum {
         return true
      }
   }
   return false
}
func (sv *UserService) AddPlateNo(userId, plateNo string) bool {
   var uc models.UserCar
   if uc.Exist(userId, plateNo) {