Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
huanghai 5 years ago
commit 09a4484dcc

@ -27,6 +27,9 @@ func Routers(r *gin.RouterGroup) {
rr.GET("/RemoveCookie", RemoveCookie)
rr.POST("/UpdateLoginPassWordInfo", UpdateLoginPassWordInfo)
rr.GET("/GetBindAuthorizationInfo", GetBindAuthorizationInfo)
rr.POST("/UnbindAuthorizationInfo", UnbindAuthorizationInfo)
return
}
@ -439,3 +442,69 @@ func UpdateLoginPassWordInfo(c *gin.Context) {
Message: r.Message,
})
}
// @Summary 获取已绑定的第三方授权
// @Description 获取已绑定的第三方授权
// @Tags 登录信息
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} Model.Res
// @Router /base/loginperson/GetBindAuthorizationInfo [get]
// @X-Sort [12]
func GetBindAuthorizationInfo(c *gin.Context) {
personId, err := c.Cookie("person_id")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "未获取到Cookie中的人员编码",
})
return
}
r, err := SysLoginpersonService.GetBindAuthorizationInfo(personId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "调用RPC服务失败",
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: r.Success,
Message: r.Message,
List: CommonUtil.ConvertStringArrayToArray(r.List),
})
}
// @Summary 解除绑定第三方授权
// @Description 解除绑定第三方授权
// @Tags 登录信息
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param typeName formData string true "第三方授权类型名 qq:QQ wx:微信"
// @Success 200 {object} Model.Res
// @Router /base/loginperson/UnbindAuthorizationInfo [post]
// @X-Sort [13]
func UnbindAuthorizationInfo(c *gin.Context) {
typeName := c.PostForm("typeName")
personId, err := c.Cookie("person_id")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "未获取到Cookie中的人员编码",
})
return
}
r, err := SysLoginpersonService.UnbindAuthorizationInfo(personId, typeName)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "调用RPC服务失败",
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: r.Success,
Message: r.Message,
})
}

@ -53,3 +53,13 @@ func UpdateLoginPassWordInfo(personId string, identityId int32, oldPassWord stri
Reply, err := UpdateLoginPassWord(SysLoginpersonProto.UpdateLoginPassWordArg{PersonId: personId, IdentityId: identityId, OldPassWord: oldPassWord, NewPassWord: newPassWord, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err
}
func GetBindAuthorizationInfo(personId string) (*SysLoginpersonProto.Reply, error) {
Reply, err := GetBindAuthorization(SysLoginpersonProto.GetBindAuthorizationArg{PersonId: personId})
return Reply, err
}
func UnbindAuthorizationInfo(personId string, typeName string) (*SysLoginpersonProto.Reply, error) {
Reply, err := UnbindAuthorization(SysLoginpersonProto.UnbindAuthorizationArg{PersonId: personId, TypeName: typeName})
return Reply, err
}

@ -183,5 +183,48 @@ func UpdateLoginPassWord(updateLoginPassWordArg SysLoginpersonProto.UpdateLoginP
LogUtil.Error("修改登录密码错误: ", err.Error())
}
return Reply, err
}
/**
2020-09-09 11:30:20
*/
func GetBindAuthorization(arg SysLoginpersonProto.GetBindAuthorizationArg) (*SysLoginpersonProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := SysLoginpersonProto.NewSysLoginpersonManageClient(conn)
Reply, err := c.GetBindAuthorization(ctx, &arg)
if err != nil {
LogUtil.Error("获取已绑定的第三方授权错误: ", err.Error())
}
return Reply, err
}
/**
2020-09-14 11:30:20
*/
func UnbindAuthorization(arg SysLoginpersonProto.UnbindAuthorizationArg) (*SysLoginpersonProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := SysLoginpersonProto.NewSysLoginpersonManageClient(conn)
Reply, err := c.UnbindAuthorization(ctx, &arg)
if err != nil {
LogUtil.Error("获取已绑定的第三方授权错误: ", err.Error())
}
return Reply, err
}

@ -509,6 +509,7 @@ func ConvertJsonStringToMapArray(data string) []map[string]interface{} {
func ConvertStringArrayToArray(data string) []string {
data = strings.ReplaceAll(data, "[", "")
data = strings.ReplaceAll(data, "]", "")
data = strings.ReplaceAll(data, "\"", "")
if len(data) > 0 {
return strings.Split(data, ",")
} else {

Loading…
Cancel
Save