package main import ( "app.yhyue.com/moapp/jybase/common" "database/sql" "log" ) // 新增动态 func AddChangeRecord(tx *sql.Tx, clueId, positionId int64, changeField, changeType, newValue, oldValue, nowTime, BCPCID string, operatorId int64) int64 { if BCPCID == "" { BCPCID = common.GetRandom(32) } if tx == nil { return TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{ "clue_id": clueId, "position_id": positionId, "change_field": changeField, "change_type": changeType, "old_value": oldValue, "new_value": newValue, "createtime": nowTime, "BCPCID": BCPCID, "operator_id": operatorId, }) } return TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{ "clue_id": clueId, "position_id": positionId, "change_field": changeField, "change_type": changeType, "old_value": oldValue, "new_value": newValue, "createtime": nowTime, "BCPCID": BCPCID, "operator_id": operatorId, }) } // 通过职位id换人名 func FindPositionToName(positionId int64) string { data := TiDb.SelectBySql(`select name from dwd_f_crm_personnel_management where resign = 0 and position_id = ? limit 1`, positionId) if data != nil && len(*data) > 0 { return common.ObjToString((*data)[0]["name"]) } return "" } // 通过坐席号换人名 func FindSeatNumberToName(seatNumber string) string { data := TiDb.SelectBySql(`select name from dwd_f_crm_personnel_management where resign = 0 and seat_number = ? limit 1`, seatNumber) if data != nil && len(*data) > 0 { return common.ObjToString((*data)[0]["name"]) } return "" } // 锁定人变更 func UpdateLockPositionId(clueId, lockPositionId int64) { ok := TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{ "id": clueId, }, map[string]interface{}{ "lock_position_id": lockPositionId, }) log.Println("锁定人信息修改:", clueId, lockPositionId, ok) return } // 锁定状态变更 func UpdateLockStatus(clueId, lockStatus int64) { ok := TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{ "id": clueId, }, map[string]interface{}{ "lock_status": lockStatus, }) log.Println("锁定状态信息修改:", clueId, lockStatus, ok) return }