diff --git a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonController/SysLoginpersonController.go b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonController/SysLoginpersonController.go index d268d4c5..89e32798 100644 --- a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonController/SysLoginpersonController.go +++ b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonController/SysLoginpersonController.go @@ -23,9 +23,8 @@ func Routers(r *gin.RouterGroup) { rr.GET("/ExportAreaManagerInfoExcel", ExportAreaManagerInfoExcel) rr.GET("/ExportBureauManagerInfoExcel", ExportBureauManagerInfoExcel) - rr.POST("/UpLoadFileTest", UpLoadFileTest) - rr.GET("/RemoveCookie", RemoveCookie) + rr.POST("/UpdateLoginPassWordInfo", UpdateLoginPassWordInfo) return } @@ -37,7 +36,7 @@ func Routers(r *gin.RouterGroup) { // @Produce json // @Success 200 {object} Model.Res // @Router /base/loginperson/RemoveCookie [get] -// @X-Sort [6] +// @X-Sort [10] func RemoveCookie(c *gin.Context) { c.SetCookie("person_id", "", -1, "/", "", false, true) c.SetCookie("identity_id", "", -1, "/", "", false, true) @@ -48,14 +47,6 @@ func RemoveCookie(c *gin.Context) { }) } -func UpLoadFileTest(c *gin.Context) { - header, err := c.FormFile("file") - //dst := header.Filename - c.SaveUploadedFile(header, "/Static/ExcelTemp/00000000.xlsx") - - fmt.Println(err) -} - // @Summary 获取地区管理员列表(虚拟) // @Description 获取地区管理员列表(虚拟) // @Tags 登录信息 @@ -74,7 +65,7 @@ func UpLoadFileTest(c *gin.Context) { // @X-TableName ["t_sys_loginperson"] // @X-ExtendSwaggerField [{"column_name":"area_name","sample_data":"长春市","column_comment":"地区名称"}] // @X-RemoveSwaggerField ["last_updated_time"] -// @X-Sort [1] +// @X-Sort [3] func PageAreaManagerInfo(c *gin.Context) { //第几页 page := CommonUtil.ConvertStringToInt32(c.Query("page")) @@ -121,7 +112,7 @@ func PageAreaManagerInfo(c *gin.Context) { // @X-LengthLimit [{"areaCode":"6,6"}] // @X-RoleLimit ["1","2","3"] // @X-InterfaceName ["PageSysLoginperson"] -// @X-Sort [2] +// @X-Sort [4] func ExportAreaManagerInfoExcel(c *gin.Context) { //地区码 areaCode := c.Query("areaCode") @@ -144,9 +135,6 @@ func ExportAreaManagerInfoExcel(c *gin.Context) { }) return } - fmt.Println("==========================") - fmt.Println(r.ExcelPath) - fmt.Println("==========================") c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "区域管理员账号.xlsx")) c.Writer.Header().Set("Content-Type", "application/octet-stream") c.File(r.ExcelPath) @@ -170,7 +158,7 @@ func ExportAreaManagerInfoExcel(c *gin.Context) { // @X-InterfaceName ["PageSysLoginperson"] // @X-TableName ["t_sys_loginperson"] // @X-ExtendSwaggerField [{"column_name":"org_name","sample_data":"长春市第一中学","column_comment":"单位名称"}] -// @X-Sort [3] +// @X-Sort [5] func PageBureauManagerInfo(c *gin.Context) { //第几页 page := CommonUtil.ConvertStringToInt32(c.Query("page")) @@ -219,7 +207,7 @@ func PageBureauManagerInfo(c *gin.Context) { // @X-EmptyLimit ["areaCode","orgType"] // @X-LengthLimit [{"areaCode":"6,6"}] // @X-RoleLimit ["1","2","3","4","7"] -// @X-Sort [2] +// @X-Sort [6] func ExportBureauManagerInfoExcel(c *gin.Context) { //地区码 areaCode := c.Query("areaCode") @@ -278,7 +266,7 @@ func ExportBureauManagerInfoExcel(c *gin.Context) { // @X-EmptyLimit ["ids"] // @X-LengthLimit [{"ids":"36,1800"}] // @X-RoleLimit ["1","2","3","4","7"] -// @X-Sort [3] +// @X-Sort [7] func ResetManagerPassWord(c *gin.Context) { //ID ids := c.PostForm("ids") @@ -318,7 +306,7 @@ func ResetManagerPassWord(c *gin.Context) { // @X-EmptyLimit ["personIds"] // @X-LengthLimit [{"personIds":"36,1800"}] // @X-RoleLimit ["1","2","3","4","5","6","7"] -// @X-Sort [4] +// @X-Sort [8] func EnableAccountInfo(c *gin.Context) { personIds := c.PostForm("personIds") //操作人 @@ -357,7 +345,7 @@ func EnableAccountInfo(c *gin.Context) { // @X-EmptyLimit ["personIds"] // @X-LengthLimit [{"personIds":"36,1800"}] // @X-RoleLimit ["1","2","3","4","5","6","7"] -// @X-Sort [5] +// @X-Sort [9] func DisableAccountInfo(c *gin.Context) { personIds := c.PostForm("personIds") //操作人 @@ -384,3 +372,52 @@ func DisableAccountInfo(c *gin.Context) { Message: r.Message, }) } + +// @Summary 修改登录密码 +// @Description 修改登录密码 +// @Tags 登录信息 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Param oldPassWord formData string true "原密码" +// @Param newPassWord formData string true "新密码" +// @Success 200 {object} Model.Res +// @Router /base/loginperson/UpdateLoginPassWordInfo [post] +// @X-EmptyLimit ["oldPassWord","newPassWord"] +// @X-LengthLimit [{"oldPassWord":"6,18"},{"newPassWord":"6,18"}] +// @X-RoleLimit ["1","2","3","4","5","6","7"] +// @X-Sort [11] +func UpdateLoginPassWordInfo(c *gin.Context) { + oldPassWord := c.PostForm("oldPassWord") + newPassWord := c.PostForm("newPassWord") + //cookie + personId, err := c.Cookie("person_id") + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: "未获取到Cookie中的人员编码!", + }) + return + } + identityId, err := c.Cookie("identity_id") + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: "未获取到Cookie中的身份编码!", + }) + return + } + //操作IP + actionIpAddress := c.ClientIP() + r, err := SysLoginpersonService.UpdateLoginPassWordInfo(personId, CommonUtil.ConvertStringToInt32(identityId), oldPassWord, newPassWord, personId, actionIpAddress) + 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, + }) +} diff --git a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoService.go b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoService.go index 8a581252..0c262295 100644 --- a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoService.go +++ b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoService.go @@ -48,3 +48,8 @@ func DisableAccountInfo(ids string, actionPersonId string, actionIpAddress strin Reply, err := DisableAccount(SysLoginpersonProto.AccountArg{PersonIds: idsArr, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) return Reply, err } + +func UpdateLoginPassWordInfo(personId string, identityId int32, oldPassWord string, newPassWord string, actionPersonId string, actionIpAddress string) (*SysLoginpersonProto.Reply, error) { + Reply, err := UpdateLoginPassWord(SysLoginpersonProto.UpdateLoginPassWordArg{PersonId: personId, IdentityId: identityId, OldPassWord: oldPassWord, NewPassWord: newPassWord, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) + return Reply, err +} diff --git a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoServiceRpc.go b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoServiceRpc.go index d8aeec94..657edf42 100644 --- a/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoServiceRpc.go +++ b/dsBaseWeb/Business/SysLoginPerson/SysLoginpersonService/SysLoginpersonProtoServiceRpc.go @@ -140,3 +140,23 @@ func DisableAccount(accountArg SysLoginpersonProto.AccountArg) (*SysLoginpersonP } return Reply, err } + +/** +功能:修改登录密码 +作者:吴缤 +时间:2020-07-09 11:30:20 +*/ +func UpdateLoginPassWord(updateLoginPassWordArg SysLoginpersonProto.UpdateLoginPassWordArg) (*SysLoginpersonProto.Reply, error) { + //1、准备动作:连接服务器 + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + conn := GRpcUtil.GetConnection() + //2、业务传参 + c := SysLoginpersonProto.NewSysLoginpersonManageClient(conn) + Reply, err := c.UpdateLoginPassWord(ctx, &updateLoginPassWordArg) + if err != nil { + LogUtil.Error("修改登录密码错误: ", err.Error()) + } + return Reply, err + +}