去除了算一算app用户绑定。主要涉及接口为登陆接口,检测用户状态
This commit is contained in:
parent
bafd5397be
commit
8525e0263f
@ -9,7 +9,6 @@ import (
|
|||||||
"hepa-calc-api/api/requests"
|
"hepa-calc-api/api/requests"
|
||||||
"hepa-calc-api/api/responses"
|
"hepa-calc-api/api/responses"
|
||||||
"hepa-calc-api/api/service"
|
"hepa-calc-api/api/service"
|
||||||
"hepa-calc-api/config"
|
|
||||||
"hepa-calc-api/global"
|
"hepa-calc-api/global"
|
||||||
"hepa-calc-api/utils"
|
"hepa-calc-api/utils"
|
||||||
"time"
|
"time"
|
||||||
@ -32,36 +31,10 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 公众号登录
|
|
||||||
if req.Source == 2 {
|
|
||||||
if req.Mobile == "" || req.OpenId == "" {
|
|
||||||
responses.FailWithMessage("登陆失败", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测参数
|
// 检测参数
|
||||||
if req.Mobile != "" {
|
if req.Source == 2 && req.OpenId == "" {
|
||||||
// 检测验证码
|
responses.FailWithMessage("登陆失败", c)
|
||||||
if config.C.Env != "dev" {
|
return
|
||||||
if req.Source == 2 {
|
|
||||||
if req.Code == "" {
|
|
||||||
responses.FailWithMessage("请输入手机号验证码", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
code, _ := global.Redis.Get(c, "login_code_"+req.Mobile).Result()
|
|
||||||
if code == "" {
|
|
||||||
responses.FailWithMessage("验证码失效", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Code != code {
|
|
||||||
responses.FailWithMessage("验证码错误", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始事务
|
// 开始事务
|
||||||
@ -75,13 +48,10 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var userInfo *model.UserInfo
|
|
||||||
var err error
|
|
||||||
|
|
||||||
// 检测用户信息
|
// 检测用户信息
|
||||||
userDao := dao.UserDao{}
|
userDao := dao.UserDao{}
|
||||||
maps := make(map[string]interface{})
|
maps := make(map[string]interface{})
|
||||||
maps["mobile"] = req.Mobile
|
maps["open_id"] = req.OpenId
|
||||||
user, _ := userDao.GetUser(maps)
|
user, _ := userDao.GetUser(maps)
|
||||||
// 新用户处理方式
|
// 新用户处理方式
|
||||||
if user == nil {
|
if user == nil {
|
||||||
@ -100,9 +70,7 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
user = &model.User{
|
user = &model.User{
|
||||||
UserName: "",
|
UserName: req.UserName,
|
||||||
AppIden: req.Uuid,
|
|
||||||
Mobile: req.Mobile,
|
|
||||||
RegisterSource: req.Source,
|
RegisterSource: req.Source,
|
||||||
OpenId: req.OpenId,
|
OpenId: req.OpenId,
|
||||||
UnionId: req.UnionId,
|
UnionId: req.UnionId,
|
||||||
@ -124,7 +92,7 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 新增用户详情
|
// 新增用户详情
|
||||||
userInfo = &model.UserInfo{
|
userInfo := &model.UserInfo{
|
||||||
UserId: user.UserId,
|
UserId: user.UserId,
|
||||||
Height: "",
|
Height: "",
|
||||||
Weight: "",
|
Weight: "",
|
||||||
@ -146,58 +114,10 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// 获取用户详情数据
|
|
||||||
userInfoDao := dao.UserInfoDao{}
|
|
||||||
userInfo, err = userInfoDao.GetUserInfoByUserId(user.UserId)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理用户openid
|
|
||||||
if req.OpenId != "" {
|
|
||||||
userData := make(map[string]interface{})
|
|
||||||
if req.OpenId != user.OpenId {
|
|
||||||
userData["open_id"] = req.OpenId
|
|
||||||
}
|
|
||||||
|
|
||||||
err := userDao.EditUserById(tx, user.UserId, userData)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理app用户数据
|
|
||||||
userService := service.UserService{}
|
|
||||||
err = userService.GetAppUserInfo(tx, user, userInfo)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理app用户病例数据
|
|
||||||
err = userService.GetAppUserCase(tx, user)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
user, err = userDao.GetUserById(user.UserId)
|
|
||||||
if err != nil {
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下发token
|
// 下发token
|
||||||
token := &utils.Token{
|
token := &utils.Token{
|
||||||
UserId: fmt.Sprintf("%d", user.UserId),
|
UserId: fmt.Sprintf("%d", user.UserId),
|
||||||
@ -211,7 +131,7 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
g := dto.LoginMobileDto(user)
|
g := dto.LoginWxDto(user)
|
||||||
|
|
||||||
// 加载token
|
// 加载token
|
||||||
g.LoadToken(jwt)
|
g.LoadToken(jwt)
|
||||||
|
|||||||
@ -27,6 +27,8 @@ func (b *Public) GetCaptcha(c *gin.Context) {
|
|||||||
|
|
||||||
// GetPhoneCode 获取手机验证码
|
// GetPhoneCode 获取手机验证码
|
||||||
func (b *Public) GetPhoneCode(c *gin.Context) {
|
func (b *Public) GetPhoneCode(c *gin.Context) {
|
||||||
|
responses.Ok(c)
|
||||||
|
return
|
||||||
publicRequest := requests.PublicRequest{}
|
publicRequest := requests.PublicRequest{}
|
||||||
req := publicRequest.GetPhoneCode
|
req := publicRequest.GetPhoneCode
|
||||||
if err := c.ShouldBind(&req); err != nil {
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
|
|||||||
@ -170,61 +170,3 @@ func (r *User) PutBindUserName(c *gin.Context) {
|
|||||||
|
|
||||||
responses.Ok(c)
|
responses.Ok(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserCheck 检测用户数据绑定状态
|
|
||||||
func (r *User) GetUserCheck(c *gin.Context) {
|
|
||||||
userRequest := requests.UserRequest{}
|
|
||||||
req := userRequest.GetUserCheck
|
|
||||||
if err := c.ShouldBind(&req); err != nil {
|
|
||||||
responses.FailWithMessage(err.Error(), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 参数验证
|
|
||||||
if err := global.Validate.Struct(req); err != nil {
|
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Mobile == "" && req.OpenId == "" {
|
|
||||||
responses.FailWithMessage("缺少参数", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
g := &dto.UserCheckDto{}
|
|
||||||
|
|
||||||
// 获取用户数据
|
|
||||||
maps := make(map[string]interface{})
|
|
||||||
if req.OpenId != "" {
|
|
||||||
maps["open_id"] = req.OpenId
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Mobile != "" {
|
|
||||||
maps["mobile"] = req.Mobile
|
|
||||||
}
|
|
||||||
|
|
||||||
userDao := dao.UserDao{}
|
|
||||||
user, err := userDao.GetUser(maps)
|
|
||||||
if err != nil || user == nil {
|
|
||||||
g.WxStatus = 0
|
|
||||||
g.MobileStatus = 0
|
|
||||||
responses.OkWithData(g, c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.UserStatus == 2 {
|
|
||||||
responses.FailWithMessage("用户已禁用", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.Mobile != "" {
|
|
||||||
g.MobileStatus = 1
|
|
||||||
g.Mobile = user.Mobile
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.OpenId != "" {
|
|
||||||
g.WxStatus = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
responses.OkWithData(g, c)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import (
|
|||||||
"hepa-calc-api/api/requests"
|
"hepa-calc-api/api/requests"
|
||||||
"hepa-calc-api/api/responses"
|
"hepa-calc-api/api/responses"
|
||||||
"hepa-calc-api/api/service"
|
"hepa-calc-api/api/service"
|
||||||
"hepa-calc-api/extend/app"
|
|
||||||
"hepa-calc-api/global"
|
"hepa-calc-api/global"
|
||||||
"hepa-calc-api/utils"
|
"hepa-calc-api/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -62,14 +61,6 @@ func (r *UserCase) PutUserCase(c *gin.Context) {
|
|||||||
|
|
||||||
userId := c.GetInt64("UserId")
|
userId := c.GetInt64("UserId")
|
||||||
|
|
||||||
// 获取用户数据
|
|
||||||
userDao := dao.UserDao{}
|
|
||||||
user, err := userDao.GetUserById(userId)
|
|
||||||
if err != nil {
|
|
||||||
responses.FailWithMessage("用户数据错误", c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户数据-病例
|
// 获取用户数据-病例
|
||||||
userCaseDao := dao.UserCaseDao{}
|
userCaseDao := dao.UserCaseDao{}
|
||||||
userCase, err := userCaseDao.GetUserCaseByUserId(userId)
|
userCase, err := userCaseDao.GetUserCaseByUserId(userId)
|
||||||
@ -79,17 +70,6 @@ func (r *UserCase) PutUserCase(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userCaseData := make(map[string]interface{})
|
userCaseData := make(map[string]interface{})
|
||||||
appData := app.UpdateUserCaseRequest{
|
|
||||||
IsAllergy: req.IsAllergyHistory,
|
|
||||||
AllergyInfo: req.AllergyHistory,
|
|
||||||
IsHospital: req.IsHospital,
|
|
||||||
IsMedication: req.IsMedication,
|
|
||||||
MedicationInfo: req.Medication,
|
|
||||||
LiverStatus: req.LiverStatus,
|
|
||||||
OtherDisease: req.ChronicDisease,
|
|
||||||
PatientUuid: user.AppIden,
|
|
||||||
DiseasesList: nil,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 是否医院就诊
|
// 是否医院就诊
|
||||||
if req.IsHospital != nil {
|
if req.IsHospital != nil {
|
||||||
@ -163,9 +143,7 @@ func (r *UserCase) PutUserCase(c *gin.Context) {
|
|||||||
// 所患疾病列表
|
// 所患疾病列表
|
||||||
if len(req.UserCaseDiseaseItem) > 0 {
|
if len(req.UserCaseDiseaseItem) > 0 {
|
||||||
baseDiseaseClassDao := dao.BaseDiseaseClassDao{}
|
baseDiseaseClassDao := dao.BaseDiseaseClassDao{}
|
||||||
diseasesLists := make([]*app.DiseasesListRequest, len(req.UserCaseDiseaseItem))
|
for _, item := range req.UserCaseDiseaseItem {
|
||||||
|
|
||||||
for i, item := range req.UserCaseDiseaseItem {
|
|
||||||
diseaseClassId, err := strconv.ParseInt(item.DiseaseClassId, 10, 64)
|
diseaseClassId, err := strconv.ParseInt(item.DiseaseClassId, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
@ -195,18 +173,7 @@ func (r *UserCase) PutUserCase(c *gin.Context) {
|
|||||||
responses.Fail(c)
|
responses.Fail(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// app请求数据
|
|
||||||
diseasesList := &app.DiseasesListRequest{
|
|
||||||
Uuid: baseDiseaseClass.AppIden,
|
|
||||||
Year: &item.Duration,
|
|
||||||
Info: item.Genotype,
|
|
||||||
Name: baseDiseaseClass.DiseaseClassName,
|
|
||||||
}
|
|
||||||
diseasesLists[i] = diseasesList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.DiseasesList = diseasesLists
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 病例数据
|
// 病例数据
|
||||||
@ -228,15 +195,6 @@ func (r *UserCase) PutUserCase(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// app数据
|
|
||||||
appData.PatientUuid = user.AppIden
|
|
||||||
_, err = app.UpdateUserCase(appData)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
responses.Fail(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
responses.Ok(c)
|
responses.Ok(c)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"hepa-calc-api/api/model"
|
"hepa-calc-api/api/model"
|
||||||
@ -187,7 +186,6 @@ func (r *QuestionDao) GetQuestionPageSearch(req requests.GetQuestionPage, page,
|
|||||||
|
|
||||||
// 搜索关键字
|
// 搜索关键字
|
||||||
if req.Keyword != "" {
|
if req.Keyword != "" {
|
||||||
fmt.Println(111)
|
|
||||||
keyword := "%" + req.Keyword + "%" //
|
keyword := "%" + req.Keyword + "%" //
|
||||||
|
|
||||||
// 标题
|
// 标题
|
||||||
|
|||||||
@ -6,11 +6,9 @@ type LoginRequest struct {
|
|||||||
|
|
||||||
// Login 登录
|
// Login 登录
|
||||||
type Login struct {
|
type Login struct {
|
||||||
Mobile string `json:"mobile" form:"mobile" label:"手机号" validate:"required,Mobile"`
|
Source int `json:"source" form:"source" label:"来源" validate:"required,oneof=2"` // (1:app 2:公众号)
|
||||||
Code string `json:"code" form:"code" label:"验证码"`
|
OpenId string `json:"openid" form:"openid" label:"openid" validate:"required"`
|
||||||
Source int `json:"source" form:"source" label:"来源" validate:"required"` // (1:app 2:公众号)
|
|
||||||
OpenId string `json:"openid" form:"openid" label:"openid"`
|
|
||||||
HeadImgUrl string `json:"headimgurl" form:"headimgurl" label:"头像"`
|
HeadImgUrl string `json:"headimgurl" form:"headimgurl" label:"头像"`
|
||||||
UnionId string `json:"unionid" form:"unionid" label:"unionid"`
|
UnionId string `json:"unionid" form:"unionid" label:"unionid" validate:"required"`
|
||||||
Uuid string `json:"uuid" form:"uuid" label:"app唯一标识"`
|
UserName string `json:"user_name" form:"user_name" label:"用户名称" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,5 @@ type PutBindUserName struct {
|
|||||||
|
|
||||||
// GetUserCheck 检测用户数据绑定状态
|
// GetUserCheck 检测用户数据绑定状态
|
||||||
type GetUserCheck struct {
|
type GetUserCheck struct {
|
||||||
Mobile string `json:"mobile" form:"mobile" label:"mobile"`
|
OpenId string `json:"openid" form:"openid" label:"openid" validate:"required"`
|
||||||
OpenId string `json:"openid" form:"openid" label:"openid"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,13 +79,6 @@ func publicRouter(r *gin.Engine, api controller.Api) {
|
|||||||
loginGroup.POST("", api.Login.Login)
|
loginGroup.POST("", api.Login.Login)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户
|
|
||||||
centerGroup := r.Group("/user")
|
|
||||||
{
|
|
||||||
// 检测用户数据绑定状态
|
|
||||||
centerGroup.GET("/check", api.User.GetUserCheck)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证码
|
// 验证码
|
||||||
codeGroup := r.Group("/code")
|
codeGroup := r.Group("/code")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -642,21 +642,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
|
|
||||||
userData := make(map[string]interface{})
|
userData := make(map[string]interface{})
|
||||||
userInfoData := make(map[string]interface{})
|
userInfoData := make(map[string]interface{})
|
||||||
appData := app.UpdateInfoRequest{
|
|
||||||
Birthday: req.Birthday,
|
|
||||||
IsPegnant: req.IsPregnant,
|
|
||||||
Sex: nil,
|
|
||||||
Weight: req.Weight,
|
|
||||||
ExpectedDateOfChildbirth: req.ExpectedDate,
|
|
||||||
IsHbv: nil,
|
|
||||||
NationUuid: "",
|
|
||||||
PatientUuid: "",
|
|
||||||
Name: req.UserName,
|
|
||||||
ProvId: nil,
|
|
||||||
CityId: nil,
|
|
||||||
CountyId: nil,
|
|
||||||
Height: req.Height,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户名称
|
// 用户名称
|
||||||
if req.UserName != user.UserName {
|
if req.UserName != user.UserName {
|
||||||
@ -681,15 +666,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
userData["age"] = nil
|
userData["age"] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 性别
|
|
||||||
if req.Sex == 1 {
|
|
||||||
sex := 0
|
|
||||||
appData.Sex = &sex
|
|
||||||
} else if req.Sex == 2 {
|
|
||||||
sex := 1
|
|
||||||
appData.Sex = &sex
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.Sex != nil {
|
if user.Sex != nil {
|
||||||
if req.Sex != *user.Sex {
|
if req.Sex != *user.Sex {
|
||||||
userData["sex"] = req.Sex
|
userData["sex"] = req.Sex
|
||||||
@ -741,51 +717,16 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
fmt.Println(req.NationId)
|
fmt.Println(req.NationId)
|
||||||
if req.NationId != nationId {
|
if req.NationId != nationId {
|
||||||
userInfoData["nation_id"] = req.NationId
|
userInfoData["nation_id"] = req.NationId
|
||||||
|
|
||||||
// 获取民族数据
|
|
||||||
baseNationDao := dao.BaseNationDao{}
|
|
||||||
maps := make(map[string]interface{})
|
|
||||||
maps["nation_id"] = req.NationId
|
|
||||||
baseNation, err := baseNationDao.GetBaseNation(maps)
|
|
||||||
if err != nil {
|
|
||||||
return false, errors.New("民族错误")
|
|
||||||
}
|
|
||||||
appData.NationUuid = baseNation.AppIden
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
userInfoData["nation_id"] = req.NationId
|
userInfoData["nation_id"] = req.NationId
|
||||||
|
|
||||||
// 获取民族数据
|
|
||||||
baseNationDao := dao.BaseNationDao{}
|
|
||||||
maps := make(map[string]interface{})
|
|
||||||
maps["nation_id"] = req.NationId
|
|
||||||
baseNation, err := baseNationDao.GetBaseNation(maps)
|
|
||||||
if err != nil {
|
|
||||||
return false, errors.New("民族错误")
|
|
||||||
}
|
|
||||||
appData.NationUuid = baseNation.AppIden
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if userInfo.NationId != nil {
|
if userInfo.NationId != nil {
|
||||||
userInfoData["nation_id"] = nil
|
userInfoData["nation_id"] = nil
|
||||||
appData.NationUuid = ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否存在家族病史
|
|
||||||
// 有无 肝硬化或肝癌家族史 0无1有2未知
|
|
||||||
// 是否存在家族病史(0:未知 1:是 2:否)
|
|
||||||
// 转换双方状态
|
|
||||||
var isHbv int
|
|
||||||
if *req.IsFamilyHistory == 0 {
|
|
||||||
isHbv = 2
|
|
||||||
} else if *req.IsFamilyHistory == 1 {
|
|
||||||
isHbv = 1
|
|
||||||
} else if *req.IsFamilyHistory == 2 {
|
|
||||||
isHbv = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
appData.IsHbv = &isHbv
|
|
||||||
if req.IsFamilyHistory != nil {
|
if req.IsFamilyHistory != nil {
|
||||||
if userInfo.IsFamilyHistory != nil {
|
if userInfo.IsFamilyHistory != nil {
|
||||||
if *req.IsFamilyHistory != *userInfo.IsFamilyHistory {
|
if *req.IsFamilyHistory != *userInfo.IsFamilyHistory {
|
||||||
@ -837,8 +778,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
return false, errors.New("省份错误")
|
return false, errors.New("省份错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.ProvId = &provinceId
|
|
||||||
|
|
||||||
baseAreaDao := dao.BaseAreaDao{}
|
baseAreaDao := dao.BaseAreaDao{}
|
||||||
baseArea, err := baseAreaDao.GetBaseAreaById(provinceId)
|
baseArea, err := baseAreaDao.GetBaseAreaById(provinceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -861,8 +800,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
return false, errors.New("城市错误")
|
return false, errors.New("城市错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.CityId = &cityId
|
|
||||||
|
|
||||||
baseArea, err = baseAreaDao.GetBaseAreaById(cityId)
|
baseArea, err = baseAreaDao.GetBaseAreaById(cityId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.New("城市错误")
|
return false, errors.New("城市错误")
|
||||||
@ -884,7 +821,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.New("区县错误")
|
return false, errors.New("区县错误")
|
||||||
}
|
}
|
||||||
appData.CountyId = &countyId
|
|
||||||
|
|
||||||
baseArea, err = baseAreaDao.GetBaseAreaById(countyId)
|
baseArea, err = baseAreaDao.GetBaseAreaById(countyId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -928,14 +864,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// app数据
|
|
||||||
appData.PatientUuid = user.AppIden
|
|
||||||
_, err = app.UpdateInfo(appData)
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user