示例#1
0
//菜单
func (c *DqsjController) Cai() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("Cai Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("Cai Post")
	}
	//微信分享
	token := getDqsjToken()
	if len(token) > 0 {
		beego.Debug("http_dqsj_token :", token)
	}
	appId := ""
	isdebug := "flase"
	iniconf, err := config.NewConfig("json", "conf/myconfig.json")
	if err != nil {
		beego.Debug(err)
	} else {
		appId = iniconf.String("qax580::appid")
		isdebug = iniconf.String("qax580::isdebug")
	}
	url := "http://www.baoguangguang.cn/dqsj/cai"
	if isdebug == "true" {
		url = "http://localhost:8080/dqsj/cai"
	}
	timestamp := time.Now().Unix()
	noncestr := getNonceStr(16, KC_RAND_KIND_ALL)
	ticket := getDqsjTicket(token)
	c.Data["AppId"] = appId
	c.Data["TimesTamp"] = timestamp
	c.Data["NonceStr"] = noncestr
	c.Data["Ticket"] = signatureWxJs(ticket, noncestr, timestamp, url)
	wxShareCon := models.WxShareCon{}
	wxShareCon.Title = "大签世界火盆烤肉欢迎您的到来!"
	wxShareCon.Link = url
	wxShareCon.ImgUrl = "http://182.92.167.29:8080/static/img/dqsjicon.jpg"
	c.Data["WxShareCon"] = wxShareCon
	// beego.Debug(wxShareCon)

	objs, err := models.GetAllCaiGroupState1()
	if err != nil {
		beego.Error(err)
	}
	var showCaiGroup []models.DqsjShowCaiGroup
	for i := 0; i < len(objs); i++ {
		objitem, err := models.GetAllCaiItemState1(objs[i].Id)
		if err != nil {
			beego.Error(err)
		} else {
			obgshow := models.DqsjShowCaiGroup{Id: objs[i].Id, Name: objs[i].Name,
				OrderId: objs[i].OrderId, State: objs[i].State, Time: objs[i].Time, CaiItems: objitem}
			showCaiGroup = append(showCaiGroup, obgshow)
		}

	}

	c.Data["ShowCaiGroup"] = showCaiGroup
	tips, err := models.GetAllCaiTipsState1()
	if err != nil {
		beego.Error(err)
	}
	c.Data["CaiTips"] = tips

	config, err := models.GetConfigPan()
	bpan := false
	if config != nil {
		bpan = config.Bpan
	}
	c.Data["Bpan"] = bpan

	c.TplName = "dqsjcai.html"
}
示例#2
0
func (c *DqsjController) AdminPan() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("AdminPan Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("AdminPan Post")
	}
	bool, _ := chackDqsjAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/dqsj/adminlogin", 302)
		return
	}

	op := c.Input().Get("op")
	beego.Debug("op :", op)
	switch op {
	case "del":
		id := c.Input().Get("id")
		err := models.DeletePanItem(id)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/adminpan", 302)
		return
	case "state0":
		id := c.Input().Get("id")
		err := models.UpdatePanItem(id, 1)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/adminpan", 302)
		return
	case "state1":
		id := c.Input().Get("id")
		err := models.UpdatePanItem(id, 0)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/adminpan", 302)
		return
	}
	panitem, err := models.GetAllPanItem()
	if err != nil {
		beego.Error(err)
	}
	//计算总概率
	allProbability := int64(0)
	for i := 0; i < len(panitem); i++ {
		if panitem[i].State == 1 {
			allProbability += panitem[i].Probability
		}
	}
	for i := 0; i < len(panitem); i++ {
		panitem[i].AllProbability = allProbability
	}
	c.Data["PanItem"] = panitem

	config, err := models.GetConfigPan()
	bpan := false
	if config != nil {
		bpan = config.Bpan
	}
	c.Data["Bpan"] = bpan
	c.TplName = "dqsjadminpan.html"
}
示例#3
0
//主页
func (c *DqsjController) Home() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("Home Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("Home Post")
	}
	//微信分享
	token := getDqsjToken()
	if len(token) > 0 {
		beego.Debug("http_dqsj_token :", token)
	}
	appId := ""
	isdebug := "flase"
	iniconf, err := config.NewConfig("json", "conf/myconfig.json")
	if err != nil {
		beego.Debug(err)
	} else {
		appId = iniconf.String("qax580::appid")
		isdebug = iniconf.String("qax580::isdebug")
	}
	url := "http://www.baoguangguang.cn/dqsj/home"
	if isdebug == "true" {
		url = "http://localhost:8080/dqsj/home"
	}

	timestamp := time.Now().Unix()
	noncestr := getNonceStr(16, KC_RAND_KIND_ALL)
	ticket := getDqsjTicket(token)
	c.Data["AppId"] = appId
	c.Data["TimesTamp"] = timestamp
	c.Data["NonceStr"] = noncestr
	c.Data["Ticket"] = signatureWxJs(ticket, noncestr, timestamp, url)
	wxShareCon := models.WxShareCon{}
	wxShareCon.Title = "大签世界火盆烤肉欢迎您的到来!"
	wxShareCon.Link = url
	wxShareCon.ImgUrl = "http://182.92.167.29:8080/static/img/dqsjicon.jpg"
	c.Data["WxShareCon"] = wxShareCon
	// beego.Debug(wxShareCon)

	//广告栏
	c.Data["ImgUrlPath"] = getImageUrl()
	guanggaos, err := models.GetAllDqsjGuanggaosState1()
	if err != nil {
		beego.Error(err)
	}
	c.Data["Guanggaos"] = guanggaos

	obj, err := models.GetOneDqsjHome()
	if err != nil {
		beego.Debug(err)
	}
	c.Data["HuoDong"] = ""
	if obj != nil {
		c.Data["HuoDong"] = obj.HuoDong
		beego.Debug("HuoDong:", obj.HuoDong)
	}
	obj1, err := models.GetAllDqsjHDState1()
	if err != nil {
		beego.Debug(err)
	}
	if obj1 != nil {
		for i := 0; i < len(obj1); i++ {
			obj1[i].ShowId = int64(i + 1)
		}
	}
	c.Data["DqsjHuoDong"] = obj1

	config, err := models.GetConfigPan()
	bpan := false
	if config != nil {
		bpan = config.Bpan
	}
	c.Data["Bpan"] = bpan

	c.TplName = "dqsjhome.html"
}