kobe6258 7 сар өмнө
parent
commit
a5509946fc

+ 3 - 1
models/chart_permission.go

@@ -1,6 +1,7 @@
 package models
 
 import (
+	"eta/eta_mini_crm_ht/utils"
 	"fmt"
 	"strings"
 	"time"
@@ -109,7 +110,8 @@ func GetChartPermissionList() (items []*ChartPermission, err error) {
 }
 func GetPermissionNames(ids []int) (items []string, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT distinct  permission_name FROM chart_permission WHERE enabled=1 AND product_id=1 and chart_permission_id in ?`
+	condition := " AND chart_permission_id in (" + utils.GetOrmReplaceHolder(len(ids)) + ")"
+	sql := `SELECT distinct  permission_name FROM chart_permission WHERE enabled=1 AND product_id=1` + condition
 	_, err = o.Raw(sql, ids).QueryRows(&items)
 	return
 }

+ 4 - 2
models/media.go

@@ -78,8 +78,9 @@ func (m *Media) ToMediaView() (message *MediaView) {
 	image, err := GetImageById(m.CoverSrc)
 	if err != nil || image == nil {
 		message.CoverSrc = ""
+	} else {
+		message.CoverSrc = image.SrcUrl
 	}
-	message.CoverSrc = image.SrcUrl
 	ids := strings.Split(m.PermissionIds, ",")
 	var idList []int
 	for _, id := range ids {
@@ -117,8 +118,9 @@ func (m *Media) ToMessageView() (message *MessageMedia) {
 	image, err := GetImageById(m.CoverSrc)
 	if err != nil || image == nil {
 		message.CoverSrc = ""
+	} else {
+		message.CoverSrc = image.SrcUrl
 	}
-	message.CoverSrc = image.SrcUrl
 	ids := strings.Split(m.PermissionIds, ",")
 	var idList []int
 	for _, id := range ids {

+ 9 - 0
routers/commentsRouter.go

@@ -261,6 +261,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_mini_crm_ht/controllers:MessageController"] = append(beego.GlobalControllerRouter["eta/eta_mini_crm_ht/controllers:MessageController"],
+        beego.ControllerComments{
+            Method: "SendTemplateMsg",
+            Router: `/sendTemplateMsg`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_mini_crm_ht/controllers:MessageController"] = append(beego.GlobalControllerRouter["eta/eta_mini_crm_ht/controllers:MessageController"],
         beego.ControllerComments{
             Method: "VideoList",