作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !55
不能预览此文件类型
... ... @@ -76,7 +76,7 @@ spec:
- name: UCENTER_SECRET
value: "cykbjnfqgctn"
- name: UCENTER_APP_KEY
value: "39aefef9e22744a3b2d2d3791824ae7b"s
value: "39aefef9e22744a3b2d2d3791824ae7b"
- name: UCENTER_CHECK_ALT
value: "rsF0pL!6DwjBO735"
- name: BUSINESS_ADMIN_HOST
... ...
... ... @@ -76,6 +76,12 @@ type ImportEmployeeData struct {
Edit []EmployeeData `json:"edit"`
}
// ChangePhoneData 修改手机号
type ChangePhoneData struct {
OldPhone string `json:"old_phone"`
NewPhone string `json:"new_phone"`
}
//SyncEmployeeService 同步用户数据
type SyncEmployeeService struct{}
... ... @@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro
// case "batchRemove":
// //移动通讯录用户部门 暂时不需要
// return nil
case "changePhoneAllCompany": // TODO 修改手机号
// 修改手机号
var (
err error
data ChangePhoneData
)
err = json.Unmarshal(byteData, &data)
if err != nil {
return fmt.Errorf("数据解析失败:%s", err)
}
return service.changePhone(data)
case "import":
//批量导入
var (
... ... @@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e
return err
}
// ChangePhone TODO 修改手机号
func (service SyncEmployeeService) changePhone(data ChangePhoneData) error {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
err error
)
if err = transactionContext.StartTransaction(); err != nil {
return err
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
var uDao *dao.UsersDao
if uDao, err = factory.CreateUsersDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
var pDao *dao.PartnerInfoDao
if pDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
// TODO 更新合伙人手机号
if err = pDao.UpdatePartnerPhone(data.OldPhone, data.NewPhone); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
// 更新高管手机号
if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
err = transactionContext.CommitTransaction()
return err
}
//ChangeAdmin 变更公司负责人,超级管理员
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
var (
... ...
... ... @@ -2,11 +2,11 @@ package constant
import "os"
var POSTGRESQL_DB_NAME = "partner_test"
var POSTGRESQL_DB_NAME = "partner_dev"
var POSTGRESQL_USER = "postgres"
var POSTGRESQL_PASSWORD = "1993618jack" // eagle1010 1993618jack
var POSTGRESQL_HOST = "127.0.0.1" // 114.55.200.59 127.0.0.1
var POSTGRESQL_PORT = "5432" // 31543 5432
var POSTGRESQL_PASSWORD = "eagle1010"
var POSTGRESQL_HOST = "114.55.200.59"
var POSTGRESQL_PORT = "31543"
var DISABLE_CREATE_TABLE = false
var DISABLE_SQL_GENERATE_PRINT = false
... ...
... ... @@ -31,6 +31,17 @@ func (dao PartnerInfoDao) PartnerAccountExist(account string, companyId int64) (
return ok, err
}
// UpdatePartnerPhone 更新合伙人手机号
func (dao PartnerInfoDao) UpdatePartnerPhone(oldPhone string, newPhone string) error {
tx := dao.transactionContext.PgDd
m := &models.PartnerInfo{}
_, err := tx.Model(m).
Where("account=?", oldPhone).
Set("account=?", newPhone).
Update()
return err
}
func (dao PartnerInfoDao) UpdatePartnerStatus(ids []int64, companyId int64, status int) error {
tx := dao.transactionContext.PgDd
m := &models.PartnerInfo{}
... ...
... ... @@ -2,7 +2,6 @@ package dao
import (
"fmt"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
)
... ... @@ -30,3 +29,14 @@ func (dao UsersDao) UpdateUserStatus(ids []int64, ststus int8) error {
Update()
return err
}
// UpdateUserPhone 更新用户手机号
func (dao UsersDao) UpdateUserPhone(oldPhone string, newPhone string) error {
tx := dao.transactionContext.PgTx
m := &models.Users{}
_, err := tx.Model(m).
Set("phone=?", newPhone).
Where("phone=?", oldPhone).
Update()
return err
}
... ...
... ... @@ -18,6 +18,9 @@ func init() {
//beego.NSRouter("/company/info", &controllers.SyncDataController{}, "post:GetCompanyInfo"),
)
// 修改手机号,企业平台调用
beego.Router("/api/business/index", &controllers.SyncDataController{}, "Post:SyncData")
beego.AddNamespace(nsPlatform) //企业平台调用
beego.AddNamespace(nsUcenter) //统一用户中心调用
}
... ...