package controllers

import "merchant/sys/enum"

type DownloadController struct {
	KeepSession
}

func (c *DownloadController) Code() {
	ranMd5 := encrypt.EncodeMd5([]byte(pubMethod.RandomString(46)))
	c.Ctx.SetCookie(enum.UserCookie, ranMd5, enum.CookieExpireTime)
	c.Ctx.SetSecureCookie(ranMd5, enum.UserCookie, ranMd5, enum.CookieExpireTime)
	_ = c.SetSession(enum.UserCookie, ranMd5)

	c.Ctx.Output.Download(enum.CodePath, enum.CodeName)
}
