• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang beego.Debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/astaxie/beego.Debug函数的典型用法代码示例。如果您正苦于以下问题:Golang Debug函数的具体用法?Golang Debug怎么用?Golang Debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Get

func (c *ContentController) Get() {
	openid := getContentCookie(c)
	op := c.Input().Get("op")
	beego.Debug("get op :---------------", op)
	switch op {
	case "con":
		id := c.Input().Get("id")
		if len(id) == 0 {
			break
		}
		// id = c.Input().Get("id")
		post, err := models.GetOnePost(id)
		if err != nil {
			beego.Error(err)
		}
		beego.Debug("id :", id)
		c.Data["Id"] = id
		c.Data["Post"] = post
		beego.Debug("is con " + post.Title)
		help_num, err := models.GatPostHelpNum(id)
		c.Data["HelpNum"] = help_num
		state, err := models.GatPaseHelpState(id, openid)
		c.Data["HelpState"] = state
		c.TplName = "content.html"
		return
	}
	c.TplName = "content.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:28,代码来源:content.go


示例2: Post

func (this *RoleController) Post() {
	form := models.RolePostForm{}
	err := json.Unmarshal(this.Ctx.Input.RequestBody, &form)
	if err != nil {
		beego.Debug("ParseRolePost:", err)
		this.RetError(errInputData)
		return
	}
	beego.Debug("ParseRolePost:", &form)

	regDate := time.Now()
	role := models.NewRole(&form, regDate)
	beego.Debug("NewRole:", role)

	if code, err := role.Insert(); err != nil {
		beego.Error("InsertRole:", err)
		if code == models.ErrDupRows {
			this.RetError(errDupUser)
		} else {
			this.RetError(errDatabase)
		}
		return
	}

	role.ClearPass()

	this.Data["json"] = &models.RolePostInfo{RoleInfo: role}
	this.ServeJson()
}
开发者ID:edwincastaneda,项目名称:beego-demo,代码行数:29,代码来源:roles.go


示例3: View

func (this *MainController) View() {
	var (
		post models.Post
		err  error
	)

	Title := this.Ctx.Input.Param(":Title")
	beego.Debug(";Title=", Title)
	if Title != "" {
		post.Title = Title
		err = post.Read("Title")
	} else {
		id, _ := strconv.Atoi(this.Ctx.Input.Param(":id"))
		post.Id = id
		err = post.Read()
	}
	if err != nil || post.Status != 0 {
		beego.Debug("show err:", err)
		this.Abort("404")
		return
	}

	post.Views++
	post.Update("Views")

	post.Content = strings.Replace(post.Content, "_ueditor_page_break_tag_", "", -1)

	this.Data["post"] = post
	//beego.Debug("show,post", post)
	this.setHeadMetas(post.Title, strings.Trim(post.Tags, ","), post.Title)
	this.display("post")
}
开发者ID:ShinichR,项目名称:myBlog,代码行数:32,代码来源:main.go


示例4: Get

func (c *ZhouBianWifiWXController) Get() {
	op := c.Input().Get("op")
	switch op {
	case "location":
		latitude := c.Input().Get("latitude")
		longitude := c.Input().Get("longitude")
		c.Data["latitude"] = latitude
		c.Data["longitude"] = longitude
		beego.Debug("latitude:", latitude)
		beego.Debug("longitude:", longitude)
		getWifi(longitude, latitude, c)
		c.TplName = "zhoubianwifi.html"
		return
	}
	appId := ""
	iniconf, err := config.NewConfig("json", "conf/myconfig.json")
	if err != nil {
		beego.Debug(err)
	} else {
		appId = iniconf.String("qax580::appid")
	}
	timestamp := time.Now().Unix()
	noncestr := getNonceStr(16, KC_RAND_KIND_ALL)
	c.Data["AppId"] = appId
	c.Data["TimesTamp"] = timestamp
	c.Data["NonceStr"] = noncestr
	getWifiWxJsToken(noncestr, timestamp, c)
	c.TplName = "zhoubianwifiwx.html"
	// getWifi("116.366324", "39.905859", c)
	// c.TplName = "zhoubianwifi.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:31,代码来源:zhoubianwifiwx.go


示例5: AdminAddCaiTips

func (c *DqsjController) AdminAddCaiTips() {
	bool, _ := chackDqsjAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/dqsj/adminlogin", 302)
		return
	}
	if c.Ctx.Input.IsGet() {
		beego.Debug("AdminAddCaiTips Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("AdminAddCaiTips Post")
		info := c.Input().Get("info")
		if len(info) != 0 {
			err := models.AddCaiTips(info)
			if err != nil {
				beego.Error(err)
			}
			c.Redirect("/dqsj/admincai", 302)
		} else {
			c.Redirect("/dqsj/adminaddcaitips", 302)
		}

	}
	c.TplName = "dqsjadminaddcaitips.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:27,代码来源:dqsj.go


示例6: run

func run() {
	for {
		for k, v := range alive {
			beego.Debug("keepalive", k, v)

			if time.Now().Sub(v.HitTime) >= time.Duration(TIMEOUT_INTERVAL)*time.Minute {
				//step 1: get and delete user status
				user := &UserStatus{
					UserMac: k,
				}
				user.Get() // first get for stop radius
				user.Delete()

				//step 2: stop radius
				user.Reason = int(radgo.DeauthReasonAging)
				radusr := &RadUser{
					User: user,
				}
				radgo.ClientAcctStop(radusr)

				//step 3: unregister user info
				info := &UserInfo{
					UserName: v.UserName,
				}
				info.UnRegister()

				//step 4: delete alive
				delete(alive, k)
			}
		}

		beego.Debug("Listener Gc running...")
		time.Sleep(GC_INTERVAL * time.Minute)
	}
}
开发者ID:tcdog001,项目名称:ums,代码行数:35,代码来源:keepalive.go


示例7: AddImg

func (c *ImageController) AddImg() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("ImageController AddImg Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("ImageController AddImg Post")
	}
	request_json := `{"errcode":1,"errmsg":"parameter error"}`
	// beego.Debug(c.Input())
	// beego.Debug(c.GetFile())
	images := c.Input().Get("images")
	beego.Debug("images:", images)
	if len(images) != 0 {
		// openid, err := getPhotoOpenId(c.Ctx)
		//json 到 []string
		// var wo []string
		// if err := json.Unmarshal(images, &wo); err == nil {
		// 	fmt.Println("================json 到 []string==")
		// 	fmt.Println(wo)
		// }
		//array 到 json str
		// arr := []string{"hello", "apple", "python", "golang", "base", "peach", "pear"}
		// lang, err := json.Marshal(arr)
		// if err == nil {
		// 	fmt.Println("================array 到 json str==")
		// 	fmt.Println(string(lang))
		// }

		//json 到 []string
		var json_images []string
		err := json.Unmarshal([]byte(images), &json_images)
		if err != nil {
			beego.Error(err)
		}
		beego.Debug(len(json_images))
		group := createImageGroupId(len(json_images))
		openid, err := getPhotoOpenId(c.Ctx)
		if err != nil {
			beego.Error(err)
			request_json = fmt.Sprintf(`{"errcode":1,"errmsg":%s}`, "AddImg getPhotoOpenId error")
			// `{"errcode":1,"errmsg":%s}`
			c.Ctx.WriteString(request_json)
			return
		}
		// beego.Debug(group)
		// beego.Debug(openid)
		for i := 0; i < len(json_images); i++ {
			_, err := models.AddPhotos(openid, group, json_images[i])
			if err != nil {
				beego.Error(err)
				request_json = fmt.Sprintf(`{"errcode":1,"errmsg":%s}`, "AddImg AddPhotos error")
				// `{"errcode":1,"errmsg":%s}`
				c.Ctx.WriteString(request_json)
				return
			}
		}
	}
	request_json = `{"errcode":0,"errmsg":"","data":""}`
	c.Ctx.WriteString(request_json)
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:60,代码来源:imgserver.go


示例8: init

//todo 文件初始化
func init() {
	beego.Debug("init...")
	initConfig()  //读取配置文件
	initFileSys() //初始化文件系统
	initSql()     //连接数据库
	beego.Debug("init done...")
}
开发者ID:elvizlai,项目名称:Blog-mysql,代码行数:8,代码来源:init.go


示例9: getWxGameJsapiTicket

//获得jsapi_ticket
func getWxGameJsapiTicket(access_toke string, noncestr string, timestamp int64, url string, c *WeixinGameController) string {
	signature := ""
	wx_url := "[REALM]?access_token=[ACCESS_TOKEN]&type=jsapi"
	realm_name := "https://api.weixin.qq.com/cgi-bin/ticket/getticket"
	wx_url = strings.Replace(wx_url, "[REALM]", realm_name, -1)
	wx_url = strings.Replace(wx_url, "[ACCESS_TOKEN]", access_toke, -1)
	beego.Debug("getJsapiTicketUrl", wx_url)
	resp, err := http.Get(wx_url)
	if err != nil {
		beego.Debug(err)
	}

	defer resp.Body.Close()
	beego.Debug("----------------getWxGameJsapiTicket body--------------------")
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		beego.Debug(err)
	} else {
		beego.Debug(string(body))
	}
	// body := []byte(`{"errcode":0,"errmsg":"ok","ticket":"bxLdikRXVbTPdHSM05e5u5sUoXNKd8-41ZO3MhKoyN5OfkWITDGgnr2fwJ0m9E8NYzWKVZvdVtaUgWvsdshFKA","expires_in":7200}`)
	var ticket JsApiTicketJson
	if err := json.Unmarshal(body, &ticket); err == nil {
		if ticket.ErrCode == 0 {
			signature = signatureWxJs(ticket.Ticket, noncestr, timestamp, url)
		}
	} else {

	}
	return signature
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:32,代码来源:wxgame.go


示例10: Logout

func (this *UserController) Logout() {
	form := models.LogoutForm{}
	if err := this.ParseForm(&form); err != nil {
		beego.Debug("ParseLogoutForm:", err)
		this.Data["json"] = models.NewErrorInfo(ErrInputData)
		this.ServeJson()
		return
	}
	beego.Debug("ParseLogoutForm:", &form)

	if err := this.VerifyForm(&form); err != nil {
		beego.Debug("ValidLogoutForm:", err)
		this.Data["json"] = models.NewErrorInfo(ErrInputData)
		this.ServeJson()
		return
	}

	if this.GetSession("user_id") != form.Phone {
		this.Data["json"] = models.NewErrorInfo(ErrInvalidUser)
		this.ServeJson()
		return
	}

	this.DelSession("user_id")

	this.Data["json"] = models.NewNormalInfo("Succes")
	this.ServeJson()
}
开发者ID:edwincastaneda,项目名称:beego-demo,代码行数:28,代码来源:users.go


示例11: UpdateDevice

func UpdateDevice(device *Deviceinfo) bool {
	beego.Debug("UpdateDevice table=", device.TableName())
	o := orm.NewOrm()

	var dev Deviceinfo
	err := o.QueryTable(device.TableName()).Filter("mac", device.Mac).One(&dev)
	if err != nil {
		return false
	} else {
		dev.State = device.State
		dev.LastKeepaliveTime = device.LastKeepaliveTime
		dev.LastRegistrationTime = device.LastRegistrationTime
		dev.IpAddress = device.IpAddress
		dev.IpLocation = device.IpLocation

		beego.Debug("UpdateDevice clientIp =", dev.IpAddress)

		_, err := o.Update(&dev)
		if err != nil {
			beego.Error(err)
			return false
		}
		return true
	}
}
开发者ID:tcdog001,项目名称:szm_lms,代码行数:25,代码来源:device.go


示例12: getWxAutoToken

/**
获得授权token
*/
func getWxAutoToken(appid string, secret string, code string) (models.AccessTokenJson, error) {
	// ?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
	tokenobj := models.AccessTokenJson{}
	response_json := `{"errcode":1,"errmsg":"getWxAccessToken error"}`
	wx_url := "[REALM]?appid=[APPID]&secret=[SECRET]&&code=[CODE]&grant_type=authorization_code"
	realm_name := "https://api.weixin.qq.com/sns/oauth2/access_token"
	wx_url = strings.Replace(wx_url, "[REALM]", realm_name, -1)
	wx_url = strings.Replace(wx_url, "[APPID]", appid, -1)
	wx_url = strings.Replace(wx_url, "[SECRET]", secret, -1)
	wx_url = strings.Replace(wx_url, "[CODE]", code, -1)
	beego.Debug("/poll getWxAutoToken url :", wx_url)
	resp, err := http.Get(wx_url)
	if err != nil {
		beego.Error(err)
		return tokenobj, err
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		beego.Error(err)
		body = []byte(response_json)
	} else {
		beego.Debug("wxqax getWxToken boey :", string(body))
	}
	var atj models.AccessTokenJson
	if err := json.Unmarshal(body, &atj); err == nil {
		beego.Debug("get Token obj", atj)
		tokenobj = atj
	} else {
		beego.Error(err)
	}
	return tokenobj, err
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:37,代码来源:poll.go


示例13: AdminpollVote

func (c *PollController) AdminpollVote() {
	bool, username := chackAccount(c.Ctx)
	if bool {
		c.Data["isUser"] = bool
		c.Data["User"] = username
	} else {
		c.Redirect("/admin", 302)
		return
	}
	pollsid := c.Input().Get("pollsid")
	pollid := c.Input().Get("pollid")
	if c.Ctx.Input.IsGet() {
		beego.Debug("Adminpollscon Get")
	}

	if c.Ctx.Input.IsPost() {
		beego.Debug("Adminpollscon Post")
	}
	objs, err := models.GetAllVote(pollsid, pollid)
	if err != nil {
		beego.Error(err)
	}
	beego.Debug("pollsid:", pollsid)
	beego.Debug("pollid:", pollid)
	beego.Debug("objs:", objs)
	c.Data["Objs"] = objs
	c.Data["PollsId"] = pollsid
	c.TplName = "adminpollvote.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:29,代码来源:poll.go


示例14: Admin

//后台
func (c *DqsjController) Admin() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("Admin Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("Admin Post")
	}
	bool, username := chackDqsjAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/dqsj/adminlogin", 302)
		return
	}
	c.Data["User"] = username
	c.Data["isUser"] = bool
	beego.Debug("username:", username)
	op := c.Input().Get("op")
	switch op {
	case "back":
		c.Ctx.SetCookie(DQSJ_USERNAME, "", -1, "/")
		c.Ctx.SetCookie(DQSJ_PASSWORD, "", -1, "/")
		c.Redirect("/dqsj/admin", 302)
		return
	}

	c.TplName = "dqsjadmin.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:29,代码来源:dqsj.go


示例15: AdminAddPan

func (c *DqsjController) AdminAddPan() {
	bool, _ := chackDqsjAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/dqsj/adminlogin", 302)
		return
	}
	if c.Ctx.Input.IsGet() {
		beego.Debug("AdminAddPan Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("AdminAddPan Post")
		name := c.Input().Get("name")
		info := c.Input().Get("info")
		probability := c.Input().Get("probability")
		if len(name) != 0 && len(info) != 0 {
			err := models.AddPanItem(name, info, probability)
			if err != nil {
				beego.Error(err)
			}
			c.Redirect("/dqsj/adminpan", 302)
		} else {
			c.Redirect("/dqsj/adminaddpan", 302)
		}

	}
	c.TplName = "dqsjadminaddpan.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:29,代码来源:dqsj.go


示例16: AdminGua

func (c *DqsjController) AdminGua() {
	bool, _ := chackDqsjAccount(c.Ctx)
	if bool {

	} else {
		c.Redirect("/dqsj/adminlogin", 302)
		return
	}
	if c.Ctx.Input.IsGet() {
		beego.Debug("AdminGua Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("AdminGua Post")
	}
	op := c.Input().Get("op")
	beego.Debug("op :", op)
	switch op {
	case "del":
		id := c.Input().Get("id")
		err := models.DeleteGuaItem(id)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/admingua", 302)
		return
	case "state0":
		id := c.Input().Get("id")
		err := models.UpdateGuaItem(id, 1)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/admingua", 302)
		return
	case "state1":
		id := c.Input().Get("id")
		err := models.UpdateGuaItem(id, 0)
		if err != nil {
			beego.Error(err)
		}
		c.Redirect("/dqsj/admingua", 302)
		return
	}
	panitem, err := models.GetAllGuaItem()
	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["GuaItem"] = panitem

	c.TplName = "dqsjadmingua.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:60,代码来源:dqsj.go


示例17: Search

func (c *WptController) Search() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("WptController Search Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("WptController Search Post")
	}
	search := c.Input().Get("search")
	if len(search) != 0 {
		objs, err := models.GetAllWptLike(search)
		if err != nil {
			beego.Error(err)
		}
		beego.Debug("Search :", objs)
		c.Data["Objs"] = objs
	} else {
		objs, err := models.GetAllWpt()
		if err != nil {
			beego.Error(err)
		}
		c.Data["Objs"] = objs

	}

	c.TplName = "wptsearch.html"
}
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:26,代码来源:wpt.go


示例18: GetCampaignCounts

func (tm *AdUnitManager) GetCampaignCounts(campaignId string, startDate time.Time, endDate time.Time) (counts []AdunitSummary, count int) {

	o := orm.NewOrm()

	var query string = ""

	query = sql.Get_Adunit_Summary
	var err error

	if campaignId != "" {
		query = query + `where a.campaignId = ?`
		_, err = o.Raw(query, startDate, endDate, startDate, endDate, campaignId).QueryRows(&counts)
	} else {
		_, err = o.Raw(query, startDate, endDate, startDate, endDate).QueryRows(&counts)
	}

	if err != nil {
		beego.Debug("failed to get counts", err)
		return counts, 0
	} else {
		//		for _, v := range counts {
		//			fmt.Println(v["campaignName"])
		//		}
		beego.Debug(counts)
		return counts, len(counts)
	}

}
开发者ID:onealtang,项目名称:monitor,代码行数:28,代码来源:Adunit.go


示例19: Post

func (c *ViewController) Post() {
	worldName := c.Ctx.Input.Query("worldName")
	configValue := c.Ctx.Input.Query("value")

	beego.Debug("Post value is  " + worldName + "value:" + configValue)

	var err error
	currentPath, err := os.Getwd()
	if err != nil {
		beego.Debug("Get Current Path failed")
	}
	confPath := filepath.Join(currentPath, "jsonfiles", worldName+".json")

	beego.Debug("Current Path is " + confPath)

	beego.Debug("channel.conf path is " + confPath)

	err2 := ioutil.WriteFile(confPath, ([]byte)(configValue), os.ModeAppend)
	if err2 != nil {
		panic("open file failed!")
	}

	resultMap := make(map[string]string)
	resultMap["defenceStr"] = configValue
	if strings.Contains(worldName, "init") {
		resultMap["detailInfo"] = GetWorldInitStr(worldName)
	} else {
		resultMap["detailInfo"] = GetWorldLevelUpStr(worldName)
	}
	resultBytes, _ := json.Marshal(resultMap)
	c.Ctx.WriteString(string(resultBytes))

}
开发者ID:lufp,项目名称:lufeipeng,代码行数:33,代码来源:view.go


示例20: UpdateOrder

func UpdateOrder(orderNumber string, transactionStatus string) (rstError error) {
	o := orm.NewOrm()
	rstError = o.Begin()

	transactionHeader := BeTransactionHeader{OrderNumber: orderNumber}

	rstError = o.Read(&transactionHeader, "OrderNumber")

	if rstError == orm.ErrNoRows {
		beego.Debug("No transaction header for order number:", orderNumber)

	} else if rstError == nil {
		beego.Debug("Find transaction header for order number:", orderNumber)
		transactionHeader.TrasactionStatus = transactionStatus
		_, rstError = o.Update(&transactionHeader)
	}

	if rstError != nil {
		beego.Error(rstError.Error())
		rstError = o.Rollback()
	} else {
		rstError = o.Commit()
	}

	return rstError
}
开发者ID:wfnuser,项目名称:o2oadmin,代码行数:26,代码来源:ResturantDao.go



注:本文中的github.com/astaxie/beego.Debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang beego.Error函数代码示例发布时间:2022-05-24
下一篇:
Golang beego.DateParse函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap