Beispiel #1
0
func (c *PhotoController) OrderDet() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("OrderDet Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("OrderDet Post")
	}
	id := c.Input().Get("id")
	beego.Debug("id:", id)
	if len(id) != 0 {
		porder, err := models.GetPorder(id)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Porder"] = porder
		beego.Debug("Porder:", porder)
		pdetails, err := models.GetPdetails(porder.OpenId, porder.Pnumber)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Pdetails"] = pdetails
		beego.Debug("Pdetails:", pdetails)
	}

	c.TplName = "porderdet.html"
}
Beispiel #2
0
func (c *PhotoController) AdminDetails() {
	bool, username := chackAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/admin", 302)
		return
	}
	c.Data["isUser"] = bool
	c.Data["User"] = username
	id := c.Input().Get("id")
	beego.Debug("id:", id)
	if len(id) != 0 {
		porder, err := models.GetPorder(id)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Porder"] = porder
		beego.Debug("Porder:", porder)
		pdetails, err := models.GetPdetails(porder.OpenId, porder.Pnumber)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Pdetails"] = pdetails
		psize, err := models.GetOnePsize(porder.PsizeId)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Psize"] = psize

		ptemp, err := models.GetOnePtemp(porder.PtempId)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Ptemp"] = ptemp
		beego.Debug("Ptemp:", ptemp)
		var photos_i []int64
		// beego.Debug(photos)
		err = json.Unmarshal([]byte(porder.Photos), &photos_i)
		if err != nil {
			beego.Error(err)
		}
		var photoss []*models.Photos
		for i := 0; i < len(photos_i); i++ {
			photos, err := models.GetOnePhotos(photos_i[i])
			if err != nil {
				beego.Error(err)

			}
			photoss = append(photoss, photos)
		}
		c.Data["Photos"] = photoss

	}
	c.TplName = "padmindetails.html"
}