作者 陈志颖

fix:删除员工状态改为禁用

@@ -88,12 +88,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s @@ -88,12 +88,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
88 uids = append(uids, int64(uid.(float64))) 88 uids = append(uids, int64(uid.(float64)))
89 } 89 }
90 } 90 }
91 - if value, ok := data["add"]; ok { 91 + if value, ok := data["add"]; ok { // 添加员工
92 for _, addEmployee := range value.([]interface{}) { 92 for _, addEmployee := range value.([]interface{}) {
93 addEmployees = append(addEmployees, addEmployee.(map[string]interface{})) 93 addEmployees = append(addEmployees, addEmployee.(map[string]interface{}))
94 } 94 }
95 } 95 }
96 - if value, ok := data["edit"]; ok { 96 + if value, ok := data["edit"]; ok { // 编辑员工
97 for _, editEmployee := range value.([]interface{}) { 97 for _, editEmployee := range value.([]interface{}) {
98 editEmployees = append(editEmployees, editEmployee.(map[string]interface{})) 98 editEmployees = append(editEmployees, editEmployee.(map[string]interface{}))
99 } 99 }
@@ -13,12 +13,18 @@ type EmployeeDao struct { @@ -13,12 +13,18 @@ type EmployeeDao struct {
13 transactionContext *pgTransaction.TransactionContext 13 transactionContext *pgTransaction.TransactionContext
14 } 14 }
15 15
16 -// 删除用户 16 +// 删除用户(stevechan: 删除员工为修改为禁用状态)
17 func (dao *EmployeeDao) BatchRemove(uids []int64) error { 17 func (dao *EmployeeDao) BatchRemove(uids []int64) error {
  18 + //tx := dao.transactionContext.PgTx
  19 + //_, err := tx.QueryOne(
  20 + // pg.Scan(),
  21 + // "DELETE FROM employees WHERE uid IN (?)",
  22 + // pg.In(uids))
  23 + //return err
18 tx := dao.transactionContext.PgTx 24 tx := dao.transactionContext.PgTx
19 _, err := tx.QueryOne( 25 _, err := tx.QueryOne(
20 pg.Scan(), 26 pg.Scan(),
21 - "DELETE FROM employees WHERE uid IN (?)", 27 + "UPDATE employees SET status = 2 WHERE uid IN (?)",
22 pg.In(uids)) 28 pg.In(uids))
23 return err 29 return err
24 } 30 }