Commit 9eae0dd2 by mushishixian

调试

parent 4c2a317b
Showing with 10 additions and 1 deletions
......@@ -81,6 +81,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
var viewData model.ViewData
//fmt.Println(string(dataByte))
if err = json.Unmarshal(dataByte, &viewData); err != nil {
fmt.Println(err)
logger.Error(err.Error())
return
}
......@@ -98,12 +99,13 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
err = mongoConn.DB("ichunt").C("activity_view_history").
Find(whereMap).One(&historyData)
if err != nil && err != mgo.ErrNotFound {
fmt.Println(err)
logger.Error(err.Error())
return
}
//mysql数据操作
var result model.ActivityViewStatistics
err = specialDb.Table(&result).Where("activity_id", viewData.ActivityId).Select()
err = specialDb.Reset().Table(&result).Where("activity_id", viewData.ActivityId).Select()
if result.ActivityId == 0 {
//先去数据库插入
activityViewStatistics := model.ActivityViewStatistics{
......@@ -114,6 +116,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
}
_, err = specialDb.Reset().Table("lie_activity_view_statistics").Data(activityViewStatistics).Insert()
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
return
}
......@@ -133,6 +136,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
_, err = specialDb.Reset().Table("lie_activity_view_statistics").Where("activity_id", viewData.ActivityId).
Data(activityViewStatistics).Update()
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
return
}
......@@ -145,6 +149,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
selector := bson.M{"unique_id": historyData.UniqueId}
err = mongoConn.DB("ichunt").C("activity_view_history").Update(selector, &historyData)
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
}
} else {
......@@ -158,6 +163,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
var user model.UserMain
err = db.Reset().Table(&user).Where("user_id", viewData.UserId).Select()
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
}
mobile = user.Mobile
......@@ -166,6 +172,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
var userActivity model.UserActivity
count, err := db.Reset().Table(&userActivity).Where("activity_id", viewData.ActivityId).Where("user_id", viewData.UserId).Count()
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
}
if count != 0 {
......@@ -187,6 +194,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
if historyData.UniqueId == "" {
err = mongoConn.DB("ichunt").C("activity_view_history").Insert(&historyData)
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
}
} else {
......@@ -194,6 +202,7 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
selector := bson.M{"unique_id": historyData.UniqueId}
err = mongoConn.DB("ichunt").C("activity_view_history").Update(selector, &historyData)
if err != nil {
fmt.Println(err)
logger.Error(err.Error())
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment