合并分支 'dev' 到 'test'
Dev 查看合并请求 !55
正在显示
7 个修改的文件
包含
88 行增加
和
6 行删除
.DS_Store
0 → 100644
不能预览此文件类型
@@ -76,7 +76,7 @@ spec: | @@ -76,7 +76,7 @@ spec: | ||
76 | - name: UCENTER_SECRET | 76 | - name: UCENTER_SECRET |
77 | value: "cykbjnfqgctn" | 77 | value: "cykbjnfqgctn" |
78 | - name: UCENTER_APP_KEY | 78 | - name: UCENTER_APP_KEY |
79 | - value: "39aefef9e22744a3b2d2d3791824ae7b"s | 79 | + value: "39aefef9e22744a3b2d2d3791824ae7b" |
80 | - name: UCENTER_CHECK_ALT | 80 | - name: UCENTER_CHECK_ALT |
81 | value: "rsF0pL!6DwjBO735" | 81 | value: "rsF0pL!6DwjBO735" |
82 | - name: BUSINESS_ADMIN_HOST | 82 | - name: BUSINESS_ADMIN_HOST |
@@ -76,6 +76,12 @@ type ImportEmployeeData struct { | @@ -76,6 +76,12 @@ type ImportEmployeeData struct { | ||
76 | Edit []EmployeeData `json:"edit"` | 76 | Edit []EmployeeData `json:"edit"` |
77 | } | 77 | } |
78 | 78 | ||
79 | +// ChangePhoneData 修改手机号 | ||
80 | +type ChangePhoneData struct { | ||
81 | + OldPhone string `json:"old_phone"` | ||
82 | + NewPhone string `json:"new_phone"` | ||
83 | +} | ||
84 | + | ||
79 | //SyncEmployeeService 同步用户数据 | 85 | //SyncEmployeeService 同步用户数据 |
80 | type SyncEmployeeService struct{} | 86 | type SyncEmployeeService struct{} |
81 | 87 | ||
@@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro | @@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro | ||
144 | // case "batchRemove": | 150 | // case "batchRemove": |
145 | // //移动通讯录用户部门 暂时不需要 | 151 | // //移动通讯录用户部门 暂时不需要 |
146 | // return nil | 152 | // return nil |
153 | + case "changePhoneAllCompany": // TODO 修改手机号 | ||
154 | + // 修改手机号 | ||
155 | + var ( | ||
156 | + err error | ||
157 | + data ChangePhoneData | ||
158 | + ) | ||
159 | + err = json.Unmarshal(byteData, &data) | ||
160 | + if err != nil { | ||
161 | + return fmt.Errorf("数据解析失败:%s", err) | ||
162 | + } | ||
163 | + return service.changePhone(data) | ||
147 | case "import": | 164 | case "import": |
148 | //批量导入 | 165 | //批量导入 |
149 | var ( | 166 | var ( |
@@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e | @@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e | ||
428 | return err | 445 | return err |
429 | } | 446 | } |
430 | 447 | ||
448 | +// ChangePhone TODO 修改手机号 | ||
449 | +func (service SyncEmployeeService) changePhone(data ChangePhoneData) error { | ||
450 | + var ( | ||
451 | + transactionContext, _ = factory.CreateTransactionContext(nil) | ||
452 | + err error | ||
453 | + ) | ||
454 | + if err = transactionContext.StartTransaction(); err != nil { | ||
455 | + return err | ||
456 | + } | ||
457 | + defer func() { | ||
458 | + _ = transactionContext.RollbackTransaction() | ||
459 | + }() | ||
460 | + | ||
461 | + var uDao *dao.UsersDao | ||
462 | + if uDao, err = factory.CreateUsersDao(map[string]interface{}{ | ||
463 | + "transactionContext": transactionContext, | ||
464 | + }); err != nil { | ||
465 | + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
466 | + } | ||
467 | + | ||
468 | + var pDao *dao.PartnerInfoDao | ||
469 | + if pDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{ | ||
470 | + "transactionContext": transactionContext, | ||
471 | + }); err != nil { | ||
472 | + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
473 | + } | ||
474 | + | ||
475 | + // TODO 更新合伙人手机号 | ||
476 | + if err = pDao.UpdatePartnerPhone(data.OldPhone, data.NewPhone); err != nil { | ||
477 | + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
478 | + } | ||
479 | + | ||
480 | + // 更新高管手机号 | ||
481 | + if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil { | ||
482 | + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
483 | + } | ||
484 | + | ||
485 | + err = transactionContext.CommitTransaction() | ||
486 | + return err | ||
487 | +} | ||
488 | + | ||
431 | //ChangeAdmin 变更公司负责人,超级管理员 | 489 | //ChangeAdmin 变更公司负责人,超级管理员 |
432 | func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error { | 490 | func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error { |
433 | var ( | 491 | var ( |
@@ -2,11 +2,11 @@ package constant | @@ -2,11 +2,11 @@ package constant | ||
2 | 2 | ||
3 | import "os" | 3 | import "os" |
4 | 4 | ||
5 | -var POSTGRESQL_DB_NAME = "partner_test" | 5 | +var POSTGRESQL_DB_NAME = "partner_dev" |
6 | var POSTGRESQL_USER = "postgres" | 6 | var POSTGRESQL_USER = "postgres" |
7 | -var POSTGRESQL_PASSWORD = "1993618jack" // eagle1010 1993618jack | ||
8 | -var POSTGRESQL_HOST = "127.0.0.1" // 114.55.200.59 127.0.0.1 | ||
9 | -var POSTGRESQL_PORT = "5432" // 31543 5432 | 7 | +var POSTGRESQL_PASSWORD = "eagle1010" |
8 | +var POSTGRESQL_HOST = "114.55.200.59" | ||
9 | +var POSTGRESQL_PORT = "31543" | ||
10 | var DISABLE_CREATE_TABLE = false | 10 | var DISABLE_CREATE_TABLE = false |
11 | var DISABLE_SQL_GENERATE_PRINT = false | 11 | var DISABLE_SQL_GENERATE_PRINT = false |
12 | 12 |
@@ -31,6 +31,17 @@ func (dao PartnerInfoDao) PartnerAccountExist(account string, companyId int64) ( | @@ -31,6 +31,17 @@ func (dao PartnerInfoDao) PartnerAccountExist(account string, companyId int64) ( | ||
31 | return ok, err | 31 | return ok, err |
32 | } | 32 | } |
33 | 33 | ||
34 | +// UpdatePartnerPhone 更新合伙人手机号 | ||
35 | +func (dao PartnerInfoDao) UpdatePartnerPhone(oldPhone string, newPhone string) error { | ||
36 | + tx := dao.transactionContext.PgDd | ||
37 | + m := &models.PartnerInfo{} | ||
38 | + _, err := tx.Model(m). | ||
39 | + Where("account=?", oldPhone). | ||
40 | + Set("account=?", newPhone). | ||
41 | + Update() | ||
42 | + return err | ||
43 | +} | ||
44 | + | ||
34 | func (dao PartnerInfoDao) UpdatePartnerStatus(ids []int64, companyId int64, status int) error { | 45 | func (dao PartnerInfoDao) UpdatePartnerStatus(ids []int64, companyId int64, status int) error { |
35 | tx := dao.transactionContext.PgDd | 46 | tx := dao.transactionContext.PgDd |
36 | m := &models.PartnerInfo{} | 47 | m := &models.PartnerInfo{} |
@@ -2,7 +2,6 @@ package dao | @@ -2,7 +2,6 @@ package dao | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | - | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models" | 5 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models" |
7 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction" |
8 | ) | 7 | ) |
@@ -30,3 +29,14 @@ func (dao UsersDao) UpdateUserStatus(ids []int64, ststus int8) error { | @@ -30,3 +29,14 @@ func (dao UsersDao) UpdateUserStatus(ids []int64, ststus int8) error { | ||
30 | Update() | 29 | Update() |
31 | return err | 30 | return err |
32 | } | 31 | } |
32 | + | ||
33 | +// UpdateUserPhone 更新用户手机号 | ||
34 | +func (dao UsersDao) UpdateUserPhone(oldPhone string, newPhone string) error { | ||
35 | + tx := dao.transactionContext.PgTx | ||
36 | + m := &models.Users{} | ||
37 | + _, err := tx.Model(m). | ||
38 | + Set("phone=?", newPhone). | ||
39 | + Where("phone=?", oldPhone). | ||
40 | + Update() | ||
41 | + return err | ||
42 | +} |
@@ -18,6 +18,9 @@ func init() { | @@ -18,6 +18,9 @@ func init() { | ||
18 | //beego.NSRouter("/company/info", &controllers.SyncDataController{}, "post:GetCompanyInfo"), | 18 | //beego.NSRouter("/company/info", &controllers.SyncDataController{}, "post:GetCompanyInfo"), |
19 | ) | 19 | ) |
20 | 20 | ||
21 | + // 修改手机号,企业平台调用 | ||
22 | + beego.Router("/api/business/index", &controllers.SyncDataController{}, "Post:SyncData") | ||
23 | + | ||
21 | beego.AddNamespace(nsPlatform) //企业平台调用 | 24 | beego.AddNamespace(nsPlatform) //企业平台调用 |
22 | beego.AddNamespace(nsUcenter) //统一用户中心调用 | 25 | beego.AddNamespace(nsUcenter) //统一用户中心调用 |
23 | } | 26 | } |
-
请 注册 或 登录 后发表评论