|
|
@@ -1,7 +1,6 @@
|
|
|
package railsadmin_controller
|
|
|
|
|
|
import (
|
|
|
- "fohow.com/apps"
|
|
|
"fohow.com/apps/models/summary_model"
|
|
|
"fohow.com/apps/models/user_model"
|
|
|
"github.com/astaxie/beego"
|
|
|
@@ -17,9 +16,17 @@ func (self *RailsadminController) UserPerfomance() {
|
|
|
|
|
|
beego.BeeLogger.Warn("UserPerfomance id:(%d)", id)
|
|
|
|
|
|
+ go CalcTeamPerfomance(id)
|
|
|
+
|
|
|
+ beego.BeeLogger.Warn("----------------end get wx user perfomance ")
|
|
|
+
|
|
|
+ self.ServeJSON()
|
|
|
+}
|
|
|
+func CalcTeamPerfomance(id int64) {
|
|
|
userSummary := summary_model.GetPerfomanceById(id, false)
|
|
|
if userSummary == nil {
|
|
|
- self.ReturnError(404, apps.NoExist, "", nil)
|
|
|
+ beego.BeeLogger.Warn("----------------userSummary not exist ")
|
|
|
+ return
|
|
|
}
|
|
|
//beginTime := userSummary.BeginDate.Unix()
|
|
|
//endTime := userSummary.EndDate.Unix()
|
|
|
@@ -32,7 +39,6 @@ func (self *RailsadminController) UserPerfomance() {
|
|
|
beego.BeeLogger.Warn("----------------begin get wx user perfomance ")
|
|
|
|
|
|
wxUserId := userSummary.WxUserId
|
|
|
- //统计个人业绩
|
|
|
//普通订单业绩
|
|
|
orderPerfomance := summary_model.GetSumOrderPerfomance(wxUserId, int64(0), beginTime, endTime)
|
|
|
//店长专区订单业绩
|
|
|
@@ -51,10 +57,8 @@ func (self *RailsadminController) UserPerfomance() {
|
|
|
userSummary.BalancePerfomance = balanceOrderPerfomance + inviteBalanceOrderPerfomance
|
|
|
userSummary.Total = userSummary.OrderPerfomance + userSummary.ShopOrderPerfomance + userSummary.ShopPerfomance + userSummary.BalancePerfomance
|
|
|
userSummary.Nums = nums + 1
|
|
|
- userSummary.Save()
|
|
|
- beego.BeeLogger.Warn("----------------end get wx user perfomance ")
|
|
|
-
|
|
|
- self.ServeJSON()
|
|
|
+ userSummary.Save() //统计个人业绩
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
func GetTeamPerfomance(list []*user_model.WxUser, beginTime, endTime int64) (orderPerfomance, shopOrderPerfomance, shopPerfomance, balanceOrderPerfomance int64) {
|