作者 陈志颖

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

... ... @@ -88,12 +88,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
uids = append(uids, int64(uid.(float64)))
}
}
if value, ok := data["add"]; ok {
if value, ok := data["add"]; ok { // 添加员工
for _, addEmployee := range value.([]interface{}) {
addEmployees = append(addEmployees, addEmployee.(map[string]interface{}))
}
}
if value, ok := data["edit"]; ok {
if value, ok := data["edit"]; ok { // 编辑员工
for _, editEmployee := range value.([]interface{}) {
editEmployees = append(editEmployees, editEmployee.(map[string]interface{}))
}
... ...
... ... @@ -13,12 +13,18 @@ type EmployeeDao struct {
transactionContext *pgTransaction.TransactionContext
}
// 删除用户
// 删除用户(stevechan: 删除员工为修改为禁用状态)
func (dao *EmployeeDao) BatchRemove(uids []int64) error {
//tx := dao.transactionContext.PgTx
//_, err := tx.QueryOne(
// pg.Scan(),
// "DELETE FROM employees WHERE uid IN (?)",
// pg.In(uids))
//return err
tx := dao.transactionContext.PgTx
_, err := tx.QueryOne(
pg.Scan(),
"DELETE FROM employees WHERE uid IN (?)",
"UPDATE employees SET status = 2 WHERE uid IN (?)",
pg.In(uids))
return err
}
... ...