func ShowIndex(c *gin.Context) { data := tool.GetTD(c) goods := model.Goods{} goods_list := goods.GetAll() data["goods_list"] = goods_list me := tool.GetMe(c) if me.ID > 0 { data["address_list"] = me.GetAddressList() //data["order_list"] = me.GetOrderList() } c.HTML(http.StatusOK, "index.html", data) }
func NewAddress(c *gin.Context) { me := tool.GetMe(c) if me.ID > 0 { var cookie middleware.CookieManager cookie = c.MustGet("CM").(middleware.CookieManager) province := c.PostForm("province") city := c.PostForm("city") detail := c.PostForm("detail") name := c.PostForm("name") phone := c.PostForm("phone") address := model.Address{Province: province, City: city, Detail: detail, Name: name, Phone: phone, UserID: int(me.ID)} address.Create() cookie.Flash("success_msg", "address add success") c.Redirect(http.StatusMovedPermanently, "/") } }