|
@@ -140,7 +140,7 @@ func (c *CustomerRule) ProductData() {
|
|
|
defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
log.Println("正在生成预览数据。。。")
|
|
|
- // rep := false
|
|
|
+ rep := false
|
|
|
id := c.GetString("id")
|
|
|
tag, ok := Mgo.FindById("entniche_rule", id, `{}`)
|
|
|
if !ok {
|
|
@@ -204,13 +204,13 @@ func (c *CustomerRule) ProductData() {
|
|
|
// 其他的分隔
|
|
|
// 1000<=总个数<4000,将时间(publishtime)按照每3个月进行分割,然后查询到的数据量进行求和。
|
|
|
// 4000<=总个数<8000,将时间(publishtime)按照每1个月进行分割,然后查询到的数据量进行求和
|
|
|
- // var err error
|
|
|
- // var count int64
|
|
|
+ var err error
|
|
|
+ var count int64
|
|
|
// var n int
|
|
|
// 小于1000的直接查
|
|
|
// if totalCount < 1000 {
|
|
|
- // err, count = UtilEsFind1(*tag)
|
|
|
- go UtilEsFind1(*tag)
|
|
|
+ err, count = UtilEsFind1(*tag)
|
|
|
+ // UtilEsFind1(*tag)
|
|
|
// } else {
|
|
|
// if totalCount >= 1000 && totalCount < 4000 {
|
|
|
// n = 3
|
|
@@ -220,19 +220,22 @@ func (c *CustomerRule) ProductData() {
|
|
|
// }
|
|
|
// err, count = UtilEsFind2(*tag, n)
|
|
|
// }
|
|
|
- // var msg string
|
|
|
- // if err == nil {
|
|
|
- // rep = true
|
|
|
- // msg = "数据生成成功"
|
|
|
- // } else {
|
|
|
- // rep = false
|
|
|
- // msg = "数据生成失败"
|
|
|
- // }
|
|
|
- // c.ServeJson(map[string]interface{}{
|
|
|
- // "rep": rep,
|
|
|
- // "count": count,
|
|
|
- // "msg": msg,
|
|
|
- // })
|
|
|
+ if err == nil {
|
|
|
+ rep = true
|
|
|
+ // msg = "数据生成成功"
|
|
|
+ c.ServeJson(map[string]interface{}{
|
|
|
+ "rep": rep,
|
|
|
+ "count": count,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ rep = false
|
|
|
+ msg := "数据生成失败"
|
|
|
+ c.ServeJson(map[string]interface{}{
|
|
|
+ "rep": rep,
|
|
|
+ "count": count,
|
|
|
+ "msg": msg,
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|