You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.7 KiB
77 lines
1.7 KiB
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) |
|
}
|
|
|