Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev
正在显示
1 个修改的文件
包含
16 行增加
和
0 行删除
@@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
6 | "oppmg/models" | 6 | "oppmg/models" |
7 | "oppmg/protocol" | 7 | "oppmg/protocol" |
8 | "oppmg/services/audit" | 8 | "oppmg/services/audit" |
9 | + "strings" | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | //TemplateController 机会模板 | 12 | //TemplateController 机会模板 |
@@ -72,6 +73,7 @@ func (this *TemplateController) TemplateAdd() { | @@ -72,6 +73,7 @@ func (this *TemplateController) TemplateAdd() { | ||
72 | if len(request.Videos) == 0 { | 73 | if len(request.Videos) == 0 { |
73 | request.Videos = make([]string, 0) | 74 | request.Videos = make([]string, 0) |
74 | } | 75 | } |
76 | + request.Videos = arrayFilter(request.Videos, "") | ||
75 | rsp, err := audit.TemplateAdd(uid, companyId, request) | 77 | rsp, err := audit.TemplateAdd(uid, companyId, request) |
76 | msg = protocol.NewReturnResponse(rsp, err) | 78 | msg = protocol.NewReturnResponse(rsp, err) |
77 | return | 79 | return |
@@ -123,6 +125,8 @@ func (this *TemplateController) TemplateUpdate() { | @@ -123,6 +125,8 @@ func (this *TemplateController) TemplateUpdate() { | ||
123 | } | 125 | } |
124 | if len(request.Videos) == 0 { | 126 | if len(request.Videos) == 0 { |
125 | request.Videos = make([]string, 0) | 127 | request.Videos = make([]string, 0) |
128 | + } else { | ||
129 | + request.Videos = arrayFilter(request.Videos, "") | ||
126 | } | 130 | } |
127 | rsp, err := audit.TemplateUpdate(uid, companyId, request) | 131 | rsp, err := audit.TemplateUpdate(uid, companyId, request) |
128 | msg = protocol.NewReturnResponse(rsp, err) | 132 | msg = protocol.NewReturnResponse(rsp, err) |
@@ -398,3 +402,15 @@ func (this *TemplateController) CategoryEditSort() { | @@ -398,3 +402,15 @@ func (this *TemplateController) CategoryEditSort() { | ||
398 | rsp, err := audit.CategoryEditSort(uid, companyId, request) | 402 | rsp, err := audit.CategoryEditSort(uid, companyId, request) |
399 | msg = protocol.NewReturnResponse(rsp, err) | 403 | msg = protocol.NewReturnResponse(rsp, err) |
400 | } | 404 | } |
405 | + | ||
406 | +//从数组过滤掉特定元素的项 | ||
407 | +func arrayFilter(arr1 []string, s string) (rsp []string) { | ||
408 | + rsp = make([]string, 0) | ||
409 | + for _, v := range arr1 { | ||
410 | + if strings.EqualFold(v, s) { | ||
411 | + continue | ||
412 | + } | ||
413 | + rsp = append(rsp, v) | ||
414 | + } | ||
415 | + return | ||
416 | +} |
-
请 注册 或 登录 后发表评论