1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package http
- import (
- api "go-common/app/service/main/ugcpay/api/http"
- "go-common/app/service/main/ugcpay/model"
- bm "go-common/library/net/http/blademaster"
- )
- func assetQuery(ctx *bm.Context) {
- var (
- err error
- arg = &api.ArgAssetQuery{}
- resp = &api.RespAssetQuery{}
- asset *model.Asset
- pp map[string]int64
- )
- if err = ctx.Bind(arg); err != nil {
- return
- }
- if asset, pp, err = srv.AssetQuery(ctx, arg.OID, arg.OType, arg.Currency); err != nil {
- ctx.JSON(nil, err)
- return
- }
- resp.Parse(asset, pp)
- ctx.JSON(resp, err)
- }
- func assetRegister(ctx *bm.Context) {
- var (
- err error
- arg = &api.ArgAssetRegister{}
- )
- if err = ctx.Bind(arg); err != nil {
- return
- }
- ctx.JSON(nil, srv.AssetRegister(ctx, arg.MID, arg.OID, arg.OType, arg.Currency, arg.Price))
- }
- func assetRelation(ctx *bm.Context) {
- var (
- err error
- arg = &api.ArgAssetRelation{}
- resp = &api.RespAssetRelation{}
- state string
- )
- if err = ctx.Bind(arg); err != nil {
- return
- }
- if state, err = srv.AssetRelation(ctx, arg.MID, arg.OID, arg.OType); err != nil {
- ctx.JSON(nil, err)
- return
- }
- resp.State = state
- ctx.JSON(resp, err)
- }
- func assetRelationDetail(ctx *bm.Context) {
- var (
- err error
- arg = &api.ArgAssetRelationDetail{}
- resp = &api.RespAssetRelationDetail{}
- asset *model.Asset
- )
- if err = ctx.Bind(arg); err != nil {
- return
- }
- if resp.RelationState, err = srv.AssetRelation(ctx, arg.MID, arg.OID, arg.OType); err != nil {
- ctx.JSON(nil, err)
- return
- }
- if asset, resp.AssetPlatformPrice, err = srv.AssetQuery(ctx, arg.OID, arg.OType, arg.Currency); err != nil {
- ctx.JSON(nil, err)
- return
- }
- resp.AssetPrice = asset.Price
- ctx.JSON(resp, err)
- }
|