本文整理汇总了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
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:33,代码来源:partner.go
示例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
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:12,代码来源:member.go
示例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
}
开发者ID:xianmau,项目名称:go2o,代码行数:12,代码来源:partner.go
示例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
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:13,代码来源:member.go
示例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
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:13,代码来源:member.go
示例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
}
开发者ID:xianmau,项目名称:go2o,代码行数:13,代码来源:partner.go
示例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
}
开发者ID:xianmau,项目名称:go2o,代码行数:13,代码来源:partner.go
示例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
}
开发者ID:honj51,项目名称:go2o,代码行数:22,代码来源:member.go
示例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
}
开发者ID:honj51,项目名称:go2o,代码行数:22,代码来源:member.go
注:本文中的github.com/atnet/gof/net/jsv.UnmarshalMap函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论