本文整理匯總了Golang中github.com/hoisie/redis.Client.Hset方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.Hset方法的具體用法?Golang Client.Hset怎麽用?Golang Client.Hset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hoisie/redis.Client
的用法示例。
在下文中一共展示了Client.Hset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReceiveScanEvent
func ReceiveScanEvent(content string) string {
var this ScanEvent
fmt.Println(content)
err := xml.Unmarshal([]byte(content), &this)
if err != nil {
return ""
}
data := "請聯係係統管理員進行身份認證"
if "101" == this.EventKey &&
"oecJ3jhN5usPBQMIXqc9bVP0toi4" == this.Ticket {
data = "吼吼吼"
var redcli redis.Client
redcli.Addr = beego.AppConfig.String("redis_addr")
redcli.Hset(this.Ticket, "scan", []byte("true"))
}
fmt.Println(data)
rcontent := `<xml>
<ToUserName><![CDATA[` + this.FromUserName + `]]></ToUserName>
<FromUserName><![CDATA[` + this.ToUserName + `]]></FromUserName>
<CreateTime>` + fmt.Sprint((time.Now().Unix())) + `</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[` + data + `]]></Content>
</xml>`
return rcontent
}
示例2: GetTempTicket
func GetTempTicket(expire_seconds int, scene_id int, scene_str string) string {
url := `https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=` + GetAccessToken()
data := `{"expire_seconds": ` + strconv.Itoa(expire_seconds) +
`, "action_name": "QR_SCENE", ` +
`"action_info": {"scene": {"scene_id": ` + strconv.Itoa(scene_id) +
`,"scene_str":"` + scene_str + `"}}}`
if ticket := getTicket(url, data); len(ticket) < 1 {
return ""
} else {
var redcli redis.Client
redcli.Addr = beego.AppConfig.String("redis_addr")
redcli.Hset(ticket, "scene_id", []byte(strconv.Itoa(scene_id)))
redcli.Expire(ticket, 120)
return ticket
}
}