- ShowStoreLatestBill
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FinancialController struct {
|
type FinancialController struct {
|
||||||
@@ -55,3 +57,37 @@ func (c *FinancialController) GetStoreBills() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
|
||||||
|
// @Title 显示门店最新账单
|
||||||
|
// @Description 显示门店最新账单
|
||||||
|
// @Param storeID query int true "门店ID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /ShowStoreLatestBill [get]
|
||||||
|
func (c *FinancialController) ShowStoreLatestBill() {
|
||||||
|
var err2 error
|
||||||
|
var bills []*legacymodel.StoreBill
|
||||||
|
w := c.Ctx.ResponseWriter
|
||||||
|
w.Header().Add("Content-Type", "text/html")
|
||||||
|
w.WriteHeader(200)
|
||||||
|
htmlResult := ""
|
||||||
|
html := `
|
||||||
|
%s
|
||||||
|
`
|
||||||
|
c.callShowStoreLatestBill(func(params *tFinancialShowStoreLatestBillParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
bills, err = financial.GetStoreBills(params.Ctx, params.StoreID)
|
||||||
|
retVal = bills
|
||||||
|
if len(bills) == 0 {
|
||||||
|
err = fmt.Errorf("门店%d没有账单", params.StoreID)
|
||||||
|
} else {
|
||||||
|
htmlResult = fmt.Sprintf(html, bills[0].Url)
|
||||||
|
}
|
||||||
|
err2 = err
|
||||||
|
return retVal, ignoreCode, err
|
||||||
|
})
|
||||||
|
if htmlResult != "" {
|
||||||
|
io.WriteString(w, htmlResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user