liuxiaolong
2020-09-01 37f69af50f54e1a15cbfbf8d652fb1042618fb78
add user isAdmin
3个文件已修改
20 ■■■■■ 已修改文件
conf/app.conf 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/userService.go 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vo/user.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/app.conf
@@ -21,4 +21,4 @@
pushLowerLimit = 5
initPushLeft = 88
testPushPhones = 18601263339
nightManagerPhones = 18601263339
nightManagerPhones = 15210613764
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) {
vo/user.go
@@ -5,4 +5,6 @@
    PhoneNum     string         `json:"phoneNum"`
    TrueName     string         `json:"trueName"`
    PlateNos    []string     `json:"plateNos"`
    IsAdmin     bool         `json:"isAdmin"` //是否是管理员
}