| | |
| | | } |
| | | paramBody := util.Struct2Map(model) |
| | | if api.AreaAdd(paramBody) { |
| | | util.ResponseFormat(c,code.Success,"保存成功") |
| | | util.ResponseFormat(c,code.AddSuccess,"添加成功") |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"保存失败") |
| | | util.ResponseFormat(c,code.ComError,"添加失败") |
| | | } |
| | | } |
| | | |
| | |
| | | paramBody := util.Struct2Map(model) |
| | | var api dbapi.AreaApi |
| | | if api.AreaUpdate(paramBody) { |
| | | util.ResponseFormat(c,code.Success,"更新成功") |
| | | util.ResponseFormat(c,code.UpdateSuccess,"更新成功") |
| | | }else { |
| | | util.ResponseFormat(c,code.ComError,"更新失败") |
| | | } |
| | |
| | | } |
| | | |
| | | if api.AreaDelete(areaId) { |
| | | util.ResponseFormat(c, code.Success, "删除成功") |
| | | util.ResponseFormat(c, code.DelSuccess, "删除成功") |
| | | } else { |
| | | util.ResponseFormat(c, code.ComError,"删除失败") |
| | | } |
| | |
| | | if flag { |
| | | authDriver := auth.GenerateAuthDriver() |
| | | tokenStr := (*authDriver).Login(c.Request, c.Writer, util.Struct2Map(userInfo)) |
| | | util.ResponseFormat(c,code.Success,map[string]interface{}{ |
| | | util.ResponseFormat(c,code.LoginSuccess,map[string]interface{}{ |
| | | "userInfo":userInfo, |
| | | "access_token":tokenStr, |
| | | "refresh_token":tokenStr, |
| | |
| | | var ( |
| | | // Success 请求处理成功 |
| | | Success = &Code{http.StatusOK, true, "请求处理成功"} |
| | | AddSuccess = &Code{http.StatusOK,true,"添加成功"} |
| | | UpdateSuccess = &Code{http.StatusOK,true,"更新成功"} |
| | | DelSuccess = &Code{http.StatusOK,true,"删除成功"} |
| | | // RequestParamError 请求参数错误 |
| | | RequestParamError = &Code{http.StatusBadRequest, false, "请求参数有误"} |
| | | // AccountPassUnmatch 该账号原密码不匹配 |
| | |
| | | UploadSuffixError = &Code{http.StatusBadRequest, false, "该上传文件格式目前暂不支持"} |
| | | // UploadSizeLimit 目前上传仅支持小于5M的文件内容 |
| | | UploadSizeLimit = &Code{http.StatusBadRequest, false, "目前上传仅支持小于5M的文件内容"} |
| | | LoginSuccess = &Code{http.StatusOK,true,"登录成功"} |
| | | // SigninInfoError 账户名或密码有误 |
| | | SigninInfoError = &Code{http.StatusUnauthorized, false, "账户名或密码有误"} |
| | | // TokenNotFound 请求未携带Token, 无权访问 |