-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,20 @@ | ||
package hosts | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"time" | ||
"github.com/mds1455975151/cmdb/utils" | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/mds1455975151/cmdb/storage" | ||
) | ||
|
||
func init() { | ||
|
||
handlerFuncList["/hosts"] = hostitem | ||
handlerFuncList["/all"] = hostsall | ||
} | ||
|
||
// | ||
// Request Hosts Item | ||
// | ||
type HostsItemReq struct { | ||
// The globalId | ||
// | ||
// Required: true | ||
GlobalId int64 `form:"globalId" json:"globalId" binding:"required"` | ||
} | ||
|
||
// | ||
// 应答: 协议返回包 | ||
// swagger:response DoBuyItemRsp | ||
// noinspection ALL | ||
type HostsItemRsp struct { | ||
// in: body | ||
Body struct { | ||
// The response code | ||
// | ||
// Required: true | ||
Code int64 `json:"code"` | ||
// The response message | ||
// | ||
// Required: true | ||
Message string `json:"message"` | ||
// The payment sequence to identify the flow. | ||
// | ||
// Required: true | ||
Sequence string `json:"sequence"` | ||
// The response BuyItem | ||
// | ||
// Required: true | ||
BuyItemMidas struct { | ||
// | ||
// ret为0的时候,返回真正购买物品的url的参数,开发者需要把该参数 | ||
// 传给sdk跳转到相关页面使用户完成真正的购买动作。 | ||
// | ||
UrlParams string `json:"url_params"` | ||
} `json:"buyItemMidas"` | ||
} | ||
} | ||
|
||
// | ||
// swagger:route POST /payment/buy_item payment payment_buy_item | ||
// | ||
// Return buy item for the given user: | ||
// | ||
// Consumes: | ||
// - application/json | ||
// | ||
// Produces: | ||
// - application/json | ||
// | ||
// Schemes: http, https | ||
// | ||
// Responses: | ||
// 200: DoBuyItemRsp | ||
func hostitem(c *gin.Context) { | ||
|
||
c.JSON(http.StatusOK, resp.Body) | ||
func hostsall(c *gin.Context) { | ||
info := storage.QueryHost(1) | ||
c.JSON(http.StatusOK, info) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,5 +67,5 @@ func Run() { | |
"path": basePath, | ||
}).Info("Start cmdb service.") | ||
|
||
router.Run() | ||
router.Run(listen) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters