Explorar el Código

supplier_contact_info_update

Xingyu Xian hace 2 semanas
padre
commit
d9bcbdc311

+ 14 - 1
db/sub_account.go

@@ -3,6 +3,7 @@ package db
 import (
 	"context"
 	"fmt"
+	"github.com/sirupsen/logrus"
 	"youngee_b_api/model/gorm_model"
 )
 
@@ -17,7 +18,7 @@ func CreateSubAccount(ctx context.Context, account gorm_model.YounggeeSubAccount
 }
 
 // UpdateSubAccount 更新子账号
-func UpdateSubAccount(ctx context.Context, account gorm_model.YounggeeSubAccount) error {
+func UpdateSubAccount(ctx context.Context, account *gorm_model.YounggeeSubAccount) error {
 	db := GetWriteDB(ctx)
 	whereCondition := gorm_model.YounggeeSubAccount{SubAccountId: account.SubAccountId}
 	err := db.Model(&gorm_model.YounggeeSubAccount{}).Where(whereCondition).Updates(account).Error
@@ -87,3 +88,15 @@ func FindSubAccountBySupplierId(ctx context.Context, supplierId int, jobId int,
 	}
 	return subAccount, total, nil
 }
+
+// CountSubAccountUserByPhone 按照手机号码统计子账号数量
+func CountSubAccountUserByPhone(ctx context.Context, phone string) (int64, error) {
+	db := GetReadDB(ctx)
+	var taskNum int64
+	err := db.Model(gorm_model.YounggeeSubAccount{}).Where("phone_number = ? and sub_account_type = 3", phone).Count(&taskNum).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[CountSubAccountUserByPhone] error read mysql, err:%+v", err)
+		return 0, err
+	}
+	return taskNum, nil
+}

+ 13 - 0
db/supplier.go

@@ -2,6 +2,7 @@ package db
 
 import (
 	"context"
+	"github.com/sirupsen/logrus"
 	"gorm.io/gorm"
 	"youngee_b_api/model/gorm_model"
 )
@@ -56,3 +57,15 @@ func UpdateSupplier(ctx context.Context, supplierInfo *gorm_model.YoungeeSupplie
 	}
 	return nil
 }
+
+// CountSupplierUserByPhone 按照手机号码统计服务商数量
+func CountSupplierUserByPhone(ctx context.Context, phone string) (int64, error) {
+	db := GetReadDB(ctx)
+	var taskNum int64
+	err := db.Model(gorm_model.YoungeeSupplier{}).Where("phone_number = ?", phone).Count(&taskNum).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[CountSupplierUserByPhone] error read mysql, err:%+v", err)
+		return 0, err
+	}
+	return taskNum, nil
+}

+ 11 - 0
db/user.go

@@ -71,3 +71,14 @@ func UpdateUser(ctx context.Context, UserID int64, UserName string, Email string
 	}
 	return &UserID, nil
 }
