- add param shopName to SendFilesToStores
This commit is contained in:
@@ -26,7 +26,7 @@ type tUploadFileInfo struct {
|
|||||||
StoreID int
|
StoreID int
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, title string, isAsync bool, userName string) (hint string, err error) {
|
func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, title, shopName string, isAsync bool, userName string) (hint string, err error) {
|
||||||
globals.SugarLogger.Debugf("SendFilesToStores, fileCount:%d isAsync:%t, userName:%s", len(files), isAsync, userName)
|
globals.SugarLogger.Debugf("SendFilesToStores, fileCount:%d isAsync:%t, userName:%s", len(files), isAsync, userName)
|
||||||
if len(files) == 0 {
|
if len(files) == 0 {
|
||||||
return "", errors.New("没有文件上传!")
|
return "", errors.New("没有文件上传!")
|
||||||
@@ -77,7 +77,7 @@ func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, ti
|
|||||||
BillName: fileHeader.Filename,
|
BillName: fileHeader.Filename,
|
||||||
}
|
}
|
||||||
if err = dao.CreateEntity(db, billRec); err == nil {
|
if err = dao.CreateEntity(db, billRec); err == nil {
|
||||||
err = weixinmsg.NotifySaleBill(storeID, title, "http://www.jxc4.com/billshow/?path="+billRec.Url)
|
err = weixinmsg.NotifySaleBill(storeID, title, shopName, "http://www.jxc4.com/billshow/?path="+billRec.Url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Infof("SendFilesToStores NotifySaleBill file:%s error:%v", fileHeader.Filename, err)
|
globals.SugarLogger.Infof("SendFilesToStores NotifySaleBill file:%s error:%v", fileHeader.Filename, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,11 +301,14 @@ 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), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
|
return SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NotifySaleBill(storeID int, title, fileURL string) (err error) {
|
func NotifySaleBill(storeID int, title, shopName, fileURL string) (err error) {
|
||||||
globals.SugarLogger.Debugf("NotifySaleBill storeID:%d, fileURL:%s", storeID, fileURL)
|
globals.SugarLogger.Debugf("NotifySaleBill storeID:%d, fileURL:%s", storeID, fileURL)
|
||||||
if title == "" {
|
if title == "" {
|
||||||
title = "当期账单"
|
title = "当期账单"
|
||||||
}
|
}
|
||||||
|
if shopName == "" {
|
||||||
|
shopName = "京西菜市"
|
||||||
|
}
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"first": map[string]interface{}{
|
"first": map[string]interface{}{
|
||||||
"value": "新的账单上传成功!",
|
"value": "新的账单上传成功!",
|
||||||
@@ -319,7 +322,7 @@ func NotifySaleBill(storeID int, title, fileURL string) (err error) {
|
|||||||
"color": "#00008B",
|
"color": "#00008B",
|
||||||
},
|
},
|
||||||
"keyword3": map[string]interface{}{
|
"keyword3": map[string]interface{}{
|
||||||
"value": "京西菜市",
|
"value": shopName,
|
||||||
},
|
},
|
||||||
"keyword4": map[string]interface{}{
|
"keyword4": map[string]interface{}{
|
||||||
"value": utils.GetCurTimeStr(),
|
"value": utils.GetCurTimeStr(),
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type FinancialController struct {
|
|||||||
// @Description 发送文件给门店,调用GET方法得到浏览器端参考的上传HTML实现,userfiles
|
// @Description 发送文件给门店,调用GET方法得到浏览器端参考的上传HTML实现,userfiles
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param title query string false "消息标题"
|
// @Param title query string false "消息标题"
|
||||||
|
// @Param shopName query string false "平台菜市名称"
|
||||||
// @Param isAsync query bool false "是否异步,缺省是同步"
|
// @Param isAsync query bool false "是否异步,缺省是同步"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
@@ -40,7 +41,7 @@ func (c *FinancialController) SendFilesToStores() {
|
|||||||
c.callSendFilesToStores(func(params *tFinancialSendFilesToStoresParams) (retVal interface{}, errCode string, err error) {
|
c.callSendFilesToStores(func(params *tFinancialSendFilesToStoresParams) (retVal interface{}, errCode string, err error) {
|
||||||
r := c.Ctx.Request
|
r := c.Ctx.Request
|
||||||
files := r.MultipartForm.File["userfiles"]
|
files := r.MultipartForm.File["userfiles"]
|
||||||
retVal, err = financial.SendFilesToStores(params.Ctx, files, params.Title, params.IsAsync, params.Ctx.GetUserName())
|
retVal, err = financial.SendFilesToStores(params.Ctx, files, params.Title, params.ShopName, params.IsAsync, params.Ctx.GetUserName())
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user