Procházet zdrojové kódy

新建商家后,默认该商家拥有帮助文档所有分类的权限。

xyxie před 1 rokem
rodič
revize
c0da4ff1bc

+ 2 - 1
controllers/day_new.go

@@ -365,7 +365,8 @@ func (this *DayNewController) AddReport() {
 				br.Msg = "生成失败,列表未全部完成英文翻译"
 				return
 			}
-			content += `<p>` + v.ContentEn + `</p></br>`
+
+			content += `<p>` + time.Unix(v.MsgTime/1e3, 0).Format(utils.FormatDateTimeMinute) + ` ` + v.ContentEn + `</p></br>`
 			msgIds += `"` + v.MsgId + `",`
 		}
 

+ 8 - 0
controllers/eta_business/eta_business.go

@@ -7,6 +7,7 @@ import (
 	"hongze/hz_crm_api/controllers"
 	"hongze/hz_crm_api/models"
 	"hongze/hz_crm_api/models/eta_business"
+	"hongze/hz_crm_api/models/help_doc"
 	etaBusinessService "hongze/hz_crm_api/services/eta_business"
 	"hongze/hz_crm_api/utils"
 	"strconv"
@@ -451,6 +452,13 @@ func (this *EtaBusinessController) Add() {
 		return
 	}
 
+	// 给商家帮助文档所有分类的权限
+	if e = help_doc.AddAllHelpDocClassifyVisible(businessItem.EtaBusinessId); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "新增商家分类文档权限失败, Err: " + e.Error()
+		return
+	}
+
 	// 操作日志
 	go func() {
 		recordOb := new(eta_business.EtaBusinessOperationRecord)

+ 13 - 1
models/help_doc/classify.go

@@ -233,6 +233,18 @@ func EditHelpDocClassifyVisible(classifyId int, visibleBusinessIds string) (err
 	return
 }
 
+func AddAllHelpDocClassifyVisible(businessId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc_classify set visible_business_ids=CONCAT(visible_business_ids,",", ?)  where visible_business_ids !=""`
+	_, err = o.Raw(sql, businessId).Exec()
+	if err != nil {
+		return
+	}
+	sql = `UPDATE help_doc_classify set visible_business_ids=CONCAT(visible_business_ids, ?)  where visible_business_ids =""`
+	_, err = o.Raw(sql, businessId).Exec()
+	return
+}
+
 func GetAllHelpDocClassify() (items []*HelpDocClassifyItems, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM help_doc_classify `
@@ -245,4 +257,4 @@ func GetAllHelpDocClassifyByKeyword(keyword string) (items []*HelpDocClassifyIte
 	sql := `SELECT * FROM help_doc_classify WHERE classify_name LIKE '%` + keyword + `%' `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 1 - 0
utils/constants.go

@@ -13,6 +13,7 @@ const (
 	FormatDateUnSpace          = "20060102"                //日期格式
 	FormatDateTime             = "2006-01-02 15:04:05"     //完整时间格式
 	HlbFormatDateTime          = "2006-01-02_15:04:05.999" //完整时间格式
+	FormatDateTimeMinute       = "2006-01-02 15:04"        //时间格式 年-月-日 时:分
 	FormatDateTimeUnSpace      = "20060102150405"          //完整时间格式
 	FormatShortDateTimeUnSpace = "060102150405"            //省去开头两位年份的时间格式
 	EmptyDateTimeStr           = "0000-00-00 00:00:00"     //DateTime零值字符串