本文整理汇总了Golang中github.com/atnet/gof/net/jsv.UnmarshalMap函数的典型用法代码示例。如果您正苦于以下问题:Golang UnmarshalMap函数的具体用法?Golang UnmarshalMap怎么用?Golang UnmarshalMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UnmarshalMap函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RegisterMember
func (this *Partner) RegisterMember(m *jsv.Args, r *jsv.Result) error {
var err error
e := member.ValueMember{}
if err = jsv.UnmarshalMap((*m)["json"], &e); err != nil {
return err
}
var cardId string
var tgId int
var partnerId int
cardId = (*m)["card_id"].(string)
tgId, _ = strconv.Atoi((*m)["tg_id"].(string))
partnerId, _ = strconv.Atoi((*m)["partner_id"].(string))
//如果卡片ID为空时,自动生成
if cardId == "" {
cardId = time.Now().Format("200601021504")
}
e.RegFrom = "WEB"
e.Pwd = domain.MemberSha1Pwd(e.Pwd)
id, err := dps.MemberService.SaveMember(&e)
if err == nil {
dps.MemberService.SaveRelation(id, cardId, tgId, partnerId)
r.Result = true
return nil
}
return err
}
示例2: GetDeliverAddrs
func (this *memberClient) GetDeliverAddrs(memberId int, token string) (addrs []member.DeliverAddress, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"member_id":"%d","token":"%s"}>>Member.GetDeliverAddrs`,
memberId, token)), &result, 1024)
if err != nil {
return nil, err
}
addrs = []member.DeliverAddress{}
err = jsv.UnmarshalMap(result.Data, &addrs)
return addrs, err
}
示例3: GetShops
func (this *partnerClient) GetShops(partnerId int, secret string) (a []partner.ValueShop, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"partner_id":"%s","secret":"%s"}>>Partner.GetShops`,
strconv.Itoa(partnerId), secret)), &result, 2048)
if err != nil {
return nil, err
}
a = []partner.ValueShop{}
err = jsv.UnmarshalMap(result.Data, &a)
return a, err
}
示例4: GetBankInfo
func (this *memberClient) GetBankInfo(memberId int, token string) (
a *member.BankInfo, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"member_id":"%d","token":"%s"}>>Member.GetBankInfo`,
memberId, token)), &result, 256)
if err != nil {
return nil, err
}
a = &member.BankInfo{}
err = jsv.UnmarshalMap(result.Data, &a)
return a, err
}
示例5: GetDeliverAddrById
func (this *memberClient) GetDeliverAddrById(memberId int, token string, addr_id int) (
e *member.DeliverAddress, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"member_id":"%d","token":"%s","addr_id":"%d"}>>Member.GetDeliverAddrById`,
memberId, token, addr_id)), &result, 256)
if err != nil {
return nil, err
}
e = &member.DeliverAddress{}
err = jsv.UnmarshalMap(result.Data, &e)
return e, err
}
示例6: GetSiteConf
func (this *partnerClient) GetSiteConf(partnerId int, secret string) (c *partner.SiteConf, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"partner_id":"%s","secret":"%s"}>>Partner.GetSiteConf`,
strconv.Itoa(partnerId), secret)), &result, 2048)
if err != nil {
return nil, err
}
c = new(partner.SiteConf)
err = jsv.UnmarshalMap(result.Data, &c)
return c, nil
}
示例7: GetItems
func (this *partnerClient) GetItems(partnerId int, secret string, categoryId int, getNum int) (
a []*valueobject.Goods, err error) {
var result jsv.Result
err = this.conn.WriteAndDecode([]byte(fmt.Sprintf(
`{"partner_id":"%s","secret":"%s","cid":"%d","num":"%d"}>>Partner.GetItems`,
strconv.Itoa(partnerId), secret, categoryId, getNum)), &result, 2048)
if err != nil {
return nil, err
}
a = []*valueobject.Goods{}
err = jsv.UnmarshalMap(result.Data, &a)
return a, err
}
示例8: SaveBankInfo
func (this *Member) SaveBankInfo(m *jsv.Args, r *jsv.Result) error {
memberId, err := Verify(m)
if err != nil {
return err
}
var e member.BankInfo
err = jsv.UnmarshalMap((*m)["json"], &e)
if err != nil {
return err
}
e.MemberId = memberId
err = dps.MemberService.SaveBankInfo(&e)
if err != nil {
jsv.LogErr(err)
return err
} else {
r.Result = true
}
return nil
}
示例9: SaveDeliverAddr
func (this *Member) SaveDeliverAddr(m *jsv.Args, r *jsv.Result) error {
memberId, err := Verify(m)
if err != nil {
return err
}
var e member.DeliverAddress
err = jsv.UnmarshalMap((*m)["json"], &e)
if err != nil {
return err
}
e.MemberId = memberId
_, err = dps.MemberService.SaveDeliverAddr(memberId, &e)
if err != nil {
jsv.LogErr(err)
r.Message = err.Error()
} else {
r.Result = true
}
return nil
}