- SendFilesToStores add param title

This commit is contained in:
gazebo
2019-01-18 10:39:00 +08:00
parent 4105497874
commit 249fdadf9a
3 changed files with 6 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ type tUploadFileInfo struct {
StoreID int
}
func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, isAsync bool, userName string) (hint string, err error) {
func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, title string, isAsync bool, userName string) (hint string, err error) {
globals.SugarLogger.Debugf("SendFilesToStores, fileCount:%d isAsync:%t, userName:%s", len(files), isAsync, userName)
if len(files) == 0 {
return "", errors.New("没有文件上传!")
@@ -77,7 +77,7 @@ func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, is
BillName: fileHeader.Filename,
}
if err = dao.CreateEntity(db, billRec); err == nil {
err = weixinmsg.NotifySaleBill(storeID, "http://www.jxc4.com/billshow/?path="+billRec.Url)
err = weixinmsg.NotifySaleBill(storeID, title, "http://www.jxc4.com/billshow/?path="+billRec.Url)
if err != nil {
globals.SugarLogger.Infof("SendFilesToStores NotifySaleBill file:%s error:%v", fileHeader.Filename, err)
}

View File

@@ -265,7 +265,7 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
return SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), data)
}
func NotifySaleBill(storeID int, fileURL string) (err error) {
func NotifySaleBill(storeID int, title, fileURL string) (err error) {
globals.SugarLogger.Debugf("NotifySaleBill storeID:%d, fileURL:%s", storeID, fileURL)
data := map[string]interface{}{
"first": map[string]interface{}{
@@ -273,7 +273,7 @@ func NotifySaleBill(storeID int, fileURL string) (err error) {
"color": "#00008B",
},
"keyword1": map[string]interface{}{
"value": "账单",
"value": title,
},
"keyword2": map[string]interface{}{
"value": "点击查看详情",

View File

@@ -18,6 +18,7 @@ type FinancialController struct {
// @Title 发送文件给门店
// @Description 发送文件给门店调用GET方法得到浏览器端参考的上传HTML实现userfiles
// @Param token header string true "认证token"
// @Param title query string true "消息标题"
// @Param isAsync query bool false "是否异步,缺省是同步"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
@@ -39,7 +40,7 @@ func (c *FinancialController) SendFilesToStores() {
c.callSendFilesToStores(func(params *tFinancialSendFilesToStoresParams) (retVal interface{}, errCode string, err error) {
r := c.Ctx.Request
files := r.MultipartForm.File["userfiles"]
retVal, err = financial.SendFilesToStores(params.Ctx, files, params.IsAsync, params.Ctx.GetUserName())
retVal, err = financial.SendFilesToStores(params.Ctx, files, params.Title, params.IsAsync, params.Ctx.GetUserName())
return retVal, "", err
})
}