gin Redirect 301 重定向
func (a *ShortUrlController) QueryUrlLong(c *gin.Context) {
short := c.Param("short")
status, msg := biz.QueryUrlByKey(short)
if status == 0 {
//如果存在原始url 直接重定向到新地址 实现短链接功能
c.Redirect(http.StatusMovedPermanently, msg)
} else {
//不存在则返回具体信息
c.JSONP(http.StatusOK, gin.H{
"status": status,
"msg": msg,
})
}
}