This commit is contained in:
suyl
2021-06-03 16:19:54 +08:00
parent 588f71abcf
commit 384aa5500a
3 changed files with 60 additions and 25 deletions

View File

@@ -4887,14 +4887,6 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
if err != nil {
return err
}
if auditStatus == model.StoreMapAuditStatusPass {
if storeMapAudit.VendorOrgCode == "" && vendorOrgCode == "" {
return fmt.Errorf("请选择平台账号进行绑定!")
}
if vendorStoreID == "" {
return fmt.Errorf("请输入绑定的平台门店ID")
}
}
retVal, err := GetVendorStore(ctx, storeMapAudit.VendorID, vendorOrgCode, vendorStoreID)
if err != nil {
return err
@@ -4902,5 +4894,23 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
if retVal == nil {
return fmt.Errorf("未在平台上查询到此门店请确认平台账号和平台门店ID")
}
if auditStatus == model.StoreMapAuditStatusPass {
if storeMapAudit.VendorOrgCode == "" && vendorOrgCode == "" {
return fmt.Errorf("请选择平台账号进行绑定!")
}
if vendorStoreID == "" {
return fmt.Errorf("请输入绑定的平台门店ID")
}
storeMap := &model.StoreMap{}
AddStoreVendorMap(ctx, db, storeMapAudit.VendorID, vendorOrgCode, storeMapAudit.StoreID, storeMap)
} else {
if comment == "" {
fmt.Errorf("审核不通过请输入原因!")
}
}
storeMapAudit.AuditStatus = auditStatus
storeMapAudit.AuditAt = time.Now()
storeMapAudit.AuditOperator = ctx.GetUserName()
dao.UpdateEntity(db, storeMapAudit, "AuditStatus", "AuditAt", "AuditOperator")
return err
}

View File

@@ -161,6 +161,7 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
user.Type = model.UserTypeConsumer | model.UserTypeStoreBoss // 先不区分商户与消息者
createName := ctx.GetRealRemoteIP()
authType := auth2.AuthTypeMobile
mobile := &alipayapi.KeyMobile{}
if manTokenInfo != nil && mobileVerifyCode == "" {
manUser, err2 := dao.GetUserByID(dao.GetDB(), "user_id", manTokenInfo.GetID())
if err = err2; err != nil {
@@ -217,6 +218,21 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
user.Avatar = inAuthInfo.GetAvatar()
}
}
//支付宝注册电话需要解密
if user.GetMobile() != "" && user.GetName() != "" && user.GetID2() != "" {
if user.LastLoginType != "" && user.LastLoginType == alipay.AuthType {
data, _ := base64.StdEncoding.DecodeString(user.GetMobile())
key, _ := base64.StdEncoding.DecodeString(alipay.AuthKey)
iv := []byte{}
iv = append(iv, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
if result, err := utils.AESCBCDecpryt(data, key, iv); err == nil && result != nil {
json.Unmarshal(result, &mobile)
}
user.Mobile = &mobile.Mobile
user.UserID2 = mobile.Mobile
user.Name = mobile.Mobile
}
}
if err = CreateUser(user, utils.LimitUTF8StringLen(createName, 32)); err == nil {
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
TryAddStoreBossRole4User(ctx, user)
@@ -228,7 +244,12 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
outAuthInfo, err = auth2.BindUser(inAuthInfo, user)
}
} else if dao.IsDuplicateError(err) {
err = auth2.ErrUserID2AlreadyExist
if user.LastLoginType != "" && user.LastLoginType == alipay.AuthType {
outAuthInfo, err = auth2.BindUser(inAuthInfo, user)
err = nil
} else {
err = auth2.ErrUserID2AlreadyExist
}
}
return outAuthInfo, err
}
@@ -401,22 +422,7 @@ func CreateUser(user *model.User, creatorName string) (err error) {
if user.GetEmail() == "" {
user.Email = nil
}
//支付宝注册电话需要解密
if user.GetMobile() != "" && user.GetName() != "" && user.GetID2() != "" {
if user.LastLoginType != "" && user.LastLoginType == alipay.AuthType {
mobile := &alipayapi.KeyMobile{}
data, _ := base64.StdEncoding.DecodeString(user.GetMobile())
key, _ := base64.StdEncoding.DecodeString(alipay.AuthKey)
iv := []byte{}
iv = append(iv, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
if result, err := utils.AESCBCDecpryt(data, key, iv); err == nil && result != nil {
json.Unmarshal(result, &mobile)
}
user.Mobile = &mobile.Mobile
user.UserID2 = mobile.Mobile
user.Name = mobile.Mobile
}
}
dao.WrapAddIDCULDEntity(user, creatorName)
user.UserID = utils.GetUUID()
user.Status = model.UserStatusNormal

View File

@@ -1136,3 +1136,22 @@ func (c *StoreController) AuditStoreMap() {
return retVal, "", err
})
}
// @Title 查询商户申请授权
// @Description 查询商户申请授权
// @Param token header string true "认证token"
// @Param storeIDs query string false "门店IDs"
// @Param vendorIDs query string false "平台IDs"
// @Param auditStatuss query string false "审核状态s"
// @Param fromTime query string false "审核时间"
// @Param toTime query string false "审核时间"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50-1表示全部"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreMapAudit [get]
func (c *StoreController) GetStoreMapAudit() {
c.callGetStoreMapAudit(func(params *tStoreGetStoreMapAuditParams) (retVal interface{}, errCode string, err error) {
return retVal, "", err
})
}