You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.7 KiB
48 lines
1.7 KiB
package transurl |
|
|
|
var urlMap = map[string]string{ |
|
"/beijing": "/question-list/alatest/1", |
|
"/shanghai": "/question-list/alatest/2", |
|
"/guangzhou": "/question-list/alatest/54", |
|
"/shenzhen": "/question-list/alatest/55", |
|
"/chengdu": "/question-list/alatest/63", |
|
"/xi'an": "/question-list/alatest/64", |
|
"/hangzhou": "/question-list/alatest/59", |
|
"/qingdao": "/question-list/alatest/65", |
|
"/dalian": "/question-list/alatest/69", |
|
"/suzhou": "/question-list/alatest/67", |
|
"/nanjing": "/question-list/alatest/68", |
|
"/arts-entertainment": "/question-list/alatest/34", |
|
"/business-jobs": "/question-list/alatest/3", |
|
"/culture": "/question-list/alatest/4", |
|
"/falimy-kids": "/question-list/alatest/45", |
|
"/food": "/question-list/alatest/35", |
|
"/general": "/question-list/alatest/36", |
|
"/health-safety": "/question-list/alatest/39", |
|
"/housing": "/question-list/alatest/49", |
|
"/lifestyle": "/question-list/alatest/1058", |
|
"/money-banking": "/question-list/alatest/1059", |
|
"/relationships": "/question-list/alatest/53", |
|
"/shopping": "/question-list/alatest/41", |
|
"/sports": "/question-list/alatest/95", |
|
"/teaching-learning": "/question-list/alatest/43", |
|
"/transport-travel": "/question-list/alatest/47", |
|
"/visa-legalities": "/question-list/alatest/48", |
|
"/web-technology": "/question-list/alatest/44", |
|
} |
|
|
|
func GetLonUrl(src string) string { |
|
if v, ok := urlMap[src]; ok { |
|
return v |
|
} |
|
return src |
|
} |
|
|
|
func GetShortUrl(dst string) string { |
|
for src, dt := range urlMap { |
|
if dt == dst { |
|
return src |
|
} |
|
} |
|
return dst |
|
}
|
|
|