作者 tangxvhui

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev

@@ -69,6 +69,9 @@ func (this *TemplateController) TemplateAdd() { @@ -69,6 +69,9 @@ func (this *TemplateController) TemplateAdd() {
69 return 69 return
70 } 70 }
71 } 71 }
  72 + if len(request.Videos) == 0 {
  73 + request.Videos = make([]string, 0)
  74 + }
72 rsp, err := audit.TemplateAdd(uid, companyId, request) 75 rsp, err := audit.TemplateAdd(uid, companyId, request)
73 msg = protocol.NewReturnResponse(rsp, err) 76 msg = protocol.NewReturnResponse(rsp, err)
74 return 77 return
@@ -118,6 +121,9 @@ func (this *TemplateController) TemplateUpdate() { @@ -118,6 +121,9 @@ func (this *TemplateController) TemplateUpdate() {
118 return 121 return
119 } 122 }
120 } 123 }
  124 + if len(request.Videos) == 0 {
  125 + request.Videos = make([]string, 0)
  126 + }
121 rsp, err := audit.TemplateUpdate(uid, companyId, request) 127 rsp, err := audit.TemplateUpdate(uid, companyId, request)
122 msg = protocol.NewReturnResponse(rsp, err) 128 msg = protocol.NewReturnResponse(rsp, err)
123 return 129 return
@@ -89,6 +89,7 @@ func (c *UploadController) UploadVideo() { @@ -89,6 +89,7 @@ func (c *UploadController) UploadVideo() {
89 filehead, err := c.GetFiles("file") 89 filehead, err := c.GetFiles("file")
90 if err != nil { 90 if err != nil {
91 log.Error("获取上传文件失败:%s", err) 91 log.Error("获取上传文件失败:%s", err)
  92 + return
92 } 93 }
93 var rsp ResponseUploadImage 94 var rsp ResponseUploadImage
94 for i := range filehead { 95 for i := range filehead {
@@ -24,6 +24,7 @@ type AuditTemplate struct { @@ -24,6 +24,7 @@ type AuditTemplate struct {
24 CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"` 24 CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
25 UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"` 25 UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
26 Example string `orm:"column(example);null" description:"示例"` 26 Example string `orm:"column(example);null" description:"示例"`
  27 + Videos string `orm:"column(videos);null" description:"示例"`
27 } 28 }
28 29
29 const ( 30 const (
@@ -82,6 +82,7 @@ func (input ValidateInputRedio) ValidateConfig() error { @@ -82,6 +82,7 @@ func (input ValidateInputRedio) ValidateConfig() error {
82 type TemplateAddRequest struct { 82 type TemplateAddRequest struct {
83 Template Template `json:"template"` 83 Template Template `json:"template"`
84 Example string `json:"example"` //示例 84 Example string `json:"example"` //示例
  85 + Videos []string `json:"videos"` //视频
85 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"` 86 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"`
86 } 87 }
87 type TemplateAddResponse struct { 88 type TemplateAddResponse struct {
@@ -115,6 +116,7 @@ type ProcessConfig struct { @@ -115,6 +116,7 @@ type ProcessConfig struct {
115 type TemplateUpdateRequest struct { 116 type TemplateUpdateRequest struct {
116 Template Template `json:"template"` 117 Template Template `json:"template"`
117 Example string `json:"example"` //示例` 118 Example string `json:"example"` //示例`
  119 + Videos []string `json:"videos"` //视频
118 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"` 120 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"`
119 } 121 }
120 type TemplateUpdateResponse struct { 122 type TemplateUpdateResponse struct {
@@ -181,6 +183,7 @@ type TemplateGetRequest struct { @@ -181,6 +183,7 @@ type TemplateGetRequest struct {
181 type TemplateGetResponse struct { 183 type TemplateGetResponse struct {
182 Template Template `json:"template"` 184 Template Template `json:"template"`
183 Example string `json:"example"` //示例` 185 Example string `json:"example"` //示例`
  186 + Videos []string `json:"videos"` //视频
184 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"` 187 AuditFlowConfig AuditFlowConfig `json:"auditFlowConfig"`
185 } 188 }
186 189
@@ -53,6 +53,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs @@ -53,6 +53,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs
53 VisibleType: int8(0), 53 VisibleType: int8(0),
54 EnableStatus: 1, 54 EnableStatus: 1,
55 Example: request.Example, 55 Example: request.Example,
  56 + Videos: jsonAssertMarsh(request.Videos),
56 CreateAt: time.Now(), 57 CreateAt: time.Now(),
57 UpdateAt: time.Now(), 58 UpdateAt: time.Now(),
58 } 59 }
@@ -181,6 +182,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques @@ -181,6 +182,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques
181 template.Icon = request.Template.Icon 182 template.Icon = request.Template.Icon
182 template.NoApprover = int8(request.AuditFlowConfig.NoApprover) 183 template.NoApprover = int8(request.AuditFlowConfig.NoApprover)
183 template.Example = request.Example 184 template.Example = request.Example
  185 + template.Videos = jsonAssertMarsh(request.Videos)
184 template.UpdateAt = time.Now() 186 template.UpdateAt = time.Now()
185 if err = models.UpdateAuditTemplateById(template); err != nil { 187 if err = models.UpdateAuditTemplateById(template); err != nil {
186 log.Error(err.Error()) 188 log.Error(err.Error())
@@ -457,6 +459,10 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs @@ -457,6 +459,10 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs
457 Code: template.Code, 459 Code: template.Code,
458 } 460 }
459 rsp.Example = template.Example 461 rsp.Example = template.Example
  462 + rsp.Videos = make([]string, 0)
  463 + if len(template.Videos) > 0 {
  464 + _ = json.Unmarshal([]byte(template.Videos), &rsp.Videos)
  465 + }
460 466
461 if auditForm, err = models.GetAuditFormByTemplateId(int(template.Id)); err != nil { 467 if auditForm, err = models.GetAuditFormByTemplateId(int(template.Id)); err != nil {
462 log.Error("id:%v msg:%v", template.Id, err.Error()) 468 log.Error("id:%v msg:%v", template.Id, err.Error())