| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package controller
- import (
- "crawler/model"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- type Company struct {
- Kobis model.Kobis
- }
- /**
- * 영화사 목록 조회
- * /company/searchCompanyList
- */
- func (this *Company) SearchCompanyList(c *gin.Context) {
- var req model.SearchCompanyListParams
- if err := c.ShouldBind(&req); err != nil {
- c.JSON(http.StatusBadRequest, err.Error())
- return
- }
- data, err := this.Kobis.CompanyListAPI(req)
- if err != nil {
- c.JSON(http.StatusBadRequest, err.Error())
- return
- }
- c.JSON(http.StatusOK, gin.H{
- "total": data.CompanyListResult.TotCnt,
- "rows": len(data.CompanyListResult.CompanyList),
- "list": data.CompanyListResult.CompanyList,
- })
- }
- /**
- * 영화사 상세 조회
- * /company/searchCompanyInfo
- */
- func (this *Company) SearchCompanyInfo(c *gin.Context) {
- var req model.SearchCompanyInfoParams
- if err := c.ShouldBind(&req); err != nil {
- c.JSON(http.StatusBadRequest, err.Error())
- return
- }
- data, err := this.Kobis.CompanyInfoAPI(req)
- if err != nil {
- c.JSON(http.StatusBadRequest, err.Error())
- return
- }
- c.JSON(http.StatusOK, gin.H{
- "info": data.CompanyInfoResult.CompanyInfo,
- })
- }
|