|
@@ -17,6 +17,7 @@ type HistoryData struct {
|
|
|
|
|
|
func (this *HistoryData) HistoryTask(history_id string) {
|
|
|
log.Println("开始历史任务...")
|
|
|
+ go UpdateHistoryState(1, history_id, 0)
|
|
|
//加载一个客户
|
|
|
log.Println("history_id", history_id)
|
|
|
customer, _ := Mgo.Find("historylog", map[string]interface{}{"_id": qu.StringTOBsonId(history_id)}, nil, nil, false, -1, -1)
|
|
@@ -61,7 +62,8 @@ func (this *HistoryData) HistoryTask(history_id string) {
|
|
|
// log.Println("c.SaveDataMap111", cus.SaveDataMap)
|
|
|
cus.RemoveRepeatData() //数据去重
|
|
|
// log.Println("c.SaveDataMap222", cus.SaveDataMap)
|
|
|
- cus.AssembelAndSaveData() //组装、保存数据
|
|
|
+ resultcount := cus.AssembelAndSaveData(history_id) //组装、保存数据
|
|
|
+ go UpdateHistoryState(2, history_id, resultcount)
|
|
|
} else {
|
|
|
log.Println("初始化客户信息失败")
|
|
|
}
|
|
@@ -79,3 +81,20 @@ func (this *HistoryData) HistoryList() {
|
|
|
this.Render("private/historylog_list.html", &this.T)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func UpdateHistoryState(state int, history_id string, count int) {
|
|
|
+ if state == 2 {
|
|
|
+ Mgo.Update("historylog", map[string]interface{}{"_id": qu.StringTOBsonId(history_id)}, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "state": state,
|
|
|
+ "result_count": count,
|
|
|
+ },
|
|
|
+ }, false, false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ Mgo.Update("historylog", map[string]interface{}{"_id": qu.StringTOBsonId(history_id)}, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "state": state,
|
|
|
+ },
|
|
|
+ }, false, false)
|
|
|
+}
|