Ejemplo n.º 1
0
//func expandTravelList(resultMaps []map[string]interface{})[]map[string]interface{}{
//	for idx, travelMap := range resultMaps{
//		resultMaps[idx]=expandTravelMap(travelMap)
//	}
//	return resultMaps
//}
//func expandTravelMap(travelMap map[string]interface{})map[string]interface{}{
//	if sn, ok := travelMap[s.Approver]; ok{
//		if status, userMap := userMgr.Get(sn.(string)); status == stat.Success{
//			name, _ := userMap[s.Name]
//			travelMap[s.ApproverSn]= travelMap[s.Approver]
//			travelMap[s.Approver] = name
//		}
//	}
//	if sn, ok := travelMap[s.Traveler];ok{
//		if status, userMap := userMgr.Get(sn.(string)); status == stat.Success{
//			name, _ := userMap[s.Name]
//			travelMap[s.TravelerSn] = travelMap[s.Traveler]
//			travelMap[s.Traveler] = name
//		}
//	}
//	return travelMap
//}
func expandTravelMapForUpdate(travelMap map[string]interface{}) map[string]interface{} {
	if sn, ok := travelMap[s.Approver]; ok {
		if status, userMap := userMgr.Get(sn.(string)); status == stat.Success {
			name, _ := userMap[s.Name]
			travelMap[s.ApproverName] = name
		}
	}
	if sn, ok := travelMap[s.Traveler]; ok {
		if status, userMap := userMgr.Get(sn.(string)); status == stat.Success {
			name, _ := userMap[s.Name]
			userName, _ := userMap[s.UserName]
			travelMap["traveler_key"] = userName
			travelMap["traveler_name"] = name
		}
	}
	beego.Debug("expandTravelMapForUpdate", travelMap)
	return travelMap
}
Ejemplo n.º 2
0
func extendUser2ItemMap(travelMap map[string]interface{}, fields ...string) map[string]interface{} {
	for _, fieldName := range fields {
		if sn, ok := travelMap[fieldName]; ok {
			if status, userMap := userMgr.Get(sn.(string)); status == stat.Success {
				name, _ := userMap[s.Name]
				travelMap[fieldName+s.Name] = name
			}
		}
	}
	return travelMap
}