+
+// UpdateUserById 更新User信息ById
+func UpdateUserById(ctx context.Context, userInfo *gorm_model.YounggeeUser) error {
+	db := GetWriteDB(ctx)
+	whereCondition := gorm_model.YounggeeUser{ID: userInfo.ID}
+	err := db.Model(&gorm_model.YounggeeUser{}).Where(whereCondition).Updates(userInfo).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 10 - 8
handler/addNewSubAccount.go

@@ -46,16 +46,18 @@ func (h *AddNewSubAccountHandler) run() {
 	}
 	// 2. 校验通过则创建样叽用户和子账号
 	if tag == "1" {
-		subAccountData, err := service.SubAccount.CreateSubAccount(h.ctx, newSubAccount)
-		respData := http_model.AddNewSubAccountData{
-			UserID:       int64(subAccountData.UserId),
-			SupplierId:   subAccountData.SupplierId,
-			SubAccountID: subAccountData.SubAccountId,
-		}
-		if err != nil {
+		subAccountData, createSubAccountErr := service.SubAccount.CreateSubAccount(h.ctx, newSubAccount)
+		if createSubAccountErr != nil {
 			fmt.Println(err)
 			h.resp.Message = "创建失败"
-		} else {
+			return
+		}
+		if subAccountData != nil {
+			respData := http_model.AddNewSubAccountData{
+				UserID:       int64(subAccountData.UserId),
+				SupplierId:   subAccountData.SupplierId,
+				SubAccountID: subAccountData.SubAccountId,
+			}
 			h.resp.Message = "成功创建子账号"
 			h.resp.Data = respData
 		}

+ 0 - 14
handler/code_login.go

@@ -11,20 +11,6 @@ import (
 	log "github.com/sirupsen/logrus"
 )
 
-/*
-// WrapSendCodeHandler
-// @BasePath /youngee/m/
-// Codelogin godoc
-// @Summary login 登录
-// @Schemes
-// @Description 输入手机号和验证码,并登录
-// @Accept json
-// @Produce json
-// @Param req body http_model.CodeLoginRequest true "登录输入内容请求参数结构体"
-// @Success 200 {object} http_model.CommonResponse{data=http_model.CodeLoginData} "登录返回相应结构体"
-// @Router /login [post]
-*/
-
 func WrapCodeLoginHandler(ctx *gin.Context) {
 	handler := newCodeLoginHandler(ctx)
 	baseRun(handler)

+ 73 - 0
handler/update_account_info.go

@@ -0,0 +1,73 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapUpdateAccountInfoHandler(ctx *gin.Context) {
+	handler := newUpdateAccountInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newUpdateAccountInfoHandler(ctx *gin.Context) *UpdateAccountInfoHandler {
+	return &UpdateAccountInfoHandler{
+		req:  http_model.NewUpdateAccountInfoRequest(),
+		resp: http_model.NewUpdateAccountInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type UpdateAccountInfoHandler struct {
+	req  *http_model.UpdateAccountInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *UpdateAccountInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *UpdateAccountInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *UpdateAccountInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *UpdateAccountInfoHandler) run() {
+	data, tag, err := service.LoginAuth.UpdateSupplierAccountInfo(h.ctx, h.req)
+	if err != nil {
+		logrus.Errorf("[UpdateSupplierAccountInfo] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("UpdateSupplierAccountInfo fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	if tag == 1 {
+		h.resp.Message = "验证码校验错误"
+		h.resp.Status = 34000
+		return
+	}
+	if tag == 2 {
+		h.resp.Message = "手机号已经被其他主账号绑定"
+		h.resp.Status = 35000
+		return
+	}
+	if tag == 3 {
+		h.resp.Message = "手机号已经被其他子账号绑定"
+		h.resp.Status = 36000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *UpdateAccountInfoHandler) checkParam() error {
+	return nil
+}

+ 25 - 15
handler/update_contact_info.go

@@ -2,7 +2,12 @@ package handler
 
 import (
 	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
 	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
 )
 
 func WrapUpdateContactInfoHandler(ctx *gin.Context) {
@@ -12,14 +17,14 @@ func WrapUpdateContactInfoHandler(ctx *gin.Context) {
 
 func newUpdateContactInfoHandler(ctx *gin.Context) *UpdateContactInfoHandler {
 	return &UpdateContactInfoHandler{
-		req:  http_model.NewCreateContactInfoRequest(),
-		resp: http_model.NewCreateContactInfoResponse(),
+		req:  http_model.NewUpdateContactInfoRequest(),
+		resp: http_model.NewUpdateContactInfoResponse(),
 		ctx:  ctx,
 	}
 }
 
 type UpdateContactInfoHandler struct {
-	req  *http_model.CreateContactInfoRequest
+	req  *http_model.UpdateContactInfoRequest
 	resp *http_model.CommonResponse
 	ctx  *gin.Context
 }
@@ -34,18 +39,23 @@ func (h *UpdateContactInfoHandler) getResponse() interface{} {
 	return h.resp
 }
 func (h *UpdateContactInfoHandler) run() {
-	//data, err := service.Supplier.GetSupplierContactInfo(h.ctx, h.req)
-	//if err != nil {
-	//	logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
-	//	util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
-	//	log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
-	//	h.resp.Message = err.Error()
-	//	h.resp.Status = 40000
-	//	return
-	//}
-	//h.resp.Data = data
-	//h.resp.Status = 20000
-	//h.resp.Message = "ok"
+	data, tag, err := service.LoginAuth.UpdateSupplierContactInfo(h.ctx, h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	if tag == true && data == nil {
+		h.resp.Message = "验证码校验错误"
+		h.resp.Status = 34000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
 }
 
 func (h *UpdateContactInfoHandler) checkParam() error {

+ 1 - 1
model/gorm_model/supplier.go

@@ -18,7 +18,7 @@ type YoungeeSupplier struct {
 	Avatar          string `gorm:"column:avatar"`                                 // 头像
 	ReviewStatus    int    `gorm:"column:review_status"`                          // 认证状态,1未认证,2已认证
 	WechatNumber    string `gorm:"column:wechat_number"`                          // 微信号
-	WechatQrCode    string `gorm:"column:wechat_qr_code"`                         // 微信二维码url
+	WechatQrCode    string `gorm:"column:wechat_qrcode"`                          // 微信二维码url
 }
 
 func (m *YoungeeSupplier) TableName() string {

+ 28 - 0
model/http_model/update_account_info.go

@@ -0,0 +1,28 @@
+package http_model
+
+type UpdateAccountInfoRequest struct {
+	SupplierId     int    `json:"supplier_id"`      // 服务商ID
+	SubAccountId   int    `json:"sub_account_id"`   // 子账号ID
+	Phone          string `json:"phone"`            // 绑定手机号
+	Code           string `json:"code"`             // 验证码
+	SupplierName   string `json:"supplier_name"`    // 服务商名称
+	Avatar         string `json:"avatar"`           // 头像url
+	SubAccountName string `json:"sub_account_name"` // 子账号名称
+}
+
+type UpdateAccountInfoData struct {
+	Phone          string `json:"phone"`            // 绑定手机号
+	SupplierName   string `json:"supplier_name"`    // 服务商名称
+	Avatar         string `json:"avatar"`           // 头像url
+	SubAccountName string `json:"sub_account_name"` // 子账号名称
+}
+
+func NewUpdateAccountInfoRequest() *UpdateAccountInfoRequest {
+	return new(UpdateAccountInfoRequest)
+}
+
+func NewUpdateAccountInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(UpdateAccountInfoData)
+	return resp
+}

+ 26 - 0
model/http_model/update_supplier_contact_info.go

@@ -0,0 +1,26 @@
+package http_model
+
+type UpdateContactInfoRequest struct {
+	SupplierId   int    `json:"supplier_id"`    // 服务商ID
+	SubAccountId int    `json:"sub_account_id"` // 子账号ID
+	ContactPhone string `json:"contact_phone"`  // 联系电话
+	WechatNumber string `json:"wechat_number"`  // 微信号
+	WechatQRCode string `json:"wechat_qr_code"` // 微信二维码
+	Code         string `json:"code"`           // 验证码
+}
+
+type UpdateContactInfoData struct {
+	ContactPhone string `json:"contact_phone"`  // 联系电话
+	WechatNumber string `json:"wechat_number"`  // 微信号
+	WechatQRCode string `json:"wechat_qr_code"` // 微信二维码
+}
+
+func NewUpdateContactInfoRequest() *UpdateContactInfoRequest {
+	return new(UpdateContactInfoRequest)
+}
+
+func NewUpdateContactInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(UpdateContactInfoData)
+	return resp
+}

+ 6 - 5
route/init.go

@@ -25,15 +25,16 @@ func InitRoute(r *gin.Engine) {
 		a.POST("/sendCode", handler.WrapSendCodeHandler)                    // 发送登录验证码
 		a.POST("/login", handler.WrapCodeLoginHandler)                      // 服务商登录
 		a.POST("/getUserInfo", handler.WrapGetUserInfoHandler)              // 服务商用户信息
-		a.POST("/getAccountInfo", handler.WrapGetAccountInfoHandler)        // 账号管理-账号信息查询
+		a.POST("/accountInfo/get", handler.WrapGetAccountInfoHandler)       // 账号管理-账号信息查询
+		a.POST("/accountInfo/update", handler.WrapUpdateAccountInfoHandler) // 账号管理-账号信息更新
 		a.POST("/reviewInfo/get", handler.WrapGetReviewInfoHandler)         // 账号管理-认证信息查询
+		a.POST("/company/review", handler.WrapCompanyReviewHandler)         // 账号管理-营业执照认证
+		a.POST("/idCard/review", handler.WrapIdCardReviewHandler)           // 账号管理-身份证认证
 		a.POST("/reviewInfo/create", handler.WrapSaveReviewHandler)         // 账号管理-认证信息创建
 		a.POST("/contactInfo/get", handler.WrapGetContactInfoHandler)       // 联系方式-查询
-		a.POST("/contactInfo/create", handler.WrapCreateContactInfoHandler) // 联系方式-创建
 		a.POST("/contactInfo/update", handler.WrapUpdateContactInfoHandler) // 联系方式-更新
-		a.POST("/company/review", handler.WrapCompanyReviewHandler)         // 营业执照认证
-		a.POST("/idCard/review", handler.WrapIdCardReviewHandler)           // 身份证认证
-		a.POST("/sendCodeT", handler.WrapSendCodeTHandler)
+		a.POST("/sendCodeT", handler.WrapSendCodeTHandler)                  // 发送验证码测试接口
+		// a.POST("/contactInfo/create", handler.WrapCreateContactInfoHandler) // 联系方式-创建
 
 		a.GET("/test/ping", func(c *gin.Context) {
 			resp := http_model.CommonResponse{

+ 6 - 6
service/login_auth.go

@@ -169,12 +169,12 @@ func (l *loginAuth) AuthCode(ctx context.Context, phone string, code string) (st
 			Role:                 userData.Role,
 			SubAccountId:         0,
 			SupplierId:           supplierUser.SupplierId,
-			JobName:              "-1",
-			EnterpriseId:         "-1",
-			CommercialCenter:     "-1",
-			CooperatePermission:  "-1",
-			FinancialPermission:  "-1",
-			CommercialManagement: "-1",
+			JobName:              "主账号无岗位",
+			EnterpriseId:         "1",
+			CommercialCenter:     "1",
+			CooperatePermission:  "1",
+			FinancialPermission:  "1",
+			CommercialManagement: "1",
 		}
 	} else if ifsubaccount == 1 {
 		loginUserData = http_model.CodeLoginData{

+ 2 - 1
service/sub_account.go

@@ -53,7 +53,8 @@ func (*subaccount) CreateSubAccount(ctx context.Context, request http_model.AddN
 
 // UpdateSubAccount 修改子账号
 func (*subaccount) UpdateSubAccount(ctx context.Context, request http_model.UpdateJobRequest) error {
-	var newSubAccount = gorm_model.YounggeeSubAccount{}
+	var newSubAccount *gorm_model.YounggeeSubAccount
+	newSubAccount = &gorm_model.YounggeeSubAccount{}
 	err := db.UpdateSubAccount(ctx, newSubAccount)
 	if err != nil {
 		return err

+ 219 - 2
service/supplier.go

@@ -105,6 +105,107 @@ func (*supplier) GetSupplierAccountInfo(ctx context.Context, req *http_model.Get
 	return supplierUserInfo, nil
 }
 
+// UpdateSupplierAccountInfo 更新服务商账号信息
+func (l *loginAuth) UpdateSupplierAccountInfo(ctx context.Context, req *http_model.UpdateAccountInfoRequest) (*http_model.UpdateAccountInfoData, int, error) {
+
+	var supplierUserInfo *http_model.UpdateAccountInfoData
+	supplierUserInfo = &http_model.UpdateAccountInfoData{}
+	supplierUserInfo.SupplierName = req.SupplierName
+	supplierUserInfo.Avatar = req.Avatar
+	supplierUserInfo.Phone = req.Phone
+	supplierUserInfo.SubAccountName = req.SubAccountName
+
+	if req.SubAccountId == 0 {
+		// 服务商主账号
+		// 1. 若修改绑定手机号
+		if req.Phone != "" {
+			// 1.1. 校验验证码
+			vCode, err := l.getSessionCode(ctx, req.Phone)
+			if err != nil {
+				return nil, 0, err
+			}
+			if vCode != req.Code {
+				return nil, 1, nil
+			}
+			// 1.2. 手机号是否已经被其他主账号绑定
+			supplierNum, supplierNumErr := db.CountSupplierUserByPhone(ctx, req.Phone)
+			if supplierNumErr != nil {
+				log.Infof("[GetSupplierAccountInfo] fail,err:%+v", supplierNumErr)
+				return nil, 0, supplierNumErr
+			}
+			if supplierNum != 0 {
+				return nil, 2, nil
+			}
+			// 1.3. 手机号是否被子账号绑定
+			subAccountNum, SubAccountErr := db.CountSubAccountUserByPhone(ctx, req.Phone)
+			if SubAccountErr != nil {
+				log.Infof("[GetSupplierAccountInfo] fail,err:%+v", SubAccountErr)
+				return nil, 0, SubAccountErr
+			}
+			if subAccountNum != 0 {
+				return nil, 3, nil
+			}
+			// 1.4. 修改Supplier信息
+			var supplierInfo *gorm_model.YoungeeSupplier
+			supplierInfo = &gorm_model.YoungeeSupplier{}
+			supplierInfo.SupplierId = req.SupplierId
+			supplierInfo.SupplierName = req.SupplierName
+			supplierInfo.Avatar = req.Avatar
+			supplierInfo.PhoneNumber = req.Phone
+			updateSupplierErr := db.UpdateSupplier(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[GetSupplierAccountInfo] fail,err:%+v", updateSupplierErr)
+				return nil, 0, updateSupplierErr
+			}
+			// 1.5. 修改User表信息
+			supplierInfoQuery, supplierInfoQueryErr := db.GetSupplierById(ctx, supplierInfo.SupplierId)
+			if supplierInfoQueryErr != nil {
+				log.Infof("[GetSupplierAccountInfo] fail,err:%+v", supplierInfoQueryErr)
+				return nil, 0, supplierInfoQueryErr
+			}
+			if supplierInfoQuery != nil {
+				var userInfo *gorm_model.YounggeeUser
+				userInfo = &gorm_model.YounggeeUser{}
+				userInfo.ID = supplierInfoQuery.UserId
+				userInfo.Phone = supplierInfoQuery.PhoneNumber
+				userInfo.Username = supplierInfoQuery.PhoneNumber
+				updateUserInfoErr := db.UpdateUserById(ctx, userInfo)
+				if updateUserInfoErr != nil {
+					log.Infof("[GetSupplierAccountInfo] fail,err:%+v", updateUserInfoErr)
+					return nil, 0, updateUserInfoErr
+				}
+			}
+
+		} else {
+			var supplierInfo *gorm_model.YoungeeSupplier
+			supplierInfo = &gorm_model.YoungeeSupplier{}
+			supplierInfo.SupplierId = req.SupplierId
+			supplierInfo.SupplierName = req.SupplierName
+			supplierInfo.Avatar = req.Avatar
+			supplierInfo.PhoneNumber = req.Phone
+			updateSupplierErr := db.UpdateSupplier(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[GetSupplierAccountInfo] fail,err:%+v", updateSupplierErr)
+				return nil, 0, updateSupplierErr
+			}
+		}
+	} else {
+		// 服务商子账号
+		var subAccountInfo *gorm_model.YounggeeSubAccount
+		subAccountInfo = &gorm_model.YounggeeSubAccount{}
+		subAccountInfo.SupplierId = req.SupplierId
+		subAccountInfo.SubAccountName = req.SubAccountName
+		subAccountInfo.Avatar = req.Avatar
+		subAccountInfo.PhoneNumber = req.Phone
+		updateSubAccountErr := db.UpdateSubAccount(ctx, subAccountInfo)
+		if updateSubAccountErr != nil {
+			log.Infof("[GetSupplierAccountInfo] fail,err:%+v", updateSubAccountErr)
+			return nil, 0, updateSubAccountErr
+		}
+	}
+	return supplierUserInfo, 0, nil
+}
+
 // GetSupplierReviewInfo 查询服务商认证信息
 func (*supplier) GetSupplierReviewInfo(ctx context.Context, req *http_model.GetReviewInfoRequest) (*http_model.GetReviewInfoData, error) {
 
@@ -167,11 +268,127 @@ func (*supplier) GetSupplierContactInfo(ctx context.Context, req *http_model.Get
 			contactInfo.WechatNumber = subAccountInfo.WechatNumber
 		}
 	}
-
 	return contactInfo, nil
 }
 
-// SaveSupplierReviewInfo 保存服务商联系方式
+// UpdateSupplierContactInfo 更新服务商联系方式
+func (l *loginAuth) UpdateSupplierContactInfo(ctx context.Context, req *http_model.UpdateContactInfoRequest) (*http_model.UpdateContactInfoData, bool, error) {
+
+	var contactInfo *http_model.UpdateContactInfoData
+	contactInfo = &http_model.UpdateContactInfoData{}
+
+	// 主账号
+	if req.SubAccountId == 0 {
+		// 1. 若更新联系电话则需要验证码校验
+		if req.ContactPhone != "" {
+			vcode, err := l.getSessionCode(ctx, req.ContactPhone)
+			if err != nil {
+				return nil, false, err
+			}
+			// fmt.Printf("缓存的验证码 vcode: %v,实际填入的 code:%v", vcode, req.Code)
+			if vcode != req.Code {
+				// 验证码错误
+				return nil, true, err
+			}
+			var supplierInfo *gorm_model.YoungeeSupplier
+			supplierInfo = &gorm_model.YoungeeSupplier{}
+			supplierInfo.ContactPhone = req.ContactPhone
+			supplierInfo.SupplierId = req.SupplierId
+			updateSupplierErr := db.UpdateSupplier(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.ContactPhone = req.ContactPhone
+		}
+
+		// 2. 微信二维码更新
+		if req.WechatQRCode != "" {
+			var supplierInfo *gorm_model.YoungeeSupplier
+			supplierInfo = &gorm_model.YoungeeSupplier{}
+			supplierInfo.WechatQrCode = req.WechatQRCode
+			supplierInfo.SupplierId = req.SupplierId
+			updateSupplierErr := db.UpdateSupplier(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.WechatQRCode = req.WechatQRCode
+
+		}
+
+		// 2. 微信号码更新
+		if req.WechatNumber != "" {
+			var supplierInfo *gorm_model.YoungeeSupplier
+			supplierInfo = &gorm_model.YoungeeSupplier{}
+			supplierInfo.WechatNumber = req.WechatNumber
+			supplierInfo.SupplierId = req.SupplierId
+			updateSupplierErr := db.UpdateSupplier(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.WechatNumber = req.WechatNumber
+		}
+	} else {
+		// 子账号
+		// 1. 若更新联系电话则需要验证码校验
+		if req.ContactPhone != "" {
+			vcode, err := l.getSessionCode(ctx, req.ContactPhone)
+			if err != nil {
+				return nil, false, err
+			}
+			// fmt.Printf("缓存的验证码 vcode: %v,实际填入的 code:%v", vcode, req.Code)
+			if vcode != req.Code {
+				// 验证码错误
+				return nil, true, err
+			}
+			var supplierInfo *gorm_model.YounggeeSubAccount
+			supplierInfo = &gorm_model.YounggeeSubAccount{}
+			supplierInfo.ContactPhone = req.ContactPhone
+			supplierInfo.SubAccountId = req.SubAccountId
+			updateSupplierErr := db.UpdateSubAccount(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.ContactPhone = req.ContactPhone
+		}
+
+		// 2. 微信二维码更新
+		if req.WechatQRCode != "" {
+			var supplierInfo *gorm_model.YounggeeSubAccount
+			supplierInfo = &gorm_model.YounggeeSubAccount{}
+			supplierInfo.WechatQRCode = req.WechatQRCode
+			supplierInfo.SubAccountId = req.SubAccountId
+			updateSupplierErr := db.UpdateSubAccount(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.WechatQRCode = req.WechatQRCode
+
+		}
+
+		// 2. 微信号码更新
+		if req.WechatNumber != "" {
+			var supplierInfo *gorm_model.YounggeeSubAccount
+			supplierInfo = &gorm_model.YounggeeSubAccount{}
+			supplierInfo.WechatNumber = req.WechatNumber
+			supplierInfo.SubAccountId = req.SubAccountId
+			updateSupplierErr := db.UpdateSubAccount(ctx, supplierInfo)
+			if updateSupplierErr != nil {
+				log.Infof("[UpdateSupplierContactInfo] fail,err:%+v", updateSupplierErr)
+				return nil, false, updateSupplierErr
+			}
+			contactInfo.WechatNumber = req.WechatNumber
+		}
+	}
+
+	return contactInfo, true, nil
+}
+
+// SaveSupplierReviewInfo 保存服务商认证信息
 func (*supplier) SaveSupplierReviewInfo(ctx context.Context, req *http_model.SaveReviewRequest) error {
 	var supplierInfo *gorm_model.YoungeeSupplier
 	supplierInfo = &gorm_model.YoungeeSupplier{}