|
@@ -3672,3 +3672,107 @@ func initRsListinit() {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//func init() {
|
|
|
|
+// initYaxuan()
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+func initYaxuan() {
|
|
|
|
+ udi := 121323
|
|
|
|
+ var nickname = "鱼与塘"
|
|
|
|
+ listYax, errList := cygx.GetYanxuanSpecialListByconditioninit(udi)
|
|
|
|
+ if errList != nil {
|
|
|
|
+ fmt.Println(errList)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //创建excel
|
|
|
|
+ dir, err := os.Executable()
|
|
|
|
+ exPath := filepath.Dir(dir)
|
|
|
|
+ downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
|
+ xlsxFile := xlsx.NewFile()
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ style := xlsx.NewStyle()
|
|
|
|
+ alignment := xlsx.Alignment{
|
|
|
|
+ Horizontal: "center",
|
|
|
|
+ Vertical: "center",
|
|
|
|
+ WrapText: true,
|
|
|
|
+ }
|
|
|
|
+ style.Alignment = alignment
|
|
|
|
+ style.ApplyAlignment = true
|
|
|
|
+
|
|
|
|
+ redStyle := xlsx.NewStyle()
|
|
|
|
+ redStyle.Alignment = alignment
|
|
|
|
+ redStyle.ApplyAlignment = true
|
|
|
|
+ redStyle.Font.Color = "ff0000"
|
|
|
|
+ //定义底色需要标黄的 单元格颜色
|
|
|
|
+ redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
|
|
|
|
+ redStyle.Fill = redFill
|
|
|
|
+ //redStyle.Border = *border
|
|
|
|
+
|
|
|
|
+ var sheetName string
|
|
|
|
+ sheetName = "活动"
|
|
|
|
+ sheet, err := xlsxFile.AddSheet(sheetName)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //标头
|
|
|
|
+ rowTitle := sheet.AddRow()
|
|
|
|
+ cellA := rowTitle.AddCell()
|
|
|
|
+ cellA.Value = "文章标题"
|
|
|
|
+ cellB := rowTitle.AddCell()
|
|
|
|
+ cellB.Value = "发布时间"
|
|
|
|
+ cellC := rowTitle.AddCell()
|
|
|
|
+ cellC.Value = "作者昵称"
|
|
|
|
+
|
|
|
|
+ cellD := rowTitle.AddCell()
|
|
|
|
+ cellD.Value = "读者手机号"
|
|
|
|
+ cellE := rowTitle.AddCell()
|
|
|
|
+ cellE.Value = "姓名"
|
|
|
|
+
|
|
|
|
+ cellF := rowTitle.AddCell()
|
|
|
|
+ cellF.Value = "公司名"
|
|
|
|
+
|
|
|
|
+ for _, v := range listYax {
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ condition = ` AND yanxuan_special_id = ? AND company_id != 16 GROUP BY mobile ORDER BY create_time DESC `
|
|
|
|
+ pars = append(pars, v.Id)
|
|
|
|
+
|
|
|
|
+ list, err := cygx.GetCygxYanxuanSpecialRecordList(condition, pars)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, item := range list {
|
|
|
|
+
|
|
|
|
+ row := sheet.AddRow()
|
|
|
|
+ cellAData := row.AddCell()
|
|
|
|
+ cellAData.Value = v.Title
|
|
|
|
+
|
|
|
|
+ cellBData := row.AddCell()
|
|
|
|
+ cellBData.Value = v.PublishTime.Format(utils.FormatDateTime)
|
|
|
|
+
|
|
|
|
+ cellCData := row.AddCell()
|
|
|
|
+ cellCData.Value = nickname
|
|
|
|
+
|
|
|
|
+ cellDData := row.AddCell()
|
|
|
|
+ cellDData.Value = item.RealName
|
|
|
|
+ cellEData := row.AddCell()
|
|
|
|
+ cellEData.Value = item.Mobile
|
|
|
|
+ cellFData := row.AddCell()
|
|
|
|
+ cellFData.Value = item.CompanyName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err = xlsxFile.Save(downLoadnFilePath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|