abiao лет назад: 5
Родитель
Сommit
9ea7acc33b
100 измененных файлов с 2307 добавлено и 2563 удалено
  1. 0 10
      go/gopath/src/d5c-statement-api/Makefile
  2. 0 91
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_add.go
  3. 0 145
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section.go
  4. 0 133
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section_percent.go
  5. 0 132
      go/gopath/src/d5c-statement-api/controllers/d5c_customer_controller/friend_stat.go
  6. 0 80
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fan_grouth.go
  7. 0 61
      go/gopath/src/d5c-statement-api/controllers/d5c_prize_draw_act_controller/prize_draw_act_controller.go
  8. 0 57
      go/gopath/src/d5c-statement-api/controllers/d5c_static_data_controller/project_static_data.go
  9. 0 86
      go/gopath/src/d5c-statement-api/routers/commentsRouter_controllers.go
  10. 0 30
      go/gopath/src/d5c-statement-api/routers/commentsRouter_d5c-statement-api_controllers.go
  11. 10 0
      go/gopath/src/fohow-statement-api/Makefile
  12. 0 0
      go/gopath/src/fohow-statement-api/README.md
  13. 0 0
      go/gopath/src/fohow-statement-api/cache/init.go
  14. 2 2
      go/gopath/src/d5c-statement-api/conf/app.conf
  15. 11 15
      go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_day_add.go
  16. 19 22
      go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_day_grouth.go
  17. 13 16
      go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_month_add.go
  18. 16 19
      go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_month_grouth.go
  19. 14 17
      go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_day_add.go
  20. 20 23
      go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_day_grouth.go
  21. 16 18
      go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_month_add.go
  22. 17 20
      go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_month_grouth.go
  23. 10 10
      go/gopath/src/d5c-statement-api/controllers/cow_point_task/cow_point_task.go
  24. 2 2
      go/gopath/src/d5c-statement-api/controllers/cow_point_task/d5c_prize_record.go
  25. 1 1
      go/gopath/src/d5c-statement-api/controllers/cow_point_task/daily_game_record.go
  26. 24 35
      go/gopath/src/d5c-statement-api/controllers/cow_punch/cow_punch.go
  27. 48 57
      go/gopath/src/d5c-statement-api/controllers/d5c_article_controller/article_stat.go
  28. 2 2
      go/gopath/src/d5c-statement-api/controllers/d5c_bd_cash_order/take_cash_order_day.go
  29. 5 6
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_invest.go
  30. 20 20
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_month_invest_and_recharge.go
  31. 6 7
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_project.go
  32. 90 0
      go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_add.go
  33. 24 24
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_grouth.go
  34. 143 0
      go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section.go
  35. 131 0
      go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section_percent.go
  36. 66 67
      go/gopath/src/d5c-statement-api/controllers/d5c_bonus_gather_controller/project_bonus_gather.go
  37. 2 2
      go/gopath/src/d5c-statement-api/controllers/d5c_cash_order/take_cash_order_day.go
  38. 44 46
      go/gopath/src/d5c-statement-api/controllers/d5c_cost_controller/cost_monthly.go
  39. 4 3
      go/gopath/src/d5c-statement-api/controllers/d5c_customer_controller/customer_stat.go
  40. 128 0
      go/gopath/src/fohow-statement-api/controllers/d5c_customer_controller/friend_stat.go
  41. 80 0
      go/gopath/src/fohow-statement-api/controllers/d5c_fans_controller/fan_grouth.go
  42. 29 31
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_channel_stat.go
  43. 12 14
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_day_add.go
  44. 20 23
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_day_grouth.go
  45. 7 7
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_distribution.go
  46. 14 17
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_month_add.go
  47. 17 20
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_month_grouth.go
  48. 1 1
      go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_platform.go
  49. 11 11
      go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/left_top_data_of_home_page.go
  50. 108 109
      go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/new_home_page_middle.go
  51. 29 30
      go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/new_home_page_top.go
  52. 21 20
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_channel_stat.go
  53. 12 14
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_cycle_distribution.go
  54. 16 16
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_cycle_distribution.go
  55. 18 19
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_month_grouth.go
  56. 16 17
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_stat.go
  57. 8 8
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_total.go
  58. 4 5
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_total.go
  59. 19 23
      go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/user_investor_grouth.go
  60. 33 37
      go/gopath/src/d5c-statement-api/controllers/d5c_pm_balance_controller/d5c_pm_balance_stat.go
  61. 2 2
      go/gopath/src/d5c-statement-api/controllers/d5c_point_task/point_task.go
  62. 50 52
      go/gopath/src/d5c-statement-api/controllers/d5c_point_train_controller/point_train_stat.go
  63. 61 0
      go/gopath/src/fohow-statement-api/controllers/d5c_prize_draw_act_controller/prize_draw_act_controller.go
  64. 8 8
      go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_all.go
  65. 31 34
      go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_channel_total.go
  66. 9 10
      go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_distribution.go
  67. 79 82
      go/gopath/src/d5c-statement-api/controllers/d5c_rhkfpf_controller/rhkfpf_stat.go
  68. 58 0
      go/gopath/src/fohow-statement-api/controllers/d5c_static_data_controller/project_static_data.go
  69. 53 56
      go/gopath/src/d5c-statement-api/controllers/d5c_stock_transfer_controller/stock_transfer_stat.go
  70. 4 4
      go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_all_project.go
  71. 12 12
      go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_channel_stat.go
  72. 16 17
      go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_cycle_distribution.go
  73. 13 13
      go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_total.go
  74. 24 29
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_channel_stat.go
  75. 11 11
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_day_add.go
  76. 15 18
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_day_grouth.go
  77. 10 11
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_grouth.go
  78. 11 11
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_month_add.go
  79. 17 17
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_month_grouth.go
  80. 5 5
      go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_register.go
  81. 18 18
      go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_channel_stat.go
  82. 19 20
      go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_month_grouth.go
  83. 7 7
      go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_total.go
  84. 54 56
      go/gopath/src/d5c-statement-api/controllers/rabbit_balance_consume_controller/rabbit_balance_consume.go
  85. 91 95
      go/gopath/src/d5c-statement-api/controllers/rabbit_exchange_platform_controller/rabbit_exchange_platform_stat.go
  86. 68 68
      go/gopath/src/d5c-statement-api/controllers/rabbit_merchant_controller/rabbit_merchant_checkout_list.go
  87. 48 49
      go/gopath/src/d5c-statement-api/controllers/rabbit_product_sold_controller/rabbit_product_sold.go
  88. 48 49
      go/gopath/src/d5c-statement-api/controllers/rabbit_user_signup_controller/rabbit_user_signup_controller.go
  89. 0 0
      go/gopath/src/fohow-statement-api/controllers/response.go
  90. 2 3
      go/gopath/src/d5c-statement-api/controllers/token.go
  91. 14 16
      go/gopath/src/d5c-statement-api/controllers/user.go
  92. 9 9
      go/gopath/src/d5c-statement-api/filters/token_authentication_filter.go
  93. 2 2
      go/gopath/src/fohow-statement-api/helpers/helpers.go
  94. 2 2
      go/gopath/src/d5c-statement-api/main.go
  95. 5 6
      go/gopath/src/d5c-statement-api/models/cow_adopt.go
  96. 1 1
      go/gopath/src/d5c-statement-api/models/cow_game_record.go
  97. 0 3
      go/gopath/src/d5c-statement-api/models/cow_point_task.go
  98. 61 72
      go/gopath/src/d5c-statement-api/models/cow_punch_dt.go
  99. 6 14
      go/gopath/src/d5c-statement-api/models/cow_wx_user.go
  100. 0 0
      go/gopath/src/d5c-statement-api/models/d5c_articles.go

+ 0 - 10
go/gopath/src/d5c-statement-api/Makefile

@@ -1,10 +0,0 @@
-all: build
-
-build:
-	go build -o d5c-statement-api ./main.go
-
-clean:
-	go clean -i ./...
-
-test:
-	go test -race ./...

+ 0 - 91
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_add.go

@@ -1,91 +0,0 @@
-package d5c_bonus_contoller
-
-import (
-	"github.com/astaxie/beego"
-	"time"
-	"strings"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
-)
-
-type BonusRechargeMonthRiseController struct {
-	beego.Controller
-}
-
-// @Title Get
-// @Description 用户充值月统计,默认当月:充值总额,老用户充值总额,新用户充值总额,充值总人数,充值老用户人数,充值新用户人数
-// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	false	"query_date"
-// @Success 200 {object} Ret
-// @router / [get]
-func (self *BonusRechargeMonthRiseController) Get(){
-
-	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
-
-	type Ret struct {
-		Month                 string        `json:"month"`
-		MonthTotalRecharge    float64       `json:"month_total_recharge"`
-		MonthOldRecharge      float64       `json:"month_old_recharge"`
-		MonthNewRecharge      float64       `json:"month_new_recharge"`
-		MonthTotalRecharger   int64         `json:"month_total_rechargers"`
-		MonthOldRecharger     int64         `json:"month_old_rechargers"`
-		MonthNewRecharger     int64         `json:"month_new_rechargers"`
-	}
-
-	now := time.Now()
-	start := time.Date(now.Year(),now.Month(),1,0,0,0,0,time.Local)
-	end := start.AddDate(0,1,0)
-
-	if len(s) == 2 {
-		startTmp,_ := time.Parse("2006-01", query_date)
-		start = time.Date(startTmp.Year(), startTmp.Month(),1,0,0,0,0,time.Local)
-		end = start.AddDate(0,1,0)
-	}
-
-	if len(s) == 3 {
-		startTmp,_ := time.Parse("2006-01-02", query_date)
-		start = time.Date(startTmp.Year(), startTmp.Month(),1,0,0,0,0,time.Local)
-		end = start.AddDate(0,1,0)
-	}
-
-
-	monthTotalRecharge := float64(0)
-	monthOldRecharge := float64(0)
-	monthNewRecharge := float64(0)
-	monthTotalRecharger := int64(0)
-	monthOldRecharger:= int64(0)
-	monthNewRecharger := int64(0)
-
-	userRecharges := models.GetTotalRechargeOnAllUser(start,end)
-
-	//	统计总充值金额,...,新用户充值人数
-	for _,item := range userRecharges {
-
-		monthTotalRecharge += float64(item.Recharge)
-		monthTotalRecharger += 1
-
-		hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
-
-		if hasRecharge {
-
-			monthOldRecharge += float64(item.Recharge)
-			monthOldRecharger += 1
-
-		}else {
-			monthNewRecharge += float64(item.Recharge)
-			monthNewRecharger += 1
-		}
-
-	}
-
-	self.Data["json"] = &Ret{Month: start.Format("2006-01"),
-							MonthTotalRecharge: tools.RoundFloat64(monthTotalRecharge/float64(100),2),
-							MonthOldRecharge: tools.RoundFloat64(monthOldRecharge/float64(100),2),
-							MonthNewRecharge:tools.RoundFloat64(monthNewRecharge/float64(100),2),
-							MonthTotalRecharger:monthTotalRecharger,
-							MonthOldRecharger:monthOldRecharger,
-							MonthNewRecharger:monthNewRecharger,
-						}
-	self.ServeJSON()
-}

+ 0 - 145
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section.go

@@ -1,145 +0,0 @@
-package d5c_bonus_contoller
-
-import (
-	"github.com/astaxie/beego"
-	"strings"
-	"time"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
-)
-
-type BonusRechargeSectionController struct {
-	beego.Controller
-}
-
-// @Title Get
-// @Description 用户充值区间月统计,默认当月
-// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	false	"query_date"
-// @Success 200 {object} Ret
-// @router / [get]
-func (self *BonusRechargeSectionController) Get(){
-
-	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
-
-	type Ret struct {
-		Month                 string        `json:"month"`
-		Section               [6]string        `json:"section"`
-		MonthTotalRecharge    []float64       `json:"month_total_recharge"`
-		MonthOldRecharge      []float64       `json:"month_old_recharge"`
-		MonthNewRecharge      []float64       `json:"month_new_recharge"`
-		MonthTotalRecharger   []int64         `json:"month_total_rechargers"`
-		MonthOldRecharger     []int64         `json:"month_old_rechargers"`
-		MonthNewRecharger     []int64         `json:"month_new_rechargers"`
-	}
-
-	now := time.Now()
-	start := time.Date(now.Year(),now.Month(),1,0,0,0,0,time.Local)
-	end := start.AddDate(0,1,0)
-	startTmp := now
-
-
-	if len(s) == 2 {
-		startTmp,_ = time.Parse("2006-01", query_date)
-	}
-
-	if len(s) == 3 {
-		startTmp,_ = time.Parse("2006-01-02", query_date)
-	}
-	start = time.Date(startTmp.Year(), startTmp.Month(),1,0,0,0,0,time.Local)
-	end = start.AddDate(0,1,0)
-
-	var se = [6]int64{0, 1, 100000, 500000, 1000000, 5000000}
-	var section = [6]string{"0-1","1-1000", "1000-5000","5000-10000", "10000-50000", "50000以上"}
-
-	var monthTotalRechargeArray []float64
-	var monthOldRechargeArray []float64
-	var monthNewRechargeArray []float64
-	var monthTotalRechargerArray []int64
-	var monthOldRechargerArray []int64
-	var monthNewRechargerArray []int64
-
-	userRecharges := models.GetTotalRechargeOnAllUser(start,end)
-
-	for i:= 0 ; i<len(se); i++ {//遍历区间
-
-		monthTotalRecharge := float64(0)
-		monthOldRecharge := float64(0)
-		monthNewRecharge := float64(0)
-		monthTotalRecharger := int64(0)
-		monthOldRecharger := int64(0)
-		monthNewRecharger := int64(0)
-
-		if i == len(se)-1{
-			//	统计总充值金额,...,新用户充值人数
-			for _,item := range userRecharges {//遍历数据
-
-				if item.Recharge > se[i] {//判断属于最后一个区间
-
-					monthTotalRecharge += float64(item.Recharge)
-					monthTotalRecharger += 1
-
-					hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
-
-					if hasRecharge {
-
-						monthOldRecharge += float64(item.Recharge)
-						monthOldRecharger += 1
-
-					}else {
-						monthNewRecharge += float64(item.Recharge)
-						monthNewRecharger += 1
-					}
-
-				}
-
-			}
-		}else{
-			//	统计总充值金额,...,新用户充值人数
-			for _,item := range userRecharges {//遍历数据
-
-				if item.Recharge > se[i] && item.Recharge <= se[i+1] {//判断属于那个区间
-
-					monthTotalRecharge += float64(item.Recharge)
-					monthTotalRecharger += 1
-
-					hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
-
-					if hasRecharge {
-
-						monthOldRecharge += float64(item.Recharge)
-						monthOldRecharger += 1
-
-					}else {
-						monthNewRecharge += float64(item.Recharge)
-						monthNewRecharger += 1
-					}
-				}
-			}
-
-		}
-
-		monthTotalRechargeArray = append(monthTotalRechargeArray,tools.RoundFloat64(monthTotalRecharge/float64(100),2))
-		monthOldRechargeArray = append(monthOldRechargeArray,tools.RoundFloat64(monthOldRecharge/float64(100),2))
-		monthNewRechargeArray = append(monthNewRechargeArray,tools.RoundFloat64(monthNewRecharge/float64(100),2))
-		monthTotalRechargerArray = append(monthTotalRechargerArray,monthTotalRecharger)
-		monthOldRechargerArray = append(monthOldRechargerArray,monthOldRecharger)
-		monthNewRechargerArray = append(monthNewRechargerArray,monthNewRecharger)
-	}
-
-	self.Data["json"] = &Ret{
-
-		Month:start.Format("2006-01-02"),
-		Section:section,
-		MonthTotalRecharge:monthTotalRechargeArray,
-		MonthOldRecharge:monthOldRechargeArray,
-		MonthNewRecharge:monthNewRechargeArray,
-		MonthTotalRecharger:monthTotalRechargerArray,
-		MonthOldRecharger:monthOldRechargerArray,
-		MonthNewRecharger:monthNewRechargerArray,
-	}
-
-	self.ServeJSON()
-}
-

+ 0 - 133
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section_percent.go

@@ -1,133 +0,0 @@
-package d5c_bonus_contoller
-
-import (
-	"github.com/astaxie/beego"
-	"strings"
-	"time"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
-)
-
-type BonusRechargeSectionPercentController struct {
-	beego.Controller
-}
-
-// @Title Get
-// @Description 用户充值区间月统计,默认当月
-// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	false	"query_date"
-// @Success 200 {object} Ret
-// @router / [get]
-func (self *BonusRechargeSectionPercentController) Get(){
-
-	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
-
-	type MapData struct {
-		Value      float64        `json:"value"`
-		Name       string         `json:"name"`
-	}
-
-	type Ret struct {
-		Month string `json:"month"`//本月月份
-		Section [6]string `json:"section"`//区间
-		RechargeMapData          []*MapData     `json:"recharge_map_data"`
-		RechargerMapData         []*MapData     `json:"recharger_map_date"`
-		NewTotalRecharge         float64        `json:"new_total_recharge"`
-		NewTotalRecharger        int64          `json:"new_total_recharger"`
-		OldTotalRecharge         float64        `json:"old_total_recharge"`
-		OldTotalRecharger        int64          `json:"old_total_recharger"`
-	}
-
-	now := time.Now()
-	start := time.Date(now.Year(),now.Month(),1,0,0,0,0,time.Local)
-	end := start.AddDate(0,1,0)
-	startTmp := now
-
-
-	if len(s) == 2 {
-		startTmp,_ = time.Parse("2006-01", query_date)
-	}
-
-	if len(s) == 3 {
-		startTmp,_ = time.Parse("2006-01-02", query_date)
-	}
-	start = time.Date(startTmp.Year(), startTmp.Month(),1,0,0,0,0,time.Local)
-	end = start.AddDate(0,1,0)
-
-	var se = [6]int64{0, 1, 100000, 500000, 1000000, 5000000}
-	var section = [6]string{"0-1","1-1000", "1000-5000","5000-10000", "10000-50000", "50000以上"}
-
-	var monOldRechargeAllSe float64  //新充值总额,不分区间
-	var monOldRechargerAllSe int64   //新充值总人数,不分区间
-	var monNewRechargeAllSe float64  //新用户充值总额,不分区间
-	var monNewRechargerAllSe int64   //新用户充值总人数,不分区间
-
-	var rechargeMapData  []*MapData
-	var rechargerMapData []*MapData
-
-
-	userRecharges := models.GetTotalRechargeOnAllUser(start,end)
-
-	for i:= 0 ; i<len(se); i++ {//遍历区间
-
-		rechargeMap := new(MapData)
-		rechargerMap := new(MapData)
-
-		monthPerSeTotalRecharge := float64(0)
-
-		monthPerSeTotalRecharger := int64(0)
-		if i == len(se)-1{
-			//	统计总充值金额,...,新用户充值人数
-			for _,item := range userRecharges {//遍历数据
-				if item.Recharge > se[i] {//判断区间
-
-					monthPerSeTotalRecharge += float64(item.Recharge)
-					monthPerSeTotalRecharger += 1
-				}
-			}
-		}else{
-			//	统计总充值金额,...,新用户充值人数
-			for _,item := range userRecharges {//遍历数据
-				if item.Recharge > se[i] && item.Recharge <= se[i+1] {//判断属于那个区间
-
-					monthPerSeTotalRecharge += float64(item.Recharge)
-					monthPerSeTotalRecharger += 1
-				}
-			}
-		}
-
-		rechargerMap.Value = float64(monthPerSeTotalRecharger)
-		rechargerMap.Name = section[i]
-		rechargeMap.Value = tools.RoundFloat64(monthPerSeTotalRecharge/float64(100),2)
-		rechargeMap.Name = section[i]
-
-		rechargeMapData = append(rechargeMapData,rechargeMap)
-		rechargerMapData = append(rechargerMapData,rechargerMap)
-	}
-
-	for _,item := range userRecharges {
-
-		hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
-
-		if !hasRecharge{
-			monNewRechargeAllSe += float64(item.Recharge)/float64(100)
-			monNewRechargerAllSe += 1
-		}else{
-			monOldRechargeAllSe += float64(item.Recharge)/float64(100)
-			monOldRechargerAllSe += 1
-		}
-
-	}
-
-	self.Data["json"] = &Ret{Month:start.Format("2006-01-02"), Section:section,
-		RechargeMapData: rechargeMapData,
-		RechargerMapData:rechargerMapData,
-		NewTotalRecharge:tools.RoundFloat64(monNewRechargeAllSe,2),
-		NewTotalRecharger:monNewRechargerAllSe,
-		OldTotalRecharge:tools.RoundFloat64(monOldRechargeAllSe,2),
-		OldTotalRecharger:monOldRechargerAllSe,
-	}
-	beego.BeeLogger.Info("%v",self.Data["json"])
-	self.ServeJSON()
-}

+ 0 - 132
go/gopath/src/d5c-statement-api/controllers/d5c_customer_controller/friend_stat.go

@@ -1,132 +0,0 @@
-package d5c_customer_controller
-
-import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"time"
-	"strconv"
-)
-
-type FriendStatController struct {
-	beego.Controller
-}
-
-
-// @Title Get
-// @Description 客服加好友模块 : 每月新增,当月新增,好友总数
-// @Param Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	true	"query_date"
-// @Success 200 {object} Ret
-// @router /new/monthly [get]
-func (self *FriendStatController) MonthlyNew(){
-
-	query_date := self.GetString("query_date")
-
-	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 0, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
-
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryDate = queryDateTmp.AddDate(0,-5,0)
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
-
-	totalPhoneFriend := models.GetTotalPhoneFriends()
-
-	friend := models.GetTotalPhoneFriendByTime(queryNextDate.AddDate(0,-1,0), queryNextDate)
-
-	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate,"%Y%m")
-
-	type Ret struct {
-
-		TotalPhoneFriend         int64          `json:"total_phone_friend"`
-		NewFriend                int64          `json:"new_friend"`
-		TimeNewPhoneFriendList   []int64        `json:"time_new_phone_friend_list"`
-		Times                    []string       `json:"times"`
-	}
-
-	var timeNewPhoneFriends []int64
-	var times []string
-	for i:=0; i<6;i++  {
-
-		increaseDate := queryDate.AddDate(0,i,0).Format("01")
-		times = append(times, increaseDate+"月")
-		beego.BeeLogger.Warn("---------%d",increaseDate)
-
-		findDate := queryDate.AddDate(0,i,0).Format("200601")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
-
-		//客服加手机每月增长
-		if item := models.ContainInItemListAndReturn(findDateInt, timeNewPhoneFriendList); item != nil {
-			timeNewPhoneFriends = append(timeNewPhoneFriends, item.Count)
-		}else {
-			timeNewPhoneFriends = append(timeNewPhoneFriends, 0)
-		}
-	}
-
-	self.Data["json"]=&Ret{TotalPhoneFriend:totalPhoneFriend, NewFriend:friend,Times:times,TimeNewPhoneFriendList:timeNewPhoneFriends}
-	self.ServeJSON()
-}
-
-// @Title Get
-// @Description 客服加好友模块 : 每个客服好友总数,该月新增,该月每天新增
-// @Param Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	true	"query_date"
-// @Success 200 {object} Ret
-// @router /single/daily [get]
-func (self *FriendStatController) SingleDailyList(){
-	query_date := self.GetString("query_date")
-
-	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
-
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryDate = queryDateTmp
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
-
-	type Ret struct {
-		Times  []string                      `json:"times"`
-		List   []*models.CustomerItem        `json:"list"`
-	}
-
-	allList := models.GetCustomerDataListByTime(queryDate,queryNextDate, true)
-
-	var times []string
-	for i:=0; i< queryDate.Day();i++  {
-		time := queryDate.AddDate(0,0,i).Format("02")
-		times = append(times,time)
-	}
-
-	for _,item := range allList{
-
-		singleList := models.GetCustomerCountListByWxidAndTime(queryDate, queryNextDate, item.WxUid)
-		var counts []int64
-
-		for i:=0; i< queryNextDate.AddDate(0,0,-1).Day();i++  {
-
-			timeString := queryDate.AddDate(0,0,i).Format("20060102")
-			timeInt,_ := strconv.ParseInt(timeString, 0, 64)
-			//beego.BeeLogger.Warn("timeInt%d",timeInt)
-
-			count := models.ContainInItemListAndReturnItemCount(timeInt,singleList)
-
-			counts = append(counts,count)
-
-		}
-
-		item.TimeCountList = counts
-	}
-
-	self.Data["json"] = &Ret{
-		Times:times,
-		List: allList,
-	}
-
-	self.ServeJSON()
-}
-
-

+ 0 - 80
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fan_grouth.go

@@ -1,80 +0,0 @@
-package d5c_fans_controller
-
-import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"time"
-	"fmt"
-)
-
-type FanGrouthController struct {
-	beego.Controller
-}
-
-// @Title Get
-// @Description 粉丝近六月的净增和新增;platform_type是平台标识,主要有superd5c,d5ctdyh,diwutegongdui三种,默认是superd5c;is_newly:true为新增,false为净增,默认false
-// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	is_newly	query	boolean	false	"is_newly"
-// @Success 200 {object} Ret
-// @router / [get]
-func (self *FanGrouthController) Get() {
-
-	//platform_type := self.GetString("platform_type")
-	is_newly, _ := self.GetBool("is_newly", false)
-
-	//if strings.TrimSpace(platform_type) == "" {
-	//	platform_type = models.PLATFORM_TYPE_FANS_D5C
-	//}
-
-	type Ret struct {
-		Months                []string `json:"months"`             //最近6个月
-		MonthD5cFans          []int64  `json:"month_d5c_fans"`     //每月第五创粉丝增长:净增/新增
-		MonthDyhFans          []int64  `json:"month_dyh_fans"`     //每月订阅号粉丝增长:净增/新增
-		MonthTgdFans          []int64  `json:"month_tgd_fans"`     //每月特工队粉丝增长:净增/新增
-	}
-
-	now := time.Now()
-	fiveMonthsAgo :=  now.AddDate(0,-5,0)
-
-	monthNewD5cList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo,now,models.PLATFORM_TYPE_FANS_D5C,is_newly)
-
-	monthNewDyhList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo,now,models.PLATFORM_TYPE_FANS_DYH,is_newly)
-
-	monthNewTgdList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo,now,models.PLATFORM_TYPE_FANS_TGD,is_newly)
-
-	var months []string
-	var monthD5cfans []int64
-	var monthDyhfans []int64
-	var monthTgdfans []int64
-
-	start := time.Date(fiveMonthsAgo.Year(),fiveMonthsAgo.Month(),1,0,0,0,0,time.Local)
-
-	for i:= 0 ; i<6 ; i++ {
-
-		month := start.AddDate(0,i,0).Month()
-
-		months = append(months, fmt.Sprintf("%d月",month))
-
-		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewD5cList);monthNewItem!= nil {
-			monthD5cfans = append(monthD5cfans,monthNewItem.Count)
-		}else{
-			monthD5cfans = append(monthD5cfans,0)
-		}
-
-		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewDyhList);monthNewItem!= nil {
-			monthDyhfans = append(monthDyhfans,monthNewItem.Count)
-		}else{
-			monthDyhfans = append(monthDyhfans,0)
-		}
-
-		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewTgdList);monthNewItem!= nil {
-			monthTgdfans = append(monthTgdfans,monthNewItem.Count)
-		}else{
-			monthTgdfans = append(monthTgdfans,0)
-		}
-
-	}
-
-	self.Data["json"] = &Ret{Months:months, MonthD5cFans: monthD5cfans, MonthDyhFans: monthDyhfans, MonthTgdFans: monthTgdfans}
-	self.ServeJSON()
-}

+ 0 - 61
go/gopath/src/d5c-statement-api/controllers/d5c_prize_draw_act_controller/prize_draw_act_controller.go

@@ -1,61 +0,0 @@
-package d5c_prize_draw_act_controller
-
-import (
-	"github.com/astaxie/beego"
-	"time"
-	"d5c-statement-api/models"
-	"strconv"
-)
-
-type PrizeDrawActController struct {
-	beego.Controller
-}
-
-// @Title Get
-// @Description 每日抽奖活动数据单月每天统计, query_date是日期YYYY-MM-DD
-// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
-// @Param	query_date	query	string	false	"query_date"
-// @Success 200 {object} Ret
-// @router /line [get]
-func (self *PrizeDrawActController)ActJoinStatDaily()  {
-
-	type Ret struct {
-		Day         []string `json:"day"`            //天数
-		Count       []int64  `json:"count"`           //参加每日抽奖的人数
-		WinCount    []int64  `json:"win_count"`       //参加每日抽奖的中奖人数
-	}
-
-	query_date := self.GetString("query_date")
-	useCache,_ := self.GetBool("cache", true)
-
-	//--------------------------------------------日期处理
-	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)//2018-03-01 00:00:00
-	queryNextDate := queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
-
-	list := models.GetPrizeDrawActJoinLine(queryDate, queryNextDate, useCache)
-
-	var counts []int64
-	var winCounts []int64
-	var times []string
-
-	for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
-
-		increaseDate := queryDate.AddDate(0,0,i).Format("01-02")
-		times = append(times, increaseDate)
-
-		findDate := queryDate.AddDate(0,0,i).Format("20060102")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
-
-		beego.BeeLogger.Warn("%s,%d", increaseDate,findDateInt)
-
-		count,winCount := models.ContainsInPrizeDrawActDataListAndReturnItemCount(findDateInt, list)
-
-		counts = append(counts, count)
-
-		winCounts = append(winCounts, winCount)
-	}
-
-	self.Data["json"] = &Ret{Day:times, Count:counts, WinCount:winCounts}
-	self.ServeJSON()
-}

+ 0 - 57
go/gopath/src/d5c-statement-api/controllers/d5c_static_data_controller/project_static_data.go

@@ -1,57 +0,0 @@
-package d5c_static_data_controller
-
-import (
-	"d5c-statement-api/models"
-	"fmt"
-	"github.com/astaxie/beego"
-)
-
-type ProjectStaticDataController struct {
-	beego.Controller
-}
-
-type Ret struct {
-	InvNums                   int64   `json:"invest_nums"`                //进行过项目投资的人数
-	NoInvNums                 int64    `json:"no_invest_nums"`               //没有进行项目投资的人数
-	NewInvNums                int64    `json:"new_invest_nums"`             //新用户
-	OldInvNums                int64    `json:"old_invest_nums"`             //老用户
-	Remark                    string    `json:"remark"`                     //说明
-}
-// @Title Get
-// @Description get 一元购投资用户统计
-// @Success 200 {object} Ret
-// @router /list [get]
-func (self *ProjectStaticDataController) List(){
-
-	var investProjectList        []*models.DollarJoinItem
-	var newInvestProjectList        []*models.DollarJoinItem
-	var oldInvestProjectList        []*models.DollarJoinItem
-	dollarUserCountList := models.GetAllDollarsJoinCount( false)
-	projectUserCountList := models.GetAllProjectJoinCount( false)
-	for _,dollarItem := range dollarUserCountList{
-		for _,projectItem := range projectUserCountList{
-			if(dollarItem.Tel==projectItem.Tel){
-				//如果一元购用户进行过项目投资,则加入 进行过投资的数据
-				investProjectList = append(investProjectList, dollarItem)
-				if(dollarItem.PaidAt < projectItem.PaidAt ){
-					//新用户= 一元活动参与时间 < 首次投资时间
-					beego.BeeLogger.Warn("new tel=[%d]", projectItem.Tel)
-					newInvestProjectList = append(newInvestProjectList, dollarItem)
-				}else{
-					//老用户= 首次投资时间 < 一元活动投资时间
-					oldInvestProjectList = append(oldInvestProjectList, dollarItem)
-				}
-			}
-		}
-	}
-
-	InvNumsCount := int64(len(investProjectList))
-	NoInvNumsCount:=int64(len(dollarUserCountList))-int64(len(investProjectList))
-	NewNumsCount:=int64(len(newInvestProjectList))
-	OldInvNumsCount:=int64(len(oldInvestProjectList))
-
-	Remark:=fmt.Sprintf("一元购进行过投资的用户:%s 一元购未进行过投资的用户:%s  参与过投资的新用户:%s 一元购进行过投资的老用户:%s", "invest_nums", "no_invest_nums", "new_invest_nums", "old_invest_nums")
-
-	self.Data["json"] = &Ret{InvNums:InvNumsCount, NoInvNums:NoInvNumsCount, NewInvNums: NewNumsCount, OldInvNums: OldInvNumsCount, Remark: Remark}
-	self.ServeJSON()
-}

+ 0 - 86
go/gopath/src/d5c-statement-api/routers/commentsRouter_controllers.go

@@ -1,86 +0,0 @@
-package routers
-
-import (
-	"github.com/astaxie/beego"
-)
-
-func init() {
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:BonusInvestController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:BonusInvestController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:BonusMonthInvestAndRechargeController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:BonusMonthInvestAndRechargeController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:FanGrouthController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:FanGrouthController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:FansDistributionController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:FansDistributionController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:FansPlatformContoller"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:FansPlatformContoller"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:ProjectDistributionController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:ProjectDistributionController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"],
-		beego.ControllerComments{
-			"Post",
-			`/`,
-			[]string{"post"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"],
-		beego.ControllerComments{
-			"Delete",
-			`/`,
-			[]string{"delete"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:UserController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:UserController"],
-		beego.ControllerComments{
-			"Get",
-			`/:uid`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:UserGrouthController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:UserGrouthController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:UserRegisterController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:UserRegisterController"],
-		beego.ControllerComments{
-			"Get",
-			`/`,
-			[]string{"get"},
-			nil})
-
-}

+ 0 - 30
go/gopath/src/d5c-statement-api/routers/commentsRouter_d5c-statement-api_controllers.go

@@ -1,30 +0,0 @@
-package routers
-
-import (
-	"github.com/astaxie/beego"
-)
-
-func init() {
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"],
-		beego.ControllerComments{
-			"Post",
-			`/`,
-			[]string{"post"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:TokenController"],
-		beego.ControllerComments{
-			"Delete",
-			`/`,
-			[]string{"delete"},
-			nil})
-
-	beego.GlobalControllerRouter["d5c-statement-api/controllers:UserController"] = append(beego.GlobalControllerRouter["d5c-statement-api/controllers:UserController"],
-		beego.ControllerComments{
-			"Get",
-			`/:uid`,
-			[]string{"get"},
-			nil})
-
-}

+ 10 - 0
go/gopath/src/fohow-statement-api/Makefile

@@ -0,0 +1,10 @@
+all: build
+
+build:
+	go build -o fohow-statement-api ./main.go
+
+clean:
+	go clean -i ./...
+
+test:
+	go test -race ./...

go/gopath/src/d5c-statement-api/README.md → go/gopath/src/fohow-statement-api/README.md


go/gopath/src/d5c-statement-api/cache/init.go → go/gopath/src/fohow-statement-api/cache/init.go


+ 2 - 2
go/gopath/src/d5c-statement-api/conf/app.conf

@@ -1,5 +1,5 @@
-appname = d5c-statement-api
-httpport = 8080
+appname = fohow-statement-api
+httpport = ls
 runmode = dev
 autorender = false
 copyrequestbody = true

+ 11 - 15
go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_day_add.go

@@ -1,10 +1,10 @@
 package adopt_cows_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
 type CowsDayAddController struct {
@@ -17,38 +17,34 @@ type CowsDayAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *CowsDayAddController) Get(){
+func (self *CowsDayAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
-	lastDay := now.AddDate(0,0,-1)//2018-03-23 14:32:00
-	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0,0 ,0, time.Local)//2018-03-23 00:00:00
+	now := time.Now()                                                                              //2018-03-24 14:32:00
+	lastDay := now.AddDate(0, 0, -1)                                                               //2018-03-23 14:32:00
+	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0, 0, 0, time.Local) //2018-03-23 00:00:00
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0,0 ,0, time.Local)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0, 0, 0, time.Local)
 	}
 
 	type Ret struct {
-		QueryDate      string          `json:"query_date"`       //查询日期
-		CowsDayNewAdd  int64           `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		CowsDayNetAdd  int64           `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		QueryDate     string `json:"query_date"`       //查询日期
+		CowsDayNewAdd int64  `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		CowsDayNetAdd int64  `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
 	}
 
 	//2018-03-09 00:00:00----2018-03-10 00:00:00
 	//不分有没有渠道的所有领养牛仔总数
-	subCowCount := models.GetAllCowAdoptCowCount(queryDate, queryDate.AddDate(0,0,1), true)
-
-
+	subCowCount := models.GetAllCowAdoptCowCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01-02"), CowsDayNewAdd: subCowCount, CowsDayNetAdd: subCowCount}
 
 	self.ServeJSON()
 
-
-
 }

+ 19 - 22
go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_day_grouth.go

@@ -1,14 +1,13 @@
 package adopt_cows_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
-	"d5c-statement-api/models"
 	"strconv"
 	"strings"
+	"time"
 )
 
-
 type CowsDayGrouthController struct {
 	beego.Controller
 }
@@ -22,32 +21,32 @@ type CowsDayGrouthController struct {
 func (self *CowsDayGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Days                []string `json:"days"`             //最近7天
-		DayNewCows          []int64  `json:"day_new_cows"`     //新增
-		DayNetCows          []int64  `json:"day_net_cows"`     //净增
+		Days       []string `json:"days"`         //最近7天
+		DayNewCows []int64  `json:"day_new_cows"` //新增
+		DayNetCows []int64  `json:"day_net_cows"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, 0, -7) //2018-03-17 14:32:00
-	nextTime := now//2018-03-24 14:32:00
+	nextTime := now                    //2018-03-24 14:32:00
 
 	// 2018-03-17 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),startTime.Day(),0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 0, 0, 0, time.Local)
 	// 2018-03-24 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(),0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(), 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(),0,0,0,0,time.Local)
+		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		//2018-03-03 00:00:00
 		start = queryDateTmp.AddDate(0, 0, -6) //前6天
-		beego.BeeLogger.Warn("start:%s",start)
+		beego.BeeLogger.Warn("start:%s", start)
 		//2018-03-10 00:00:00
-		end = queryDateTmp.AddDate(0,0,1)
-		beego.BeeLogger.Warn("end:%s",end)
+		end = queryDateTmp.AddDate(0, 0, 1)
+		beego.BeeLogger.Warn("end:%s", end)
 
 	}
 
@@ -60,7 +59,6 @@ func (self *CowsDayGrouthController) Get() {
 	var dayNewFans []int64
 	var dayNetFans []int64
 
-
 	for i := 0; i < 7; i++ {
 
 		day := start.AddDate(0, 0, i).Format("01-02")
@@ -68,8 +66,8 @@ func (self *CowsDayGrouthController) Get() {
 
 		md := start.AddDate(0, 0, i).Format("20060102")
 
-		mdInt,_ := strconv.ParseInt(md, 0 ,64)
-		beego.BeeLogger.Warn("md:%s,mdint:%d",md,mdInt)
+		mdInt, _ := strconv.ParseInt(md, 0, 64)
+		beego.BeeLogger.Warn("md:%s,mdint:%d", md, mdInt)
 
 		adopt := models.ContainsInDayItemListAndReturnItemCount(mdInt, adoptCowCountPerDayList)
 		//subOther := ContainsInDayListAndReturn(mdInt, subOtherCountPerDayList)
@@ -78,8 +76,7 @@ func (self *CowsDayGrouthController) Get() {
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  adopt
+		dayNewF := adopt
 		beego.BeeLogger.Warn("dayNewF:%d", dayNewF)
 
 		dayNewFans = append(dayNewFans, dayNewF)
@@ -90,7 +87,7 @@ func (self *CowsDayGrouthController) Get() {
 		dayNetFans = append(dayNetFans, dayNetF)
 	}
 
-	self.Data["json"] = &Ret{Days:days, DayNewCows: dayNewFans,DayNetCows: dayNetFans}
+	self.Data["json"] = &Ret{Days: days, DayNewCows: dayNewFans, DayNetCows: dayNetFans}
 	self.ServeJSON()
 
-}
+}

+ 13 - 16
go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_month_add.go

@@ -1,10 +1,10 @@
 package adopt_cows_controller
 
 import (
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type CowsMonthAddController struct {
@@ -17,45 +17,42 @@ type CowsMonthAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *CowsMonthAddController) Get(){
+func (self *CowsMonthAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 
-		query_date_tmp, _ := time.Parse("2006-01-02",query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 	if len(s) == 2 {
 
-		query_date, _ := time.Parse("2006-01",query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date, _ := time.Parse("2006-01", query_date)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 
 	type Ret struct {
-		QueryDate      string            `json:"query_date"`       //查询日期
-		CowsMonthNewAdd  int64           `json:"cows_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		CowsMonthNetAdd  int64           `json:"cows_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		QueryDate       string `json:"query_date"`         //查询日期
+		CowsMonthNewAdd int64  `json:"cows_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		CowsMonthNetAdd int64  `json:"cows_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
 	}
 
-
 	//某月不分有没有渠道的所有领养牛仔总数
-	adoptCowCount := models.GetAllCowAdoptCowCount(queryDate, queryDate.AddDate(0,1,0),true)
+	adoptCowCount := models.GetAllCowAdoptCowCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	//某月不分有没有渠道的所有领养牛仔总数
 	unAdoptCowCount := int64(0)
 
-
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01"), CowsMonthNewAdd: adoptCowCount, CowsMonthNetAdd: adoptCowCount - unAdoptCowCount}
 
 	self.ServeJSON()
 
 }
-

+ 16 - 19
go/gopath/src/d5c-statement-api/controllers/adopt_cows_controller/cows_month_grouth.go

@@ -1,11 +1,11 @@
 package adopt_cows_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
 )
 
 type CowsMonthGrouthController struct {
@@ -18,17 +18,17 @@ type CowsMonthGrouthController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *CowsMonthGrouthController) Get(){
+func (self *CowsMonthGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Months                []string `json:"months"`             //六个月
-		MonthNewCows          []int64  `json:"month_new_cows"`     //新增
-		MonthNetCows          []int64  `json:"month_net_cows"`     //净增
+		Months       []string `json:"months"`         //六个月
+		MonthNewCows []int64  `json:"month_new_cows"` //新增
+		MonthNetCows []int64  `json:"month_net_cows"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	end := now
 
@@ -43,14 +43,13 @@ func (self *CowsMonthGrouthController) Get(){
 	}
 
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	start = queryDate.AddDate(0, -5, 0) //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
-
-	end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
-	beego.BeeLogger.Warn("end:%s",end)
+	beego.BeeLogger.Warn("start:%s", start)
 
+	end = queryDate.AddDate(0, 1, 0) //2018-03-01 00:00:00
+	beego.BeeLogger.Warn("end:%s", end)
 
 	cowAdoptCountPerMonthList := models.GetAllCowAdoptCowCountByMonth(start, end, true)
 	//uncowAdoptCountPerMonthList := models.GetAllCowUncowAdoptCountByMonth(start,end, true)
@@ -61,7 +60,6 @@ func (self *CowsMonthGrouthController) Get(){
 	var MonthNewCows []int64
 	var MonthNetCows []int64
 
-
 	for i := 0; i < 6; i++ {
 
 		month := start.AddDate(0, i, 0).Format("2006-01")
@@ -69,21 +67,20 @@ func (self *CowsMonthGrouthController) Get(){
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		sub := models.ContainsInMonthItemListAndReturnItemCount(ymInt, cowAdoptCountPerMonthList)
-		beego.BeeLogger.Warn("sub:%d",sub)
+		beego.BeeLogger.Warn("sub:%d", sub)
 		//subOther := ContainsInMonthListAndReturn(ymInt, subOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("subOther:%d",subOther)
 		unSub := int64(0)
-		beego.BeeLogger.Warn("unSub:%d",unSub)
+		beego.BeeLogger.Warn("unSub:%d", unSub)
 		//unSubOther := ContainsInMonthListAndReturn(ymInt, unSubOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("unSubOther:%d",unSubOther)
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  sub
+		dayNewF := sub
 		beego.BeeLogger.Warn("monthNewF:%d", dayNewF)
 
 		MonthNewCows = append(MonthNewCows, dayNewF)

+ 14 - 17
go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_day_add.go

@@ -1,10 +1,10 @@
 package cow_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
 type FansDayAddController struct {
@@ -17,42 +17,39 @@ type FansDayAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansDayAddController) Get(){
+func (self *FansDayAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
-	lastDay := now.AddDate(0,0,-1)//2018-03-23 14:32:00
-	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0,0 ,0, time.Local)//2018-03-23 00:00:00
+	now := time.Now()                                                                              //2018-03-24 14:32:00
+	lastDay := now.AddDate(0, 0, -1)                                                               //2018-03-23 14:32:00
+	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0, 0, 0, time.Local) //2018-03-23 00:00:00
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0,0 ,0, time.Local)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0, 0, 0, time.Local)
 	}
 
 	type Ret struct {
-		QueryDate      string          `json:"query_date"`       //查询日期
-		FansDayNewAdd  int64           `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		FansDayNetAdd  int64           `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
-		CowsDayNetAdd  int64           `json:"cows_day_net_add"` //日期下订单净增
+		QueryDate     string `json:"query_date"`       //查询日期
+		FansDayNewAdd int64  `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		FansDayNetAdd int64  `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		CowsDayNetAdd int64  `json:"cows_day_net_add"` //日期下订单净增
 	}
 
 	//2018-03-09 00:00:00----2018-03-10 00:00:00
 	//不分有没有渠道的所有关注人数
-	subUserCount := models.GetAllCowSubUserCount(queryDate, queryDate.AddDate(0,0,1), true)
+	subUserCount := models.GetAllCowSubUserCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 	//不分有没有渠道的所有取消关注人数
-	unSubUserCount := models.GetAllCowUnSubUserCount(queryDate, queryDate.AddDate(0,0,1), true)
+	unSubUserCount := models.GetAllCowUnSubUserCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 	//统计当天订单净增
-	allCowCount := models.GetAllCowOrderCount(queryDate, queryDate.AddDate(0,0,1), true)
+	allCowCount := models.GetAllCowOrderCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01-02"), FansDayNewAdd: subUserCount, FansDayNetAdd: subUserCount - unSubUserCount, CowsDayNetAdd: allCowCount}
 
-
 	self.ServeJSON()
 
-
-
 }

+ 20 - 23
go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_day_grouth.go

@@ -1,14 +1,13 @@
 package cow_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
-	"d5c-statement-api/models"
 	"strconv"
 	"strings"
+	"time"
 )
 
-
 type FansDayGrouthController struct {
 	beego.Controller
 }
@@ -22,37 +21,37 @@ type FansDayGrouthController struct {
 func (self *FansDayGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Days                []string `json:"days"`             //最近7天
-		DayNewFans          []int64  `json:"day_new_fans"`     //新增
-		DayNetFans          []int64  `json:"day_net_fans"`     //净增
+		Days       []string `json:"days"`         //最近7天
+		DayNewFans []int64  `json:"day_new_fans"` //新增
+		DayNetFans []int64  `json:"day_net_fans"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, 0, -7) //2018-03-17 14:32:00
-	nextTime := now//2018-03-24 14:32:00
+	nextTime := now                    //2018-03-24 14:32:00
 
 	// 2018-03-17 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),startTime.Day(),0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 0, 0, 0, time.Local)
 	// 2018-03-24 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(),0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(), 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(),0,0,0,0,time.Local)
+		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		//2018-03-03 00:00:00
 		start = queryDateTmp.AddDate(0, 0, -6) //前6天
-		beego.BeeLogger.Warn("start:%s",start)
+		beego.BeeLogger.Warn("start:%s", start)
 		//2018-03-10 00:00:00
-		end = queryDateTmp.AddDate(0,0,1)
-		beego.BeeLogger.Warn("end:%s",end)
+		end = queryDateTmp.AddDate(0, 0, 1)
+		beego.BeeLogger.Warn("end:%s", end)
 
 	}
 
 	subUserCountPerDayList := models.GetAllCowSubUserCountByDay(start, end, true)
-	unSubUserCountPerDayList := models.GetAllCowUnSubUserCountByDay(start,end, true)
+	unSubUserCountPerDayList := models.GetAllCowUnSubUserCountByDay(start, end, true)
 	//subOtherCountPerDayList := models.GetSubOtherCountByDay(start, end)
 	//unSubOtherCountPerDayList := models.GetUnSubOtherCountByDay(start, end)
 
@@ -60,7 +59,6 @@ func (self *FansDayGrouthController) Get() {
 	var dayNewFans []int64
 	var dayNetFans []int64
 
-
 	for i := 0; i < 7; i++ {
 
 		day := start.AddDate(0, 0, i).Format("01-02")
@@ -68,8 +66,8 @@ func (self *FansDayGrouthController) Get() {
 
 		md := start.AddDate(0, 0, i).Format("20060102")
 
-		mdInt,_ := strconv.ParseInt(md, 0 ,64)
-		beego.BeeLogger.Warn("md:%s,mdint:%d",md,mdInt)
+		mdInt, _ := strconv.ParseInt(md, 0, 64)
+		beego.BeeLogger.Warn("md:%s,mdint:%d", md, mdInt)
 
 		sub := models.ContainsInDayItemListAndReturnItemCount(mdInt, subUserCountPerDayList)
 		//subOther := ContainsInDayListAndReturn(mdInt, subOtherCountPerDayList)
@@ -78,8 +76,7 @@ func (self *FansDayGrouthController) Get() {
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  sub
+		dayNewF := sub
 		beego.BeeLogger.Warn("dayNewF:%d", dayNewF)
 
 		dayNewFans = append(dayNewFans, dayNewF)
@@ -90,7 +87,7 @@ func (self *FansDayGrouthController) Get() {
 		dayNetFans = append(dayNetFans, dayNetF)
 	}
 
-	self.Data["json"] = &Ret{Days:days, DayNewFans: dayNewFans,DayNetFans: dayNetFans}
+	self.Data["json"] = &Ret{Days: days, DayNewFans: dayNewFans, DayNetFans: dayNetFans}
 	self.ServeJSON()
 
-}
+}

+ 16 - 18
go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_month_add.go

@@ -1,10 +1,10 @@
 package cow_fans_controller
 
 import (
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type FansMonthAddController struct {
@@ -17,48 +17,46 @@ type FansMonthAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansMonthAddController) Get(){
+func (self *FansMonthAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 
-		query_date_tmp, _ := time.Parse("2006-01-02",query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 	if len(s) == 2 {
 
-		query_date, _ := time.Parse("2006-01",query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date, _ := time.Parse("2006-01", query_date)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 
 	type Ret struct {
-		QueryDate      string            `json:"query_date"`       //查询日期
-		FansMonthNewAdd  int64           `json:"fans_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		FansMonthNetAdd  int64           `json:"fans_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
-		CowsMonthNewAdd  int64           `json:"cows_month_new_add"` //日期下养成牛新增
+		QueryDate       string `json:"query_date"`         //查询日期
+		FansMonthNewAdd int64  `json:"fans_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		FansMonthNetAdd int64  `json:"fans_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		CowsMonthNewAdd int64  `json:"cows_month_new_add"` //日期下养成牛新增
 	}
 
-
 	//某月不分有没有渠道的所有关注人数
-	subUserCount := models.GetAllCowSubUserCount(queryDate, queryDate.AddDate(0,1,0),true)
+	subUserCount := models.GetAllCowSubUserCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	//某月不分有没有渠道的所有取消关注人数
-	unSubUserCount := models.GetAllCowUnSubUserCount(queryDate, queryDate.AddDate(0,1,0), true)
+	unSubUserCount := models.GetAllCowUnSubUserCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	//日期下养成牛总数统计
-	subCowCount := models.GetAllCowOrderCount(queryDate, queryDate.AddDate(0,1,0), true)
+	subCowCount := models.GetAllCowOrderCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01"), FansMonthNewAdd: subUserCount, FansMonthNetAdd: subUserCount - unSubUserCount, CowsMonthNewAdd: subCowCount}
 
 	self.ServeJSON()
 
 }
-

+ 17 - 20
go/gopath/src/d5c-statement-api/controllers/cow_fans_controller/fans_month_grouth.go

@@ -1,11 +1,11 @@
 package cow_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
 )
 
 type FansMonthGrouthController struct {
@@ -18,17 +18,17 @@ type FansMonthGrouthController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansMonthGrouthController) Get(){
+func (self *FansMonthGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Months                []string `json:"months"`             //六个月
-		MonthNewFans          []int64  `json:"month_new_fans"`     //新增
-		MonthNetFans          []int64  `json:"month_net_fans"`     //净增
+		Months       []string `json:"months"`         //六个月
+		MonthNewFans []int64  `json:"month_new_fans"` //新增
+		MonthNetFans []int64  `json:"month_net_fans"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	end := now
 
@@ -43,17 +43,16 @@ func (self *FansMonthGrouthController) Get(){
 	}
 
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	start = queryDate.AddDate(0, -5, 0) //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
-
-	end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
-	beego.BeeLogger.Warn("end:%s",end)
+	beego.BeeLogger.Warn("start:%s", start)
 
+	end = queryDate.AddDate(0, 1, 0) //2018-03-01 00:00:00
+	beego.BeeLogger.Warn("end:%s", end)
 
 	subUserCountPerMonthList := models.GetAllCowSubUserCountByMonth(start, end, true)
-	unSubUserCountPerMonthList := models.GetAllCowUnSubUserCountByMonth(start,end, true)
+	unSubUserCountPerMonthList := models.GetAllCowUnSubUserCountByMonth(start, end, true)
 	//subOtherCountPerMonthList := models.GetSubOtherCountByMonth(start, end)
 	//unSubOtherCountPerMonthList := models.GetUnSubOtherCountByMonth(start, end)
 
@@ -61,7 +60,6 @@ func (self *FansMonthGrouthController) Get(){
 	var monthNewFans []int64
 	var monthNetFans []int64
 
-
 	for i := 0; i < 6; i++ {
 
 		month := start.AddDate(0, i, 0).Format("2006-01")
@@ -69,21 +67,20 @@ func (self *FansMonthGrouthController) Get(){
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		sub := models.ContainsInMonthItemListAndReturnItemCount(ymInt, subUserCountPerMonthList)
-		beego.BeeLogger.Warn("sub:%d",sub)
+		beego.BeeLogger.Warn("sub:%d", sub)
 		//subOther := ContainsInMonthListAndReturn(ymInt, subOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("subOther:%d",subOther)
 		unSub := models.ContainsInMonthItemListAndReturnItemCount(ymInt, unSubUserCountPerMonthList)
-		beego.BeeLogger.Warn("unSub:%d",unSub)
+		beego.BeeLogger.Warn("unSub:%d", unSub)
 		//unSubOther := ContainsInMonthListAndReturn(ymInt, unSubOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("unSubOther:%d",unSubOther)
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  sub
+		dayNewF := sub
 		beego.BeeLogger.Warn("monthNewF:%d", dayNewF)
 
 		monthNewFans = append(monthNewFans, dayNewF)

+ 10 - 10
go/gopath/src/d5c-statement-api/controllers/cow_point_task/cow_point_task.go

@@ -4,8 +4,8 @@ import (
 	"fmt"
 	"time"
 
-	"d5c-statement-api/models"
-	// "d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	// "fohow-statement-api/tools"
 	"github.com/astaxie/beego"
 )
 
@@ -68,14 +68,14 @@ func (self *CowPointTaskController) FinishedTaskDaily() {
 
 	//tags := []string{"daily_continuity", "daily_countdown", "daily_interval", "daily_article", "daily_share"}
 	type Ret struct {
-		Days        []string `json:"days"`       //天数
-		Continuity         []int64  `json:"daily_continuity"`        //每日签到
-		CountDown      []int64  `json:"daily_countdown"`     //倒计时签到
-		Interval []int64  `json:"daily_interval"`    //分时段签到
-		Article    []int64  `json:"daily_article"`   //阅读文章
-		Share    []int64  `json:"share"`   //分享好友
-		Vedio    []int64  `json:"vedio"`   //观看视频
-		Gap    []int64  `json:"gap"`   //间接喂养
+		Days       []string `json:"days"`             //天数
+		Continuity []int64  `json:"daily_continuity"` //每日签到
+		CountDown  []int64  `json:"daily_countdown"`  //倒计时签到
+		Interval   []int64  `json:"daily_interval"`   //分时段签到
+		Article    []int64  `json:"daily_article"`    //阅读文章
+		Share      []int64  `json:"share"`            //分享好友
+		Vedio      []int64  `json:"vedio"`            //观看视频
+		Gap        []int64  `json:"gap"`              //间接喂养
 	}
 	days, continuity, countdown, interval, article, share, vedio, gap := []string{}, []int64{}, []int64{}, []int64{}, []int64{}, []int64{}, []int64{}, []int64{}
 	for i, j := monthStartUnix, 1; i < nextMonthStartUnix; i, j = i+24*3600, j+1 {

+ 2 - 2
go/gopath/src/d5c-statement-api/controllers/cow_point_task/d5c_prize_record.go

@@ -1,7 +1,7 @@
 package cow_point_task
 
 import (
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strconv"
 	"strings"
@@ -251,4 +251,4 @@ func (self *GamePrizeDailyController) D5cRecordCountUserOneMonth() {
 
 	self.Data["json"] = &Ret{Month: start.Format("2006-01"), CountUser: countUser, CountFeed: countFeed}
 	self.ServeJSON()
-}
+}

+ 1 - 1
go/gopath/src/d5c-statement-api/controllers/cow_point_task/daily_game_record.go

@@ -1,7 +1,7 @@
 package cow_point_task
 
 import (
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strconv"
 	"strings"

+ 24 - 35
go/gopath/src/d5c-statement-api/controllers/cow_punch/cow_punch.go

@@ -3,11 +3,10 @@ package cow_punch
 import (
 	"time"
 
-	"d5c-statement-api/models"
-	// "d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	// "fohow-statement-api/tools"
 	"github.com/astaxie/beego"
 	"strconv"
-
 )
 
 //养牛任务相关
@@ -16,9 +15,9 @@ type CowPunchController struct {
 }
 
 type Ret struct {
-	Times                       []string   `json:"times"`                      //12个月/30天/24小时
-	DayTotal                    int64    `json:"day_total"`                //当天报名人数
-	DayPunchTotal               []int64   `json:"day_punch_total"`             //当天报名总额
+	Times         []string `json:"times"`           //12个月/30天/24小时
+	DayTotal      int64    `json:"day_total"`       //当天报名人数
+	DayPunchTotal []int64  `json:"day_punch_total"` //当天报名总额
 }
 
 // @Title Get
@@ -29,7 +28,7 @@ type Ret struct {
 // @Param	query_month	query	string	false	"query_month"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *CowPunchController) Get(){
+func (self *CowPunchController) Get() {
 
 	query_date := self.GetString("query_date")
 	query_month := self.GetString("query_month")
@@ -46,7 +45,7 @@ func (self *CowPunchController) Get(){
 	query_date_month, _ := time.Parse("2006-01", query_month)
 	if query_type == "d" {
 		//查询一个月份30天
-		queryCurrentDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(),query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+		queryCurrentDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		queryEndDate = queryCurrentDate.AddDate(0, 0, 1)
 		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		queryNextDate = queryDate.AddDate(0, 1, 0)
@@ -59,32 +58,30 @@ func (self *CowPunchController) Get(){
 	}
 
 	//--------------------------------------------数据处理
-	beego.BeeLogger.Warn("queryDate queryNextDate (%s,%s)",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("queryDate queryNextDate (%s,%s)", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
-	if query_type == "d"{
+	if query_type == "d" {
 		//2019-05-01 00:00:00  --- 2019-06-01 00:00:00
-		self.QueryByDayOnDay(queryDate,queryNextDate,queryCurrentDate,queryEndDate)
+		self.QueryByDayOnDay(queryDate, queryNextDate, queryCurrentDate, queryEndDate)
 	}
 }
 
-func (self *CowPunchController) QueryByDayOnDay(queryDate, queryNextDate ,queryCurrentDate,queryEndDate  time.Time){
+func (self *CowPunchController) QueryByDayOnDay(queryDate, queryNextDate, queryCurrentDate, queryEndDate time.Time) {
 
 	var times []string
 	var DayStockTotal []int64
 
 	dayTotal := models.GetPunchCount(queryCurrentDate, queryEndDate, false)
-	dayTimeStockTotal := models.GetAllPunchTotalByDay(queryDate, queryNextDate,false)
+	dayTimeStockTotal := models.GetAllPunchTotalByDay(queryDate, queryNextDate, false)
 
+	for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-	for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
-
-		increaseDate := queryDate.AddDate(0,0,i).Format("01-02")
+		increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 		times = append(times, increaseDate)
 
-		findDate := queryDate.AddDate(0,0,i).Format("20060102")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
-
+		findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 		//打卡报名每日总数
 		totalSub := models.ContainsInDayPunchItemListStockTransferCount(findDateInt, dayTimeStockTotal)
@@ -93,9 +90,9 @@ func (self *CowPunchController) QueryByDayOnDay(queryDate, queryNextDate ,queryC
 	}
 
 	self.Data["json"] = Ret{
-		Times                      :times,
-		DayTotal                   :dayTotal,
-		DayPunchTotal        	   :DayStockTotal,
+		Times:         times,
+		DayTotal:      dayTotal,
+		DayPunchTotal: DayStockTotal,
 	}
 	//beego.BeeLogger.Warn("-------%v",self.Data["json"])
 	self.ServeJSON()
@@ -108,17 +105,16 @@ func (self *CowPunchController) QueryByDayOnDay(queryDate, queryNextDate ,queryC
 // @router /punch/count [get]
 func (self *CowPunchController) SigninDaily() {
 	type Ret struct {
-		List       []*models.CowPunchDt             `json:"list"`
+		List []*models.CowPunchDt `json:"list"`
 	}
-	userPunchs:= models.GetCowPunchDtByDate()
-	
+	userPunchs := models.GetCowPunchDtByDate()
+
 	ret := new(Ret)
 	ret.List = userPunchs
 	self.Data["json"] = ret
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description punch count : 每日养牛报表-日统计
 // @Param Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -126,19 +122,12 @@ func (self *CowPunchController) SigninDaily() {
 // @router /cow/count [get]
 func (self *CowPunchController) CowStateDaily() {
 	type Ret struct {
-		List       []*models.CowsDt             `json:"list"`
+		List []*models.CowsDt `json:"list"`
 	}
-	userCows:= models.GetCowDtByRank()
+	userCows := models.GetCowDtByRank()
 
 	ret := new(Ret)
 	ret.List = userCows
 	self.Data["json"] = ret
 	self.ServeJSON()
 }
-
-
-
-
-
-
-

+ 48 - 57
go/gopath/src/d5c-statement-api/controllers/d5c_article_controller/article_stat.go

@@ -1,12 +1,12 @@
 package d5c_article_controller
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"fmt"
-	"time"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 	"strconv"
-	"d5c-statement-api/tools"
+	"time"
 )
 
 type ArticleStatController struct {
@@ -35,7 +35,7 @@ func (self *ArticleStatController) GetArticle() {
 	}
 
 	list := models.GetD5cArticle(queryTitle, page, perPage)
-	for _,item := range list{
+	for _, item := range list {
 		item.PTime = item.PulishTime.Unix()
 	}
 
@@ -85,7 +85,7 @@ func (self *ArticleStatController) GetArticleChannelData() {
 	//aId, _ := self.GetInt64(":article_id")
 
 	type Ret struct {
-		List    []*models.DataPerChannelArticle     `json:"list"`
+		List []*models.DataPerChannelArticle `json:"list"`
 	}
 
 	var resultList []*models.DataPerChannelArticle
@@ -95,32 +95,32 @@ func (self *ArticleStatController) GetArticleChannelData() {
 	noChannelRegist := models.GetNoChannelRegistUserCount()
 	noChannelData.RegistCount = noChannelRegist.TotalCount
 
-	if noChannelRegist.TotalCount >0 {
-		beego.BeeLogger.Warn("aaaaaaaaaaaaaaa%d",noChannelRegist.TotalCount)
-		noChannelData.ActiveRate = fmt.Sprintf("%0.2f%s",tools.RoundFloat64((float64(noChannelData.Count)/float64(noChannelRegist.TotalCount))*100,2),"%")
-	}else{
-		noChannelData.ActiveRate = fmt.Sprintf("%0.2f%s",float64(0),"%")
+	if noChannelRegist.TotalCount > 0 {
+		beego.BeeLogger.Warn("aaaaaaaaaaaaaaa%d", noChannelRegist.TotalCount)
+		noChannelData.ActiveRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64((float64(noChannelData.Count)/float64(noChannelRegist.TotalCount))*100, 2), "%")
+	} else {
+		noChannelData.ActiveRate = fmt.Sprintf("%0.2f%s", float64(0), "%")
 	}
 	resultList = append(resultList, noChannelData)
 
 	//处理有渠道
 	channelList := models.GetDataPerChannelArticleList()
 	channelRegist := models.GetPerChannelRegistUserCountList()
-	for _,item:= range channelList {
+	for _, item := range channelList {
 		tmp := models.ContainInDataPerChannelListAndReturnTotalCount(item.SignupChannelId, channelRegist)
 		noChannelData.RegistCount = tmp
 		if tmp > 0 {
-			beego.BeeLogger.Warn("aaaaaaaaaaaaaaaa%d",tmp)
-			item.ActiveRate = fmt.Sprintf("%0.2f%s",tools.RoundFloat64((float64(item.Count)/float64(tmp))*100,2),"%")
-		}else{
-			item.ActiveRate = fmt.Sprintf("%0.2f%s",float64(0),"%")
+			beego.BeeLogger.Warn("aaaaaaaaaaaaaaaa%d", tmp)
+			item.ActiveRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64((float64(item.Count)/float64(tmp))*100, 2), "%")
+		} else {
+			item.ActiveRate = fmt.Sprintf("%0.2f%s", float64(0), "%")
 		}
 
 		resultList = append(resultList, item)
 
 	}
 
-	self.Data["json"] = &Ret{List:resultList}
+	self.Data["json"] = &Ret{List: resultList}
 	self.ServeJSON()
 }
 
@@ -137,16 +137,16 @@ func (self *ArticleStatController) GetArticleReadCountGrouth() {
 	aId, _ := self.GetInt64(":article_id")
 
 	type Ret struct {
-		Times   []string                            `json:"times"`
-		Count   []int64                             `json:"count"`
+		Times []string `json:"times"`
+		Count []int64  `json:"count"`
 	}
 	//list := models.GetClickGrouthByAId(aId)
 	list := models.GetReadWxUserCountGrouthByAId(aId)
 
 	var times []string
 	var count []int64
-	for i:=0; i< 8 ;i++  {
-		times = append(times, fmt.Sprintf("%d天",i))
+	for i := 0; i < 8; i++ {
+		times = append(times, fmt.Sprintf("%d天", i))
 
 		tmp := models.ContainsInClickItemAndReturnItemCount(int64(i), list)
 
@@ -154,7 +154,7 @@ func (self *ArticleStatController) GetArticleReadCountGrouth() {
 
 	}
 
-	self.Data["json"] = &Ret{Times:times, Count:count}
+	self.Data["json"] = &Ret{Times: times, Count: count}
 	self.ServeJSON()
 }
 
@@ -170,32 +170,31 @@ func (self *ArticleStatController) GetMonthlyArticleDataList() {
 	query_date := self.GetString("query_date")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	queryDate = queryDateTmp
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 
 	type Ret struct {
-		List    []*models.D5cArticle     `json:"list"`
-		TotalClick   int64               `json:"total_click"`
-		TotalUser    int64               `json:"total_user"`
+		List       []*models.D5cArticle `json:"list"`
+		TotalClick int64                `json:"total_click"`
+		TotalUser  int64                `json:"total_user"`
 	}
 
 	list := models.GetD5cArticleList(queryDate, queryNextDate)
 	totalClick := int64(0)
 	totalUser := int64(0)
 
-	for _,item := range list{
+	for _, item := range list {
 		totalClick += item.ClickNum
 		totalUser += item.Count
 	}
 
-
-	self.Data["json"] = &Ret{List:list, TotalClick:totalClick, TotalUser:totalUser}
+	self.Data["json"] = &Ret{List: list, TotalClick: totalClick, TotalUser: totalUser}
 	self.ServeJSON()
 }
 
@@ -211,14 +210,14 @@ func (self *ArticleStatController) GetMonthlyArticleDataCount() {
 	query_date := self.GetString("query_date")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	queryDate = queryDateTmp
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 
 	type Ret struct {
 		MonthlyBalanceGiveout  int64 `json:"monthly_balance_give_out"`
@@ -226,17 +225,16 @@ func (self *ArticleStatController) GetMonthlyArticleDataCount() {
 		MonthlyShareToTimeline int64 `json:"monthly_share_to_timeline"`
 	}
 
-	balanceA := models.GetPmBalanceCountByTime(queryDate,queryNextDate)
+	balanceA := models.GetPmBalanceCountByTime(queryDate, queryNextDate)
 	balanceB := models.GetPmWxUserBalanceCountByTime(queryDate, queryNextDate)
 
 	shareToGroup := models.GetShareToGroupCountByTime(queryDate, queryNextDate)
 	shareToTimeline := models.GetShareToTimelineCountByTime(queryDate, queryNextDate)
 
-	self.Data["json"] = &Ret{MonthlyBalanceGiveout:balanceB+balanceA, MonthlyShareToGroup:shareToGroup, MonthlyShareToTimeline:shareToTimeline}
+	self.Data["json"] = &Ret{MonthlyBalanceGiveout: balanceB + balanceA, MonthlyShareToGroup: shareToGroup, MonthlyShareToTimeline: shareToTimeline}
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description 文章每月 : 阅读人数折线图
 // @Param Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -249,18 +247,18 @@ func (self *ArticleStatController) GetMonthlyArticleDataGrouth() {
 	query_date := self.GetString("query_date")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	queryDate = queryDateTmp
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 
 	type Ret struct {
-		Times     []string              `json:"times"`
-		List      []int64               `json:"list"`
+		Times []string `json:"times"`
+		List  []int64  `json:"list"`
 	}
 
 	var times []string
@@ -268,7 +266,7 @@ func (self *ArticleStatController) GetMonthlyArticleDataGrouth() {
 
 	list := models.GetArticleReadUserCountByTime(queryDate, queryNextDate)
 
-	for i:=0; i<queryNextDate.AddDate(0,0,-1).Day();i++ {
+	for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 		increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 		times = append(times, increaseDate)
@@ -281,13 +279,6 @@ func (self *ArticleStatController) GetMonthlyArticleDataGrouth() {
 		resultList = append(resultList, tmp)
 	}
 
-	self.Data["json"] = &Ret{List:resultList, Times:times}
+	self.Data["json"] = &Ret{List: resultList, Times: times}
 	self.ServeJSON()
 }
-
-
-
-
-
-
-

+ 2 - 2
go/gopath/src/d5c-statement-api/controllers/d5c_bd_cash_order/take_cash_order_day.go

@@ -1,8 +1,8 @@
 package d5c_bd_cash_order
 
 import (
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
 	"strconv"
 	"strings"

+ 5 - 6
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_invest.go

@@ -1,12 +1,11 @@
 package d5c_bonus_contoller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
-
 type BonusInvestController struct {
 	beego.Controller
 }
@@ -16,13 +15,13 @@ type BonusInvestController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} int64
 // @router / [get]
-func (self *BonusInvestController) Get(){
-	type Ret struct{
+func (self *BonusInvestController) Get() {
+	type Ret struct {
 		TotalInvest float64 `json:"total_invest"`
 	}
 
 	total := models.GetD5cTotalProjectJoinInvestment()
 
-	self.Data["json"]= &Ret{TotalInvest: tools.RoundFloat64(float64(total)/float64(100),2)}
+	self.Data["json"] = &Ret{TotalInvest: tools.RoundFloat64(float64(total)/float64(100), 2)}
 	self.ServeJSON()
 }

+ 20 - 20
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_month_invest_and_recharge.go

@@ -1,12 +1,12 @@
 package d5c_bonus_contoller
 
 import (
-	"github.com/astaxie/beego"
-	"time"
 	"fmt"
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 	"strconv"
-	"d5c-statement-api/tools"
+	"time"
 )
 
 type BonusMonthInvestAndRechargeController struct {
@@ -18,13 +18,13 @@ type BonusMonthInvestAndRechargeController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *BonusMonthInvestAndRechargeController) Get(){
+func (self *BonusMonthInvestAndRechargeController) Get() {
 
 	type Ret struct {
-		Months                []string   `json:"months"`                //最近6个月
-		MonthProjectMoney     []float64  `json:"month_project_money"`   //每月项目成功后项目融资总额(最小投资额+项目方最大出资金额)
-		MonthInvestMoney      []float64  `json:"month_invest_money"`    //每月项目成功后实际融资总额(投资记录的投资总额)
-		MonthBalanceMoney     []float64  `json:"month_balance_money"`   //每月充值总额
+		Months            []string  `json:"months"`              //最近6个月
+		MonthProjectMoney []float64 `json:"month_project_money"` //每月项目成功后项目融资总额(最小投资额+项目方最大出资金额)
+		MonthInvestMoney  []float64 `json:"month_invest_money"`  //每月项目成功后实际融资总额(投资记录的投资总额)
+		MonthBalanceMoney []float64 `json:"month_balance_money"` //每月充值总额
 	}
 
 	now := time.Now()
@@ -32,19 +32,19 @@ func (self *BonusMonthInvestAndRechargeController) Get(){
 	endTime := now.AddDate(0, 1, 0)
 
 	// 2017-10-01 00:00:00 前五个月的第一天
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-03-01 00:00:00 下一个月的第一天
-	end := time.Date(endTime.Year(),endTime.Month(),1,0,0,0,0,time.Local)
+	end := time.Date(endTime.Year(), endTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
-	beego.BeeLogger.Warn("getting d5c's bonus_month_invest_and_recharge: %s, %s", start.Format("2006-01-02"),end.Format("2006-01-02"))
+	beego.BeeLogger.Warn("getting d5c's bonus_month_invest_and_recharge: %s, %s", start.Format("2006-01-02"), end.Format("2006-01-02"))
 	var months []string
 	var monthProjectMoney []float64
 	var monthInvestMoney []float64
 	var monthBalanceMoney []float64
 	//项目融资总额
-	monthProjectMoneyList := models.GetPerMonthProjeceFinance(start.Format("2006-01-02"),end.Format("2006-01-02"))
+	monthProjectMoneyList := models.GetPerMonthProjeceFinance(start.Format("2006-01-02"), end.Format("2006-01-02"))
 	//实际融资总额
-	monthInvestMoneyList := models.GetPerMonthProjeceRealFinance(start.Format("2006-01-02"),end.Format("2006-01-02"))
+	monthInvestMoneyList := models.GetPerMonthProjeceRealFinance(start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	//充值总额
 	monthBalanceMoneyList := models.GetMonthBalanceMoney(start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -54,32 +54,32 @@ func (self *BonusMonthInvestAndRechargeController) Get(){
 		month := start.AddDate(0, i, 0).Month()
 		months = append(months, fmt.Sprintf("%d月", month))
 
-		ym := start.AddDate(0,i,0).Format("200601")
-		ymInt,_ := strconv.ParseInt(ym, 0, 64)
+		ym := start.AddDate(0, i, 0).Format("200601")
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		if tmp := models.ContainsInMonthItemListAndReturnItem(int64(ymInt), monthProjectMoneyList); tmp != nil {
 
-			monthProjectMoney = append(monthProjectMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100),2))
+			monthProjectMoney = append(monthProjectMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100), 2))
 		} else {
 			monthProjectMoney = append(monthProjectMoney, 0)
 		}
 
 		if tmp := models.ContainsInMonthItemListAndReturnItem(int64(ymInt), monthInvestMoneyList); tmp != nil {
-			monthInvestMoney = append(monthInvestMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100),2))
+			monthInvestMoney = append(monthInvestMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100), 2))
 		} else {
 			monthInvestMoney = append(monthInvestMoney, 0)
 		}
 
 		if tmp := models.ContainsInMonthItemListAndReturnItem(int64(ymInt), monthBalanceMoneyList); tmp != nil {
 
-			monthBalanceMoney = append(monthBalanceMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100),2))
+			monthBalanceMoney = append(monthBalanceMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100), 2))
 		} else {
 			monthBalanceMoney = append(monthBalanceMoney, 0)
 		}
 
 	}
 
-	beego.BeeLogger.Warn("getted d5c's bonus_month_invest_and_recharge: %s, %s", start.Format("2006-01-02"),end.Format("2006-01-02"))
+	beego.BeeLogger.Warn("getted d5c's bonus_month_invest_and_recharge: %s, %s", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	self.Data["json"] = &Ret{Months: months, MonthProjectMoney: monthProjectMoney, MonthInvestMoney: monthInvestMoney, MonthBalanceMoney: monthBalanceMoney}
 	self.ServeJSON()

+ 6 - 7
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_project.go

@@ -1,12 +1,11 @@
 package d5c_bonus_contoller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
-
 type BonusProjectController struct {
 	beego.Controller
 }
@@ -16,13 +15,13 @@ type BonusProjectController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} int64
 // @router / [get]
-func (self *BonusProjectController) Get(){
-	type Ret struct{
+func (self *BonusProjectController) Get() {
+	type Ret struct {
 		TotalInvest float64 `json:"total_project"`
 	}
 
 	total := models.GetD5cTotalProjectInvestment()
 
-	self.Data["json"]= &Ret{TotalInvest: tools.RoundFloat64(float64(total)/float64(100),2)}
+	self.Data["json"] = &Ret{TotalInvest: tools.RoundFloat64(float64(total)/float64(100), 2)}
 	self.ServeJSON()
-}
+}

+ 90 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_add.go

@@ -0,0 +1,90 @@
+package d5c_bonus_contoller
+
+import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
+	"strings"
+	"time"
+)
+
+type BonusRechargeMonthRiseController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 用户充值月统计,默认当月:充值总额,老用户充值总额,新用户充值总额,充值总人数,充值老用户人数,充值新用户人数
+// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	false	"query_date"
+// @Success 200 {object} Ret
+// @router / [get]
+func (self *BonusRechargeMonthRiseController) Get() {
+
+	query_date := self.GetString("query_date")
+	s := strings.Split(query_date, "-")
+
+	type Ret struct {
+		Month               string  `json:"month"`
+		MonthTotalRecharge  float64 `json:"month_total_recharge"`
+		MonthOldRecharge    float64 `json:"month_old_recharge"`
+		MonthNewRecharge    float64 `json:"month_new_recharge"`
+		MonthTotalRecharger int64   `json:"month_total_rechargers"`
+		MonthOldRecharger   int64   `json:"month_old_rechargers"`
+		MonthNewRecharger   int64   `json:"month_new_rechargers"`
+	}
+
+	now := time.Now()
+	start := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	end := start.AddDate(0, 1, 0)
+
+	if len(s) == 2 {
+		startTmp, _ := time.Parse("2006-01", query_date)
+		start = time.Date(startTmp.Year(), startTmp.Month(), 1, 0, 0, 0, 0, time.Local)
+		end = start.AddDate(0, 1, 0)
+	}
+
+	if len(s) == 3 {
+		startTmp, _ := time.Parse("2006-01-02", query_date)
+		start = time.Date(startTmp.Year(), startTmp.Month(), 1, 0, 0, 0, 0, time.Local)
+		end = start.AddDate(0, 1, 0)
+	}
+
+	monthTotalRecharge := float64(0)
+	monthOldRecharge := float64(0)
+	monthNewRecharge := float64(0)
+	monthTotalRecharger := int64(0)
+	monthOldRecharger := int64(0)
+	monthNewRecharger := int64(0)
+
+	userRecharges := models.GetTotalRechargeOnAllUser(start, end)
+
+	//	统计总充值金额,...,新用户充值人数
+	for _, item := range userRecharges {
+
+		monthTotalRecharge += float64(item.Recharge)
+		monthTotalRecharger += 1
+
+		hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
+
+		if hasRecharge {
+
+			monthOldRecharge += float64(item.Recharge)
+			monthOldRecharger += 1
+
+		} else {
+			monthNewRecharge += float64(item.Recharge)
+			monthNewRecharger += 1
+		}
+
+	}
+
+	self.Data["json"] = &Ret{Month: start.Format("2006-01"),
+		MonthTotalRecharge:  tools.RoundFloat64(monthTotalRecharge/float64(100), 2),
+		MonthOldRecharge:    tools.RoundFloat64(monthOldRecharge/float64(100), 2),
+		MonthNewRecharge:    tools.RoundFloat64(monthNewRecharge/float64(100), 2),
+		MonthTotalRecharger: monthTotalRecharger,
+		MonthOldRecharger:   monthOldRecharger,
+		MonthNewRecharger:   monthNewRecharger,
+	}
+	self.ServeJSON()
+}

+ 24 - 24
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_month_grouth.go

@@ -1,11 +1,11 @@
 package d5c_bonus_contoller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"time"
 	"strings"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
+	"time"
 )
 
 type BonusRechargeMonthGrouthController struct {
@@ -18,13 +18,13 @@ type BonusRechargeMonthGrouthController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *BonusRechargeMonthGrouthController) Get(){
+func (self *BonusRechargeMonthGrouthController) Get() {
 
 	//参数处理
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//时间处理
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	query_date_tmp := now
 
@@ -37,17 +37,17 @@ func (self *BonusRechargeMonthGrouthController) Get(){
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 	}
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	start = queryDate.AddDate(0, -5, 0) //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
+	beego.BeeLogger.Warn("start:%s", start)
 
 	//数据结构
 	type Ret struct {
-		Month                 []string        `json:"month"`
-		MonthTotalRecharge    []float64       `json:"month_total_recharge"`
-		MonthOldRecharge      []float64       `json:"month_old_recharge"`
-		MonthNewRecharge      []float64       `json:"month_new_recharge"`
+		Month              []string  `json:"month"`
+		MonthTotalRecharge []float64 `json:"month_total_recharge"`
+		MonthOldRecharge   []float64 `json:"month_old_recharge"`
+		MonthNewRecharge   []float64 `json:"month_new_recharge"`
 	}
 
 	var monthArray []string
@@ -55,22 +55,22 @@ func (self *BonusRechargeMonthGrouthController) Get(){
 	var monthOldRechargeArray []float64
 	var monthNewRechargeArray []float64
 
-    for i:=0 ; i<6; i++{
+	for i := 0; i < 6; i++ {
 
-    	eachStart := start.AddDate(0,i,0)
-    	eachEnd := start.AddDate(0,i+1,0)
+		eachStart := start.AddDate(0, i, 0)
+		eachEnd := start.AddDate(0, i+1, 0)
 
-    	tmp := eachStart.Format("2006-01")
-    	monthArray = append(monthArray, tmp)
+		tmp := eachStart.Format("2006-01")
+		monthArray = append(monthArray, tmp)
 
 		monthTotalRecharge := float64(0)
 		monthOldRecharge := float64(0)
 		monthNewRecharge := float64(0)
 
-		userRecharges := models.GetTotalRechargeOnAllUser(eachStart,eachEnd)
+		userRecharges := models.GetTotalRechargeOnAllUser(eachStart, eachEnd)
 
 		//	统计总充值金额,...,新用户充值人数
-		for _,item := range userRecharges {
+		for _, item := range userRecharges {
 
 			monthTotalRecharge += float64(item.Recharge)
 
@@ -80,17 +80,17 @@ func (self *BonusRechargeMonthGrouthController) Get(){
 
 				monthOldRecharge += float64(item.Recharge)
 
-			}else {
+			} else {
 				monthNewRecharge += float64(item.Recharge)
 			}
 		}
 
-		monthTotalRechargeArray = append(monthTotalRechargeArray, tools.RoundFloat64(monthTotalRecharge/float64(100),2))
-		monthOldRechargeArray = append(monthOldRechargeArray, tools.RoundFloat64(monthOldRecharge/float64(100),2))
-		monthNewRechargeArray = append(monthNewRechargeArray, tools.RoundFloat64(monthNewRecharge/float64(100),2))
+		monthTotalRechargeArray = append(monthTotalRechargeArray, tools.RoundFloat64(monthTotalRecharge/float64(100), 2))
+		monthOldRechargeArray = append(monthOldRechargeArray, tools.RoundFloat64(monthOldRecharge/float64(100), 2))
+		monthNewRechargeArray = append(monthNewRechargeArray, tools.RoundFloat64(monthNewRecharge/float64(100), 2))
 
 	}
 
 	self.Data["json"] = &Ret{Month: monthArray, MonthTotalRecharge: monthTotalRechargeArray, MonthOldRecharge: monthOldRechargeArray, MonthNewRecharge: monthNewRechargeArray}
 	self.ServeJSON()
-}
+}

+ 143 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section.go

@@ -0,0 +1,143 @@
+package d5c_bonus_contoller
+
+import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
+	"strings"
+	"time"
+)
+
+type BonusRechargeSectionController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 用户充值区间月统计,默认当月
+// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	false	"query_date"
+// @Success 200 {object} Ret
+// @router / [get]
+func (self *BonusRechargeSectionController) Get() {
+
+	query_date := self.GetString("query_date")
+	s := strings.Split(query_date, "-")
+
+	type Ret struct {
+		Month               string    `json:"month"`
+		Section             [6]string `json:"section"`
+		MonthTotalRecharge  []float64 `json:"month_total_recharge"`
+		MonthOldRecharge    []float64 `json:"month_old_recharge"`
+		MonthNewRecharge    []float64 `json:"month_new_recharge"`
+		MonthTotalRecharger []int64   `json:"month_total_rechargers"`
+		MonthOldRecharger   []int64   `json:"month_old_rechargers"`
+		MonthNewRecharger   []int64   `json:"month_new_rechargers"`
+	}
+
+	now := time.Now()
+	start := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	end := start.AddDate(0, 1, 0)
+	startTmp := now
+
+	if len(s) == 2 {
+		startTmp, _ = time.Parse("2006-01", query_date)
+	}
+
+	if len(s) == 3 {
+		startTmp, _ = time.Parse("2006-01-02", query_date)
+	}
+	start = time.Date(startTmp.Year(), startTmp.Month(), 1, 0, 0, 0, 0, time.Local)
+	end = start.AddDate(0, 1, 0)
+
+	var se = [6]int64{0, 1, 100000, 500000, 1000000, 5000000}
+	var section = [6]string{"0-1", "1-1000", "1000-5000", "5000-10000", "10000-50000", "50000以上"}
+
+	var monthTotalRechargeArray []float64
+	var monthOldRechargeArray []float64
+	var monthNewRechargeArray []float64
+	var monthTotalRechargerArray []int64
+	var monthOldRechargerArray []int64
+	var monthNewRechargerArray []int64
+
+	userRecharges := models.GetTotalRechargeOnAllUser(start, end)
+
+	for i := 0; i < len(se); i++ { //遍历区间
+
+		monthTotalRecharge := float64(0)
+		monthOldRecharge := float64(0)
+		monthNewRecharge := float64(0)
+		monthTotalRecharger := int64(0)
+		monthOldRecharger := int64(0)
+		monthNewRecharger := int64(0)
+
+		if i == len(se)-1 {
+			//	统计总充值金额,...,新用户充值人数
+			for _, item := range userRecharges { //遍历数据
+
+				if item.Recharge > se[i] { //判断属于最后一个区间
+
+					monthTotalRecharge += float64(item.Recharge)
+					monthTotalRecharger += 1
+
+					hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
+
+					if hasRecharge {
+
+						monthOldRecharge += float64(item.Recharge)
+						monthOldRecharger += 1
+
+					} else {
+						monthNewRecharge += float64(item.Recharge)
+						monthNewRecharger += 1
+					}
+
+				}
+
+			}
+		} else {
+			//	统计总充值金额,...,新用户充值人数
+			for _, item := range userRecharges { //遍历数据
+
+				if item.Recharge > se[i] && item.Recharge <= se[i+1] { //判断属于那个区间
+
+					monthTotalRecharge += float64(item.Recharge)
+					monthTotalRecharger += 1
+
+					hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
+
+					if hasRecharge {
+
+						monthOldRecharge += float64(item.Recharge)
+						monthOldRecharger += 1
+
+					} else {
+						monthNewRecharge += float64(item.Recharge)
+						monthNewRecharger += 1
+					}
+				}
+			}
+
+		}
+
+		monthTotalRechargeArray = append(monthTotalRechargeArray, tools.RoundFloat64(monthTotalRecharge/float64(100), 2))
+		monthOldRechargeArray = append(monthOldRechargeArray, tools.RoundFloat64(monthOldRecharge/float64(100), 2))
+		monthNewRechargeArray = append(monthNewRechargeArray, tools.RoundFloat64(monthNewRecharge/float64(100), 2))
+		monthTotalRechargerArray = append(monthTotalRechargerArray, monthTotalRecharger)
+		monthOldRechargerArray = append(monthOldRechargerArray, monthOldRecharger)
+		monthNewRechargerArray = append(monthNewRechargerArray, monthNewRecharger)
+	}
+
+	self.Data["json"] = &Ret{
+
+		Month:               start.Format("2006-01-02"),
+		Section:             section,
+		MonthTotalRecharge:  monthTotalRechargeArray,
+		MonthOldRecharge:    monthOldRechargeArray,
+		MonthNewRecharge:    monthNewRechargeArray,
+		MonthTotalRecharger: monthTotalRechargerArray,
+		MonthOldRecharger:   monthOldRechargerArray,
+		MonthNewRecharger:   monthNewRechargerArray,
+	}
+
+	self.ServeJSON()
+}

+ 131 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_bonus_contoller/bonus_recharge_section_percent.go

@@ -0,0 +1,131 @@
+package d5c_bonus_contoller
+
+import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
+	"strings"
+	"time"
+)
+
+type BonusRechargeSectionPercentController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 用户充值区间月统计,默认当月
+// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	false	"query_date"
+// @Success 200 {object} Ret
+// @router / [get]
+func (self *BonusRechargeSectionPercentController) Get() {
+
+	query_date := self.GetString("query_date")
+	s := strings.Split(query_date, "-")
+
+	type MapData struct {
+		Value float64 `json:"value"`
+		Name  string  `json:"name"`
+	}
+
+	type Ret struct {
+		Month             string     `json:"month"`   //本月月份
+		Section           [6]string  `json:"section"` //区间
+		RechargeMapData   []*MapData `json:"recharge_map_data"`
+		RechargerMapData  []*MapData `json:"recharger_map_date"`
+		NewTotalRecharge  float64    `json:"new_total_recharge"`
+		NewTotalRecharger int64      `json:"new_total_recharger"`
+		OldTotalRecharge  float64    `json:"old_total_recharge"`
+		OldTotalRecharger int64      `json:"old_total_recharger"`
+	}
+
+	now := time.Now()
+	start := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	end := start.AddDate(0, 1, 0)
+	startTmp := now
+
+	if len(s) == 2 {
+		startTmp, _ = time.Parse("2006-01", query_date)
+	}
+
+	if len(s) == 3 {
+		startTmp, _ = time.Parse("2006-01-02", query_date)
+	}
+	start = time.Date(startTmp.Year(), startTmp.Month(), 1, 0, 0, 0, 0, time.Local)
+	end = start.AddDate(0, 1, 0)
+
+	var se = [6]int64{0, 1, 100000, 500000, 1000000, 5000000}
+	var section = [6]string{"0-1", "1-1000", "1000-5000", "5000-10000", "10000-50000", "50000以上"}
+
+	var monOldRechargeAllSe float64 //新充值总额,不分区间
+	var monOldRechargerAllSe int64  //新充值总人数,不分区间
+	var monNewRechargeAllSe float64 //新用户充值总额,不分区间
+	var monNewRechargerAllSe int64  //新用户充值总人数,不分区间
+
+	var rechargeMapData []*MapData
+	var rechargerMapData []*MapData
+
+	userRecharges := models.GetTotalRechargeOnAllUser(start, end)
+
+	for i := 0; i < len(se); i++ { //遍历区间
+
+		rechargeMap := new(MapData)
+		rechargerMap := new(MapData)
+
+		monthPerSeTotalRecharge := float64(0)
+
+		monthPerSeTotalRecharger := int64(0)
+		if i == len(se)-1 {
+			//	统计总充值金额,...,新用户充值人数
+			for _, item := range userRecharges { //遍历数据
+				if item.Recharge > se[i] { //判断区间
+
+					monthPerSeTotalRecharge += float64(item.Recharge)
+					monthPerSeTotalRecharger += 1
+				}
+			}
+		} else {
+			//	统计总充值金额,...,新用户充值人数
+			for _, item := range userRecharges { //遍历数据
+				if item.Recharge > se[i] && item.Recharge <= se[i+1] { //判断属于那个区间
+
+					monthPerSeTotalRecharge += float64(item.Recharge)
+					monthPerSeTotalRecharger += 1
+				}
+			}
+		}
+
+		rechargerMap.Value = float64(monthPerSeTotalRecharger)
+		rechargerMap.Name = section[i]
+		rechargeMap.Value = tools.RoundFloat64(monthPerSeTotalRecharge/float64(100), 2)
+		rechargeMap.Name = section[i]
+
+		rechargeMapData = append(rechargeMapData, rechargeMap)
+		rechargerMapData = append(rechargerMapData, rechargerMap)
+	}
+
+	for _, item := range userRecharges {
+
+		hasRecharge := models.IsRechargeBeforeTheMonth(item.UserId, start)
+
+		if !hasRecharge {
+			monNewRechargeAllSe += float64(item.Recharge) / float64(100)
+			monNewRechargerAllSe += 1
+		} else {
+			monOldRechargeAllSe += float64(item.Recharge) / float64(100)
+			monOldRechargerAllSe += 1
+		}
+
+	}
+
+	self.Data["json"] = &Ret{Month: start.Format("2006-01-02"), Section: section,
+		RechargeMapData:   rechargeMapData,
+		RechargerMapData:  rechargerMapData,
+		NewTotalRecharge:  tools.RoundFloat64(monNewRechargeAllSe, 2),
+		NewTotalRecharger: monNewRechargerAllSe,
+		OldTotalRecharge:  tools.RoundFloat64(monOldRechargeAllSe, 2),
+		OldTotalRecharger: monOldRechargerAllSe,
+	}
+	beego.BeeLogger.Info("%v", self.Data["json"])
+	self.ServeJSON()
+}

Разница между файлами не показана из-за своего большого размера
+ 66 - 67
go/gopath/src/d5c-statement-api/controllers/d5c_bonus_gather_controller/project_bonus_gather.go


+ 2 - 2
go/gopath/src/d5c-statement-api/controllers/d5c_cash_order/take_cash_order_day.go

@@ -1,8 +1,8 @@
 package d5c_cash_order
 
 import (
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
 	"strconv"
 	"strings"

+ 44 - 46
go/gopath/src/d5c-statement-api/controllers/d5c_cost_controller/cost_monthly.go

@@ -1,57 +1,55 @@
 package d5c_cost_controller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
-	"d5c-statement-api/tools"
 )
 
 type CostMonthlyController struct {
 	beego.Controller
 }
 
-
 // @Title Get
 // @Description 共12个月的五项支出情况。默认是当月及前11月。
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *CostMonthlyController) Get(){
+func (self *CostMonthlyController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	type Ret struct {
-		Months                [12]string        `json:"months"`
+		Months [12]string `json:"months"`
 
-		MonthTrainClubCost    [12]float64       `json:"month_train_club_cost"`
-		MonthArticleCost      [12]float64       `json:"month_article_cost"`
-		MonthTrainCoinCost    [12]float64       `json:"month_train_coin_cost"`
-		MonthZtInvestCost     [12]float64       `json:"month_zt_invest_cost"`
-		MonthZhuotieCost      [12]float64       `json:"month_zhuotie_cost"`
-
-		MonthTotal            [12]float64       `json:"month_total"`
+		MonthTrainClubCost [12]float64 `json:"month_train_club_cost"`
+		MonthArticleCost   [12]float64 `json:"month_article_cost"`
+		MonthTrainCoinCost [12]float64 `json:"month_train_coin_cost"`
+		MonthZtInvestCost  [12]float64 `json:"month_zt_invest_cost"`
+		MonthZhuotieCost   [12]float64 `json:"month_zhuotie_cost"`
 
+		MonthTotal [12]float64 `json:"month_total"`
 	}
 
 	now := time.Now()
-	start := time.Date(now.AddDate(0,-11,0).Year(),now.AddDate(0,-11,0).Month(),1,0,0,0,0,time.Local)
-	end := time.Date(now.AddDate(0,1,0).Year(),now.AddDate(0,1,0).Month(),1,0,0,0,0,time.Local)
+	start := time.Date(now.AddDate(0, -11, 0).Year(), now.AddDate(0, -11, 0).Month(), 1, 0, 0, 0, 0, time.Local)
+	end := time.Date(now.AddDate(0, 1, 0).Year(), now.AddDate(0, 1, 0).Month(), 1, 0, 0, 0, 0, time.Local)
 
 	if len(s) == 2 {
-		startTmp,_ := time.Parse("2006-01", query_date)
-		start = time.Date(startTmp.AddDate(0,-11,0).Year(), startTmp.AddDate(0,-11,0).Month(),1,0,0,0,0,time.Local)
-		end = startTmp.AddDate(0,1,0)
+		startTmp, _ := time.Parse("2006-01", query_date)
+		start = time.Date(startTmp.AddDate(0, -11, 0).Year(), startTmp.AddDate(0, -11, 0).Month(), 1, 0, 0, 0, 0, time.Local)
+		end = startTmp.AddDate(0, 1, 0)
 	}
 
 	if len(s) == 3 {
-		startTmp,_ := time.Parse("2006-01-02", query_date)
-		start = time.Date(startTmp.AddDate(0,-11,0).Year(), startTmp.AddDate(0,-11,0).Month(),1,0,0,0,0,time.Local)
-		end = startTmp.AddDate(0,1,0)
+		startTmp, _ := time.Parse("2006-01-02", query_date)
+		start = time.Date(startTmp.AddDate(0, -11, 0).Year(), startTmp.AddDate(0, -11, 0).Month(), 1, 0, 0, 0, 0, time.Local)
+		end = startTmp.AddDate(0, 1, 0)
 	}
 
 	var months [12]string
@@ -67,43 +65,43 @@ func (self *CostMonthlyController) Get(){
 	trainCoinCostList := models.GetTwelveMonthTrainCoinCostList(start, end)
 	ztInvestCostList := models.GetTwelveMontZtInvestCostList(start, end)
 	zhuotieCostList := models.GetTwelveMontZhuotieCostList(start, end)
-	for i:= 0; i<12; i++ {
-		startString := start.AddDate(0,i,0).Format("2006-01")
+	for i := 0; i < 12; i++ {
+		startString := start.AddDate(0, i, 0).Format("2006-01")
 		months[i] = startString
 
-		startStrTmp := start.AddDate(0,i,0).Format("200601")
-		startInt,_ := strconv.ParseInt(startStrTmp,0,64)
+		startStrTmp := start.AddDate(0, i, 0).Format("200601")
+		startInt, _ := strconv.ParseInt(startStrTmp, 0, 64)
 
 		beego.BeeLogger.Error("-----------------trainclubcost----------%f", monthTrainClubCostList[i])
 		monthTotalList[i] += monthTrainClubCostList[i]
 
-		if item := models.ContainsInMonthItemListAndReturnItem(startInt, articleCostList);item!=nil {
-			monthArticleCostList[i] = tools.RoundFloat64(float64(item.Count) / 100.0,2)
-		}else{
+		if item := models.ContainsInMonthItemListAndReturnItem(startInt, articleCostList); item != nil {
+			monthArticleCostList[i] = tools.RoundFloat64(float64(item.Count)/100.0, 2)
+		} else {
 			monthArticleCostList[i] = 0 * 1.0
 		}
 
 		monthTotalList[i] += monthArticleCostList[i]
 
-		if item := models.ContainsInMonthItemListAndReturnItem(startInt, trainCoinCostList);item!=nil {
-			monthTrainCoinCostList[i] = tools.RoundFloat64(float64(item.Count) / 100.0,2)
-		}else{
+		if item := models.ContainsInMonthItemListAndReturnItem(startInt, trainCoinCostList); item != nil {
+			monthTrainCoinCostList[i] = tools.RoundFloat64(float64(item.Count)/100.0, 2)
+		} else {
 			monthTrainCoinCostList[i] = 0 * 1.0
 		}
 
 		monthTotalList[i] += monthTrainCoinCostList[i]
 
-		if item := models.ContainsInMonthItemListAndReturnItem(startInt, ztInvestCostList);item!=nil {
-			monthZtInvestCostList[i] = tools.RoundFloat64(float64(item.Count) / 100.0,2)
-		}else{
+		if item := models.ContainsInMonthItemListAndReturnItem(startInt, ztInvestCostList); item != nil {
+			monthZtInvestCostList[i] = tools.RoundFloat64(float64(item.Count)/100.0, 2)
+		} else {
 			monthZtInvestCostList[i] = 0 * 1.0
 		}
 
 		monthTotalList[i] += monthZtInvestCostList[i]
 
-		if item := models.ContainsInMonthItemListAndReturnItem(startInt, zhuotieCostList);item!=nil {
-			monthZhuotieCostList[i] = tools.RoundFloat64(float64(item.Count) / 100.0,2)
-		}else{
+		if item := models.ContainsInMonthItemListAndReturnItem(startInt, zhuotieCostList); item != nil {
+			monthZhuotieCostList[i] = tools.RoundFloat64(float64(item.Count)/100.0, 2)
+		} else {
 			monthZhuotieCostList[i] = 0 * 1.0
 		}
 
@@ -111,12 +109,12 @@ func (self *CostMonthlyController) Get(){
 
 	}
 
-	self.Data["json"] = &Ret{Months:months,
-							MonthTrainClubCost:monthTrainClubCostList,
-							MonthArticleCost:monthArticleCostList,
-							MonthTrainCoinCost:monthTrainCoinCostList,
-							MonthZtInvestCost:monthZtInvestCostList,
-							MonthZhuotieCost:monthZhuotieCostList,
-							MonthTotal:monthTotalList}
+	self.Data["json"] = &Ret{Months: months,
+		MonthTrainClubCost: monthTrainClubCostList,
+		MonthArticleCost:   monthArticleCostList,
+		MonthTrainCoinCost: monthTrainCoinCostList,
+		MonthZtInvestCost:  monthZtInvestCostList,
+		MonthZhuotieCost:   monthZhuotieCostList,
+		MonthTotal:         monthTotalList}
 	self.ServeJSON()
-}
+}

+ 4 - 3
go/gopath/src/d5c-statement-api/controllers/d5c_customer_controller/customer_stat.go

@@ -1,9 +1,9 @@
 package d5c_customer_controller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
 type CustomerStatController struct {
@@ -11,6 +11,7 @@ type CustomerStatController struct {
 }
 
 var BASE_WEIGHT float64
+
 // @Title Get
 // @Description 客服资源分配模块 : 真实投资人总数、训练营参与人总数、手机好友总数、实名用户总数、注册用户总数、权重基数
 // @Param Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -81,7 +82,7 @@ func (self *CustomerStatController) SingleResourceWeight() {
 			float64(single.TrainJoinCount)*models.TRAIN_JOIN_WEIGHT +
 			float64(single.PhoneFriendCount)*models.PHONE_FRIEND_WEIGHT +
 			float64(single.CertifRegisterCount)*models.CERTI_REGITER_WEIGHT +
-				float64(single.RegisterCount)*models.REGITER_WEIGHT
+			float64(single.RegisterCount)*models.REGITER_WEIGHT
 
 		single.BaseSum = tools.RoundFloat64(tmp, 2)
 		resultList = append(resultList, single)

+ 128 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_customer_controller/friend_stat.go

@@ -0,0 +1,128 @@
+package d5c_customer_controller
+
+import (
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
+	"strconv"
+	"time"
+)
+
+type FriendStatController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 客服加好友模块 : 每月新增,当月新增,好友总数
+// @Param Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	true	"query_date"
+// @Success 200 {object} Ret
+// @router /new/monthly [get]
+func (self *FriendStatController) MonthlyNew() {
+
+	query_date := self.GetString("query_date")
+
+	now := time.Now()
+	queryDate := time.Date(now.Year(), now.Month(), 0, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
+
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryDate = queryDateTmp.AddDate(0, -5, 0)
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
+
+	totalPhoneFriend := models.GetTotalPhoneFriends()
+
+	friend := models.GetTotalPhoneFriendByTime(queryNextDate.AddDate(0, -1, 0), queryNextDate)
+
+	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate, "%Y%m")
+
+	type Ret struct {
+		TotalPhoneFriend       int64    `json:"total_phone_friend"`
+		NewFriend              int64    `json:"new_friend"`
+		TimeNewPhoneFriendList []int64  `json:"time_new_phone_friend_list"`
+		Times                  []string `json:"times"`
+	}
+
+	var timeNewPhoneFriends []int64
+	var times []string
+	for i := 0; i < 6; i++ {
+
+		increaseDate := queryDate.AddDate(0, i, 0).Format("01")
+		times = append(times, increaseDate+"月")
+		beego.BeeLogger.Warn("---------%d", increaseDate)
+
+		findDate := queryDate.AddDate(0, i, 0).Format("200601")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
+
+		//客服加手机每月增长
+		if item := models.ContainInItemListAndReturn(findDateInt, timeNewPhoneFriendList); item != nil {
+			timeNewPhoneFriends = append(timeNewPhoneFriends, item.Count)
+		} else {
+			timeNewPhoneFriends = append(timeNewPhoneFriends, 0)
+		}
+	}
+
+	self.Data["json"] = &Ret{TotalPhoneFriend: totalPhoneFriend, NewFriend: friend, Times: times, TimeNewPhoneFriendList: timeNewPhoneFriends}
+	self.ServeJSON()
+}
+
+// @Title Get
+// @Description 客服加好友模块 : 每个客服好友总数,该月新增,该月每天新增
+// @Param Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	true	"query_date"
+// @Success 200 {object} Ret
+// @router /single/daily [get]
+func (self *FriendStatController) SingleDailyList() {
+	query_date := self.GetString("query_date")
+
+	now := time.Now()
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
+
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryDate = queryDateTmp
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
+
+	type Ret struct {
+		Times []string               `json:"times"`
+		List  []*models.CustomerItem `json:"list"`
+	}
+
+	allList := models.GetCustomerDataListByTime(queryDate, queryNextDate, true)
+
+	var times []string
+	for i := 0; i < queryDate.Day(); i++ {
+		time := queryDate.AddDate(0, 0, i).Format("02")
+		times = append(times, time)
+	}
+
+	for _, item := range allList {
+
+		singleList := models.GetCustomerCountListByWxidAndTime(queryDate, queryNextDate, item.WxUid)
+		var counts []int64
+
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
+
+			timeString := queryDate.AddDate(0, 0, i).Format("20060102")
+			timeInt, _ := strconv.ParseInt(timeString, 0, 64)
+			//beego.BeeLogger.Warn("timeInt%d",timeInt)
+
+			count := models.ContainInItemListAndReturnItemCount(timeInt, singleList)
+
+			counts = append(counts, count)
+
+		}
+
+		item.TimeCountList = counts
+	}
+
+	self.Data["json"] = &Ret{
+		Times: times,
+		List:  allList,
+	}
+
+	self.ServeJSON()
+}

+ 80 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_fans_controller/fan_grouth.go

@@ -0,0 +1,80 @@
+package d5c_fans_controller
+
+import (
+	"fmt"
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
+	"time"
+)
+
+type FanGrouthController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 粉丝近六月的净增和新增;platform_type是平台标识,主要有superd5c,d5ctdyh,diwutegongdui三种,默认是superd5c;is_newly:true为新增,false为净增,默认false
+// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	is_newly	query	boolean	false	"is_newly"
+// @Success 200 {object} Ret
+// @router / [get]
+func (self *FanGrouthController) Get() {
+
+	//platform_type := self.GetString("platform_type")
+	is_newly, _ := self.GetBool("is_newly", false)
+
+	//if strings.TrimSpace(platform_type) == "" {
+	//	platform_type = models.PLATFORM_TYPE_FANS_D5C
+	//}
+
+	type Ret struct {
+		Months       []string `json:"months"`         //最近6个月
+		MonthD5cFans []int64  `json:"month_d5c_fans"` //每月第五创粉丝增长:净增/新增
+		MonthDyhFans []int64  `json:"month_dyh_fans"` //每月订阅号粉丝增长:净增/新增
+		MonthTgdFans []int64  `json:"month_tgd_fans"` //每月特工队粉丝增长:净增/新增
+	}
+
+	now := time.Now()
+	fiveMonthsAgo := now.AddDate(0, -5, 0)
+
+	monthNewD5cList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo, now, models.PLATFORM_TYPE_FANS_D5C, is_newly)
+
+	monthNewDyhList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo, now, models.PLATFORM_TYPE_FANS_DYH, is_newly)
+
+	monthNewTgdList := models.GetReportWxUserGrouthByPeriod(fiveMonthsAgo, now, models.PLATFORM_TYPE_FANS_TGD, is_newly)
+
+	var months []string
+	var monthD5cfans []int64
+	var monthDyhfans []int64
+	var monthTgdfans []int64
+
+	start := time.Date(fiveMonthsAgo.Year(), fiveMonthsAgo.Month(), 1, 0, 0, 0, 0, time.Local)
+
+	for i := 0; i < 6; i++ {
+
+		month := start.AddDate(0, i, 0).Month()
+
+		months = append(months, fmt.Sprintf("%d月", month))
+
+		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewD5cList); monthNewItem != nil {
+			monthD5cfans = append(monthD5cfans, monthNewItem.Count)
+		} else {
+			monthD5cfans = append(monthD5cfans, 0)
+		}
+
+		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewDyhList); monthNewItem != nil {
+			monthDyhfans = append(monthDyhfans, monthNewItem.Count)
+		} else {
+			monthDyhfans = append(monthDyhfans, 0)
+		}
+
+		if monthNewItem := models.MonthIsContainInList(int64(month), monthNewTgdList); monthNewItem != nil {
+			monthTgdfans = append(monthTgdfans, monthNewItem.Count)
+		} else {
+			monthTgdfans = append(monthTgdfans, 0)
+		}
+
+	}
+
+	self.Data["json"] = &Ret{Months: months, MonthD5cFans: monthD5cfans, MonthDyhFans: monthDyhfans, MonthTgdFans: monthTgdfans}
+	self.ServeJSON()
+}

+ 29 - 31
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_channel_stat.go

@@ -1,8 +1,8 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strings"
 	"time"
 )
@@ -18,64 +18,63 @@ type FansChannelStatController struct {
 // @Param	type	query	string	false	"type"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansChannelStatController) Get(){
-
+func (self *FansChannelStatController) Get() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	//2018-03-24 14:32:00
 	now := time.Now()
 	//2018-03-23 14:32:00
-	lastDate := now.AddDate(0,0,-1)
+	lastDate := now.AddDate(0, 0, -1)
 	//2018-03-23 00:00:00
-	queryDate := time.Date(lastDate.Year(), lastDate.Month(), lastDate.Day(), 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(lastDate.Year(), lastDate.Month(), lastDate.Day(), 0, 0, 0, 0, time.Local)
 	//2018-03-24 00:00:00
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 
 	//日统计
-	if len(s) == 3 && query_type == "d"{
+	if len(s) == 3 && query_type == "d" {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),query_date_tmp.Day(),0,0,0,0,time.Local)
-		queryNextDate = queryDate.AddDate(0,0,1)//2018-03-10 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+		queryNextDate = queryDate.AddDate(0, 0, 1) //2018-03-10 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
-	//月统计
-	}else if len(s) == 3 && query_type == "m"{
+		//月统计
+	} else if len(s) == 3 && query_type == "m" {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)//2018-03-01 00:00:00
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
+		queryNextDate = queryDate.AddDate(0, 1, 0)                                                      //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
-	}else if len(s) == 2 && query_type == "m" {
+	} else if len(s) == 2 && query_type == "m" {
 		//2018-03-01 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01", query_date)
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)//2018-03-01 00:00:00
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
+		queryNextDate = queryDate.AddDate(0, 1, 0)                                                      //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
 	}
 	//月统计
-	if query_date =="" && query_type == "m" {
+	if query_date == "" && query_type == "m" {
 		//2018-03-01 00:00:00
-		queryDate = time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+		queryNextDate = queryDate.AddDate(0, 1, 0) //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 	}
 	//---------------------------------------------数据处理
 
 	type Ret struct {
-		FansChannelDataList   []*models.FansChannelData    `json:"fans_channel_data_list"`
+		FansChannelDataList []*models.FansChannelData `json:"fans_channel_data_list"`
 	}
 
 	//非渠道(其他)关注人数新增
@@ -86,7 +85,7 @@ func (self *FansChannelStatController) Get(){
 	subOtherNetCount := subOtherCount - unSubOtherCount
 
 	//渠道关注集合
-	fansSubChannelDataList := models.GetSubFansChannelData(queryDate,queryNextDate, true)
+	fansSubChannelDataList := models.GetSubFansChannelData(queryDate, queryNextDate, true)
 	//渠道取消关注集合
 	fansUnSubChannelDataList := models.GetUnSubFansChannelData(queryDate, queryNextDate, true)
 	//注意:fansSubChannelAddList和fansUnSubChannelAddLIst有交集
@@ -102,7 +101,7 @@ func (self *FansChannelStatController) Get(){
 
 		item.ChannelQrcode = models.GetChannelQrcodeRemarkById(item.ChannelQrcodeId)
 
-		unSubCount := GetChannelAddById(item.ChannelQrcodeId,fansUnSubChannelDataList)
+		unSubCount := GetChannelAddById(item.ChannelQrcodeId, fansUnSubChannelDataList)
 
 		item.NetAdd = item.Count - unSubCount
 
@@ -125,12 +124,12 @@ func (self *FansChannelStatController) Get(){
 
 	}
 
-	self.Data["json"] = &Ret{FansChannelDataList: fansChannelDataList }
+	self.Data["json"] = &Ret{FansChannelDataList: fansChannelDataList}
 	self.ServeJSON()
 
 }
 
-func GetChannelAddById(targetId int64, referenceList []*models.FansChannelData) int64{
+func GetChannelAddById(targetId int64, referenceList []*models.FansChannelData) int64 {
 
 	for _, item := range referenceList {
 
@@ -142,7 +141,7 @@ func GetChannelAddById(targetId int64, referenceList []*models.FansChannelData)
 	return 0
 }
 
-func GetResGroupFansChannelData(targetList, referenceList []*models.FansChannelData) []*models.FansChannelData{
+func GetResGroupFansChannelData(targetList, referenceList []*models.FansChannelData) []*models.FansChannelData {
 
 	var resultList []*models.FansChannelData
 	for _, item := range targetList {
@@ -155,4 +154,3 @@ func GetResGroupFansChannelData(targetList, referenceList []*models.FansChannelD
 
 	return resultList
 }
-

+ 12 - 14
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_day_add.go

@@ -1,10 +1,10 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
 type FansDayAddController struct {
@@ -17,39 +17,37 @@ type FansDayAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansDayAddController) Get(){
+func (self *FansDayAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
-	lastDay := now.AddDate(0,0,-1)//2018-03-23 14:32:00
-	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0,0 ,0, time.Local)//2018-03-23 00:00:00
+	now := time.Now()                                                                              //2018-03-24 14:32:00
+	lastDay := now.AddDate(0, 0, -1)                                                               //2018-03-23 14:32:00
+	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0, 0, 0, time.Local) //2018-03-23 00:00:00
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0,0 ,0, time.Local)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), query_date.Day(), 0, 0, 0, 0, time.Local)
 	}
 
 	type Ret struct {
-		QueryDate      string          `json:"query_date"`       //查询日期
-		FansDayNewAdd  int64           `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		FansDayNetAdd  int64           `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		QueryDate     string `json:"query_date"`       //查询日期
+		FansDayNewAdd int64  `json:"fans_day_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		FansDayNetAdd int64  `json:"fans_day_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
 	}
 
 	//2018-03-09 00:00:00----2018-03-10 00:00:00
 	//不分有没有渠道的所有关注人数
-	subUserCount := models.GetAllSubUserCount(queryDate, queryDate.AddDate(0,0,1), true)
+	subUserCount := models.GetAllSubUserCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 
 	//不分有没有渠道的所有取消关注人数
-	unSubUserCount := models.GetAllUnSubUserCount(queryDate, queryDate.AddDate(0,0,1), true)
+	unSubUserCount := models.GetAllUnSubUserCount(queryDate, queryDate.AddDate(0, 0, 1), true)
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01-02"), FansDayNewAdd: subUserCount, FansDayNetAdd: subUserCount - unSubUserCount}
 
 	self.ServeJSON()
 
-
-
 }

+ 20 - 23
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_day_grouth.go

@@ -1,14 +1,13 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
-	"d5c-statement-api/models"
 	"strconv"
 	"strings"
+	"time"
 )
 
-
 type FansDayGrouthController struct {
 	beego.Controller
 }
@@ -22,37 +21,37 @@ type FansDayGrouthController struct {
 func (self *FansDayGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Days                []string `json:"days"`             //最近7天
-		DayNewFans          []int64  `json:"day_new_fans"`     //新增
-		DayNetFans          []int64  `json:"day_net_fans"`     //净增
+		Days       []string `json:"days"`         //最近7天
+		DayNewFans []int64  `json:"day_new_fans"` //新增
+		DayNetFans []int64  `json:"day_net_fans"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, 0, -7) //2018-03-17 14:32:00
-	nextTime := now//2018-03-24 14:32:00
+	nextTime := now                    //2018-03-24 14:32:00
 
 	// 2018-03-17 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),startTime.Day(),0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 0, 0, 0, time.Local)
 	// 2018-03-24 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(),0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(), 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(),0,0,0,0,time.Local)
+		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		//2018-03-03 00:00:00
 		start = queryDateTmp.AddDate(0, 0, -6) //前6天
-		beego.BeeLogger.Warn("start:%s",start)
+		beego.BeeLogger.Warn("start:%s", start)
 		//2018-03-10 00:00:00
-		end = queryDateTmp.AddDate(0,0,1)
-		beego.BeeLogger.Warn("end:%s",end)
+		end = queryDateTmp.AddDate(0, 0, 1)
+		beego.BeeLogger.Warn("end:%s", end)
 
 	}
 
 	subUserCountPerDayList := models.GetAllSubUserCountByDay(start, end, true)
-	unSubUserCountPerDayList := models.GetAllUnSubUserCountByDay(start,end, true)
+	unSubUserCountPerDayList := models.GetAllUnSubUserCountByDay(start, end, true)
 	//subOtherCountPerDayList := models.GetSubOtherCountByDay(start, end)
 	//unSubOtherCountPerDayList := models.GetUnSubOtherCountByDay(start, end)
 
@@ -60,7 +59,6 @@ func (self *FansDayGrouthController) Get() {
 	var dayNewFans []int64
 	var dayNetFans []int64
 
-
 	for i := 0; i < 7; i++ {
 
 		day := start.AddDate(0, 0, i).Format("01-02")
@@ -68,8 +66,8 @@ func (self *FansDayGrouthController) Get() {
 
 		md := start.AddDate(0, 0, i).Format("20060102")
 
-		mdInt,_ := strconv.ParseInt(md, 0 ,64)
-		beego.BeeLogger.Warn("md:%s,mdint:%d",md,mdInt)
+		mdInt, _ := strconv.ParseInt(md, 0, 64)
+		beego.BeeLogger.Warn("md:%s,mdint:%d", md, mdInt)
 
 		sub := models.ContainsInDayItemListAndReturnItemCount(mdInt, subUserCountPerDayList)
 		//subOther := ContainsInDayListAndReturn(mdInt, subOtherCountPerDayList)
@@ -78,8 +76,7 @@ func (self *FansDayGrouthController) Get() {
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  sub
+		dayNewF := sub
 		beego.BeeLogger.Warn("dayNewF:%d", dayNewF)
 
 		dayNewFans = append(dayNewFans, dayNewF)
@@ -90,7 +87,7 @@ func (self *FansDayGrouthController) Get() {
 		dayNetFans = append(dayNetFans, dayNetF)
 	}
 
-	self.Data["json"] = &Ret{Days:days, DayNewFans: dayNewFans,DayNetFans: dayNetFans}
+	self.Data["json"] = &Ret{Days: days, DayNewFans: dayNewFans, DayNetFans: dayNetFans}
 	self.ServeJSON()
 
-}
+}

+ 7 - 7
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_distribution.go

@@ -1,8 +1,8 @@
 package d5c_fans_controller
 
 import (
-"github.com/astaxie/beego"
-"d5c-statement-api/models"
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 )
 
 type FansDistributionController struct {
@@ -14,19 +14,19 @@ type FansDistributionController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansDistributionController) Get(){
+func (self *FansDistributionController) Get() {
 
 	type Ret struct {
-		FanCityDistribution         []*models.CityDistribution   `json:"fan_city_distribution"`
+		FanCityDistribution []*models.CityDistribution `json:"fan_city_distribution"`
 
-		FanCityDistributionMax      int64                        `json:"fan_city_distribution_max"`
+		FanCityDistributionMax int64 `json:"fan_city_distribution_max"`
 	}
 
 	fanDisList := models.GetFansCityDistribution(true)
 	max := models.GetFansCityDistributionMax(true)
 
-	self.Data["json"] = &Ret{FanCityDistribution:fanDisList, FanCityDistributionMax:max}
+	self.Data["json"] = &Ret{FanCityDistribution: fanDisList, FanCityDistributionMax: max}
 
 	self.ServeJSON()
 
-}
+}

+ 14 - 17
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_month_add.go

@@ -1,10 +1,10 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type FansMonthAddController struct {
@@ -17,45 +17,42 @@ type FansMonthAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansMonthAddController) Get(){
+func (self *FansMonthAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 
-		query_date_tmp, _ := time.Parse("2006-01-02",query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 	if len(s) == 2 {
 
-		query_date, _ := time.Parse("2006-01",query_date)
-		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0,0 ,0, time.Local)
+		query_date, _ := time.Parse("2006-01", query_date)
+		queryDate = time.Date(query_date.Year(), query_date.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	}
 
 	type Ret struct {
-		QueryDate      string            `json:"query_date"`       //查询日期
-		FansMonthNewAdd  int64           `json:"fans_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		FansMonthNetAdd  int64           `json:"fans_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		QueryDate       string `json:"query_date"`         //查询日期
+		FansMonthNewAdd int64  `json:"fans_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
+		FansMonthNetAdd int64  `json:"fans_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
 	}
 
-
 	//某月不分有没有渠道的所有关注人数
-	subUserCount := models.GetAllSubUserCount(queryDate, queryDate.AddDate(0,1,0),true)
+	subUserCount := models.GetAllSubUserCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	//某月不分有没有渠道的所有取消关注人数
-	unSubUserCount := models.GetAllUnSubUserCount(queryDate, queryDate.AddDate(0,1,0), true)
-
+	unSubUserCount := models.GetAllUnSubUserCount(queryDate, queryDate.AddDate(0, 1, 0), true)
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01"), FansMonthNewAdd: subUserCount, FansMonthNetAdd: subUserCount - unSubUserCount}
 
 	self.ServeJSON()
 
 }
-

+ 17 - 20
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_month_grouth.go

@@ -1,11 +1,11 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
 )
 
 type FansMonthGrouthController struct {
@@ -18,17 +18,17 @@ type FansMonthGrouthController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *FansMonthGrouthController) Get(){
+func (self *FansMonthGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Months                []string `json:"months"`             //六个月
-		MonthNewFans          []int64  `json:"month_new_fans"`     //新增
-		MonthNetFans          []int64  `json:"month_net_fans"`     //净增
+		Months       []string `json:"months"`         //六个月
+		MonthNewFans []int64  `json:"month_new_fans"` //新增
+		MonthNetFans []int64  `json:"month_net_fans"` //净增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	end := now
 
@@ -43,17 +43,16 @@ func (self *FansMonthGrouthController) Get(){
 	}
 
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	start = queryDate.AddDate(0, -5, 0) //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
-
-	end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
-	beego.BeeLogger.Warn("end:%s",end)
+	beego.BeeLogger.Warn("start:%s", start)
 
+	end = queryDate.AddDate(0, 1, 0) //2018-03-01 00:00:00
+	beego.BeeLogger.Warn("end:%s", end)
 
 	subUserCountPerMonthList := models.GetAllSubUserCountByMonth(start, end, true)
-	unSubUserCountPerMonthList := models.GetAllUnSubUserCountByMonth(start,end, true)
+	unSubUserCountPerMonthList := models.GetAllUnSubUserCountByMonth(start, end, true)
 	//subOtherCountPerMonthList := models.GetSubOtherCountByMonth(start, end)
 	//unSubOtherCountPerMonthList := models.GetUnSubOtherCountByMonth(start, end)
 
@@ -61,7 +60,6 @@ func (self *FansMonthGrouthController) Get(){
 	var monthNewFans []int64
 	var monthNetFans []int64
 
-
 	for i := 0; i < 6; i++ {
 
 		month := start.AddDate(0, i, 0).Format("2006-01")
@@ -69,21 +67,20 @@ func (self *FansMonthGrouthController) Get(){
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		sub := models.ContainsInMonthItemListAndReturnItemCount(ymInt, subUserCountPerMonthList)
-		beego.BeeLogger.Warn("sub:%d",sub)
+		beego.BeeLogger.Warn("sub:%d", sub)
 		//subOther := ContainsInMonthListAndReturn(ymInt, subOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("subOther:%d",subOther)
 		unSub := models.ContainsInMonthItemListAndReturnItemCount(ymInt, unSubUserCountPerMonthList)
-		beego.BeeLogger.Warn("unSub:%d",unSub)
+		beego.BeeLogger.Warn("unSub:%d", unSub)
 		//unSubOther := ContainsInMonthListAndReturn(ymInt, unSubOtherCountPerMonthList)
 		//beego.BeeLogger.Warn("unSubOther:%d",unSubOther)
 
 		//subOtherNet := subOther - unSubOther
 
-
-		dayNewF :=  sub
+		dayNewF := sub
 		beego.BeeLogger.Warn("monthNewF:%d", dayNewF)
 
 		monthNewFans = append(monthNewFans, dayNewF)

+ 1 - 1
go/gopath/src/d5c-statement-api/controllers/d5c_fans_controller/fans_platform.go

@@ -1,8 +1,8 @@
 package d5c_fans_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type FansPlatformContoller struct {

+ 11 - 11
go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/left_top_data_of_home_page.go

@@ -1,32 +1,33 @@
 package d5c_home_page_stat_controller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
 type LeftTopDataOfHomePageController struct {
 	beego.Controller
 }
+
 // @Title Get
 // @Description 首页左上角的数据集合。
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} int64
 // @router / [get]
-func (self *LeftTopDataOfHomePageController) Get(){
+func (self *LeftTopDataOfHomePageController) Get() {
 	//platform_type := self.GetString("platform_type")
 	//
 	//if strings.TrimSpace(platform_type) == "" {
 	//	platform_type = models.PLATFORM_TYPE_FANS_D5C
 	//}
 	type Ret struct {
-		TotalFans       int64   `json:"platform_total_fans"`
-		TotaCowFans       int64   `json:"total_cow_fans"`//养牛平台粉丝总数
-		TotaCows      int64   `json:"total_cows"`//养牛总数
-		TotalRegisters  int64   `json:"total_register"`
-		TotalInvest     float64 `json:"total_invest"`//融资总额
-		TotalProject    float64 `json:"total_project"`//项目总额
+		TotalFans      int64   `json:"platform_total_fans"`
+		TotaCowFans    int64   `json:"total_cow_fans"` //养牛平台粉丝总数
+		TotaCows       int64   `json:"total_cows"`     //养牛总数
+		TotalRegisters int64   `json:"total_register"`
+		TotalInvest    float64 `json:"total_invest"`  //融资总额
+		TotalProject   float64 `json:"total_project"` //项目总额
 	}
 
 	//totalFans := models.GetFansTotalCountByType(platform_type)
@@ -37,8 +38,7 @@ func (self *LeftTopDataOfHomePageController) Get(){
 	totalInvest := models.GetD5cTotalProjectJoinInvestment()
 	totalProject := models.GetD5cTotalProjectInvestment()
 
-
-	self.Data["json"] = &Ret{TotaCows: totalCows,TotalFans: totalFans,TotaCowFans: totalCowFans, TotalRegisters: total, TotalInvest: tools.RoundFloat64(float64(totalInvest)/float64(100),2), TotalProject: tools.RoundFloat64(float64(totalProject)/float64(100),2)}
+	self.Data["json"] = &Ret{TotaCows: totalCows, TotalFans: totalFans, TotaCowFans: totalCowFans, TotalRegisters: total, TotalInvest: tools.RoundFloat64(float64(totalInvest)/float64(100), 2), TotalProject: tools.RoundFloat64(float64(totalProject)/float64(100), 2)}
 
 	self.ServeJSON()
 }

+ 108 - 109
go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/new_home_page_middle.go

@@ -1,14 +1,14 @@
 package d5c_home_page_stat_controller
 
 import (
-	"github.com/astaxie/beego"
-	"time"
-	"strings"
-	"strconv"
-	"d5c-statement-api/models"
 	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 	"math"
-	"d5c-statement-api/tools"
+	"strconv"
+	"strings"
+	"time"
 )
 
 type NewHomePageMiddleController struct {
@@ -16,18 +16,18 @@ type NewHomePageMiddleController struct {
 }
 
 type Ret struct {
-	Times                      []string   `json:"times"`                      //12个月/30天/24小时
-	TimeNewFans                []int64    `json:"time_new_fans"`              //新增粉丝
-	TimeNetFans                []int64    `json:"time_net_fans"`             //净增用户
-	TimeNewUsers               []int64    `json:"time_new_users"`             //新增用户
-	TimeNewPhoneFriends        []int64    `json:"time_new_phone_friends"`     //新增手机加用户
-	TimeTrainClubNewInvestors  []int64    `json:"time_train_club_new_investors"`  //该时间训练营投资人数
-	TimePresentPmBalances      []int64    `json:"time_present_pm_balances"`   //该时间赠送积分
-	TimeConsumePmBalances      []int64    `json:"time_consume_pm_balances"`   //该时间消耗积分
-	TimeInvestMoney            []float64  `json:"time_invest_money"`          //该时间实际融资
-	TimeReadArticleFans        []int64    `json:"time_read_article_fans"`     //该时间系统文章阅读人数uv
-	TimePointTrainJoiners      []int64    `json:"time_point_train_joiners"`   //积分训练营参与人数
-	TimeNewDollars              []int64    `json:"time_new_dollars"`              //新增一元购用户
+	Times                     []string  `json:"times"`                         //12个月/30天/24小时
+	TimeNewFans               []int64   `json:"time_new_fans"`                 //新增粉丝
+	TimeNetFans               []int64   `json:"time_net_fans"`                 //净增用户
+	TimeNewUsers              []int64   `json:"time_new_users"`                //新增用户
+	TimeNewPhoneFriends       []int64   `json:"time_new_phone_friends"`        //新增手机加用户
+	TimeTrainClubNewInvestors []int64   `json:"time_train_club_new_investors"` //该时间训练营投资人数
+	TimePresentPmBalances     []int64   `json:"time_present_pm_balances"`      //该时间赠送积分
+	TimeConsumePmBalances     []int64   `json:"time_consume_pm_balances"`      //该时间消耗积分
+	TimeInvestMoney           []float64 `json:"time_invest_money"`             //该时间实际融资
+	TimeReadArticleFans       []int64   `json:"time_read_article_fans"`        //该时间系统文章阅读人数uv
+	TimePointTrainJoiners     []int64   `json:"time_point_train_joiners"`      //积分训练营参与人数
+	TimeNewDollars            []int64   `json:"time_new_dollars"`              //新增一元购用户
 }
 
 // @Title Get
@@ -37,54 +37,54 @@ type Ret struct {
 // @Param	type	query	string	false	"type"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *NewHomePageMiddleController) Get(){
+func (self *NewHomePageMiddleController) Get() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
 
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-		if queryType == "m" {//查询一个月份30天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
-		}else if queryType == "y"{//查询12个月
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryDate = queryDateTmp.AddDate(0,-12,0)
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
-		}else {//查询一天24小时
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+		if queryType == "m" { //查询一个月份30天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
+		} else if queryType == "y" { //查询12个月
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryDate = queryDateTmp.AddDate(0, -12, 0)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
+		} else { //查询一天24小时
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
-	if queryType == "m"{
-		self.QueryByDayOnMonth(queryDate,queryNextDate)
-	}else if queryType == "y"{
-		self.QueryByMonthOnYear(queryDate,queryNextDate)
-	}else {
-		self.QueryByHalfOnDay(queryDate,queryNextDate)
+	if queryType == "m" {
+		self.QueryByDayOnMonth(queryDate, queryNextDate)
+	} else if queryType == "y" {
+		self.QueryByMonthOnYear(queryDate, queryNextDate)
+	} else {
+		self.QueryByHalfOnDay(queryDate, queryNextDate)
 	}
 }
 
-func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNextDate time.Time){
-	useCache,_ := self.GetBool("cache", true)
+func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNextDate time.Time) {
+	useCache, _ := self.GetBool("cache", true)
 
 	var times []string
 	var timeNewFans []int64
@@ -104,29 +104,29 @@ func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNext
 
 	timeNewUserList := models.GetPerMonthUserSignupCountByTime(queryDate, queryNextDate)
 
-	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate,"%Y%m")
+	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate, "%Y%m")
 
-	timeTrainClubNewInvestorList := models.GetTrainClubNewInvestorByYmdTime(queryDate, queryNextDate,"%Y%m")
+	timeTrainClubNewInvestorList := models.GetTrainClubNewInvestorByYmdTime(queryDate, queryNextDate, "%Y%m")
 
-	timePresentPmBalanceList := models.GetPresentPmBalancesByYmdTime(queryDate, queryNextDate,"%Y%m", useCache)
+	timePresentPmBalanceList := models.GetPresentPmBalancesByYmdTime(queryDate, queryNextDate, "%Y%m", useCache)
 	//timePresentPmWxBalanceList := models.GetPresentPmWxBalancesByYmdTime(queryDate, queryNextDate,"%Y%m")
 
-	timeConsumePmBalanceList := models.GetConsumePmBalancesByYmdTime(queryDate, queryNextDate,"%Y%m", useCache)
+	timeConsumePmBalanceList := models.GetConsumePmBalancesByYmdTime(queryDate, queryNextDate, "%Y%m", useCache)
 
-	timeInvestMoneyList := models.GetPerMonthProjeceRealFinance(queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	timeInvestMoneyList := models.GetPerMonthProjeceRealFinance(queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 
-	timeReadArticleFanList := models.GetMonthItemReadArticleFansCount(queryDate,queryNextDate, useCache)
+	timeReadArticleFanList := models.GetMonthItemReadArticleFansCount(queryDate, queryNextDate, useCache)
 
-	timePointTrainList := models.GetPointTrainJoinersByYmdTime(queryDate, queryNextDate,"%Y%m")
-	timeNewDollarsList := models.GetAllDollarsCountByMonth(queryDate, queryNextDate,true)
+	timePointTrainList := models.GetPointTrainJoinersByYmdTime(queryDate, queryNextDate, "%Y%m")
+	timeNewDollarsList := models.GetAllDollarsCountByMonth(queryDate, queryNextDate, true)
 
-	for i:=0; i<13;i++  {
+	for i := 0; i < 13; i++ {
 
-		increaseDate := queryDate.AddDate(0,i,0).Format("2006-01")
+		increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 		times = append(times, increaseDate)
 
-		findDate := queryDate.AddDate(0,i,0).Format("200601")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+		findDate := queryDate.AddDate(0, i, 0).Format("200601")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 		//粉丝每月增长
 		sub := models.ContainsInMonthItemListAndReturnItemCount(findDateInt, subUserCountPerMonthList)
@@ -136,21 +136,21 @@ func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNext
 		subNet := sub - unSub
 		timeNetFans = append(timeNetFans, subNet)
 
-	    //注册用户每月增长
+		//注册用户每月增长
 		monthNewUserCount := models.ContainsInMonthItemListAndReturnItemCount(findDateInt, timeNewUserList)
 		timeNewUsers = append(timeNewUsers, monthNewUserCount)
 
 		//客服加手机每月增长
 		if item := models.ContainInItemListAndReturn(findDateInt, timeNewPhoneFriendList); item != nil {
 			timeNewPhoneFriends = append(timeNewPhoneFriends, item.Count)
-		}else {
+		} else {
 			timeNewPhoneFriends = append(timeNewPhoneFriends, 0)
 		}
 
 		//训练营每月增长
 		if item := models.ContainInItemListAndReturn(findDateInt, timeTrainClubNewInvestorList); item != nil {
 			timeTrainClubNewInvestors = append(timeTrainClubNewInvestors, item.Count)
-		}else {
+		} else {
 			timeTrainClubNewInvestors = append(timeTrainClubNewInvestors, 0)
 		}
 
@@ -163,18 +163,18 @@ func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNext
 		//消耗积分每月增长
 		if item := models.ContainInItemListAndReturn(findDateInt, timeConsumePmBalanceList); item != nil {
 			timeConsumePmBalances = append(timeConsumePmBalances, int64(math.Abs(float64(item.Count))))
-		}else {
+		} else {
 			timeConsumePmBalances = append(timeConsumePmBalances, 0)
 		}
 
 		//融资金额每月新增
 		if tmp := models.ContainsInMonthItemListAndReturnItem(findDateInt, timeInvestMoneyList); tmp != nil {
-			timeInvestMoney = append(timeInvestMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100),2))
+			timeInvestMoney = append(timeInvestMoney, tools.RoundFloat64(float64(tmp.Count)/float64(100), 2))
 		} else {
 			timeInvestMoney = append(timeInvestMoney, 0)
 		}
 		//文章阅读人数每月统计
-		if item :=models.ContainsInMonthItemListAndReturnItem(findDateInt, timeReadArticleFanList); item != nil {
+		if item := models.ContainsInMonthItemListAndReturnItem(findDateInt, timeReadArticleFanList); item != nil {
 			timeReadArticleFans = append(timeReadArticleFans, item.Count)
 		} else {
 			timeReadArticleFans = append(timeReadArticleFans, 0)
@@ -183,7 +183,7 @@ func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNext
 		//积分训练营
 		if item := models.ContainInItemListAndReturn(findDateInt, timePointTrainList); item != nil {
 			timePointTrainJoiners = append(timePointTrainJoiners, item.Count)
-		}else {
+		} else {
 			timePointTrainJoiners = append(timePointTrainJoiners, 0)
 		}
 		//一元购参与人数
@@ -192,24 +192,24 @@ func (self *NewHomePageMiddleController) QueryByMonthOnYear(queryDate, queryNext
 	}
 
 	self.Data["json"] = Ret{
-		Times                  :times,
-		TimeNewFans            :timeNewFans,
-		TimeNetFans            :timeNetFans,
-		TimeNewUsers           :timeNewUsers,
-		TimeNewPhoneFriends    :timeNewPhoneFriends,
-		TimeTrainClubNewInvestors  :timeTrainClubNewInvestors,
-		TimePresentPmBalances  :timePresentPmBalances,
-		TimeConsumePmBalances  :timeConsumePmBalances,
-		TimeInvestMoney        :timeInvestMoney,
-		TimeReadArticleFans    :timeReadArticleFans,
-		TimePointTrainJoiners  :timePointTrainJoiners,
-		TimeNewDollars          :timeNewDollars,
+		Times:                     times,
+		TimeNewFans:               timeNewFans,
+		TimeNetFans:               timeNetFans,
+		TimeNewUsers:              timeNewUsers,
+		TimeNewPhoneFriends:       timeNewPhoneFriends,
+		TimeTrainClubNewInvestors: timeTrainClubNewInvestors,
+		TimePresentPmBalances:     timePresentPmBalances,
+		TimeConsumePmBalances:     timeConsumePmBalances,
+		TimeInvestMoney:           timeInvestMoney,
+		TimeReadArticleFans:       timeReadArticleFans,
+		TimePointTrainJoiners:     timePointTrainJoiners,
+		TimeNewDollars:            timeNewDollars,
 	}
 	self.ServeJSON()
 
 }
 
-func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextDate time.Time){
+func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextDate time.Time) {
 
 	var times []string
 	var timeNewFans []int64
@@ -227,7 +227,7 @@ func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextD
 
 	timeNewUserList := models.GetPerDayUserSignupCountByTime(queryDate, queryNextDate)
 
-	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate,"%Y%m%d")
+	timeNewPhoneFriendList := models.GetTotalPhoneFriendsByYmdTime(queryDate, queryNextDate, "%Y%m%d")
 
 	//timeTrainClubNewInvestorList := models.GetTrainClubNewInvestorByYmdTime(queryDate, queryNextDate,"%Y%m%d")
 	//
@@ -236,18 +236,17 @@ func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextD
 	//
 	//timeConsumePmBalanceList := models.GetConsumePmBalancesByYmdTime(queryDate, queryNextDate,"%Y%m%d")
 	//
-	timeInvestMoneyList := models.GetPerDayProjeceRealFinance(queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
-
-	timePointTrainList := models.GetPointTrainJoinersByYmdTime(queryDate, queryNextDate,"%Y%m%d")
+	timeInvestMoneyList := models.GetPerDayProjeceRealFinance(queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 
+	timePointTrainList := models.GetPointTrainJoinersByYmdTime(queryDate, queryNextDate, "%Y%m%d")
 
-	for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
+	for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-		increaseDate := queryDate.AddDate(0,0,i).Format("01-02")
+		increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 		times = append(times, increaseDate)
 
-		findDate := queryDate.AddDate(0,0,i).Format("20060102")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+		findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 		//beego.BeeLogger.Warn("%s,%d", increaseDate,findDateInt)
 		//粉丝每月新增长
@@ -259,13 +258,13 @@ func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextD
 		timeNetFans = append(timeNetFans, subNet)
 
 		//注册用户每日增长
-		monthNewUserCount := models.ContainsInDayItemListAndReturnItemCount(findDateInt,timeNewUserList)
+		monthNewUserCount := models.ContainsInDayItemListAndReturnItemCount(findDateInt, timeNewUserList)
 		timeNewUsers = append(timeNewUsers, monthNewUserCount)
 
 		//客服加手机每日增长
 		if item := models.ContainInItemListAndReturn(findDateInt, timeNewPhoneFriendList); item != nil {
 			timeNewPhoneFriends = append(timeNewPhoneFriends, item.Count)
-		}else {
+		} else {
 			timeNewPhoneFriends = append(timeNewPhoneFriends, 0)
 		}
 
@@ -294,31 +293,31 @@ func (self *NewHomePageMiddleController) QueryByDayOnMonth(queryDate, queryNextD
 			timeInvestMoney = append(timeInvestMoney, 0)
 		}
 
-	    //积分训练营
-	    if item := models.ContainInItemListAndReturn(findDateInt, timePointTrainList); item != nil {
+		//积分训练营
+		if item := models.ContainInItemListAndReturn(findDateInt, timePointTrainList); item != nil {
 			timePointTrainJoiners = append(timePointTrainJoiners, item.Count)
-		}else {
+		} else {
 			timePointTrainJoiners = append(timePointTrainJoiners, 0)
 		}
 	}
 
 	self.Data["json"] = Ret{
-		Times                      :times,
-		TimeNewFans                :timeNewFans,
-		TimeNetFans                :timeNetFans,
-		TimeNewUsers               :timeNewUsers,
-		TimeNewPhoneFriends        :timeNewPhoneFriends,
+		Times:               times,
+		TimeNewFans:         timeNewFans,
+		TimeNetFans:         timeNetFans,
+		TimeNewUsers:        timeNewUsers,
+		TimeNewPhoneFriends: timeNewPhoneFriends,
 		//TimeTrainClubNewInvestors  :timeTrainClubNewInvestors,
 		//TimePresentPmBalances      :timePresentPmBalances,
 		//TimeConsumePmBalances      :timeConsumePmBalances,
-		TimeInvestMoney            :timeInvestMoney,
-		TimePointTrainJoiners      :timePointTrainJoiners,
+		TimeInvestMoney:       timeInvestMoney,
+		TimePointTrainJoiners: timePointTrainJoiners,
 	}
 	//beego.BeeLogger.Warn("-------%v",self.Data["json"])
 	self.ServeJSON()
 }
 
-func (self *NewHomePageMiddleController) QueryByHalfOnDay(queryDate, queryNextDate time.Time){
+func (self *NewHomePageMiddleController) QueryByHalfOnDay(queryDate, queryNextDate time.Time) {
 
 	var times []string
 	var timeNewFans []int64
@@ -342,19 +341,19 @@ func (self *NewHomePageMiddleController) QueryByHalfOnDay(queryDate, queryNextDa
 
 	for i := 0; i < 48; i++ {
 
-		queryDateTmp := queryDate.Unix() + 3600 * 0.5 * int64(i)
+		queryDateTmp := queryDate.Unix() + 3600*0.5*int64(i)
 
-		increaseDate := time.Unix(queryDateTmp,0).Format("15:04")//20060102150405
+		increaseDate := time.Unix(queryDateTmp, 0).Format("15:04") //20060102150405
 		times = append(times, increaseDate)
 
-		findDate := time.Unix(queryDateTmp,0).Format("200601021504")
+		findDate := time.Unix(queryDateTmp, 0).Format("200601021504")
 		findDateStr := findDate
 		if strings.HasSuffix(findDate, "00") {
 			findDateStr = fmt.Sprintf("%s%d", strings.TrimSuffix(findDate, "00"), 0)
 		} else {
 			findDateStr = fmt.Sprintf("%s%d", strings.TrimSuffix(findDate, "30"), 1)
 		}
-		findDateInt,_ := strconv.ParseInt(findDateStr, 0, 64)
+		findDateInt, _ := strconv.ParseInt(findDateStr, 0, 64)
 
 		//粉丝每日增长
 		sub := models.ContainsInHalfHourItemListAndReturnItemCount(findDateInt, subUserCountPerMonthList)
@@ -365,7 +364,7 @@ func (self *NewHomePageMiddleController) QueryByHalfOnDay(queryDate, queryNextDa
 		timeNetFans = append(timeNetFans, subNet)
 
 		//注册用户每日增长
-		monthNewUserCount := models.ContainsInHalfHourItemListAndReturnItemCount(findDateInt,timeNewUserList)
+		monthNewUserCount := models.ContainsInHalfHourItemListAndReturnItemCount(findDateInt, timeNewUserList)
 		timeNewUsers = append(timeNewUsers, monthNewUserCount)
 
 		//赠送积分每月增长
@@ -385,13 +384,13 @@ func (self *NewHomePageMiddleController) QueryByHalfOnDay(queryDate, queryNextDa
 	}
 
 	self.Data["json"] = Ret{
-		Times                  :times,
-		TimeNewFans            :timeNewFans,
-		TimeNetFans            :timeNetFans,
-		TimeNewUsers           :timeNewUsers,
-		TimePresentPmBalances  :timePresentPmBalances,
-		TimeConsumePmBalances  :timeConsumePmBalances,
-		TimePointTrainJoiners  :timePointTrainJoiners,
+		Times:                 times,
+		TimeNewFans:           timeNewFans,
+		TimeNetFans:           timeNetFans,
+		TimeNewUsers:          timeNewUsers,
+		TimePresentPmBalances: timePresentPmBalances,
+		TimeConsumePmBalances: timeConsumePmBalances,
+		TimePointTrainJoiners: timePointTrainJoiners,
 	}
 	self.ServeJSON()
 }

+ 29 - 30
go/gopath/src/d5c-statement-api/controllers/d5c_home_page_stat_controller/new_home_page_top.go

@@ -1,11 +1,11 @@
 package d5c_home_page_stat_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	//"math"
+	"fohow-statement-api/tools"
 	"time"
-	"d5c-statement-api/tools"
 )
 
 type NewHomePageTopController struct {
@@ -17,45 +17,44 @@ type NewHomePageTopController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *NewHomePageTopController) Get(){
+func (self *NewHomePageTopController) Get() {
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(),now.Month(),1,0,0,0,0,time.Local)
-	useCache,_ := self.GetBool("cache", true)
-	queryEndDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	useCache, _ := self.GetBool("cache", true)
+	queryEndDate := queryDate.AddDate(0, 1, 0)
 	beego.BeeLogger.Warn("new_nome_page_top.Get() queryDate=%v, queryEndDate=%v", queryDate, queryEndDate)
 
 	type Ret struct {
-		TotalFans              int64     `json:"platform_total_fans"`  //粉丝总数
-		TotalRegisters         int64     `json:"platform_total_register"` //注册总数
-		QueryTotalInvest       float64   `json:"platform_query_month_total_invest"`//当月融资总额
-		TotalPhoneFriend       int64     `json:"total_phone_friend"`//手机总数
-		TotalNotYetExchange    int64   `json:"total_not_yet_exchange"`//未兑换积分
+		TotalFans           int64   `json:"platform_total_fans"`               //粉丝总数
+		TotalRegisters      int64   `json:"platform_total_register"`           //注册总数
+		QueryTotalInvest    float64 `json:"platform_query_month_total_invest"` //当月融资总额
+		TotalPhoneFriend    int64   `json:"total_phone_friend"`                //手机总数
+		TotalNotYetExchange int64   `json:"total_not_yet_exchange"`            //未兑换积分
 		//TotalAlreadyExchange   int64   `json:"total_already_exchange"`//已兑换积分
 
-		FansMonthReadArticle   int64   `json:"fans_month_read_article"` //当月系统文章阅读人数
+		FansMonthReadArticle int64 `json:"fans_month_read_article"` //当月系统文章阅读人数
 
-		FansMonthNewAdd  int64           `json:"fans_month_new_add"` //日期下粉丝新增(渠道关注+非渠道关注)
-		FansMonthNetAdd  int64           `json:"fans_month_net_add"` //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
-		UserMonthNewAdd  int64           `json:"user_month_new_add"` //日期下用户新增
-		FriendMonthNewAdd int64          `json:"friend_month_new_add"` //日期下好友新增
+		FansMonthNewAdd   int64 `json:"fans_month_new_add"`   //日期下粉丝新增(渠道关注+非渠道关注)
+		FansMonthNetAdd   int64 `json:"fans_month_net_add"`   //日期下粉丝净增(渠道关注+非渠道关注-渠道取消关注-非渠道取消关注)
+		UserMonthNewAdd   int64 `json:"user_month_new_add"`   //日期下用户新增
+		FriendMonthNewAdd int64 `json:"friend_month_new_add"` //日期下好友新增
 	}
 
-
 	totalFans := models.GetFansTotalCountByWxUserTable(true)
 	totalUsers := models.GetRegisterUsersTotalCount()
 
 	//查询日期的众筹总额
 	var queryMonthInvestBonus = float64(0)
-	investMon := models.GetD5cTotalProjectJoinInvestmentByTime(queryDate,queryEndDate, "2006-01-02")
+	investMon := models.GetD5cTotalProjectJoinInvestmentByTime(queryDate, queryEndDate, "2006-01-02")
 	if investMon != 0 {
-		queryMonthInvestBonus = tools.RoundFloat64(float64(investMon)/float64(100),2)
+		queryMonthInvestBonus = tools.RoundFloat64(float64(investMon)/float64(100), 2)
 	}
 
 	totalPhoneFriend := models.GetTotalPhoneFriends()
 
 	//注册用户积分
-	totalNotYetExchange := models.GetPresentPmBalances();
+	totalNotYetExchange := models.GetPresentPmBalances()
 	//+微信用户有效积分
 	//totalNotYetExchange += models.GetPresentPmWxBalances();
 
@@ -72,22 +71,22 @@ func (self *NewHomePageTopController) Get(){
 
 	friend := models.GetTotalPhoneFriendByTime(queryDate, queryEndDate)
 
-	fansMonthReadArticle := models.GetMonthReadArticleFansCount(useCache);
+	fansMonthReadArticle := models.GetMonthReadArticleFansCount(useCache)
 	//beego.BeeLogger.Warn("%d",fansMonthReadArticle)
 
-	self.Data["json"]= &Ret{
-		TotalFans : totalFans,
-		TotalRegisters:totalUsers,
-		QueryTotalInvest: queryMonthInvestBonus,
-		TotalPhoneFriend: totalPhoneFriend,
+	self.Data["json"] = &Ret{
+		TotalFans:           totalFans,
+		TotalRegisters:      totalUsers,
+		QueryTotalInvest:    queryMonthInvestBonus,
+		TotalPhoneFriend:    totalPhoneFriend,
 		TotalNotYetExchange: totalNotYetExchange,
 
 		//TotalAlreadyExchange: int64(math.Abs(float64(totalAlreadyExchange))),
 
-		FansMonthNewAdd: subUserCount,
-		FansMonthNetAdd: subUserCount - unSubUserCount,
-		UserMonthNewAdd: userMonthNewAdd,
-		FriendMonthNewAdd: friend,
+		FansMonthNewAdd:      subUserCount,
+		FansMonthNetAdd:      subUserCount - unSubUserCount,
+		UserMonthNewAdd:      userMonthNewAdd,
+		FriendMonthNewAdd:    friend,
 		FansMonthReadArticle: fansMonthReadArticle,
 	}
 	self.ServeJSON()

+ 21 - 20
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_channel_stat.go

@@ -1,74 +1,75 @@
 package d5c_investors_controlelr
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strings"
 	"time"
-	"d5c-statement-api/tools"
 )
 
 type InvestorsChannelStatController struct {
 	beego.Controller
 }
+
 // @Title Get
 // @Description get 投资人模块-各个渠道数据列表:当月新投资人、总投资人、总投资总额
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *InvestorsChannelStatController) Get(){
+func (self *InvestorsChannelStatController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
 	//2018-03-23 00:00:00
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
 	//2018-03-24 00:00:00
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
 	if len(s) == 2 {
-		query_date_tmp,_ := time.Parse("2006-01", query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-		queryNextDate = queryDate.AddDate(0,1,0)
+		query_date_tmp, _ := time.Parse("2006-01", query_date)
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+		queryNextDate = queryDate.AddDate(0, 1, 0)
 	}
 
 	type Ret struct {
-		List      []*models.DataPerChannel   `json:"data_list_perchannel"`
+		List []*models.DataPerChannel `json:"data_list_perchannel"`
 	}
 
 	var dataPerChannelList []*models.DataPerChannel
 
 	//非渠道注册的投资人新增,总人数,总实际金额,时间内的投资金额
-	data := models.GetNewInvestorComeNotByChannelByTime(queryDate,queryNextDate)
+	data := models.GetNewInvestorComeNotByChannelByTime(queryDate, queryNextDate)
 	data_t := models.GetTotalInvestorAndTotalInvestmentByNoChannel()
-	data_time_t := models.GetTimeTotalInvestmentByNoChannel(queryDate,queryNextDate)
+	data_time_t := models.GetTimeTotalInvestmentByNoChannel(queryDate, queryNextDate)
 	if data_t != nil {
 
 		data.TotalCount = data_t.TotalCount
-		data.TotalInvest = tools.RoundFloat64(data_t.TotalInvest,2)
+		data.TotalInvest = tools.RoundFloat64(data_t.TotalInvest, 2)
 	}
 	if data_time_t != nil {
 
-		data.TimeInvest = tools.RoundFloat64(data_time_t.TimeInvest,2)
+		data.TimeInvest = tools.RoundFloat64(data_time_t.TimeInvest, 2)
 	}
 	dataPerChannelList = append(dataPerChannelList, data)
 
 	//所有渠道注册的投资人新增,总人数,总实际金额
-	list := models.GetNewInvestorPerChannelByTime(queryDate,queryNextDate)
+	list := models.GetNewInvestorPerChannelByTime(queryDate, queryNextDate)
 	listAmountAndCount := models.GetAllInvestCountAndAmountByProjectJoins()
-	listTimeAmount := models.GetChannelTimeInvestByTime(queryDate,queryNextDate)
+	listTimeAmount := models.GetChannelTimeInvestByTime(queryDate, queryNextDate)
 
-	for _,item:=range list{
+	for _, item := range list {
 
-		data_ct_total_count,data_ct_total_invest  := models.ContainInDataPerChannelListAndReturnChannelCount(item.SignupChannelId,listAmountAndCount)
+		data_ct_total_count, data_ct_total_invest := models.ContainInDataPerChannelListAndReturnChannelCount(item.SignupChannelId, listAmountAndCount)
 		data_ct_time_invest := models.ContainInDataPerChannelListAndReturnTimeInvest(item.SignupChannelId, listTimeAmount)
 		item.TotalCount = data_ct_total_count
-		item.TotalInvest = tools.RoundFloat64(data_ct_total_invest,2)
+		item.TotalInvest = tools.RoundFloat64(data_ct_total_invest, 2)
 		item.TimeInvest = tools.RoundFloat64(data_ct_time_invest, 2)
 		dataPerChannelList = append(dataPerChannelList, item)
 	}
-	self.Data["json"] = &Ret{List:dataPerChannelList}
+	self.Data["json"] = &Ret{List: dataPerChannelList}
 	self.ServeJSON()
 }

+ 12 - 14
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_cycle_distribution.go

@@ -1,28 +1,27 @@
 package d5c_investors_controlelr
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"fmt"
-	"d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 )
 
 type InvestorsCycleDistributionController struct {
 	beego.Controller
 }
 
-
 // @Title Get
 // @Description 投资人模块-平均真实转化周期,0-180天的转化人数和转化天数
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *InvestorsCycleDistributionController) Get(){
+func (self *InvestorsCycleDistributionController) Get() {
 
 	type Ret struct {
-		CycleConvertRate     float64       `json:"cycle_convert_rate"`//平均真实转化率= 所有投资人注册到投资的天数/所有投资人
-		CycleConvertDay      []string      `json:"cycle_convert_day"`//转化天数
-		CycleConvertCount    []int64       `json:"cycle_convert_count"`//转化数量
+		CycleConvertRate  float64  `json:"cycle_convert_rate"`  //平均真实转化率= 所有投资人注册到投资的天数/所有投资人
+		CycleConvertDay   []string `json:"cycle_convert_day"`   //转化天数
+		CycleConvertCount []int64  `json:"cycle_convert_count"` //转化数量
 	}
 
 	list := models.GetCycleConvertDataList()
@@ -33,26 +32,25 @@ func (self *InvestorsCycleDistributionController) Get(){
 	var cycleConvertDay []string
 	var cycleConvertCount []int64
 
-	for _,item:=range list{
-
+	for _, item := range list {
 
 		totalDays += item.Days * item.Count
 
 		totalCounts += item.Count
 
 		if item.Days <= 180 {
-			cycleConvertDay = append(cycleConvertDay, fmt.Sprintf("%d天",item.Days))
+			cycleConvertDay = append(cycleConvertDay, fmt.Sprintf("%d天", item.Days))
 			cycleConvertCount = append(cycleConvertCount, item.Count)
 		}
 	}
 
 	rate := float64(0)
 	if totalCounts > 0 && totalDays > 0 {
-		rate = tools.RoundFloat64(float64(totalDays)/float64(totalCounts),2)
+		rate = tools.RoundFloat64(float64(totalDays)/float64(totalCounts), 2)
 	}
 
 	self.Data["json"] = &Ret{CycleConvertRate: rate,
-							CycleConvertDay:cycleConvertDay,
-							CycleConvertCount:cycleConvertCount}
+		CycleConvertDay:   cycleConvertDay,
+		CycleConvertCount: cycleConvertCount}
 	self.ServeJSON()
 }

+ 16 - 16
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_cycle_distribution.go

@@ -1,10 +1,10 @@
 package d5c_investors_controlelr
 
 import (
-	"github.com/astaxie/beego"
 	"fmt"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 )
 
 type InvestorPerChannelCycleDistributionController struct {
@@ -19,17 +19,17 @@ type InvestorPerChannelCycleDistributionController struct {
 // @router / [get]
 func (self *InvestorPerChannelCycleDistributionController) Get() {
 
-	channel_id,_ := self.GetInt64("channel_id")
-	beego.BeeLogger.Warn("channelId:%d",channel_id)
+	channel_id, _ := self.GetInt64("channel_id")
+	beego.BeeLogger.Warn("channelId:%d", channel_id)
 
 	type Ret struct {
-		ChannelCycleConvertRate     float64       `json:"channel_cycle_convert_rate"`//平均真实转化率= 所有投资人注册到投资的天数/所有投资人
-		ChannelCycleConvertDay      []string      `json:"channel_cycle_convert_day"`//转化天数
-		ChannelCycleConvertCount    []int64       `json:"channel_cycle_convert_count"`//转化数量
+		ChannelCycleConvertRate  float64  `json:"channel_cycle_convert_rate"`  //平均真实转化率= 所有投资人注册到投资的天数/所有投资人
+		ChannelCycleConvertDay   []string `json:"channel_cycle_convert_day"`   //转化天数
+		ChannelCycleConvertCount []int64  `json:"channel_cycle_convert_count"` //转化数量
 	}
 
 	list := models.GetCycleConvertDataListByChannelId(channel_id)
-	beego.BeeLogger.Warn("len(list):%d",len(list))
+	beego.BeeLogger.Warn("len(list):%d", len(list))
 
 	totalDays := int64(0)
 	totalCounts := int64(0)
@@ -37,25 +37,25 @@ func (self *InvestorPerChannelCycleDistributionController) Get() {
 	var cycleConvertDay []string
 	var cycleConvertCount []int64
 
-	for _,item:=range list{
+	for _, item := range list {
 		totalDays += item.Days * item.Count
 
 		totalCounts += item.Count
 	}
 
-	for i:=0; i<=180;  i++{
-		cycleConvertDay = append(cycleConvertDay, fmt.Sprintf("%d天",i))
-		cycleConvertCount = append(cycleConvertCount, models.ContainInCycleConvertDataListAndReturnDataCount(int64(i),list))
+	for i := 0; i <= 180; i++ {
+		cycleConvertDay = append(cycleConvertDay, fmt.Sprintf("%d天", i))
+		cycleConvertCount = append(cycleConvertCount, models.ContainInCycleConvertDataListAndReturnDataCount(int64(i), list))
 	}
 
 	rate := float64(0)
 	if totalCounts > 0 && totalDays > 0 {
-		rate = tools.RoundFloat64(float64(totalDays)/float64(totalCounts),2)
+		rate = tools.RoundFloat64(float64(totalDays)/float64(totalCounts), 2)
 	}
 
 	self.Data["json"] = &Ret{ChannelCycleConvertRate: rate,
-		ChannelCycleConvertDay:cycleConvertDay,
-		ChannelCycleConvertCount:cycleConvertCount}
+		ChannelCycleConvertDay:   cycleConvertDay,
+		ChannelCycleConvertCount: cycleConvertCount}
 	self.ServeJSON()
 
 }

+ 18 - 19
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_month_grouth.go

@@ -1,11 +1,11 @@
 package d5c_investors_controlelr
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
 )
 
 type InvestorPerChannelMonthGrouthController struct {
@@ -21,50 +21,49 @@ type InvestorPerChannelMonthGrouthController struct {
 // @router / [get]
 func (self *InvestorPerChannelMonthGrouthController) Get() {
 
-	channel_id,_ := self.GetInt64("channel_id")
+	channel_id, _ := self.GetInt64("channel_id")
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, -5, 0) //2017-10-24 14:32:00
-	nextTime := now.AddDate(0, 1, 0)//2018-04-24 14:32:00
+	nextTime := now.AddDate(0, 1, 0)   //2018-04-24 14:32:00
 
 	// 2017-10-01 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-04-01 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), 1,0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	query_date_tmp := now
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01-02", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 	if len(s) == 2 {
 		//2018-02-01 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 
 	type Ret struct {
-		Months              []string                 `json:"months"`
-		NewInvestor         int64                    `json:"this_month_new_investor"`
-		MonthNewInvestors   []int64                  `json:"months_new_investor"`
+		Months            []string `json:"months"`
+		NewInvestor       int64    `json:"this_month_new_investor"`
+		MonthNewInvestors []int64  `json:"months_new_investor"`
 	}
 
 	list := models.GetPerMonthNewInvestorsByChannelIdAndTime(start, end, channel_id)
 
-	var months            []string
+	var months []string
 	var monthNewInvestors []int64
-	var newInvestors      int64
-
+	var newInvestors int64
 
 	for i := 0; i < 6; i++ {
 
@@ -73,7 +72,7 @@ func (self *InvestorPerChannelMonthGrouthController) Get() {
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		monthNewUserCount := models.ContainsInMonthItemListAndReturnItemCount(ymInt, list)
 

+ 16 - 17
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_stat.go

@@ -1,8 +1,8 @@
 package d5c_investors_controlelr
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strings"
 	"time"
 )
@@ -20,52 +20,51 @@ type InvestorsPerChannelStatController struct {
 // @router / [get]
 func (self *InvestorsPerChannelStatController) Get() {
 
-	channel_id,_ := self.GetInt64("channel_id")
+	channel_id, _ := self.GetInt64("channel_id")
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, -5, 0) //2017-10-24 14:32:00
-	nextTime := now.AddDate(0, 1, 0)//2018-04-24 14:32:00
+	nextTime := now.AddDate(0, 1, 0)   //2018-04-24 14:32:00
 
 	// 2017-10-01 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-04-01 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), 1,0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	query_date_tmp := now
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01-02", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 	if len(s) == 2 {
 		//2018-02-01 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 
-
 	type Ret struct {
-		ChannelId                   int64                                 `json:"channel_di"`
-		InvestorDataPerChannel      []*models.InvestorDataPerChannel      `json:"investor_data_list_per_channel"`//渠道的所有投资人的具体信息
+		ChannelId              int64                            `json:"channel_di"`
+		InvestorDataPerChannel []*models.InvestorDataPerChannel `json:"investor_data_list_per_channel"` //渠道的所有投资人的具体信息
 	}
 	//查询日期的当月新投资人用户id列表
 	newInvestorsUserIdList := models.GetNewInvestorUserIdByChannelIdAndTime(start, end, channel_id)
 	list := models.GetNewInvestorDataListByChannelId(channel_id)
 
 	//列表给以新人标记
-	for _,id := range newInvestorsUserIdList{
-		if tmp:= models.ContainInInvestorDataPerChannelListAndReturnChannel(id,list);tmp!=nil {
+	for _, id := range newInvestorsUserIdList {
+		if tmp := models.ContainInInvestorDataPerChannelListAndReturnChannel(id, list); tmp != nil {
 			tmp.IsNewInvestor = true
-		}else{
+		} else {
 			tmp.IsNewInvestor = false
 		}
 	}

+ 8 - 8
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_per_channel_total.go

@@ -1,9 +1,9 @@
 package d5c_investors_controlelr
 
 import (
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/tools"
 )
 
 type InvestorPerChannelTotalController struct {
@@ -16,17 +16,17 @@ type InvestorPerChannelTotalController struct {
 // @Param	channel_id	query	int	true	"channel_id"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *InvestorPerChannelTotalController) Get(){
+func (self *InvestorPerChannelTotalController) Get() {
 
-	channel_id,_ := self.GetInt64("channel_id")
+	channel_id, _ := self.GetInt64("channel_id")
 
 	type Ret struct {
-		ChannelInvestorCount    int64       `json:"channel_investor_count"`//该渠道投资人数
-		ChannelInvestorAmount   float64     `json:"channel_investor_amount"`//该渠道投资总额
+		ChannelInvestorCount  int64   `json:"channel_investor_count"`  //该渠道投资人数
+		ChannelInvestorAmount float64 `json:"channel_investor_amount"` //该渠道投资总额
 	}
 
 	dataPerChannel := models.GetTotalInvestorAndTotalInvestmentByChannel(channel_id)
 
-	self.Data["json"] = &Ret{ChannelInvestorCount:dataPerChannel.TotalCount, ChannelInvestorAmount:tools.RoundFloat64(dataPerChannel.TotalInvest,2)}
+	self.Data["json"] = &Ret{ChannelInvestorCount: dataPerChannel.TotalCount, ChannelInvestorAmount: tools.RoundFloat64(dataPerChannel.TotalInvest, 2)}
 	self.ServeJSON()
-}
+}

+ 4 - 5
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/investors_total.go

@@ -1,8 +1,8 @@
 package d5c_investors_controlelr
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type InvestorTotalController struct {
@@ -14,16 +14,15 @@ type InvestorTotalController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *InvestorTotalController) Get(){
-
+func (self *InvestorTotalController) Get() {
 
 	type Ret struct {
-		InvestorCount   int64    `json:"investor_count"`
+		InvestorCount int64 `json:"investor_count"`
 	}
 
 	investorCount := models.GetTotalInvestUserCount()
 
-	self.Data["json"]= &Ret{InvestorCount:investorCount}
+	self.Data["json"] = &Ret{InvestorCount: investorCount}
 	self.ServeJSON()
 
 }

+ 19 - 23
go/gopath/src/d5c-statement-api/controllers/d5c_investors_controlelr/user_investor_grouth.go

@@ -1,20 +1,19 @@
 package d5c_investors_controlelr
 
 import (
-	"github.com/astaxie/beego"
-	"time"
 	"fmt"
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 	"strconv"
 	"strings"
-	"d5c-statement-api/tools"
+	"time"
 )
 
 type InvestorsNewGrouthController struct {
 	beego.Controller
 }
 
-
 // @Title Get
 // @Description 投资人模块-第五创平台的近六月的新增投资人,当月新增投资人数量,当月众筹总额
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -25,9 +24,9 @@ func (self *InvestorsNewGrouthController) Get() {
 
 	//参数处理
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//时间处理
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	query_date_tmp := now
 
@@ -40,21 +39,21 @@ func (self *InvestorsNewGrouthController) Get() {
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 	}
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	start = queryDate.AddDate(0, -12, 0) //2017-09-01 00:00:00
 
 	type Ret struct {
-		Months                   []string `json:"months"`                     //最近6个月
-		MonthNewInvestUsers      []int64  `json:"month_invest_users"`         //每月新增投资人(产生过有效的股权、收益权投资记录)
-		QueryMonthInvestBonus  float64  `json:"query_month_invest_bonus"`   //查询月众筹总额
-		QueryMonthInvestors    int64    `json:"query_month_investors"`      //查询月新增投资人数
+		Months                []string `json:"months"`                   //最近6个月
+		MonthNewInvestUsers   []int64  `json:"month_invest_users"`       //每月新增投资人(产生过有效的股权、收益权投资记录)
+		QueryMonthInvestBonus float64  `json:"query_month_invest_bonus"` //查询月众筹总额
+		QueryMonthInvestors   int64    `json:"query_month_investors"`    //查询月新增投资人数
 	}
 
 	var months []string
 	var monthNewInvestUsers []int64
 
-	monthNewInvestUserList := models.GetMonthNewInvestUsers(start.Format("2006-01-02"), queryDate.AddDate(0,1,0).Format("2006-01-02"))
+	monthNewInvestUserList := models.GetMonthNewInvestUsers(start.Format("2006-01-02"), queryDate.AddDate(0, 1, 0).Format("2006-01-02"))
 
 	for i := 0; i < 13; i++ {
 
@@ -62,10 +61,9 @@ func (self *InvestorsNewGrouthController) Get() {
 
 		months = append(months, fmt.Sprintf("%d月", month))
 
-		ym := start.AddDate(0,i,0).Format("200601")
-
-		ymInt,_ := strconv.ParseInt(ym, 0, 64)
+		ym := start.AddDate(0, i, 0).Format("200601")
 
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		if tmp := models.YearMonthIsContainInList(ymInt, monthNewInvestUserList); tmp != nil {
 
@@ -86,17 +84,15 @@ func (self *InvestorsNewGrouthController) Get() {
 
 	//查询日的众筹总额(不是指新增投资人产生的投资总额)
 	var queryMonthInvestBonus = float64(0)
-	investMon := models.GetD5cTotalProjectJoinInvestmentByTime(queryDate,queryDate.AddDate(0,1,0), "2006-01-02")
+	investMon := models.GetD5cTotalProjectJoinInvestmentByTime(queryDate, queryDate.AddDate(0, 1, 0), "2006-01-02")
 	if investMon != 0 {
-		queryMonthInvestBonus = tools.RoundFloat64(float64(investMon)/float64(100),2)
+		queryMonthInvestBonus = tools.RoundFloat64(float64(investMon)/float64(100), 2)
 	}
 
-
 	self.Data["json"] = &Ret{Months: months,
-							MonthNewInvestUsers: monthNewInvestUsers,
-							QueryMonthInvestBonus:queryMonthInvestBonus,
-							QueryMonthInvestors:queryMonthInvestors}
+		MonthNewInvestUsers:   monthNewInvestUsers,
+		QueryMonthInvestBonus: queryMonthInvestBonus,
+		QueryMonthInvestors:   queryMonthInvestors}
 	self.ServeJSON()
 
 }
-

+ 33 - 37
go/gopath/src/d5c-statement-api/controllers/d5c_pm_balance_controller/d5c_pm_balance_stat.go

@@ -1,11 +1,11 @@
 package d5c_pm_balance_controller
 
 import (
+	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"time"
-	"d5c-statement-api/tools"
-	"fmt"
 )
 
 type D5cPmBalanceStatController struct {
@@ -18,23 +18,23 @@ type D5cPmBalanceStatController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router /all/stat [get]
-func(self *D5cPmBalanceStatController) GetAllStat(){
+func (self *D5cPmBalanceStatController) GetAllStat() {
 
-	useCache,_ := self.GetBool("cache", true)
+	useCache, _ := self.GetBool("cache", true)
 
 	_query_date := self.GetString("query_date")
 	query_date, _ := time.ParseInLocation("2006-01-02", _query_date, time.Local)
 
 	type Ret struct {
-		Total               int64                `json:"total"`
-		Top10Total          int64                `json:"top_10_total"`
-		TheDay              string               `json:"the_day"`
+		Total      int64  `json:"total"`
+		Top10Total int64  `json:"top_10_total"`
+		TheDay     string `json:"the_day"`
 	}
 
 	total := models.GetPmBalanceSumByDate(query_date, useCache)
 	top10Total := models.GetTopPmBalanceSumByDateAndLimit(query_date, 10, useCache)
 
-	self.Data["json"]=&Ret{Total:total, Top10Total:top10Total,TheDay:query_date.Format("2006-01-02")}
+	self.Data["json"] = &Ret{Total: total, Top10Total: top10Total, TheDay: query_date.Format("2006-01-02")}
 	self.ServeJSON()
 }
 
@@ -44,33 +44,31 @@ func(self *D5cPmBalanceStatController) GetAllStat(){
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router /all/source/distribution [get]
-func(self *D5cPmBalanceStatController) GetAllSourceDis(){
+func (self *D5cPmBalanceStatController) GetAllSourceDis() {
 
-	useCache,_ := self.GetBool("cache", true)
+	useCache, _ := self.GetBool("cache", true)
 
 	_query_date := self.GetString("query_date")
 	query_date, _ := time.ParseInLocation("2006-01-02", _query_date, time.Local)
 
 	type Ret struct {
-		SourceList          []string                       `json:"source_list"`
-		CountList           []int64                        `json:"count_list"`
-		TheDay              string                         `json:"the_day"`
+		SourceList []string `json:"source_list"`
+		CountList  []int64  `json:"count_list"`
+		TheDay     string   `json:"the_day"`
 	}
 
 	list := models.GetPmBalanceFromSourceByDate(query_date, useCache)
 
 	var sourceList []string
 	var countList []int64
-	for _, item := range list{
+	for _, item := range list {
 		item.SourceCn = models.PM_BALANCE_SOURCE_CN_TEXT[item.Source]
 
 		sourceList = append(sourceList, item.SourceCn)
 		countList = append(countList, item.Count)
 	}
 
-
-
-	self.Data["json"]=&Ret{SourceList:sourceList, CountList:countList,TheDay:query_date.Format("2006-01-02")}
+	self.Data["json"] = &Ret{SourceList: sourceList, CountList: countList, TheDay: query_date.Format("2006-01-02")}
 	self.ServeJSON()
 }
 
@@ -80,34 +78,34 @@ func(self *D5cPmBalanceStatController) GetAllSourceDis(){
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router /user/top/list [get]
-func(self *D5cPmBalanceStatController) GetUserTopList(){
+func (self *D5cPmBalanceStatController) GetUserTopList() {
 
-	useCache,_ := self.GetBool("cache", true)
+	useCache, _ := self.GetBool("cache", true)
 
 	_query_date := self.GetString("query_date")
 	query_date, _ := time.ParseInLocation("2006-01-02", _query_date, time.Local)
 
 	type Ret struct {
-		List                []*models.UserPmBalance  `json:"list"`
-		TheDay              string                         `json:"the_day"`
+		List   []*models.UserPmBalance `json:"list"`
+		TheDay string                  `json:"the_day"`
 	}
 
 	list := models.GetTopPmBalanceUserListByDateAndLimit(query_date, 10, useCache)
 
 	rank := int64(0)
-	for _, item := range list{
+	for _, item := range list {
 		rank = rank + 1
 		item.Rank = rank
 		userInfo := models.GetUserInfoByUserId(item.UserId, useCache)
 
-		if userInfo != nil{
+		if userInfo != nil {
 			item.Nickname = userInfo.Nickname
 			item.RealName = userInfo.RealName
 			item.WxUserId = userInfo.WxUserId
 		}
 	}
 
-	self.Data["json"]=&Ret{List:list,TheDay:query_date.Format("2006-01-02")}
+	self.Data["json"] = &Ret{List: list, TheDay: query_date.Format("2006-01-02")}
 	self.ServeJSON()
 }
 
@@ -118,18 +116,18 @@ func(self *D5cPmBalanceStatController) GetUserTopList(){
 // @Param	user_id	query	int	false	"user_id"
 // @Success 200 {object} Ret
 // @router /user/source/distribution [get]
-func (self *D5cPmBalanceStatController) GetUserSourceDis()  {
+func (self *D5cPmBalanceStatController) GetUserSourceDis() {
 
-	useCache,_ := self.GetBool("cache", true)
+	useCache, _ := self.GetBool("cache", true)
 
 	_query_date := self.GetString("query_date")
 	query_date, _ := time.ParseInLocation("2006-01-02", _query_date, time.Local)
 
-	userId,_ := self.GetInt64("user_id")
+	userId, _ := self.GetInt64("user_id")
 
 	type MapData struct {
-		Value    int64         `json:"value"`
-		Name     string        `json:"name"`
+		Value int64  `json:"value"`
+		Name  string `json:"name"`
 	}
 
 	type Ret struct {
@@ -142,7 +140,7 @@ func (self *D5cPmBalanceStatController) GetUserSourceDis()  {
 
 	useBalanceList := models.GetUserPmBalanceFromSourceByDateAndUserId(query_date, userId, useCache)
 	var list []*MapData
-	for _, item := range useBalanceList{
+	for _, item := range useBalanceList {
 		data := new(MapData)
 		data.Value = item.Count
 		data.Name = models.PM_BALANCE_SOURCE_CN_TEXT[item.Source]
@@ -151,20 +149,18 @@ func (self *D5cPmBalanceStatController) GetUserSourceDis()  {
 
 	investInfo := models.GetUserInvestCountByUserId(userId, useCache)
 
-	if investInfo != nil{
-		investInfo.PaiedPriceFormat = fmt.Sprintf("%0.2f元", tools.RoundFloat64(float64(investInfo.PaiedPrice)/ 100, 2))
+	if investInfo != nil {
+		investInfo.PaiedPriceFormat = fmt.Sprintf("%0.2f元", tools.RoundFloat64(float64(investInfo.PaiedPrice)/100, 2))
 		investInfo.ProjectCountFormat = fmt.Sprintf("%d", investInfo.ProjectCount)
 	}
 
 	var section []string
-	for _, v := range models.PM_BALANCE_SOURCE_CN_TEXT{
+	for _, v := range models.PM_BALANCE_SOURCE_CN_TEXT {
 		section = append(section, v)
 	}
 
 	userInfo := models.GetUserInfoByUserId(userId, useCache)
 
-	self.Data["json"]=&Ret{List:list,InvestCount:investInfo,TheDay:query_date.Format("2006-01-02"),Section:section,UserInfo:userInfo}
+	self.Data["json"] = &Ret{List: list, InvestCount: investInfo, TheDay: query_date.Format("2006-01-02"), Section: section, UserInfo: userInfo}
 	self.ServeJSON()
 }
-
-

+ 2 - 2
go/gopath/src/d5c-statement-api/controllers/d5c_point_task/point_task.go

@@ -4,8 +4,8 @@ import (
 	"fmt"
 	"time"
 
-	"d5c-statement-api/models"
-	// "d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	// "fohow-statement-api/tools"
 	"github.com/astaxie/beego"
 )
 

+ 50 - 52
go/gopath/src/d5c-statement-api/controllers/d5c_point_train_controller/point_train_stat.go

@@ -1,33 +1,32 @@
 package d5c_point_train_controller
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"fmt"
-	"d5c-statement-api/tools"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 )
 
 type D5cPointTrainStatController struct {
 	beego.Controller
 }
 
-
 // @Title Get
 // @Description get 第五创积分训练营数据统计:返回所有期积分训练营
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router /list [get]
-func(self *D5cPointTrainStatController) GetPointTrains(){
+func (self *D5cPointTrainStatController) GetPointTrains() {
 
-	cache,_ := self.GetBool("cache", true)
+	cache, _ := self.GetBool("cache", true)
 	list := models.GetProintTrainList(cache)
 
 	type Ret struct {
-		List             []*models.PointTrain `json:"list"`
-		ListCount        int64                `json:"list_count"`
+		List      []*models.PointTrain `json:"list"`
+		ListCount int64                `json:"list_count"`
 	}
 
-	self.Data["json"]=&Ret{List:list, ListCount:int64(len(list))}
+	self.Data["json"] = &Ret{List: list, ListCount: int64(len(list))}
 	self.ServeJSON()
 }
 
@@ -36,26 +35,26 @@ func(self *D5cPointTrainStatController) GetPointTrains(){
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router /all/stat [get]
-func(self *D5cPointTrainStatController) GetAllPointTrainStat(){
+func (self *D5cPointTrainStatController) GetAllPointTrainStat() {
 
-	cache,_ := self.GetBool("cache", true)
+	cache, _ := self.GetBool("cache", true)
 
 	type Ret struct {
-		Total            int64                `json:"total"`
-		Convert          int64                `json:"convert"`
-		Rate             string               `json:"rate"`
+		Total   int64  `json:"total"`
+		Convert int64  `json:"convert"`
+		Rate    string `json:"rate"`
 	}
 
 	total := models.GetJoinCount(cache)
 	convert := models.GetInvestorCount(cache)
 
 	cal := float64(0)
-	if total > 0{
-		cal = tools.RoundFloat64(float64(convert)/ float64(total), 2)
+	if total > 0 {
+		cal = tools.RoundFloat64(float64(convert)/float64(total), 2)
 	}
 	rate := fmt.Sprintf("%0.2f", cal)
 
-	self.Data["json"]=&Ret{Total:total, Convert:convert, Rate:rate}
+	self.Data["json"] = &Ret{Total: total, Convert: convert, Rate: rate}
 	self.ServeJSON()
 }
 
@@ -65,27 +64,27 @@ func(self *D5cPointTrainStatController) GetAllPointTrainStat(){
 // @Param	id	query	int	true	"id"
 // @Success 200 {object} Ret
 // @router /single/stat [get]
-func(self *D5cPointTrainStatController) GetSinglePointTrainStat(){
+func (self *D5cPointTrainStatController) GetSinglePointTrainStat() {
 
-	cache,_ := self.GetBool("cache", true)
-	id,_ := self.GetInt64("id")
+	cache, _ := self.GetBool("cache", true)
+	id, _ := self.GetInt64("id")
 
 	type Ret struct {
-		Total            int64                `json:"single_total"`
-		Convert          int64                `json:"single_convert"`
-		Rate             string               `json:"single_rate"`
+		Total   int64  `json:"single_total"`
+		Convert int64  `json:"single_convert"`
+		Rate    string `json:"single_rate"`
 	}
 
-	total := models.GetJoinCountByPointTId(id,cache)
-	convert := models.GetInvestorCountByPointTId(id,cache)
+	total := models.GetJoinCountByPointTId(id, cache)
+	convert := models.GetInvestorCountByPointTId(id, cache)
 
 	cal := float64(0)
-	if total > 0{
-		cal = tools.RoundFloat64(float64(convert)/ float64(total), 2)
+	if total > 0 {
+		cal = tools.RoundFloat64(float64(convert)/float64(total), 2)
 	}
 	rate := fmt.Sprintf("%0.2f", cal)
 
-	self.Data["json"]=&Ret{Total:total, Convert:convert, Rate:rate}
+	self.Data["json"] = &Ret{Total: total, Convert: convert, Rate: rate}
 	self.ServeJSON()
 }
 
@@ -95,16 +94,16 @@ func(self *D5cPointTrainStatController) GetSinglePointTrainStat(){
 // @Param	id	query	int	true	"id"
 // @Success 200 {object} Ret
 // @router /line [get]
-func(self *D5cPointTrainStatController) GetPointTrainLineStat(){
+func (self *D5cPointTrainStatController) GetPointTrainLineStat() {
 
-	cache,_ := self.GetBool("cache", true)
-	id,_ := self.GetInt64("id")
+	cache, _ := self.GetBool("cache", true)
+	id, _ := self.GetInt64("id")
 
 	type Ret struct {
-		Days          []string   `json:"days"`                  //横坐标
-		TotalLine     []float64  `json:"total_line"`			//所有训练营真实投资人均值线
-		CurLine       []int64    `json:"cur_line"`              //该期真实投资人真实转化天数
-		AverageDay    float64    `json:"average_day_count"`     //该期真实投资人真实转化天数平均值
+		Days       []string  `json:"days"`              //横坐标
+		TotalLine  []float64 `json:"total_line"`        //所有训练营真实投资人均值线
+		CurLine    []int64   `json:"cur_line"`          //该期真实投资人真实转化天数
+		AverageDay float64   `json:"average_day_count"` //该期真实投资人真实转化天数平均值
 	}
 
 	allTrainlist := models.GetPointTrainCycleConvertDataList(cache)
@@ -118,34 +117,33 @@ func(self *D5cPointTrainStatController) GetPointTrainLineStat(){
 	thisDaySum := int64(0)
 	thisUserSum := int64(0)
 
-	for i:=0; i< 181; i++ {
+	for i := 0; i < 181; i++ {
 
-		days = append(days, fmt.Sprintf("%d天",i))
+		days = append(days, fmt.Sprintf("%d天", i))
 
-		allCount := models.ContainInCycleConvertDataListAndReturnDataCount(int64(i),allTrainlist)
+		allCount := models.ContainInCycleConvertDataListAndReturnDataCount(int64(i), allTrainlist)
 		totalTrainsCount := 1
-		if len(totalTrains) > 0{
+		if len(totalTrains) > 0 {
 			totalTrainsCount = len(totalTrains)
 		}
-		trainCount := tools.RoundFloat64(float64(allCount)/float64(totalTrainsCount),2)
+		trainCount := tools.RoundFloat64(float64(allCount)/float64(totalTrainsCount), 2)
 		totalLine = append(totalLine, trainCount)
 
-		thisCount := models.ContainInCycleConvertDataListAndReturnDataCount(int64(i),thisTrainList)
+		thisCount := models.ContainInCycleConvertDataListAndReturnDataCount(int64(i), thisTrainList)
 		curLine = append(curLine, thisCount)
 
 	}
 
-	for _,item := range thisTrainList{
+	for _, item := range thisTrainList {
 		thisDaySum += item.Days
 		thisUserSum += item.Count
 	}
 
 	if thisUserSum > 0 {
-		averageDay = tools.RoundFloat64(float64(thisDaySum)/float64(thisUserSum),2)
+		averageDay = tools.RoundFloat64(float64(thisDaySum)/float64(thisUserSum), 2)
 	}
 
-
-	self.Data["json"]=&Ret{Days:days, TotalLine:totalLine,CurLine:curLine, AverageDay:averageDay}
+	self.Data["json"] = &Ret{Days: days, TotalLine: totalLine, CurLine: curLine, AverageDay: averageDay}
 	self.ServeJSON()
 }
 
@@ -155,13 +153,13 @@ func(self *D5cPointTrainStatController) GetPointTrainLineStat(){
 // @Param	id	query	int	true	"id"
 // @Success 200 {object} Ret
 // @router /channel/list [get]
-func(self *D5cPointTrainStatController) GetPointTrainChannelStat(){
+func (self *D5cPointTrainStatController) GetPointTrainChannelStat() {
 
-	cache,_ := self.GetBool("cache", true)
-	id,_ := self.GetInt64("id")
+	cache, _ := self.GetBool("cache", true)
+	id, _ := self.GetInt64("id")
 
 	type Ret struct {
-		List    []*models.TrainChannelData    `json:"list"`
+		List []*models.TrainChannelData `json:"list"`
 	}
 
 	var list []*models.TrainChannelData
@@ -174,7 +172,7 @@ func(self *D5cPointTrainStatController) GetPointTrainChannelStat(){
 
 	investList := models.GetInvestorCountFromChannel(cache)
 
-	for _, item := range channelList{
+	for _, item := range channelList {
 
 		joinCount := models.FindChannelJoinAllCountById(joinList, item.Id)
 
@@ -194,6 +192,6 @@ func(self *D5cPointTrainStatController) GetPointTrainChannelStat(){
 		list = append(list, item)
 	}
 
-	self.Data["json"]=&Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
-}
+}

+ 61 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_prize_draw_act_controller/prize_draw_act_controller.go

@@ -0,0 +1,61 @@
+package d5c_prize_draw_act_controller
+
+import (
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
+	"strconv"
+	"time"
+)
+
+type PrizeDrawActController struct {
+	beego.Controller
+}
+
+// @Title Get
+// @Description 每日抽奖活动数据单月每天统计, query_date是日期YYYY-MM-DD
+// @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
+// @Param	query_date	query	string	false	"query_date"
+// @Success 200 {object} Ret
+// @router /line [get]
+func (self *PrizeDrawActController) ActJoinStatDaily() {
+
+	type Ret struct {
+		Day      []string `json:"day"`       //天数
+		Count    []int64  `json:"count"`     //参加每日抽奖的人数
+		WinCount []int64  `json:"win_count"` //参加每日抽奖的中奖人数
+	}
+
+	query_date := self.GetString("query_date")
+	useCache, _ := self.GetBool("cache", true)
+
+	//--------------------------------------------日期处理
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
+	queryNextDate := queryDate.AddDate(0, 1, 0)                                                      //2018-04-01 00:00:00
+
+	list := models.GetPrizeDrawActJoinLine(queryDate, queryNextDate, useCache)
+
+	var counts []int64
+	var winCounts []int64
+	var times []string
+
+	for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
+
+		increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
+		times = append(times, increaseDate)
+
+		findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
+
+		beego.BeeLogger.Warn("%s,%d", increaseDate, findDateInt)
+
+		count, winCount := models.ContainsInPrizeDrawActDataListAndReturnItemCount(findDateInt, list)
+
+		counts = append(counts, count)
+
+		winCounts = append(winCounts, winCount)
+	}
+
+	self.Data["json"] = &Ret{Day: times, Count: counts, WinCount: winCounts}
+	self.ServeJSON()
+}

+ 8 - 8
go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_all.go

@@ -1,8 +1,8 @@
 package d5c_project_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type ProjectAllController struct {
@@ -17,21 +17,21 @@ type ProjectAllController struct {
 // @Param	query_title	query	string	false	"query_title"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ProjectAllController) Get(){
+func (self *ProjectAllController) Get() {
 
-	page,_ := self.GetInt64("page")
-	perPage,_ := self.GetInt64("per_page")
-	if page > 0 && perPage > 20{
+	page, _ := self.GetInt64("page")
+	perPage, _ := self.GetInt64("per_page")
+	if page > 0 && perPage > 20 {
 		perPage = 20
 	}
 	queryTitle := self.GetString("query_title")
 
 	type Ret struct {
-		ProjectList   []*models.ProjectInfo     `json:"project_list"`
+		ProjectList []*models.ProjectInfo `json:"project_list"`
 	}
 
-	list := models.GetD5cProjects(page,perPage,queryTitle)
+	list := models.GetD5cProjects(page, perPage, queryTitle)
 
-	self.Data["json"] = &Ret{ProjectList:list}
+	self.Data["json"] = &Ret{ProjectList: list}
 	self.ServeJSON()
 }

+ 31 - 34
go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_channel_total.go

@@ -1,8 +1,8 @@
 package d5c_project_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type ProjectChannelTotalController struct {
@@ -15,19 +15,19 @@ type ProjectChannelTotalController struct {
 // @Param	project_id	query	int	true	"project_id"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ProjectChannelTotalController) Get(){
+func (self *ProjectChannelTotalController) Get() {
 
-	projectId,_ := self.GetInt64("project_id")
+	projectId, _ := self.GetInt64("project_id")
 
 	type Ret struct {
-		List      []*models.DataProjectPerChannel     `json:"list"`
-		Project   *models.ProjectInfo                 `json:"project"`
-		ProjectTotalCount   int64                     `json:"project_total_count"`
-		ProjectTotalAmount  float64                   `json:"project_total_amount"`
-		ProjectNewCount   int64                     `json:"project_new_count"`
-		ProjectNewAmount  float64                   `json:"project_new_amount"`
-		ProjectOldCount   int64                     `json:"project_old_count"`
-		ProjectOldAmount  float64                   `json:"project_old_amount"`
+		List               []*models.DataProjectPerChannel `json:"list"`
+		Project            *models.ProjectInfo             `json:"project"`
+		ProjectTotalCount  int64                           `json:"project_total_count"`
+		ProjectTotalAmount float64                         `json:"project_total_amount"`
+		ProjectNewCount    int64                           `json:"project_new_count"`
+		ProjectNewAmount   float64                         `json:"project_new_amount"`
+		ProjectOldCount    int64                           `json:"project_old_count"`
+		ProjectOldAmount   float64                         `json:"project_old_amount"`
 	}
 
 	project := models.GetD5cProjectById(projectId)
@@ -46,7 +46,7 @@ func (self *ProjectChannelTotalController) Get(){
 	oldAmount := float64(0)
 	noChannelTotalAmount := float64(0)
 
-	for _,item := range statList{
+	for _, item := range statList {
 
 		totalAmount += item.TotalInvest
 		totalCount += 1
@@ -56,7 +56,7 @@ func (self *ProjectChannelTotalController) Get(){
 			newAmount += item.TotalInvest
 			newCount += 1
 
-		}else{
+		} else {
 
 			oldAmount += item.TotalInvest
 			oldCount += 1
@@ -71,7 +71,7 @@ func (self *ProjectChannelTotalController) Get(){
 	var list []*models.DataProjectPerChannel
 	noChannel := new(models.DataProjectPerChannel)
 	//无渠道注册的0渠道,描述“其他”,投资人总数和总额、新旧投资人总数、新旧投资人总额
-	nc,na,oc,oa := GetNewAndOldCountAndAmountByChannelId(0, statList)
+	nc, na, oc, oa := GetNewAndOldCountAndAmountByChannelId(0, statList)
 	noChannel.ProjectId = projectId
 	noChannel.SignupChannelId = 0
 	noChannel.ChannelValue = "其他"
@@ -83,13 +83,11 @@ func (self *ProjectChannelTotalController) Get(){
 	noChannel.TotalCount = noChannelTotalCount
 	list = append(list, noChannel)
 
+	for _, dItem := range dataList {
 
-	for _,dItem := range dataList {
+		if dItem.TotalCount > 0 {
 
-
-        if dItem.TotalCount > 0 {
-
-			nc,na,oc,oa := GetNewAndOldCountAndAmountByChannelId(dItem.SignupChannelId, statList)
+			nc, na, oc, oa := GetNewAndOldCountAndAmountByChannelId(dItem.SignupChannelId, statList)
 			dItem.NewerTotalCount = nc
 			dItem.NewerTotalInvest = na
 			dItem.OlderTotalCount = oc
@@ -107,25 +105,24 @@ func (self *ProjectChannelTotalController) Get(){
 		}*/
 	}
 
-
 	self.Data["json"] = &Ret{
-		List :list,
-		Project            :project,
-		ProjectTotalCount  :totalCount,
-		ProjectTotalAmount :totalAmount,
-		ProjectNewCount    :newCount,
-		ProjectNewAmount    :newAmount,
-		ProjectOldCount     :oldCount,
-		ProjectOldAmount    :oldAmount,
+		List:               list,
+		Project:            project,
+		ProjectTotalCount:  totalCount,
+		ProjectTotalAmount: totalAmount,
+		ProjectNewCount:    newCount,
+		ProjectNewAmount:   newAmount,
+		ProjectOldCount:    oldCount,
+		ProjectOldAmount:   oldAmount,
 	}
 
 	self.ServeJSON()
 }
 
-func GetNewAndOldCountAndAmountByChannelId(cId int64, list []*models.StatProjectPerChannel) (int64, float64, int64, float64 ){
+func GetNewAndOldCountAndAmountByChannelId(cId int64, list []*models.StatProjectPerChannel) (int64, float64, int64, float64) {
 
-	if list == nil || len(list) == 0{
-		return 0,0,0,0
+	if list == nil || len(list) == 0 {
+		return 0, 0, 0, 0
 	}
 
 	newCount := int64(0)
@@ -134,7 +131,7 @@ func GetNewAndOldCountAndAmountByChannelId(cId int64, list []*models.StatProject
 	newAmount := float64(0)
 	oldAmount := float64(0)
 
-	for _,each := range list{
+	for _, each := range list {
 		if each.SignupChannelId == cId {
 
 			if each.InvestedProjectId > 0 {
@@ -142,7 +139,7 @@ func GetNewAndOldCountAndAmountByChannelId(cId int64, list []*models.StatProject
 				oldCount += 1
 				oldAmount += each.TotalInvest
 
-			}else{
+			} else {
 				newCount += 1
 				newAmount += each.TotalInvest
 			}
@@ -150,5 +147,5 @@ func GetNewAndOldCountAndAmountByChannelId(cId int64, list []*models.StatProject
 		}
 	}
 
-	return newCount,newAmount,oldCount,oldAmount
+	return newCount, newAmount, oldCount, oldAmount
 }

+ 9 - 10
go/gopath/src/d5c-statement-api/controllers/d5c_project_controller/project_distribution.go

@@ -1,8 +1,8 @@
 package d5c_project_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strings"
 )
 
@@ -15,11 +15,11 @@ type ProjectDistributionController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ProjectDistributionController) Get(){
+func (self *ProjectDistributionController) Get() {
 
 	type Ret struct {
-		ProjectCityDistribution     []*models.CityDistribution   `json:"project_city_distribution"`
-		ProjectDistMax              int64                        `json:"project_city_distribution_max"`
+		ProjectCityDistribution []*models.CityDistribution `json:"project_city_distribution"`
+		ProjectDistMax          int64                      `json:"project_city_distribution_max"`
 	}
 
 	projectDisTmpList := models.GetProjectCityDistritbution()
@@ -29,27 +29,26 @@ func (self *ProjectDistributionController) Get(){
 	var projectDisList []*models.CityDistribution
 
 	//处理深圳市和深圳的情况
-	for _,projectDisTmp := range projectDisTmpList {
+	for _, projectDisTmp := range projectDisTmpList {
 
 		cityTmp := strings.Replace(projectDisTmp.City, " ", "", -1)
 
-		if IsEndWithSpecialCharacter(cityTmp,"市") {
+		if IsEndWithSpecialCharacter(cityTmp, "市") {
 
 			cityTmp = RemoveEndCharacter(cityTmp)
 
 		}
 
 		projectDisTmp.City = cityTmp
-		if projectDis := ProjectDisListInclude(projectDisTmp, projectDisList) ; projectDis == nil {
+		if projectDis := ProjectDisListInclude(projectDisTmp, projectDisList); projectDis == nil {
 
 			projectDisList = append(projectDisList, projectDisTmp)
 
 		}
 
-
 	}
 
-	self.Data["json"] = &Ret{ProjectCityDistribution:projectDisList,ProjectDistMax:max}
+	self.Data["json"] = &Ret{ProjectCityDistribution: projectDisList, ProjectDistMax: max}
 
 	self.ServeJSON()
 
@@ -66,7 +65,6 @@ func IsEndWithSpecialCharacter(targetString, specialCharacter string) bool {
 	//取最后一个字符
 	strRuneEnd := string(strRune[(len(strRune) - 1):len(strRune)])
 
-
 	if strRuneEnd == specialCharacter {
 		return true
 	} else {
@@ -89,6 +87,7 @@ func RemoveEndCharacter(targetString string) string {
 	return strRuneRemoveEnd
 
 }
+
 //列表是否包含该城市的项目分布情况,有则修改后返回,无则返回空
 func ProjectDisListInclude(item *models.CityDistribution, list []*models.CityDistribution) *models.CityDistribution {
 

+ 79 - 82
go/gopath/src/d5c-statement-api/controllers/d5c_rhkfpf_controller/rhkfpf_stat.go

@@ -1,12 +1,12 @@
 package d5c_rhkfpf_controller
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"time"
-	"d5c-statement-api/tools"
 	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 	"strings"
+	"time"
 )
 
 type RhkfpfStatController struct {
@@ -24,57 +24,55 @@ func (self *RhkfpfStatController) GetRhkfStatList() {
 	query_date := self.GetString("query_date")
 
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
-	query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+	query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	queryDate = queryDateTmp
-	queryNextDate = queryDateTmp.AddDate(0,1,0)
+	queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 
 	type Item struct {
-		Id               int64  `orm:"column(id)"                         json:"id"`
-		KfWxUid          int64  `orm:"column(kf_wx_uid)"                  json:"kf_wx_uid"`
-		KfName           string `orm:"column(nickname)"                   json:"nickname"`
-		Head             string `orm:"column(head)"                       json:"head"`
-
-		Count            int64  `orm:"column(count)"                      json:"count"`
-		SatisRate        string `orm:"column(satis_rate)"                 json:"satis_rate"`
-
-		VerySatisCount   int64   `orm:"column(very_satis_Count)"           json:"very_satis_Count"`
-		SatisCount       int64   `orm:"column(satis_count)"                json:"satis_count"`
-		SosoCount        int64   `orm:"column(soso_count)"                 json:"soso_count"`
-		UnSatisCount     int64   `orm:"column(unsatis_count)"              json:"unsatis_count"`
-		VeryUnSatisCount int64   `orm:"column(very_unsatis_count)"         json:"very_unsatis_count"`
-
-		CurCount         int64  `orm:"column(cur_count)"                  json:"cur_count"`
-		CurSatisRate     string `orm:"column(cur_satis_rate)"             json:"cur_satis_rate"`
-
-		CurVerySatisCount   int64   `orm:"column(cur_very_satis_Count)"           json:"cur_very_satis_Count"`
-		CurSatisCount       int64   `orm:"column(cur_satis_count)"                json:"cur_satis_count"`
-		CurSosoCount        int64   `orm:"column(cur_soso_count)"                 json:"cur_soso_count"`
-		CurUnSatisCount     int64   `orm:"column(cur_unsatis_count)"              json:"cur_unsatis_count"`
-		CurVeryUnSatisCount int64   `orm:"column(cur_very_unsatis_count)"         json:"cur_very_unsatis_count"`
-
-
+		Id      int64  `orm:"column(id)"                         json:"id"`
+		KfWxUid int64  `orm:"column(kf_wx_uid)"                  json:"kf_wx_uid"`
+		KfName  string `orm:"column(nickname)"                   json:"nickname"`
+		Head    string `orm:"column(head)"                       json:"head"`
+
+		Count     int64  `orm:"column(count)"                      json:"count"`
+		SatisRate string `orm:"column(satis_rate)"                 json:"satis_rate"`
+
+		VerySatisCount   int64 `orm:"column(very_satis_Count)"           json:"very_satis_Count"`
+		SatisCount       int64 `orm:"column(satis_count)"                json:"satis_count"`
+		SosoCount        int64 `orm:"column(soso_count)"                 json:"soso_count"`
+		UnSatisCount     int64 `orm:"column(unsatis_count)"              json:"unsatis_count"`
+		VeryUnSatisCount int64 `orm:"column(very_unsatis_count)"         json:"very_unsatis_count"`
+
+		CurCount     int64  `orm:"column(cur_count)"                  json:"cur_count"`
+		CurSatisRate string `orm:"column(cur_satis_rate)"             json:"cur_satis_rate"`
+
+		CurVerySatisCount   int64 `orm:"column(cur_very_satis_Count)"           json:"cur_very_satis_Count"`
+		CurSatisCount       int64 `orm:"column(cur_satis_count)"                json:"cur_satis_count"`
+		CurSosoCount        int64 `orm:"column(cur_soso_count)"                 json:"cur_soso_count"`
+		CurUnSatisCount     int64 `orm:"column(cur_unsatis_count)"              json:"cur_unsatis_count"`
+		CurVeryUnSatisCount int64 `orm:"column(cur_very_unsatis_count)"         json:"cur_very_unsatis_count"`
 	}
 	type Ret struct {
 		List          []*Item `json:"list"`
 		TotalCount    int64   `json:"total_count"`
 		CurTotalCount int64   `json:"cur_total_count"`
 
-		VerySatisTotalCount   int64   `orm:"column(very_satis_total_Count)"           json:"very_satis_total_Count"`
-		SatisTotalCount       int64   `orm:"column(satis_total_count)"                json:"satis_total_count"`
-		SosoTotalCount        int64   `orm:"column(soso_total_count)"                 json:"soso_total_count"`
-		UnSatisTotalCount     int64   `orm:"column(unsatis_total_count)"              json:"unsatis_total_count"`
-		VeryUnSatisTotalCount int64   `orm:"column(very_unsatis_total_count)"         json:"very_unsatis_total_count"`
-
-		CurVerySatisTotalCount   int64   `orm:"column(cur_very_satis_total_Count)"           json:"cur_very_satis_total_Count"`
-		CurSatisTotalCount       int64   `orm:"column(cur_satis_total_count)"                json:"cur_satis_total_count"`
-		CurSosoTotalCount        int64   `orm:"column(cur_soso_total_count)"                 json:"cur_soso_total_count"`
-		CurUnSatisTotalCount     int64   `orm:"column(cur_unsatis_total_count)"              json:"cur_unsatis_total_count"`
-		CurVeryUnSatisTotalCount int64   `orm:"column(cur_very_unsatis_total_count)"         json:"cur_very_unsatis_total_count"`
+		VerySatisTotalCount   int64 `orm:"column(very_satis_total_Count)"           json:"very_satis_total_Count"`
+		SatisTotalCount       int64 `orm:"column(satis_total_count)"                json:"satis_total_count"`
+		SosoTotalCount        int64 `orm:"column(soso_total_count)"                 json:"soso_total_count"`
+		UnSatisTotalCount     int64 `orm:"column(unsatis_total_count)"              json:"unsatis_total_count"`
+		VeryUnSatisTotalCount int64 `orm:"column(very_unsatis_total_count)"         json:"very_unsatis_total_count"`
+
+		CurVerySatisTotalCount   int64 `orm:"column(cur_very_satis_total_Count)"           json:"cur_very_satis_total_Count"`
+		CurSatisTotalCount       int64 `orm:"column(cur_satis_total_count)"                json:"cur_satis_total_count"`
+		CurSosoTotalCount        int64 `orm:"column(cur_soso_total_count)"                 json:"cur_soso_total_count"`
+		CurUnSatisTotalCount     int64 `orm:"column(cur_unsatis_total_count)"              json:"cur_unsatis_total_count"`
+		CurVeryUnSatisTotalCount int64 `orm:"column(cur_very_unsatis_total_count)"         json:"cur_very_unsatis_total_count"`
 	}
 
 	list := models.GetSurveyList()
@@ -86,14 +84,14 @@ func (self *RhkfpfStatController) GetRhkfStatList() {
 	unSatisCountList := models.GetEveryKfpfAnswerTotalList(models.SELECTS_UNSATIS_ENUM)
 	veryUnSatisCountList := models.GetEveryKfpfAnswerTotalList(models.SELECTS_VERY_UNSATIS_ENUM)
 
-	curVerySatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate,models.SELECTS_VERY_SATIS_ENUM)
-	curSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate,models.SELECTS_SATIS_ENUM)
-	curSosoCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate,models.SELECTS_SOSO_ENUM)
-	curUnSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate,models.SELECTS_UNSATIS_ENUM)
-	curVeryUnSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate,models.SELECTS_VERY_UNSATIS_ENUM)
+	curVerySatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate, models.SELECTS_VERY_SATIS_ENUM)
+	curSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate, models.SELECTS_SATIS_ENUM)
+	curSosoCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate, models.SELECTS_SOSO_ENUM)
+	curUnSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate, models.SELECTS_UNSATIS_ENUM)
+	curVeryUnSatisCountList := models.GetEveryKfpfAnswerTotalListByTime(queryDate, queryNextDate, models.SELECTS_VERY_UNSATIS_ENUM)
 
 	var resultList []*Item
-	for _, each := range list{
+	for _, each := range list {
 		item := new(Item)
 		item.Id = each.Id
 		item.KfWxUid = each.KfWxUid
@@ -114,76 +112,75 @@ func (self *RhkfpfStatController) GetRhkfStatList() {
 		item.CurUnSatisCount = models.ContainsInRhkfItemAndReturnItemCount(each.KfWxUid, curUnSatisCountList)
 		item.CurVeryUnSatisCount = models.ContainsInRhkfItemAndReturnItemCount(each.KfWxUid, curVeryUnSatisCountList)
 
-		item.SatisRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.VerySatisCount+item.SatisCount) / float64(item.Count), 4) * 100, "%")
-		item.CurSatisRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.CurVerySatisCount+item.CurSatisCount) / float64(item.CurCount), 4) * 100, "%")
+		item.SatisRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.VerySatisCount+item.SatisCount)/float64(item.Count), 4)*100, "%")
+		item.CurSatisRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.CurVerySatisCount+item.CurSatisCount)/float64(item.CurCount), 4)*100, "%")
 
 		resultList = append(resultList, item)
 	}
 
 	totalCount := models.GetAllKfpfTotalCount()
-	curTotalCount := models.GetAllKfpfTotalCountByTime(queryDate,queryNextDate)
+	curTotalCount := models.GetAllKfpfTotalCountByTime(queryDate, queryNextDate)
 
 	answerList := models.GetEveryAnswerAllKfpfTotalCount()
 	curAnswerlist := models.GetEveryAnswerAllKfpfTotalCountByTime(queryDate, queryNextDate)
 
 	var verySatisTotalCount, satisTotalCount, sosoTotalCount, unSatisTotalCount, veryUnSatisTotalCount,
-	curVerySatisTotalCount, curSatisTotalCount, curSosoTotalCount, curUnSatisTotalCount, curVeryUnSatisTotalCount int64
+		curVerySatisTotalCount, curSatisTotalCount, curSosoTotalCount, curUnSatisTotalCount, curVeryUnSatisTotalCount int64
 
-	for _, item := range answerList{
+	for _, item := range answerList {
 
-		if item.Answer == models.SELECTS_VERY_SATIS_ENUM{
+		if item.Answer == models.SELECTS_VERY_SATIS_ENUM {
 			verySatisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_SATIS_ENUM{
+		if item.Answer == models.SELECTS_SATIS_ENUM {
 			satisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_SOSO_ENUM{
+		if item.Answer == models.SELECTS_SOSO_ENUM {
 			sosoTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_UNSATIS_ENUM{
+		if item.Answer == models.SELECTS_UNSATIS_ENUM {
 			unSatisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_VERY_UNSATIS_ENUM{
+		if item.Answer == models.SELECTS_VERY_UNSATIS_ENUM {
 			veryUnSatisTotalCount = item.Count
 		}
 	}
 
-	for _, item := range curAnswerlist{
+	for _, item := range curAnswerlist {
 
-		if item.Answer == models.SELECTS_VERY_SATIS_ENUM{
+		if item.Answer == models.SELECTS_VERY_SATIS_ENUM {
 			curVerySatisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_SATIS_ENUM{
+		if item.Answer == models.SELECTS_SATIS_ENUM {
 			curSatisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_SOSO_ENUM{
+		if item.Answer == models.SELECTS_SOSO_ENUM {
 			curSosoTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_UNSATIS_ENUM{
+		if item.Answer == models.SELECTS_UNSATIS_ENUM {
 			curUnSatisTotalCount = item.Count
 		}
-		if item.Answer == models.SELECTS_VERY_UNSATIS_ENUM{
+		if item.Answer == models.SELECTS_VERY_UNSATIS_ENUM {
 			curVeryUnSatisTotalCount = item.Count
 		}
 
 	}
 
-	self.Data["json"] = &Ret{List: resultList, TotalCount:totalCount, CurTotalCount:curTotalCount,
-		VerySatisTotalCount: verySatisTotalCount,
-		SatisTotalCount: satisTotalCount,
-		SosoTotalCount: sosoTotalCount,
-		UnSatisTotalCount: unSatisTotalCount,
-		VeryUnSatisTotalCount: veryUnSatisTotalCount,
-		CurVerySatisTotalCount: curVerySatisTotalCount,
-		CurSatisTotalCount: curSatisTotalCount,
-		CurSosoTotalCount: curSosoTotalCount,
-		CurUnSatisTotalCount: curUnSatisTotalCount,
+	self.Data["json"] = &Ret{List: resultList, TotalCount: totalCount, CurTotalCount: curTotalCount,
+		VerySatisTotalCount:      verySatisTotalCount,
+		SatisTotalCount:          satisTotalCount,
+		SosoTotalCount:           sosoTotalCount,
+		UnSatisTotalCount:        unSatisTotalCount,
+		VeryUnSatisTotalCount:    veryUnSatisTotalCount,
+		CurVerySatisTotalCount:   curVerySatisTotalCount,
+		CurSatisTotalCount:       curSatisTotalCount,
+		CurSosoTotalCount:        curSosoTotalCount,
+		CurUnSatisTotalCount:     curUnSatisTotalCount,
 		CurVeryUnSatisTotalCount: curVeryUnSatisTotalCount,
 	}
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description 融后客服评分模块 : 客服的所有评价结果列表
 // @Param Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -202,19 +199,19 @@ func (self *RhkfpfStatController) GetKfDetailList() {
 	}
 
 	type Ret struct {
-		List []*models.RhkfDetail `json:"list"`
-		ListCount int64           `json:"list_count"`
+		List      []*models.RhkfDetail `json:"list"`
+		ListCount int64                `json:"list_count"`
 	}
 
 	list := models.GetRhkfDetailListBySurId(surveyId, page, perPage)
 	listCount := models.GetRhkfDetailListCountBySurId(surveyId)
 
-	for _,item := range list{
+	for _, item := range list {
 		item.AnswerCn = models.SELECTS_ENUM[item.Answer]
 		item.CTime = item.CreatedAt.Unix()
 	}
 
-	self.Data["json"] = &Ret{List: list, ListCount:listCount}
+	self.Data["json"] = &Ret{List: list, ListCount: listCount}
 	self.ServeJSON()
 }
 
@@ -227,4 +224,4 @@ func (self *RhkfpfStatController) GetFullImgUrl(img string) string {
 	} else {
 		return fmt.Sprintf("%s/%s", beego.AppConfig.String("AliOssImgHost"), img)
 	}
-}
+}

+ 58 - 0
go/gopath/src/fohow-statement-api/controllers/d5c_static_data_controller/project_static_data.go

@@ -0,0 +1,58 @@
+package d5c_static_data_controller
+
+import (
+	"fmt"
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
+)
+
+type ProjectStaticDataController struct {
+	beego.Controller
+}
+
+type Ret struct {
+	InvNums    int64  `json:"invest_nums"`     //进行过项目投资的人数
+	NoInvNums  int64  `json:"no_invest_nums"`  //没有进行项目投资的人数
+	NewInvNums int64  `json:"new_invest_nums"` //新用户
+	OldInvNums int64  `json:"old_invest_nums"` //老用户
+	Remark     string `json:"remark"`          //说明
+}
+
+// @Title Get
+// @Description get 一元购投资用户统计
+// @Success 200 {object} Ret
+// @router /list [get]
+func (self *ProjectStaticDataController) List() {
+
+	var investProjectList []*models.DollarJoinItem
+	var newInvestProjectList []*models.DollarJoinItem
+	var oldInvestProjectList []*models.DollarJoinItem
+	dollarUserCountList := models.GetAllDollarsJoinCount(false)
+	projectUserCountList := models.GetAllProjectJoinCount(false)
+	for _, dollarItem := range dollarUserCountList {
+		for _, projectItem := range projectUserCountList {
+			if dollarItem.Tel == projectItem.Tel {
+				//如果一元购用户进行过项目投资,则加入 进行过投资的数据
+				investProjectList = append(investProjectList, dollarItem)
+				if dollarItem.PaidAt < projectItem.PaidAt {
+					//新用户= 一元活动参与时间 < 首次投资时间
+					beego.BeeLogger.Warn("new tel=[%d]", projectItem.Tel)
+					newInvestProjectList = append(newInvestProjectList, dollarItem)
+				} else {
+					//老用户= 首次投资时间 < 一元活动投资时间
+					oldInvestProjectList = append(oldInvestProjectList, dollarItem)
+				}
+			}
+		}
+	}
+
+	InvNumsCount := int64(len(investProjectList))
+	NoInvNumsCount := int64(len(dollarUserCountList)) - int64(len(investProjectList))
+	NewNumsCount := int64(len(newInvestProjectList))
+	OldInvNumsCount := int64(len(oldInvestProjectList))
+
+	Remark := fmt.Sprintf("一元购进行过投资的用户:%s 一元购未进行过投资的用户:%s  参与过投资的新用户:%s 一元购进行过投资的老用户:%s", "invest_nums", "no_invest_nums", "new_invest_nums", "old_invest_nums")
+
+	self.Data["json"] = &Ret{InvNums: InvNumsCount, NoInvNums: NoInvNumsCount, NewInvNums: NewNumsCount, OldInvNums: OldInvNumsCount, Remark: Remark}
+	self.ServeJSON()
+}

+ 53 - 56
go/gopath/src/d5c-statement-api/controllers/d5c_stock_transfer_controller/stock_transfer_stat.go

@@ -1,30 +1,29 @@
 package d5c_stock_transfer_stat_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
 	"strconv"
-	"d5c-statement-api/models"
+	"time"
 )
 
 type StockTransferController struct {
 	beego.Controller
 }
 
-
 type Ret struct {
-	Times                       []string   `json:"times"`                      //12个月/30天/24小时
-	MonthTotal                   int64    `json:"month_total"`                //当月转让成交总额
-	MonthUsers                   int64    `json:"month_users"`               //当月转让成交人数
-	TimeStockUsers              []int64    `json:"time_stock_users"`             //月购买转让人数
-	TimeStockTotal              []int64    `json:"time_stock_total"`             //月成交总额
-	MonthUsersList         		[]*models.StockTransferUsers      `json:"month_user_list"`     //当月购买会员数据
-
-	DayTotal                    int64    `json:"day_total"`                //当天转让成交总额
-	DayUsers                   	int64    `json:"day_users"`               //当天转让成交人数
-	DayStockUsers               []int64  `json:"day_stock_users"`             //天购买转让人数
-	DayStockTotal               []int64   `json:"day_stock_total"`             //天成交总额
-	DayUsersList         		[]*models.StockTransferUsers      `json:"day_user_list"`  //当天购买会员数据
+	Times          []string                     `json:"times"`            //12个月/30天/24小时
+	MonthTotal     int64                        `json:"month_total"`      //当月转让成交总额
+	MonthUsers     int64                        `json:"month_users"`      //当月转让成交人数
+	TimeStockUsers []int64                      `json:"time_stock_users"` //月购买转让人数
+	TimeStockTotal []int64                      `json:"time_stock_total"` //月成交总额
+	MonthUsersList []*models.StockTransferUsers `json:"month_user_list"`  //当月购买会员数据
+
+	DayTotal      int64                        `json:"day_total"`       //当天转让成交总额
+	DayUsers      int64                        `json:"day_users"`       //当天转让成交人数
+	DayStockUsers []int64                      `json:"day_stock_users"` //天购买转让人数
+	DayStockTotal []int64                      `json:"day_stock_total"` //天成交总额
+	DayUsersList  []*models.StockTransferUsers `json:"day_user_list"`   //当天购买会员数据
 }
 
 // @Title Get
@@ -35,7 +34,7 @@ type Ret struct {
 // @Param	query_month	query	string	false	"query_month"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *StockTransferController) Get(){
+func (self *StockTransferController) Get() {
 
 	query_date := self.GetString("query_date")
 	query_month := self.GetString("query_month")
@@ -52,7 +51,7 @@ func (self *StockTransferController) Get(){
 	query_date_month, _ := time.Parse("2006-01", query_month)
 	if query_type == "d" {
 		//查询一个月份30天
-		queryCurrentDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(),query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+		queryCurrentDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		queryEndDate = queryCurrentDate.AddDate(0, 0, 1)
 		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		queryNextDate = queryDate.AddDate(0, 1, 0)
@@ -65,19 +64,19 @@ func (self *StockTransferController) Get(){
 	}
 
 	//--------------------------------------------数据处理
-	beego.BeeLogger.Warn("queryDate queryNextDate (%s,%s)",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("queryDate queryNextDate (%s,%s)", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
-	if query_type == "d"{
+	if query_type == "d" {
 		//2019-05-01 00:00:00  --- 2019-06-01 00:00:00
-		self.QueryByDayOnDay(queryDate,queryNextDate,queryCurrentDate,queryEndDate)
-	}else if query_type == "m"{
+		self.QueryByDayOnDay(queryDate, queryNextDate, queryCurrentDate, queryEndDate)
+	} else if query_type == "m" {
 		//2018-05-01 00:00:00 +0800 CST ---2019-06-01 00:00:00 +0800 CST
-		self.QueryByDayOnMonth(queryDate,queryNextDate,queryCurrentDate,queryEndDate)
+		self.QueryByDayOnMonth(queryDate, queryNextDate, queryCurrentDate, queryEndDate)
 	}
 }
 
-func (self *StockTransferController) QueryByDayOnMonth(queryDate, queryNextDate,queryCurrentDate,queryEndDate time.Time){
+func (self *StockTransferController) QueryByDayOnMonth(queryDate, queryNextDate, queryCurrentDate, queryEndDate time.Time) {
 
 	var times []string
 	var MonthStockUsers []int64
@@ -85,22 +84,22 @@ func (self *StockTransferController) QueryByDayOnMonth(queryDate, queryNextDate,
 
 	monthTotal := models.GetStockTotal(queryCurrentDate, queryEndDate, false)
 	monthUsers := models.GetStockCount(queryCurrentDate, queryEndDate, false)
-	monthTimeStockUsers := models.GetAllStockTransferCountByMonth(queryDate, queryNextDate,false)
-	monthTimeStockTotal := models.GetAllStockTransferTotalByMonth(queryDate, queryNextDate,false)
-	monthUsersList:=models.GetAllStockTransferUsers(queryCurrentDate, queryEndDate, false)
-	for _,monthUser := range monthUsersList {
+	monthTimeStockUsers := models.GetAllStockTransferCountByMonth(queryDate, queryNextDate, false)
+	monthTimeStockTotal := models.GetAllStockTransferTotalByMonth(queryDate, queryNextDate, false)
+	monthUsersList := models.GetAllStockTransferUsers(queryCurrentDate, queryEndDate, false)
+	for _, monthUser := range monthUsersList {
 		if monthUser.Total > 0 {
-			monthUser.Total=int64(monthUser.Total/100)
+			monthUser.Total = int64(monthUser.Total / 100)
 		}
 	}
 
-	for i:=0; i<13;i++  {
+	for i := 0; i < 13; i++ {
 
-		increaseDate := queryDate.AddDate(0,i,0).Format("2006-01")
+		increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 		times = append(times, increaseDate)
 
-		findDate := queryDate.AddDate(0,i,0).Format("200601")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+		findDate := queryDate.AddDate(0, i, 0).Format("200601")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 		//股权转让每月成交总人数
 		sub := models.ContainsInMonthItemListStockTransferCount(findDateInt, monthTimeStockUsers)
@@ -113,19 +112,19 @@ func (self *StockTransferController) QueryByDayOnMonth(queryDate, queryNextDate,
 	}
 
 	self.Data["json"] = Ret{
-		Times                      :times,
-		MonthTotal                 :monthTotal,
-		MonthUsers                 :monthUsers,
-		TimeStockUsers             :MonthStockUsers,
-		TimeStockTotal        	   :MonthStockTotal,
-		MonthUsersList			   :monthUsersList,
+		Times:          times,
+		MonthTotal:     monthTotal,
+		MonthUsers:     monthUsers,
+		TimeStockUsers: MonthStockUsers,
+		TimeStockTotal: MonthStockTotal,
+		MonthUsersList: monthUsersList,
 	}
 	//beego.BeeLogger.Warn("-------%v",self.Data["json"])
 	self.ServeJSON()
 
 }
 
-func (self *StockTransferController) QueryByDayOnDay(queryDate, queryNextDate ,queryCurrentDate,queryEndDate  time.Time){
+func (self *StockTransferController) QueryByDayOnDay(queryDate, queryNextDate, queryCurrentDate, queryEndDate time.Time) {
 
 	var times []string
 	var DayStockUsers []int64
@@ -133,22 +132,22 @@ func (self *StockTransferController) QueryByDayOnDay(queryDate, queryNextDate ,q
 
 	dayTotal := models.GetStockTotal(queryCurrentDate, queryEndDate, false)
 	dayUsers := models.GetStockCount(queryCurrentDate, queryEndDate, false)
-	dayTimeStockUsers := models.GetAllStockTransferCountByDay(queryDate, queryNextDate,false)
-	dayTimeStockTotal := models.GetAllStockTransferTotalByDay(queryDate, queryNextDate,false)
-	dayUsersList:=models.GetAllStockTransferUsers(queryCurrentDate, queryEndDate, false)
-	for _,dayUser := range dayUsersList {
+	dayTimeStockUsers := models.GetAllStockTransferCountByDay(queryDate, queryNextDate, false)
+	dayTimeStockTotal := models.GetAllStockTransferTotalByDay(queryDate, queryNextDate, false)
+	dayUsersList := models.GetAllStockTransferUsers(queryCurrentDate, queryEndDate, false)
+	for _, dayUser := range dayUsersList {
 		if dayUser.Total > 0 {
-			dayUser.Total=int64(dayUser.Total/100)
+			dayUser.Total = int64(dayUser.Total / 100)
 		}
 	}
 
-	for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
+	for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-		increaseDate := queryDate.AddDate(0,0,i).Format("01-02")
+		increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 		times = append(times, increaseDate)
 
-		findDate := queryDate.AddDate(0,0,i).Format("20060102")
-		findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+		findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+		findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 		//股权转让每日成交总人数
 		sub := models.ContainsInDayItemListStockTransferCount(findDateInt, dayTimeStockUsers)
 		DayStockUsers = append(DayStockUsers, sub)
@@ -160,15 +159,13 @@ func (self *StockTransferController) QueryByDayOnDay(queryDate, queryNextDate ,q
 	}
 
 	self.Data["json"] = Ret{
-		Times                      :times,
-		DayTotal                   :dayTotal,
-		DayUsers                   :dayUsers,
-		DayStockUsers              :DayStockUsers,
-		DayStockTotal        	   :DayStockTotal,
-		DayUsersList			   :dayUsersList,
-
+		Times:         times,
+		DayTotal:      dayTotal,
+		DayUsers:      dayUsers,
+		DayStockUsers: DayStockUsers,
+		DayStockTotal: DayStockTotal,
+		DayUsersList:  dayUsersList,
 	}
 	//beego.BeeLogger.Warn("-------%v",self.Data["json"])
 	self.ServeJSON()
 }
-

+ 4 - 4
go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_all_project.go

@@ -1,8 +1,8 @@
 package d5c_train_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type TrainAllProjectController struct {
@@ -14,14 +14,14 @@ type TrainAllProjectController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *TrainAllProjectController) Get(){
+func (self *TrainAllProjectController) Get() {
 
 	type Ret struct {
-		List  []*models.PtypeTrainProject    `json:"list"`
+		List []*models.PtypeTrainProject `json:"list"`
 	}
 
 	list := models.GetPtypeTrainProjects()
 
-	self.Data["json"]=&Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
 }

+ 12 - 12
go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_channel_stat.go

@@ -1,10 +1,10 @@
 package d5c_train_controller
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 )
 
 type TrainChannelStatController struct {
@@ -17,31 +17,31 @@ type TrainChannelStatController struct {
 // @Param	project_id	query	int	true	"project_id"
 // @Success 200 {object} Ret
 // @router / [get]
-func(self*TrainChannelStatController) Get(){
+func (self *TrainChannelStatController) Get() {
 
-	projectId,_ := self.GetInt64("project_id")
+	projectId, _ := self.GetInt64("project_id")
 
 	type Ret struct {
-		List    []*models.TrainChannelData    `json:"list"`
+		List []*models.TrainChannelData `json:"list"`
 	}
 
 	var list []*models.TrainChannelData
 
 	trainNoChannelList := models.GetTrainNoChannelDataList(projectId)
 	trainNochannelInvestCount := models.GetTrainChannelInvestorCountByZeroCId(0)
-	for _,item := range trainNoChannelList {
+	for _, item := range trainNoChannelList {
 		item.ChannelInvestAllCount = trainNochannelInvestCount
 		channelRate := float64(0)
 		if item.Id == 0 && trainNochannelInvestCount > 0 {
-			channelRate = tools.RoundFloat64(float64(trainNochannelInvestCount)/float64(item.ChannelJoinAllCount), 2)*100
+			channelRate = tools.RoundFloat64(float64(trainNochannelInvestCount)/float64(item.ChannelJoinAllCount), 2) * 100
 		}
-		item.ChannelRate = fmt.Sprintf("%0.2f%s",channelRate, "%")
+		item.ChannelRate = fmt.Sprintf("%0.2f%s", channelRate, "%")
 		list = append(list, item)
 	}
 
 	trainChannelList := models.GetTrainChannelDataList(projectId)
 
-	for _,item := range trainChannelList {
+	for _, item := range trainChannelList {
 
 		tmp := int64(0)
 		if item.ChannelJoinAllCount > 0 {
@@ -57,6 +57,6 @@ func(self*TrainChannelStatController) Get(){
 
 	}
 
-	self.Data["json"]=&Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
-}
+}

+ 16 - 17
go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_cycle_distribution.go

@@ -1,10 +1,10 @@
 package d5c_train_controller
 
 import (
-	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
+	"github.com/astaxie/beego"
 )
 
 type TrainCycleDistributionController struct {
@@ -17,15 +17,15 @@ type TrainCycleDistributionController struct {
 // @Param	project_id	query	int	true	"project_id"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *TrainCycleDistributionController) Get(){
+func (self *TrainCycleDistributionController) Get() {
 
-	projectId,_ := self.GetInt64("project_id")
+	projectId, _ := self.GetInt64("project_id")
 
 	type Ret struct {
-		TrainCycleConvertDay           []string   `json:"channel_cycle_convert_day"`//转化天数
-		TrainCycleConvertCountList     []float64    `json:"train_count_list"`
-		ThisTrainCycleConvertCountList []int64    `json:"this_train_count_list"`
-		ThisTrainConvertAverageRate    float64    `json:"this_train_rate"`
+		TrainCycleConvertDay           []string  `json:"channel_cycle_convert_day"` //转化天数
+		TrainCycleConvertCountList     []float64 `json:"train_count_list"`
+		ThisTrainCycleConvertCountList []int64   `json:"this_train_count_list"`
+		ThisTrainConvertAverageRate    float64   `json:"this_train_rate"`
 	}
 
 	trainList := models.GetTrainCycleConvertDataList()
@@ -38,26 +38,25 @@ func (self *TrainCycleDistributionController) Get(){
 	thisDaySum := int64(0)
 	thisUserSum := int64(0)
 
-	for i:=0; i< 181; i++ {
+	for i := 0; i < 181; i++ {
 
-		trainCycleConvertDay = append(trainCycleConvertDay, fmt.Sprintf("%d天",i))
+		trainCycleConvertDay = append(trainCycleConvertDay, fmt.Sprintf("%d天", i))
 
-		trainCount := tools.RoundFloat64(float64(models.ContainInCycleConvertDataListAndReturnDataCount(int64(i),trainList))/float64(totalTrainsCount),2)
+		trainCount := tools.RoundFloat64(float64(models.ContainInCycleConvertDataListAndReturnDataCount(int64(i), trainList))/float64(totalTrainsCount), 2)
 		trainCountList = append(trainCountList, trainCount)
-		thisTrainCountList = append(thisTrainCountList, models.ContainInCycleConvertDataListAndReturnDataCount(int64(i),thisTrainList))
+		thisTrainCountList = append(thisTrainCountList, models.ContainInCycleConvertDataListAndReturnDataCount(int64(i), thisTrainList))
 
 	}
 
-	for _,item := range thisTrainList{
+	for _, item := range thisTrainList {
 		thisDaySum += item.Days
 		thisUserSum += item.Count
 	}
 
 	if thisUserSum > 0 {
-		thisTrainRate = tools.RoundFloat64(float64(thisDaySum)/float64(thisUserSum),2)
+		thisTrainRate = tools.RoundFloat64(float64(thisDaySum)/float64(thisUserSum), 2)
 	}
 
-	self.Data["json"]=&Ret{TrainCycleConvertDay:trainCycleConvertDay,TrainCycleConvertCountList:trainCountList,ThisTrainCycleConvertCountList:thisTrainCountList,ThisTrainConvertAverageRate:thisTrainRate}
+	self.Data["json"] = &Ret{TrainCycleConvertDay: trainCycleConvertDay, TrainCycleConvertCountList: trainCountList, ThisTrainCycleConvertCountList: thisTrainCountList, ThisTrainConvertAverageRate: thisTrainRate}
 	self.ServeJSON()
 }
-

+ 13 - 13
go/gopath/src/d5c-statement-api/controllers/d5c_train_controller/train_total.go

@@ -1,9 +1,9 @@
 package d5c_train_controller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
 type TrainTotalController struct {
@@ -16,17 +16,17 @@ type TrainTotalController struct {
 // @Param	project_id	query	int	true	"project_id"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *TrainTotalController) Get(){
+func (self *TrainTotalController) Get() {
 
-	projectId,_ := self.GetInt64("project_id")
+	projectId, _ := self.GetInt64("project_id")
 
 	type Ret struct {
-		TrainProUserCount               int64            `json:"train_pro_user_count"`
-		TrainProInvestorCount           int64            `json:"train_pro_investor_count"`
-		TrainProConvertRate             float64          `json:"train_pro_convert_rate"`
-		ThisTrainProUserCount           int64            `json:"this_train_pro_user_count"`
-		ThisTrainProInvestorCount       int64            `json:"this_train_pro_investor_count"`
-		ThisTrainProConvertRate         float64          `json:"this_train_pro_convert_rate"`
+		TrainProUserCount         int64   `json:"train_pro_user_count"`
+		TrainProInvestorCount     int64   `json:"train_pro_investor_count"`
+		TrainProConvertRate       float64 `json:"train_pro_convert_rate"`
+		ThisTrainProUserCount     int64   `json:"this_train_pro_user_count"`
+		ThisTrainProInvestorCount int64   `json:"this_train_pro_investor_count"`
+		ThisTrainProConvertRate   float64 `json:"this_train_pro_convert_rate"`
 	}
 
 	trainProUserCount := models.GetPtypeTrainProjectUserCount()
@@ -38,12 +38,12 @@ func (self *TrainTotalController) Get(){
 	thisTrainProConvertRate := float64(0)
 
 	if trainProUserCount > 0 {
-		trainProConvertRate = tools.RoundFloat64(float64(trainProInvestorCount)/float64(trainProUserCount),2)
+		trainProConvertRate = tools.RoundFloat64(float64(trainProInvestorCount)/float64(trainProUserCount), 2)
 	}
 	if thisTrainProUserCount > 0 {
-		thisTrainProConvertRate = tools.RoundFloat64(float64(thisTrainProInvestorCount)/float64(thisTrainProUserCount),2)
+		thisTrainProConvertRate = tools.RoundFloat64(float64(thisTrainProInvestorCount)/float64(thisTrainProUserCount), 2)
 	}
 
-	self.Data["json"]=&Ret{TrainProUserCount:trainProUserCount,TrainProInvestorCount:trainProInvestorCount,TrainProConvertRate:trainProConvertRate,ThisTrainProUserCount:thisTrainProUserCount,ThisTrainProInvestorCount:thisTrainProInvestorCount,ThisTrainProConvertRate:thisTrainProConvertRate}
+	self.Data["json"] = &Ret{TrainProUserCount: trainProUserCount, TrainProInvestorCount: trainProInvestorCount, TrainProConvertRate: trainProConvertRate, ThisTrainProUserCount: thisTrainProUserCount, ThisTrainProInvestorCount: thisTrainProInvestorCount, ThisTrainProConvertRate: thisTrainProConvertRate}
 	self.ServeJSON()
 }

+ 24 - 29
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_channel_stat.go

@@ -1,10 +1,10 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
 type UserChannelStatController struct {
@@ -18,66 +18,65 @@ type UserChannelStatController struct {
 // @Param	type	query	string	false	"type"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *UserChannelStatController) Get (){
+func (self *UserChannelStatController) Get() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	//2018-03-26 14:32:00
 	now := time.Now()
 	//2018-03-25 14:32:00
-	lastDate := now.AddDate(0,0,-1)
+	lastDate := now.AddDate(0, 0, -1)
 	//2018-03-25 00:00:00
-	queryDate := time.Date(lastDate.Year(), lastDate.Month(), lastDate.Day(), 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(lastDate.Year(), lastDate.Month(), lastDate.Day(), 0, 0, 0, 0, time.Local)
 	//2018-03-26 00:00:00
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 
 	//日统计
-	if len(s) == 3 && query_type == "d"{
+	if len(s) == 3 && query_type == "d" {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),query_date_tmp.Day(),0,0,0,0,time.Local)
-		queryNextDate = queryDate.AddDate(0,0,1)//2018-03-10 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+		queryNextDate = queryDate.AddDate(0, 0, 1) //2018-03-10 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
 		//月统计
-	}else if len(s) == 3 && query_type == "m"{
+	} else if len(s) == 3 && query_type == "m" {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)//2018-03-01 00:00:00
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
+		queryNextDate = queryDate.AddDate(0, 1, 0)                                                      //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
-	}else if len(s) == 2 && query_type == "m" {
+	} else if len(s) == 2 && query_type == "m" {
 		//2018-03-01 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01", query_date)
-		queryDate = time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)//2018-03-01 00:00:00
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
+		queryNextDate = queryDate.AddDate(0, 1, 0)                                                      //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 
 	}
 	//月统计
-	if query_date =="" && query_type == "m" {
+	if query_date == "" && query_type == "m" {
 		//2018-03-01 00:00:00
-		queryDate = time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-		queryNextDate = queryDate.AddDate(0,1,0)//2018-04-01 00:00:00
+		queryDate = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+		queryNextDate = queryDate.AddDate(0, 1, 0) //2018-04-01 00:00:00
 
-		beego.BeeLogger.Warn("%d,%s,%s,%s",len(s),query_type,queryDate, queryNextDate)
+		beego.BeeLogger.Warn("%d,%s,%s,%s", len(s), query_type, queryDate, queryNextDate)
 	}
 	//---------------------------------------------数据处理
 
 	type Ret struct {
-		UserSignupChannelDataList   []*models.UserSignUpChannelData    `json:"user_signup_channel_data_list"`
+		UserSignupChannelDataList []*models.UserSignUpChannelData `json:"user_signup_channel_data_list"`
 	}
 
-
 	userSignupChannelDataList := models.GetPerChannelUserSignupCountByTime(queryDate, queryNextDate)
 
 	var list []*models.UserSignUpChannelData
@@ -97,7 +96,7 @@ func (self *UserChannelStatController) Get (){
 
 	for _, each := range userSignupChannelDataList {
 
-		if each.SignupChannelId != 0{
+		if each.SignupChannelId != 0 {
 
 			channel := models.GetSignUpChannelById(each.SignupChannelId)
 			if channel != nil {
@@ -113,7 +112,3 @@ func (self *UserChannelStatController) Get (){
 	self.ServeJSON()
 
 }
-
-
-
-

+ 11 - 11
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_day_add.go

@@ -1,10 +1,10 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
 	"strings"
-	"d5c-statement-api/models"
+	"time"
 )
 
 type UserDayAddController struct {
@@ -17,27 +17,27 @@ type UserDayAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *UserDayAddController) Get(){
+func (self *UserDayAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-26 14:32:00
-	lastDay := now.AddDate(0,0,-1)//2018-03-25 14:32:00
-	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0,0 ,0, time.Local)//2018-03-25 00:00:00
+	now := time.Now()                                                                              //2018-03-26 14:32:00
+	lastDay := now.AddDate(0, 0, -1)                                                               //2018-03-25 14:32:00
+	queryDate := time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 0, 0, 0, 0, time.Local) //2018-03-25 00:00:00
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 	}
 
-	userDayNewAdd := models.GetUserAddByTime(queryDate, queryDate.AddDate(0,0,1))
+	userDayNewAdd := models.GetUserAddByTime(queryDate, queryDate.AddDate(0, 0, 1))
 
 	type Ret struct {
-		QueryDate      string          `json:"query_date"`       //查询日期
-		UserDayNewAdd  int64           `json:"fans_day_new_add"` //日期下用户新增
+		QueryDate     string `json:"query_date"`       //查询日期
+		UserDayNewAdd int64  `json:"fans_day_new_add"` //日期下用户新增
 	}
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01-02"), UserDayNewAdd: userDayNewAdd}

+ 15 - 18
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_day_grouth.go

@@ -1,14 +1,13 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
-
 type UserDayGrouthController struct {
 	beego.Controller
 }
@@ -21,31 +20,31 @@ type UserDayGrouthController struct {
 // @router / [get]
 func (self *UserDayGrouthController) Get() {
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Days                 []string `json:"days"`             //最近7天
-		DayNewUsers          []int64  `json:"day_new_users"`     //新增
+		Days        []string `json:"days"`          //最近7天
+		DayNewUsers []int64  `json:"day_new_users"` //新增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, 0, -7) //2018-03-17 14:32:00
-	nextTime := now//2018-03-24 14:32:00
+	nextTime := now                    //2018-03-24 14:32:00
 
 	// 2018-03-17 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),startTime.Day(),0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 0, 0, 0, time.Local)
 	// 2018-03-24 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(),0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), nextTime.Day(), 0, 0, 0, 0, time.Local)
 
 	if len(s) == 3 {
 		//2018-03-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDateTmp := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),query_date_tmp.Day(),0,0,0,0,time.Local)
+		queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
 		//2018-03-03 00:00:00
 		start = queryDateTmp.AddDate(0, 0, -6) //前6天
-		beego.BeeLogger.Warn("start:%s",start)
+		beego.BeeLogger.Warn("start:%s", start)
 		//2018-03-10 00:00:00
-		end = queryDateTmp.AddDate(0,0,1)
-		beego.BeeLogger.Warn("end:%s",end)
+		end = queryDateTmp.AddDate(0, 0, 1)
+		beego.BeeLogger.Warn("end:%s", end)
 
 	}
 
@@ -54,7 +53,6 @@ func (self *UserDayGrouthController) Get() {
 	var days []string
 	var dayNewUsers []int64
 
-
 	for i := 0; i < 7; i++ {
 
 		day := start.AddDate(0, 0, i).Format("01-02")
@@ -62,15 +60,14 @@ func (self *UserDayGrouthController) Get() {
 
 		md := start.AddDate(0, 0, i).Format("20060102")
 
-		mdInt,_ := strconv.ParseInt(md, 0 ,64)
+		mdInt, _ := strconv.ParseInt(md, 0, 64)
 
 		dayNewUserCount := models.ContainsInDayItemListAndReturnItemCount(mdInt, list)
 
 		dayNewUsers = append(dayNewUsers, dayNewUserCount)
 
-
 	}
 
-	self.Data["json"] = &Ret{Days:days, DayNewUsers: dayNewUsers}
+	self.Data["json"] = &Ret{Days: days, DayNewUsers: dayNewUsers}
 	self.ServeJSON()
-}
+}

+ 10 - 11
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_grouth.go

@@ -1,11 +1,11 @@
 package d5c_user_controller
 
 import (
-	"github.com/astaxie/beego"
-	"time"
 	"fmt"
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 	"strconv"
+	"time"
 )
 
 type UserGrouthController struct {
@@ -29,17 +29,17 @@ func (self *UserGrouthController) Get() {
 	endTime := now.AddDate(0, 1, 0)
 
 	// 2017-10-01 00:00:00 前五个月的第一天
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-03-01 00:00:00 下一个月的第一天
-	end := time.Date(endTime.Year(),endTime.Month(),1,0,0,0,0,time.Local)
+	end := time.Date(endTime.Year(), endTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
-	beego.BeeLogger.Warn("getting d5c's user_grouth: %s, %s", start.Format("2006-01-02"),end.Format("2006-01-02"))
+	beego.BeeLogger.Warn("getting d5c's user_grouth: %s, %s", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	var months []string
 	var monthNewUsers []int64
 	var monthNewInvestUsers []int64
 
-	monthNewUserList := models.GetMonthNewUsers(start.Format("2006-01-02"),end.Format("2006-01-02"))
+	monthNewUserList := models.GetMonthNewUsers(start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	monthNewInvestUserList := models.GetMonthNewInvestUsers(start.Format("2006-01-02"), end.Format("2006-01-02"))
 
@@ -49,9 +49,9 @@ func (self *UserGrouthController) Get() {
 
 		months = append(months, fmt.Sprintf("%d月", month))
 
-		ym := start.AddDate(0,i,0).Format("200601")
+		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0, 64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		if tmp := models.YearMonthIsContainInList(ymInt, monthNewUserList); tmp != nil {
 
@@ -69,10 +69,9 @@ func (self *UserGrouthController) Get() {
 
 	}
 
-	beego.BeeLogger.Warn("geted d5c's user_grouth: %s, %s", start.Format("2006-01-02"),end.Format("2006-01-02"))
+	beego.BeeLogger.Warn("geted d5c's user_grouth: %s, %s", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	self.Data["json"] = &Ret{Months: months, MonthNewUsers: monthNewUsers, MonthNewInvestUsers: monthNewInvestUsers}
 	self.ServeJSON()
 
 }
-

+ 11 - 11
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_month_add.go

@@ -1,10 +1,10 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
 )
 
 type UserMonthAddController struct {
@@ -17,34 +17,34 @@ type UserMonthAddController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *UserMonthAddController) Get(){
+func (self *UserMonthAddController) Get() {
 
 	query_date := self.GetString("query_date")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-26 14:32:00
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)//2018-03-01 00:00:00
+	now := time.Now()                                                          //2018-03-26 14:32:00
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local) //2018-03-01 00:00:00
 
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)//2018-02-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-02-01 00:00:00
 	}
 
 	if len(s) == 2 {
 		//2018-02-01 00:00:00
 		query_date_tmp, _ := time.Parse("2006-01", query_date)
-		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)//2018-02-01 00:00:00
+		queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local) //2018-02-01 00:00:00
 	}
 
-	userMonthNewAdd := models.GetUserAddByTime(queryDate, queryDate.AddDate(0,1,0))
+	userMonthNewAdd := models.GetUserAddByTime(queryDate, queryDate.AddDate(0, 1, 0))
 
 	type Ret struct {
-		QueryDate      string          `json:"query_date"`       //查询日期
-		UserMonthNewAdd  int64           `json:"fans_day_new_add"` //日期下用户新增
+		QueryDate       string `json:"query_date"`       //查询日期
+		UserMonthNewAdd int64  `json:"fans_day_new_add"` //日期下用户新增
 	}
 
 	self.Data["json"] = &Ret{QueryDate: queryDate.Format("2006-01"), UserMonthNewAdd: userMonthNewAdd}
 	self.ServeJSON()
-}
+}

+ 17 - 17
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_month_grouth.go

@@ -1,56 +1,57 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"strconv"
-	"d5c-statement-api/models"
 )
 
 type UserMonthGrouthController struct {
 	beego.Controller
 }
+
 // @Title Get
 // @Description 默认是当月及其前5月,输入某个日期,查询输入日期月份及其前5月的新增数据
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *UserMonthGrouthController) Get(){
+func (self *UserMonthGrouthController) Get() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	type Ret struct {
-		Months                 []string `json:"months"`             //六个月
-		MonthNewUsers          []int64  `json:"month_new_users"`     //新增
+		Months        []string `json:"months"`          //六个月
+		MonthNewUsers []int64  `json:"month_new_users"` //新增
 	}
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, -5, 0) //2017-10-24 14:32:00
-	nextTime := now.AddDate(0, 1, 0)//2018-04-24 14:32:00
+	nextTime := now.AddDate(0, 1, 0)   //2018-04-24 14:32:00
 
 	// 2017-10-01 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-04-01 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), 1,0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	query_date_tmp := now
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01-02", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 	if len(s) == 2 {
 		//2018-02-01 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 
 	var months []string
@@ -58,7 +59,6 @@ func (self *UserMonthGrouthController) Get(){
 
 	list := models.GetPerMonthUserSignupCountByTime(start, end)
 
-
 	for i := 0; i < 6; i++ {
 
 		month := start.AddDate(0, i, 0).Format("2006-01")
@@ -66,7 +66,7 @@ func (self *UserMonthGrouthController) Get(){
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		monthNewUserCount := models.ContainsInMonthItemListAndReturnItemCount(ymInt, list)
 
@@ -77,4 +77,4 @@ func (self *UserMonthGrouthController) Get(){
 	self.Data["json"] = &Ret{Months: months, MonthNewUsers: monthNewUsers}
 	self.ServeJSON()
 
-}
+}

+ 5 - 5
go/gopath/src/d5c-statement-api/controllers/d5c_user_controller/user_register.go

@@ -1,8 +1,8 @@
 package d5c_user_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 )
 
 type UserRegisterController struct {
@@ -14,15 +14,15 @@ type UserRegisterController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} int64
 // @router / [get]
-func (self *UserRegisterController) Get(){
+func (self *UserRegisterController) Get() {
 
-	type Ret struct{
+	type Ret struct {
 		TotalRegisters int64 `json:"total_register"`
 	}
 
 	total := models.GetRegisterUsersTotalCount()
 
-	self.Data["json"]= &Ret{TotalRegisters:total}
+	self.Data["json"] = &Ret{TotalRegisters: total}
 	self.ServeJSON()
 
-}
+}

+ 18 - 18
go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_channel_stat.go

@@ -1,12 +1,12 @@
 package d5c_zt_invest_controller
 
 import (
+	"fmt"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strings"
 	"time"
-	"d5c-statement-api/tools"
-	"fmt"
 )
 
 type ZtInvestChannelStatController struct {
@@ -19,20 +19,20 @@ type ZtInvestChannelStatController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ZtInvestChannelStatController) Get(){
+func (self *ZtInvestChannelStatController) Get() {
 
 	type Ret struct {
-		List     []*models.DataPerChannelZtInvest      `json:"list"`
+		List []*models.DataPerChannelZtInvest `json:"list"`
 	}
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
 	nextTime := now.AddDate(0, 1, 0)
 
-	start := time.Date(now.Year(),now.Month(),1,0,0,0,0,time.Local)
-	end := time.Date(nextTime.Year(), nextTime.Month(), 1,0,0,0,0,time.Local)
+	start := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	query_date_tmp := now
 	if len(s) == 3 {
@@ -41,40 +41,40 @@ func (self *ZtInvestChannelStatController) Get(){
 	if len(s) == 2 {
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 	}
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	start = queryDate
-	end = queryDate.AddDate(0,1,0)
+	end = queryDate.AddDate(0, 1, 0)
 
 	noChannelList := models.GetPerChannelDataByNoChannel(start, end)
-	perChanelList := models.GetPerChannelData(start,end)
+	perChanelList := models.GetPerChannelData(start, end)
 
 	var list []*models.DataPerChannelZtInvest
 
-	for _,item :=range noChannelList {
+	for _, item := range noChannelList {
 
 		if item != nil {
 
 			if item.TotalCount != 0 {
-				item.ConvertRate = fmt.Sprintf("%0.2f%s",tools.RoundFloat64(float64(item.InvestorCount)/float64(item.TotalCount),2)*100,"%")
+				item.ConvertRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.InvestorCount)/float64(item.TotalCount), 2)*100, "%")
 			}
 			list = append(list, item)
 		}
 	}
 
-	for _,item :=range perChanelList {
+	for _, item := range perChanelList {
 
 		if item != nil {
 
 			if item.TotalCount != 0 {
-				item.ConvertRate = fmt.Sprintf("%0.2f%s",tools.RoundFloat64(float64(item.InvestorCount)/float64(item.TotalCount),2)*100,"%")
-			}else{
-				item.ConvertRate = fmt.Sprintf("%d",0)
+				item.ConvertRate = fmt.Sprintf("%0.2f%s", tools.RoundFloat64(float64(item.InvestorCount)/float64(item.TotalCount), 2)*100, "%")
+			} else {
+				item.ConvertRate = fmt.Sprintf("%d", 0)
 			}
 			list = append(list, item)
 		}
 	}
 
-	self.Data["json"] = &Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
 
 }

+ 19 - 20
go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_month_grouth.go

@@ -1,11 +1,11 @@
 package d5c_zt_invest_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"d5c-statement-api/models"
-	"strconv"
 )
 
 type ZtInvestMonthGrouthController struct {
@@ -18,42 +18,42 @@ type ZtInvestMonthGrouthController struct {
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ZtInvestMonthGrouthController) Get(){
+func (self *ZtInvestMonthGrouthController) Get() {
 
 	type Ret struct {
-		Months         []string     `json:"months"`
-		QueryMonthNew  int64        `json:"query_month_new"`
-		MonthsNew      []int64      `json:"months_new"`
+		Months        []string `json:"months"`
+		QueryMonthNew int64    `json:"query_month_new"`
+		MonthsNew     []int64  `json:"months_new"`
 	}
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
-	now := time.Now()//2018-03-24 14:32:00
+	now := time.Now()                  //2018-03-24 14:32:00
 	startTime := now.AddDate(0, -5, 0) //2017-10-24 14:32:00
-	nextTime := now.AddDate(0, 1, 0)//2018-04-24 14:32:00
+	nextTime := now.AddDate(0, 1, 0)   //2018-04-24 14:32:00
 
 	// 2017-10-01 00:00:00
-	start := time.Date(startTime.Year(),startTime.Month(),1,0,0,0,0,time.Local)
+	start := time.Date(startTime.Year(), startTime.Month(), 1, 0, 0, 0, 0, time.Local)
 	// 2018-04-01 00:00:00
-	end := time.Date(nextTime.Year(), nextTime.Month(), 1,0,0,0,0,time.Local)
+	end := time.Date(nextTime.Year(), nextTime.Month(), 1, 0, 0, 0, 0, time.Local)
 
 	query_date_tmp := now
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01-02", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 	if len(s) == 2 {
 		//2018-02-01 00:00:00
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 		//2018-02-01 00:00:00
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 		start = queryDate.AddDate(0, -5, 0) //2017-09-01 00:00:00
-		end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
+		end = queryDate.AddDate(0, 1, 0)    //2018-03-01 00:00:00
 	}
 
 	list := models.GetPerMonthNewUserCountFromZtInvestByTime(start, end)
@@ -62,7 +62,6 @@ func (self *ZtInvestMonthGrouthController) Get(){
 	var monthsNew []int64
 	var queryMonthNew int64
 
-
 	for i := 0; i < 6; i++ {
 
 		month := start.AddDate(0, i, 0).Format("2006-01")
@@ -70,18 +69,18 @@ func (self *ZtInvestMonthGrouthController) Get(){
 
 		ym := start.AddDate(0, i, 0).Format("200601")
 
-		ymInt,_ := strconv.ParseInt(ym, 0 ,64)
+		ymInt, _ := strconv.ParseInt(ym, 0, 64)
 
 		monthNewUserCount := models.ContainsInMonthItemListAndReturnItemCount(ymInt, list)
 
 		monthsNew = append(monthsNew, monthNewUserCount)
-		queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
-		if ym == queryDate.Format("200601"){
+		queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+		if ym == queryDate.Format("200601") {
 			queryMonthNew = monthNewUserCount
 		}
 
 	}
 
-	self.Data["json"]= &Ret{Months:months, QueryMonthNew:queryMonthNew, MonthsNew: monthsNew}
+	self.Data["json"] = &Ret{Months: months, QueryMonthNew: queryMonthNew, MonthsNew: monthsNew}
 	self.ServeJSON()
 }

+ 7 - 7
go/gopath/src/d5c-statement-api/controllers/d5c_zt_invest_controller/zt_invest_total.go

@@ -1,9 +1,9 @@
 package d5c_zt_invest_controller
 
 import (
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
-	"d5c-statement-api/tools"
 )
 
 type ZtInvestTotalController struct {
@@ -15,18 +15,18 @@ type ZtInvestTotalController struct {
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router / [get]
-func (self *ZtInvestTotalController) Get(){
+func (self *ZtInvestTotalController) Get() {
 
 	type Ret struct {
-		TotalZtJoinCount     int64       `json:"total_zt_join_count"`
-		TotalInvestCount     int64       `json:"total_invest_count"`
-		ConvertRate          float64     `json:"convert_rate"`
+		TotalZtJoinCount int64   `json:"total_zt_join_count"`
+		TotalInvestCount int64   `json:"total_invest_count"`
+		ConvertRate      float64 `json:"convert_rate"`
 	}
 
 	totalZtJoinCount := models.GetTotalUserCountFromZtInvest()
 	totalInvestCount := models.GetTotalInvestorCountFromZtInvest()
 
-	self.Data["json"] = &Ret{TotalZtJoinCount:totalZtJoinCount, TotalInvestCount:totalInvestCount,ConvertRate: tools.RoundFloat64(float64(totalInvestCount)/float64(totalZtJoinCount),2)}
+	self.Data["json"] = &Ret{TotalZtJoinCount: totalZtJoinCount, TotalInvestCount: totalInvestCount, ConvertRate: tools.RoundFloat64(float64(totalInvestCount)/float64(totalZtJoinCount), 2)}
 	self.ServeJSON()
 
 }

+ 54 - 56
go/gopath/src/d5c-statement-api/controllers/rabbit_balance_consume_controller/rabbit_balance_consume.go

@@ -1,13 +1,13 @@
 package rabbit_balance_consume_controller
 
 import (
-	"d5c-statement-api/models"
-	"strings"
-	"time"
-	"github.com/astaxie/beego"
-	"strconv"
 	"fmt"
+	"fohow-statement-api/models"
+	"github.com/astaxie/beego"
 	"math"
+	"strconv"
+	"strings"
+	"time"
 )
 
 type RabbitBalanceConsumeController struct {
@@ -21,35 +21,35 @@ type RabbitBalanceConsumeController struct {
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /consume/list [get]
-func(self *RabbitBalanceConsumeController) GetSourceConsumeList(){
+func (self *RabbitBalanceConsumeController) GetSourceConsumeList() {
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-		if queryType == "m" {//查询一个月份30天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
-		}else {//查询一天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+		if queryType == "m" { //查询一个月份30天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
+		} else { //查询一天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	list := models.GetSourceConsumeListByTime(queryDate, queryNextDate)
@@ -58,26 +58,26 @@ func(self *RabbitBalanceConsumeController) GetSourceConsumeList(){
 	highestCount := int64(0)
 	var highestSourceCn string
 
-	for i:=0; i< len(list);i++  {
+	for i := 0; i < len(list); i++ {
 
 		list[i].ConsumeSourceCn = models.SOURCE_CN_TEXT[list[i].ConsumeSource]
 		list[i].CousumeCount = int64(math.Abs(float64(list[i].CousumeCount)))
 
 		totalCount += list[i].CousumeCount
-		if i== 0 {
+		if i == 0 {
 			highestCount = list[0].CousumeCount
 			highestSourceCn = list[0].ConsumeSourceCn
 		}
 	}
 
 	type Ret struct {
-		List    []*models.ConsumeSourceData    `json:"list"`
-		TotalCount    int64                    `json:"total_count"`
-		HighestCount  int64                    `json:"highest_count"`
-		HighestSourceCn string                   `json:"highest_source"`
+		List            []*models.ConsumeSourceData `json:"list"`
+		TotalCount      int64                       `json:"total_count"`
+		HighestCount    int64                       `json:"highest_count"`
+		HighestSourceCn string                      `json:"highest_source"`
 	}
 
-	self.Data["json"]=&Ret{List:list, TotalCount:totalCount,HighestCount:highestCount,HighestSourceCn:highestSourceCn}
+	self.Data["json"] = &Ret{List: list, TotalCount: totalCount, HighestCount: highestCount, HighestSourceCn: highestSourceCn}
 	self.ServeJSON()
 }
 
@@ -88,54 +88,53 @@ func(self *RabbitBalanceConsumeController) GetSourceConsumeList(){
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /consume/line [get]
-func (self *RabbitBalanceConsumeController) GetSourceConsumeLine(){
+func (self *RabbitBalanceConsumeController) GetSourceConsumeLine() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-		beego.BeeLogger.Warn("%s",query_date_tmp.Format("2006-01-02"))
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+		beego.BeeLogger.Warn("%s", query_date_tmp.Format("2006-01-02"))
 
-		if queryType == "m" {//查询多天
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
+		if queryType == "m" { //查询多天
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 			queryDate = queryDateTmp
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
-		}else {//查询一天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
+		} else { //查询一天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
-
 	var timeList []string
 	var lineList []*models.ConsumeSourceLine
 
 	list := models.GetConsumeSourceList()
 
 	//日期处理
-	if queryType == "m"{
-		for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
+	if queryType == "m" {
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 			increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 			timeList = append(timeList, increaseDate)
 		}
-	}else{
+	} else {
 		for i := 0; i < 49; i++ {
 
 			queryDateTmp := queryDate.Unix() + 3600*0.5*int64(i)
@@ -145,22 +144,22 @@ func (self *RabbitBalanceConsumeController) GetSourceConsumeLine(){
 		}
 	}
 
-	for _,each:=range list{
+	for _, each := range list {
 
 		line := new(models.ConsumeSourceLine)
 		line.ConsumeSource = each.ConsumeSource
 		line.ConsumeSourceCn = models.SOURCE_CN_TEXT[each.ConsumeSource]
 
-		if queryType == "m"{
+		if queryType == "m" {
 
 			var lineListTmp []int64
 
 			list := models.GetSourceConsumeListByTimeAndSource(queryDate, queryNextDate, each.ConsumeSource, "%Y%m%d")
 
-			for i := 0; i < queryNextDate.AddDate(0,0,-1).Day(); i++ {
+			for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-				findDate := queryDate.AddDate(0,0,i).Format("20060102")
-				findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+				findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+				findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 				count := models.ContainInItemListAndReturnItemCount(findDateInt, list)
 				lineListTmp = append(lineListTmp, int64(math.Abs(float64(count))))
@@ -168,11 +167,11 @@ func (self *RabbitBalanceConsumeController) GetSourceConsumeLine(){
 
 			line.CountList = lineListTmp
 
-		}else{
+		} else {
 
 			var lineListTmp []int64
 
-			list := models.GetSourceConsumeListByHour(queryDate,queryNextDate,each.ConsumeSource)
+			list := models.GetSourceConsumeListByHour(queryDate, queryNextDate, each.ConsumeSource)
 
 			for i := 0; i < 49; i++ {
 
@@ -196,12 +195,11 @@ func (self *RabbitBalanceConsumeController) GetSourceConsumeLine(){
 		lineList = append(lineList, line)
 	}
 
-
 	type Ret struct {
-		TimeList   []string                         `json:"time_list"`
-		LineList   []*models.ConsumeSourceLine      `json:"line_list"`
+		TimeList []string                    `json:"time_list"`
+		LineList []*models.ConsumeSourceLine `json:"line_list"`
 	}
-	self.Data["json"]=&Ret{TimeList:timeList, LineList:lineList}
+	self.Data["json"] = &Ret{TimeList: timeList, LineList: lineList}
 	self.ServeJSON()
 }
 
@@ -220,4 +218,4 @@ select source, sum(count),CONCAT( DATE_FORMAT( DATE_ADD(created_at, INTERVAL 8 H
 #该来源时间内消耗萝卜数量
 select source, sum(count),DATE_FORMAT( DATE_ADD(created_at, INTERVAL 8 HOUR), '%Y%m%d' ) as ymd_hm from balances where count < 0 and DATE_ADD(created_at,INTERVAL 8 HOUR) >= '2018-06-01' and DATE_ADD(created_at,INTERVAL 8 HOUR) < '2018-07-01' and source = 'exchange_product' GROUP BY ymd_hm;
 
-*/
+*/

+ 91 - 95
go/gopath/src/d5c-statement-api/controllers/rabbit_exchange_platform_controller/rabbit_exchange_platform_stat.go

@@ -1,11 +1,11 @@
 package rabbit_exchange_platform_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
-	"strings"
-	"d5c-statement-api/models"
 	"strconv"
+	"strings"
+	"time"
 )
 
 type RabbitExchangePlatformStatController struct {
@@ -19,36 +19,36 @@ type RabbitExchangePlatformStatController struct {
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /exchange_platform/data_list [get]
-func (self *RabbitExchangePlatformStatController) DataList(){
+func (self *RabbitExchangePlatformStatController) DataList() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-		if queryType == "m" {//查询一个月份30天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
-		}else {//查询一天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+		if queryType == "m" { //查询一个月份30天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
+		} else { //查询一天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	list := models.GetPlatformExchangeList(queryDate, queryNextDate)
@@ -58,12 +58,12 @@ func (self *RabbitExchangePlatformStatController) DataList(){
 	timeTotalPCount := int64(0)
 	var highestPCountPlatform string
 	higestPCount := int64(0)
-	for i,each := range list{
+	for i, each := range list {
 		each.TotalPCount = models.ContainsInItemListAndReturnItemTotalPCount(each.PlatformId, tpList)
 
 		timeTotalPCount += each.PCount
 
-		if i == 0{
+		if i == 0 {
 			higestPCount = each.PCount
 			highestPCountPlatform = each.PlatformName
 		}
@@ -74,16 +74,16 @@ func (self *RabbitExchangePlatformStatController) DataList(){
 	totalCount := models.GetPlatformExchangeTotalPCount()
 
 	type Ret struct {
-		List     []*models.PlatformExchangeItem `json:"list"`
-		TimeTotalPCount    int64                `json:"time_total_p_count"`
-		HighestPCountPlatForm   string          `json:"highest_p_count_platform"`
-		HighestPCount      int64                `json:"highest_p_count"`
+		List                  []*models.PlatformExchangeItem `json:"list"`
+		TimeTotalPCount       int64                          `json:"time_total_p_count"`
+		HighestPCountPlatForm string                         `json:"highest_p_count_platform"`
+		HighestPCount         int64                          `json:"highest_p_count"`
 
-		TotalPCount        int64                `json:"total_p_count"`//所有的萝卜数量
-		LeftPCount         int64                `json:"left_p_count"` //剩余的萝卜数量
+		TotalPCount int64 `json:"total_p_count"` //所有的萝卜数量
+		LeftPCount  int64 `json:"left_p_count"`  //剩余的萝卜数量
 	}
 
-	self.Data["json"]=&Ret{List:list, TimeTotalPCount:timeTotalPCount, HighestPCount:higestPCount, HighestPCountPlatForm:highestPCountPlatform,TotalPCount:totalCount,LeftPCount:leftCount}
+	self.Data["json"] = &Ret{List: list, TimeTotalPCount: timeTotalPCount, HighestPCount: higestPCount, HighestPCountPlatForm: highestPCountPlatform, TotalPCount: totalCount, LeftPCount: leftCount}
 	self.ServeJSON()
 
 }
@@ -93,17 +93,15 @@ func (self *RabbitExchangePlatformStatController) DataList(){
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router /exchange_platform/list [get]
-func (self *RabbitExchangePlatformStatController) List(){
+func (self *RabbitExchangePlatformStatController) List() {
 
 	list := models.GetPlatformList()
 
 	type Ret struct {
-		List     []*models.PlatformExchangeItem `json:"list"`
+		List []*models.PlatformExchangeItem `json:"list"`
 	}
 
-
-
-	self.Data["json"]=&Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
 
 }
@@ -115,52 +113,52 @@ func (self *RabbitExchangePlatformStatController) List(){
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /exchange_platform/line_p_count [get]
-func (self *RabbitExchangePlatformStatController) PCountLine(){
+func (self *RabbitExchangePlatformStatController) PCountLine() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 	queryType := "d"
 	format := "%Y%m%d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		if queryType == "m" {//查询多个月份
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryDate = queryDateTmp.AddDate(0,-12,0)
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
+		if queryType == "m" { //查询多个月份
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryDate = queryDateTmp.AddDate(0, -12, 0)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 			format = "%Y%m"
-		}else {//查询一月份多天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
+		} else { //查询一月份多天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
 			format = "%Y%m%d"
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	var timeList []string
 
-	if queryType == "m"{
-		for i:=0 ;i < 13;i++ {
+	if queryType == "m" {
+		for i := 0; i < 13; i++ {
 
 			increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 			timeList = append(timeList, increaseDate)
 		}
-	}else{
-		for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++ {
+	} else {
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 			increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 			timeList = append(timeList, increaseDate)
@@ -171,34 +169,34 @@ func (self *RabbitExchangePlatformStatController) PCountLine(){
 
 	list := models.GetPlatformList()
 
-	for _,each := range list{
+	for _, each := range list {
 
 		line := new(models.PlatformExchangeLine)
 
 		line.PlatformId = each.PlatformId
 		platform := models.GetPlatformById(each.PlatformId)
-		if platform != nil{
+		if platform != nil {
 			line.PlatformName = platform.PlatformName
 		}
 
-		var countList  []int64
+		var countList []int64
 
 		pcList := models.GetMulMonthsPCountByPlatformIdAndTimeAndTimeFormat(queryDate, queryNextDate, each.PlatformId, format)
 
 		if format == "%Y%m" {
-			for i:=0 ;i < 13;i++{
+			for i := 0; i < 13; i++ {
 
-				findDate := queryDate.AddDate(0,i,0).Format("200601")
-				findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+				findDate := queryDate.AddDate(0, i, 0).Format("200601")
+				findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 				count := models.ContainInItemListAndReturnItemCount(findDateInt, pcList)
 				countList = append(countList, count)
 			}
-		}else{
-			for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++{
+		} else {
+			for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-				findDate := queryDate.AddDate(0,0,i).Format("20060102")
-				findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+				findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+				findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 				count := models.ContainInItemListAndReturnItemCount(findDateInt, pcList)
 				countList = append(countList, count)
@@ -211,11 +209,11 @@ func (self *RabbitExchangePlatformStatController) PCountLine(){
 	}
 
 	type Ret struct {
-		TimeList      []string                            `json:"time_list"`
-		LineList      []*models.PlatformExchangeLine        `json:"line_data"`
+		TimeList []string                       `json:"time_list"`
+		LineList []*models.PlatformExchangeLine `json:"line_data"`
 	}
 
-	self.Data["json"]=&Ret{TimeList:timeList, LineList:lineList}
+	self.Data["json"] = &Ret{TimeList: timeList, LineList: lineList}
 	self.ServeJSON()
 
 }
@@ -227,52 +225,52 @@ func (self *RabbitExchangePlatformStatController) PCountLine(){
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /exchange_platform/line_s_count [get]
-func (self *RabbitExchangePlatformStatController) SCountLine(){
+func (self *RabbitExchangePlatformStatController) SCountLine() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 	queryType := "d"
 	format := "%Y%m%d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		if queryType == "m" {//查询多个月份
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryDate = queryDateTmp.AddDate(0,-12,0)
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
+		if queryType == "m" { //查询多个月份
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryDate = queryDateTmp.AddDate(0, -12, 0)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 			format = "%Y%m"
-		}else {//查询一月份多天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
+		} else { //查询一月份多天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
 			format = "%Y%m%d"
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	var timeList []string
 
-	if queryType == "m"{
-		for i:=0 ;i < 13;i++ {
+	if queryType == "m" {
+		for i := 0; i < 13; i++ {
 
 			increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 			timeList = append(timeList, increaseDate)
 		}
-	}else{
-		for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++ {
+	} else {
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 			increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 			timeList = append(timeList, increaseDate)
@@ -283,38 +281,38 @@ func (self *RabbitExchangePlatformStatController) SCountLine(){
 
 	list := models.GetPlatformList()
 
-	for _,each := range list{
+	for _, each := range list {
 
 		line := new(models.PlatformExchangeLine)
 		line.PlatformId = each.PlatformId
 		platform := models.GetPlatformById(each.PlatformId)
-		if platform != nil{
+		if platform != nil {
 			line.PlatformName = platform.PlatformName
 		}
 
-		var countList  []int64
+		var countList []int64
 
 		if queryType == "m" {
 
 			pcList := models.GetMulMonthsSCountByPlatformIdAndTimeAndTimeFormat(queryDate, queryNextDate, each.PlatformId, format)
 
-			for i:=0 ;i < 13;i++{
+			for i := 0; i < 13; i++ {
 
-				findDate := queryDate.AddDate(0,i,0).Format("200601")
-				findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+				findDate := queryDate.AddDate(0, i, 0).Format("200601")
+				findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 				count := models.ContainInItemListAndReturnItemCount(findDateInt, pcList)
 				countList = append(countList, count)
 			}
 
-		}else{
+		} else {
 
 			pcList := models.GetMulMonthsSCountByPlatformIdAndTimeAndTimeFormat(queryDate, queryNextDate, each.PlatformId, format)
 
-			for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++{
+			for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
-				findDate := queryDate.AddDate(0,0,i).Format("20060102")
-				findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+				findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+				findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 				count := models.ContainInItemListAndReturnItemCount(findDateInt, pcList)
 				countList = append(countList, count)
@@ -327,13 +325,11 @@ func (self *RabbitExchangePlatformStatController) SCountLine(){
 	}
 
 	type Ret struct {
-		TimeList      []string                            `json:"time_list"`
-		LineList      []*models.PlatformExchangeLine        `json:"line_list"`
+		TimeList []string                       `json:"time_list"`
+		LineList []*models.PlatformExchangeLine `json:"line_list"`
 	}
 
-	self.Data["json"]=&Ret{TimeList:timeList, LineList:lineList}
+	self.Data["json"] = &Ret{TimeList: timeList, LineList: lineList}
 	self.ServeJSON()
 
 }
-
-

+ 68 - 68
go/gopath/src/d5c-statement-api/controllers/rabbit_merchant_controller/rabbit_merchant_checkout_list.go

@@ -1,11 +1,11 @@
 package rabbit_merchant_controller
 
 import (
-  "fmt"
+	"fmt"
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
-	"time"
 	"strings"
-	"d5c-statement-api/models"
+	"time"
 )
 
 type RabbitMerchantCheckoutListController struct {
@@ -20,41 +20,41 @@ type RabbitMerchantCheckoutListController struct {
 // @Param	per_page	query	int	false	"per_page"
 // @Success 200 {object} Ret
 // @router /checkout/list [get]
-func (self *RabbitMerchantCheckoutListController) List(){
+func (self *RabbitMerchantCheckoutListController) List() {
 
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 
 	now := time.Now()
 	//2018-03-23 00:00:00
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
 	//2018-03-24 00:00:00
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 
 	query_date_tmp := queryDate
 	if len(s) == 2 {
-		query_date_tmp,_ = time.Parse("2006-01", query_date)
+		query_date_tmp, _ = time.Parse("2006-01", query_date)
 	}
 	if len(s) == 3 {
-		query_date_tmp,_ = time.Parse("2006-01-02", query_date)
+		query_date_tmp, _ = time.Parse("2006-01-02", query_date)
 	}
 
-	queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate = queryDate.AddDate(0,1,0)
+	queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate = queryDate.AddDate(0, 1, 0)
 
-	page,_ := self.GetInt64("page",1)
-	perPage,_ := self.GetInt64("per_page",50)
-	if page > 0 && perPage > 100{
+	page, _ := self.GetInt64("page", 1)
+	perPage, _ := self.GetInt64("per_page", 50)
+	if page > 0 && perPage > 100 {
 		perPage = 20
 	}
 
 	list := models.GetMerchantCheckoutList(queryDate, queryNextDate, page, perPage)
 
 	type Ret struct {
-		List    []*models.RabbitMerchantCheckoutItem     `json:"list"`
+		List []*models.RabbitMerchantCheckoutItem `json:"list"`
 	}
 
-	for _,item :=range list{
+	for _, item := range list {
 		if item.BackVoucher == models.VOUCHER_ORDINARY_TYPE_ENUM_VALUE {
 			item.BackVoucher = models.VOUCHER_ORDINARY_TYPE_ENUM_NAME
 		}
@@ -66,7 +66,7 @@ func (self *RabbitMerchantCheckoutListController) List(){
 		}
 	}
 
-	self.Data["json"]=&Ret{List:list}
+	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
 
 }
@@ -77,13 +77,13 @@ func (self *RabbitMerchantCheckoutListController) List(){
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router /checkout/month/line [get]
-func (self *RabbitMerchantCheckoutListController) MonthList(){
+func (self *RabbitMerchantCheckoutListController) MonthList() {
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
-	now := time.Now()//2018-03-24 14:32:00
+	s := strings.Split(query_date, "-")
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	end := now
-	timeLength := 6  //设置要取多少个月
+	timeLength := 6 //设置要取多少个月
 	query_date_tmp := now
 	if len(s) == 3 {
 		//2018-02-09 00:00:00
@@ -95,26 +95,26 @@ func (self *RabbitMerchantCheckoutListController) MonthList(){
 	}
 
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	start = queryDate.AddDate(0, -(timeLength - 1), 0) //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
-	end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
-	beego.BeeLogger.Warn("end:%s",end)
+	beego.BeeLogger.Warn("start:%s", start)
+	end = queryDate.AddDate(0, 1, 0) //2018-03-01 00:00:00
+	beego.BeeLogger.Warn("end:%s", end)
 	list := models.GetMerchantMonthList(start, end)
 	var result []*models.MonthPrice
 	j := 0
 	for i := 0; i < timeLength; i++ {
-		itemtime := queryDate.AddDate(0, i-(timeLength - 1), 0).Format("200601")
-		if len(list) >= j + 1 && list[j].YearMonth == itemtime {
+		itemtime := queryDate.AddDate(0, i-(timeLength-1), 0).Format("200601")
+		if len(list) >= j+1 && list[j].YearMonth == itemtime {
 			result = append(result, list[j])
 			j++
 		} else {
-	    item := new(models.MonthPrice)
-	    item.YearMonth = itemtime
-	    item.Count = 0
-	    result = append(result, item)
+			item := new(models.MonthPrice)
+			item.YearMonth = itemtime
+			item.Count = 0
+			result = append(result, item)
 		}
-		result[i].Month = fmt.Sprintf("%d%s", int(queryDate.AddDate(0, i-(timeLength - 1), 0).Month()), "月")
+		result[i].Month = fmt.Sprintf("%d%s", int(queryDate.AddDate(0, i-(timeLength-1), 0).Month()), "月")
 	}
 
 	var ym []string
@@ -125,27 +125,28 @@ func (self *RabbitMerchantCheckoutListController) MonthList(){
 		ym = append(ym, result[a].YearMonth)
 		month = append(month, result[a].Month)
 		c = append(c, result[a].Count)
-	  beego.BeeLogger.Warn("%d", len(ym))
+		beego.BeeLogger.Warn("%d", len(ym))
 	}
 	beego.BeeLogger.Warn("%d", len(ym))
 	type Ret struct {
-		YmList                 []string `json:"ym"`
-		MonthList          []string  `json:"month"`
-		CList          []float64  `json:"c"`
+		YmList    []string  `json:"ym"`
+		MonthList []string  `json:"month"`
+		CList     []float64 `json:"c"`
 	}
-	self.Data["json"]=&Ret{YmList:ym, MonthList: month, CList: c}
+	self.Data["json"] = &Ret{YmList: ym, MonthList: month, CList: c}
 	self.ServeJSON()
 }
+
 // @Title Get
 // @Description 默认是当月,输入某个日期,查询
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Param	query_date	query	string	false	"query_date"
 // @Success 200 {object} Ret
 // @router /check [get]
-func (self *RabbitMerchantCheckoutListController) Check(){
+func (self *RabbitMerchantCheckoutListController) Check() {
 	query_date := self.GetString("query_date")
-	s := strings.Split(query_date,"-")
-	now := time.Now()//2018-03-24 14:32:00
+	s := strings.Split(query_date, "-")
+	now := time.Now() //2018-03-24 14:32:00
 	start := now
 	end := now
 	query_date_tmp := now
@@ -158,26 +159,26 @@ func (self *RabbitMerchantCheckoutListController) Check(){
 		query_date_tmp, _ = time.Parse("2006-01", query_date)
 	}
 	//2018-02-01 00:00:00
-	queryDate := time.Date(query_date_tmp.Year(),query_date_tmp.Month(),1,0,0,0,0,time.Local)
+	queryDate := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
 	start = queryDate //2018-09-01 00:00:00
-	beego.BeeLogger.Warn("start:%s",start)
-	end = queryDate.AddDate(0,1,0)//2018-03-01 00:00:00
-	beego.BeeLogger.Warn("end:%s",end)
+	beego.BeeLogger.Warn("start:%s", start)
+	end = queryDate.AddDate(0, 1, 0) //2018-03-01 00:00:00
+	beego.BeeLogger.Warn("end:%s", end)
 	check := models.GetMerchantCheck(start, end)
-	beego.BeeLogger.Warn("%d",check.PriceSum)
-	beego.BeeLogger.Warn("%d",check.PriceMax)
+	beego.BeeLogger.Warn("%d", check.PriceSum)
+	beego.BeeLogger.Warn("%d", check.PriceMax)
 	list := models.GetMerchantCheckoutList(start, end, 1, 10)
 	var top string
-	if (len(list) > 0) {
+	if len(list) > 0 {
 		top = list[0].MerchantName
 	}
 	type Ret struct {
-	  PriceSum  float64  `orm:"column(sum)" json:"sum"`
-	  PriceMax  float64  `orm:"column(max)" json:"max"`
-	  PriceTop  string   `orm:"column(top)" json:"top"`
+		PriceSum float64 `orm:"column(sum)" json:"sum"`
+		PriceMax float64 `orm:"column(max)" json:"max"`
+		PriceTop string  `orm:"column(top)" json:"top"`
 	}
 
-	self.Data["json"]=&Ret{PriceSum: check.PriceSum, PriceMax: check.PriceMax, PriceTop: top }
+	self.Data["json"] = &Ret{PriceSum: check.PriceSum, PriceMax: check.PriceMax, PriceTop: top}
 	self.ServeJSON()
 }
 
@@ -186,18 +187,18 @@ func (self *RabbitMerchantCheckoutListController) Check(){
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
 // @Success 200 {object} Ret
 // @router /merchant/list [get]
-func (self *RabbitMerchantCheckoutListController) MerchantList(){
+func (self *RabbitMerchantCheckoutListController) MerchantList() {
 
-	useCache,_ := self.GetBool("cache")
+	useCache, _ := self.GetBool("cache")
 	type Ret struct {
-		MerchantList   []*models.Merchant     `json:"merchant_list"`
+		MerchantList []*models.Merchant `json:"merchant_list"`
 	}
 
 	list := models.GetMerchantList(useCache)
-	if list == nil{
-		list = make([]*models.Merchant, 0,0)
+	if list == nil {
+		list = make([]*models.Merchant, 0, 0)
 	}
-	self.Data["json"] = &Ret{MerchantList:list}
+	self.Data["json"] = &Ret{MerchantList: list}
 	self.ServeJSON()
 }
 
@@ -208,34 +209,33 @@ func (self *RabbitMerchantCheckoutListController) MerchantList(){
 // @Param	merchant_id	query	int	false	"merchant_id"
 // @Success 200 {object} Ret
 // @router /settle/list [get]
-func (self *RabbitMerchantCheckoutListController) SettleList(){
+func (self *RabbitMerchantCheckoutListController) SettleList() {
 
-	merchantId,_ := self.GetInt64("merchant_id")
+	merchantId, _ := self.GetInt64("merchant_id")
 	query_date := self.GetString("query_date")
 
 	query_date_tmp, err := time.ParseInLocation("2006-01", query_date, time.Local)
-	if err != nil{
+	if err != nil {
 		self.ServeJSON()
 		self.StopRun()
 	}
 
-	useCache,_ := self.GetBool("cache")
+	useCache, _ := self.GetBool("cache")
 	type Ret struct {
-		SettlementList   []*models.Settlement     `json:"settlement_list"`
-		TotalAmount      int64                    `json:"total_amount"`
+		SettlementList []*models.Settlement `json:"settlement_list"`
+		TotalAmount    int64                `json:"total_amount"`
 	}
 
-	list := models.GetSettlementFromOrdersByReceiveTimeAndMerchantId(query_date_tmp, query_date_tmp.AddDate(0,1,0), merchantId, useCache)
-	if list == nil{
+	list := models.GetSettlementFromOrdersByReceiveTimeAndMerchantId(query_date_tmp, query_date_tmp.AddDate(0, 1, 0), merchantId, useCache)
+	if list == nil {
 		list = make([]*models.Settlement, 0, 0)
 	}
 
 	totalAmount := int64(0)
-	for _,i := range list{
+	for _, i := range list {
 		totalAmount += i.Amount
 	}
 
-	self.Data["json"] = &Ret{SettlementList:list, TotalAmount:totalAmount}
+	self.Data["json"] = &Ret{SettlementList: list, TotalAmount: totalAmount}
 	self.ServeJSON()
 }
-

+ 48 - 49
go/gopath/src/d5c-statement-api/controllers/rabbit_product_sold_controller/rabbit_product_sold.go

@@ -1,12 +1,12 @@
 package rabbit_product_sold_controller
 
 import (
-	"strings"
-	"time"
+	"fohow-statement-api/models"
+	"fohow-statement-api/tools"
 	"github.com/astaxie/beego"
-	"d5c-statement-api/models"
 	"strconv"
-	"d5c-statement-api/tools"
+	"strings"
+	"time"
 )
 
 type RabbitProductSoldController struct {
@@ -19,7 +19,7 @@ select o.product_id, p.name, count(*) as count, sum(o.total_price) as paied_pric
 
 日销售、日成本、日利润/月销售、月成本、月利润
 select sum(o.total_price) as paied_price, SUM(o.buy_price) as buy_price, (sum(o.total_price) - SUM(o.buy_price)) as profit_price, DATE_FORMAT(FROM_UNIXTIME(paied_at),'%Y%m%d') as ymd_time from orders o LEFT JOIN products p on p.id = o.product_id where o.paied_at >= UNIX_TIMESTAMP('2018-06-01 00:00:00') AND o.paied_at < UNIX_TIMESTAMP('2018-07-01 00:00:00') and (o.`status` = 'processing' or o.`status` = 'complete' or o.`status` = 'dispatch') and p.`status` = 1 GROUP BY ymd_time;
- */
+*/
 
 // @Title Get
 // @Description get 拉比兔:时间内商品销售列表。type:d/m->日统计/月统计。query_date:YYYY-MM-DD
@@ -28,35 +28,35 @@ select sum(o.total_price) as paied_price, SUM(o.buy_price) as buy_price, (sum(o.
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /sold/list [get]
-func(self *RabbitProductSoldController) GetProductSoldList(){
+func (self *RabbitProductSoldController) GetProductSoldList() {
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-		if queryType == "m" {//查询一月
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
-		}else {//查询一天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+		if queryType == "m" { //查询一月
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
+		} else { //查询一天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	list := models.GetProductSoldListByTime(queryDate, queryNextDate)
@@ -66,7 +66,7 @@ func(self *RabbitProductSoldController) GetProductSoldList(){
 	totalBuyPrice := float64(0)
 	totalProfitPrice := float64(0)
 
-	for _,each := range list{
+	for _, each := range list {
 
 		totalCount += each.Count
 		totalSoldPrice += each.PaiedPrice
@@ -77,16 +77,15 @@ func(self *RabbitProductSoldController) GetProductSoldList(){
 	type Ret struct {
 		List             []*models.RabbitProductSoldItem `json:"list"`
 		TotalCount       int64                           `json:"total_count"`
-		TotalSoldPrice   float64                           `json:"total_sold_price"`
-		TotalBuyPrice    float64                           `json:"total_buy_price"`
-		TotalProfitPrice float64                           `json:"total_profit_price"`
+		TotalSoldPrice   float64                         `json:"total_sold_price"`
+		TotalBuyPrice    float64                         `json:"total_buy_price"`
+		TotalProfitPrice float64                         `json:"total_profit_price"`
 	}
 
-	self.Data["json"]=&Ret{List:list, TotalCount:totalCount, TotalSoldPrice:tools.RoundFloat64(totalSoldPrice,2), TotalBuyPrice:tools.RoundFloat64(totalBuyPrice,2), TotalProfitPrice: tools.RoundFloat64(totalProfitPrice,2)}
+	self.Data["json"] = &Ret{List: list, TotalCount: totalCount, TotalSoldPrice: tools.RoundFloat64(totalSoldPrice, 2), TotalBuyPrice: tools.RoundFloat64(totalBuyPrice, 2), TotalProfitPrice: tools.RoundFloat64(totalProfitPrice, 2)}
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description get 拉比兔:时间内商品销售金额折线图。type:d/m。query_date:YYYY-MM-DD
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -94,40 +93,40 @@ func(self *RabbitProductSoldController) GetProductSoldList(){
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /sold/line [get]
-func (self *RabbitProductSoldController) GetProductSoldLine(){
+func (self *RabbitProductSoldController) GetProductSoldLine() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 	queryType := "d"
 	format := "%Y%m%d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		if queryType == "m" {//查询多个月份
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryDate = queryDateTmp.AddDate(0,-12,0)
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
+		if queryType == "m" { //查询多个月份
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryDate = queryDateTmp.AddDate(0, -12, 0)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 			format = "%Y%m"
-		}else {//查询一月份多天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
+		} else { //查询一月份多天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
 			format = "%Y%m%d"
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	var timeList []string
@@ -143,14 +142,14 @@ func (self *RabbitProductSoldController) GetProductSoldLine(){
 	wxPayWayList := models.GetProductWxPayWaySoldLineByTimeAndTimeFormat(queryDate, queryNextDate, format)
 	rabbitPayWayList := models.GetProductRaPayWaySoldLineByTimeAndTimeFormat(queryDate, queryNextDate, format)
 
-	if queryType == "m"{
-		for i:=0 ;i < 13;i++ {
+	if queryType == "m" {
+		for i := 0; i < 13; i++ {
 
 			increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 			timeList = append(timeList, increaseDate)
 
-			findDate := queryDate.AddDate(0,i,0).Format("200601")
-			findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+			findDate := queryDate.AddDate(0, i, 0).Format("200601")
+			findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 			paiedPrice := models.ContainsInItemListAndReturnItemTotalPaiedPrice(findDateInt, list)
 			buyPrice := models.ContainsInItemListAndReturnItemTotalBuyPrice(findDateInt, list)
@@ -166,14 +165,14 @@ func (self *RabbitProductSoldController) GetProductSoldLine(){
 			wxPwPaiedPriceList = append(wxPwPaiedPriceList, wxPaiedPrice)
 			raPwPaiedPriceList = append(raPwPaiedPriceList, raPaiedPrice)
 		}
-	}else{
-		for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++ {
+	} else {
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 			increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 			timeList = append(timeList, increaseDate)
 
-			findDate := queryDate.AddDate(0,0,i).Format("20060102")
-			findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+			findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+			findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 			paiedPrice := models.ContainsInItemListAndReturnItemTotalPaiedPrice(findDateInt, list)
 			buyPrice := models.ContainsInItemListAndReturnItemTotalBuyPrice(findDateInt, list)
@@ -200,7 +199,7 @@ func (self *RabbitProductSoldController) GetProductSoldLine(){
 		WeixinPayList   []float64 `json:"weixin_pay_list"`
 	}
 
-	self.Data["json"]=&Ret{TimeList:timeList, PaiedPriceList:paiedPriceList, BuyPriceList:buyPriceList, ProfitPriceList:profitPriceList, RabbitPayList:raPwPaiedPriceList, WeixinPayList: wxPwPaiedPriceList}
+	self.Data["json"] = &Ret{TimeList: timeList, PaiedPriceList: paiedPriceList, BuyPriceList: buyPriceList, ProfitPriceList: profitPriceList, RabbitPayList: raPwPaiedPriceList, WeixinPayList: wxPwPaiedPriceList}
 	self.ServeJSON()
 
-}
+}

+ 48 - 49
go/gopath/src/d5c-statement-api/controllers/rabbit_user_signup_controller/rabbit_user_signup_controller.go

@@ -1,11 +1,11 @@
 package rabbit_user_signup_controller
 
 import (
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
+	"strconv"
 	"strings"
 	"time"
-	"strconv"
-	"d5c-statement-api/models"
 )
 
 type RabbitUserSignupController struct {
@@ -18,7 +18,7 @@ select COUNT(*),u.signup_channel_id,c.channel_value from users u left join sign_
 select COUNT(*),u.signup_channel_id,c.channel_value from users u left join sign_up_channels c on u.signup_channel_id = c.id GROUP BY u.signup_channel_id;
 
 select COUNT(*),DATE_FORMAT(DATE_ADD(u.created_at,INTERVAL 8 HOUR),'%Y%m%d') as ymd_hm_time from users u left join sign_up_channels c on u.signup_channel_id = c.id where DATE_ADD(u.created_at,INTERVAL 8 HOUR) >= '2017-06-01' and DATE_ADD(u.created_at,INTERVAL 8 HOUR) < '2018-07-01' GROUP BY ymd_hm_time;
- */
+*/
 
 // @Title Get
 // @Description get 拉比兔:时间内注册用户渠道列表。type:d/m->日统计/月统计。query_date:YYYY-MM-DD
@@ -27,35 +27,35 @@ select COUNT(*),DATE_FORMAT(DATE_ADD(u.created_at,INTERVAL 8 HOUR),'%Y%m%d') as
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /user/list [get]
-func(self *RabbitUserSignupController) GetSignupUserCountList(){
+func (self *RabbitUserSignupController) GetSignupUserCountList() {
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,0,1)
+	queryDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 0, 1)
 	queryType := "d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
-
-		if queryType == "m" {//查询一月
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = query_date_tmp.AddDate(0,1,0)
-		}else {//查询一天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,0,1)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
+
+		if queryType == "m" { //查询一月
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = query_date_tmp.AddDate(0, 1, 0)
+		} else { //查询一天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), query_date_tmp.Day(), 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 0, 1)
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	list := models.GetRabbitSignupUserCountListByTime(queryDate, queryNextDate)
@@ -65,7 +65,7 @@ func(self *RabbitUserSignupController) GetSignupUserCountList(){
 	totalCount := int64(0)
 	timeAddCount := int64(0)
 
-	for _,each := range list{
+	for _, each := range list {
 
 		timeAddCount += each.Count
 
@@ -77,16 +77,15 @@ func(self *RabbitUserSignupController) GetSignupUserCountList(){
 	}
 
 	type Ret struct {
-		List             []*models.RabbitSignupUserItem `json:"list"`
-		TotalCount       int64                          `json:"total_count"`
-		TimeCount        int64                          `json:"time_count"`
+		List       []*models.RabbitSignupUserItem `json:"list"`
+		TotalCount int64                          `json:"total_count"`
+		TimeCount  int64                          `json:"time_count"`
 	}
 
-	self.Data["json"]=&Ret{List:list, TotalCount:totalCount, TimeCount:timeAddCount}
+	self.Data["json"] = &Ret{List: list, TotalCount: totalCount, TimeCount: timeAddCount}
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description get 拉比兔:时间内注册用户折线图。type:d/m。query_date:YYYY-MM-DD
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -94,40 +93,40 @@ func(self *RabbitUserSignupController) GetSignupUserCountList(){
 // @Param	type	query	string	true	"type"
 // @Success 200 {object} Ret
 // @router /user/line [get]
-func (self *RabbitUserSignupController) GetSignupUserCountLine(){
+func (self *RabbitUserSignupController) GetSignupUserCountLine() {
 
 	query_date := self.GetString("query_date")
 
 	query_type := self.GetString("type")
 
-	s := strings.Split(query_date,"-")
+	s := strings.Split(query_date, "-")
 	//--------------------------------------------日期处理
 	now := time.Now()
-	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0,0 ,0, time.Local)
-	queryNextDate := queryDate.AddDate(0,1,0)
+	queryDate := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.Local)
+	queryNextDate := queryDate.AddDate(0, 1, 0)
 	queryType := "d"
 	format := "%Y%m%d"
-	if query_type != ""{
+	if query_type != "" {
 		queryType = query_type
 	}
 
 	if len(s) == 3 {
-		query_date_tmp,_ := time.Parse("2006-01-02", query_date)
+		query_date_tmp, _ := time.Parse("2006-01-02", query_date)
 
-		if queryType == "m" {//查询多个月份
-			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryDate = queryDateTmp.AddDate(0,-12,0)
-			queryNextDate = queryDateTmp.AddDate(0,1,0)
+		if queryType == "m" { //查询多个月份
+			queryDateTmp := time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryDate = queryDateTmp.AddDate(0, -12, 0)
+			queryNextDate = queryDateTmp.AddDate(0, 1, 0)
 			format = "%Y%m"
-		}else {//查询一月份多天
-			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0,0 ,0, time.Local)
-			queryNextDate = queryDate.AddDate(0,1,0)
+		} else { //查询一月份多天
+			queryDate = time.Date(query_date_tmp.Year(), query_date_tmp.Month(), 1, 0, 0, 0, 0, time.Local)
+			queryNextDate = queryDate.AddDate(0, 1, 0)
 			format = "%Y%m%d"
 		}
 	}
 	//--------------------------------------------数据处理
 
-	beego.BeeLogger.Warn("%s,%s",queryDate.Format("2006-01-02"),queryNextDate.Format("2006-01-02"))
+	beego.BeeLogger.Warn("%s,%s", queryDate.Format("2006-01-02"), queryNextDate.Format("2006-01-02"))
 	//---------------------------------------------Times数据处理
 
 	var timeList []string
@@ -136,28 +135,28 @@ func (self *RabbitUserSignupController) GetSignupUserCountLine(){
 
 	list := models.GetRabbitSignupUserCountLine(queryDate, queryNextDate, format)
 
-	if queryType == "m"{
-		for i:=0 ;i < 13;i++ {
+	if queryType == "m" {
+		for i := 0; i < 13; i++ {
 
 			increaseDate := queryDate.AddDate(0, i, 0).Format("2006-01")
 			timeList = append(timeList, increaseDate)
 
-			findDate := queryDate.AddDate(0,i,0).Format("200601")
-			findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+			findDate := queryDate.AddDate(0, i, 0).Format("200601")
+			findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 			paiedPrice := models.ContainInItemListAndReturnItemCount(findDateInt, list)
 
 			countList = append(countList, paiedPrice)
 
 		}
-	}else{
-		for i:=0 ;i < queryNextDate.AddDate(0,0,-1).Day();i++ {
+	} else {
+		for i := 0; i < queryNextDate.AddDate(0, 0, -1).Day(); i++ {
 
 			increaseDate := queryDate.AddDate(0, 0, i).Format("01-02")
 			timeList = append(timeList, increaseDate)
 
-			findDate := queryDate.AddDate(0,0,i).Format("20060102")
-			findDateInt,_ := strconv.ParseInt(findDate, 0, 64)
+			findDate := queryDate.AddDate(0, 0, i).Format("20060102")
+			findDateInt, _ := strconv.ParseInt(findDate, 0, 64)
 
 			paiedPrice := models.ContainInItemListAndReturnItemCount(findDateInt, list)
 
@@ -166,11 +165,11 @@ func (self *RabbitUserSignupController) GetSignupUserCountLine(){
 	}
 
 	type Ret struct {
-		TimeList      []string                            `json:"time_list"`
-		CountList     []int64                             `json:"count_list"`
+		TimeList  []string `json:"time_list"`
+		CountList []int64  `json:"count_list"`
 	}
 
-	self.Data["json"]=&Ret{TimeList:timeList, CountList:countList}
+	self.Data["json"] = &Ret{TimeList: timeList, CountList: countList}
 	self.ServeJSON()
 
-}
+}

go/gopath/src/d5c-statement-api/controllers/response.go → go/gopath/src/fohow-statement-api/controllers/response.go


+ 2 - 3
go/gopath/src/d5c-statement-api/controllers/token.go

@@ -1,8 +1,8 @@
 package controllers
 
 import (
-	"d5c-statement-api/models"
 	"encoding/json"
+	"fohow-statement-api/models"
 
 	"github.com/astaxie/beego"
 
@@ -55,10 +55,9 @@ func (self *TokenController) Post() {
 func (self *TokenController) Delete() {
 
 	user := self.Ctx.Input.GetData("user").(models.User)
-	if user.Id != 0{
+	if user.Id != 0 {
 		models.DeleteUserTokenByUserId(user.Id)
 	}
 
 	self.ServeJSON()
 }
-

+ 14 - 16
go/gopath/src/d5c-statement-api/controllers/user.go

@@ -1,7 +1,7 @@
 package controllers
 
 import (
-	"d5c-statement-api/models"
+	"fohow-statement-api/models"
 	"github.com/astaxie/beego"
 )
 
@@ -10,7 +10,6 @@ type UserController struct {
 	beego.Controller
 }
 
-
 // @Title Get
 // @Description get user by uid
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -29,7 +28,6 @@ func (self *UserController) Get() {
 	self.ServeJSON()
 }
 
-
 // @Title Get
 // @Description get userPermission by user
 // @Param	Authorization	header 	string	true	"格式: Token XXXXXX"
@@ -40,38 +38,38 @@ func (self *UserController) Get() {
 func (self *UserController) GetPermissonList() {
 
 	user := self.Ctx.Input.GetData("user").(models.User)
-	if user.Id == 0{
+	if user.Id == 0 {
 		self.Ctx.Output.SetStatus(404)
 	}
-	menuType:= "menu"
-	firstPage:=""
+	menuType := "menu"
+	firstPage := ""
 	//获取用户菜单权限
-	permissonMenuList := models.GetPermissionsByUserIdAndType(user.Id , menuType, false)
+	permissonMenuList := models.GetPermissionsByUserIdAndType(user.Id, menuType, false)
 	for _, permissonMenu := range permissonMenuList {
-		if permissonMenu.Id == models.HOME_PAGE{
-			firstPage=permissonMenu.UrlPath
+		if permissonMenu.Id == models.HOME_PAGE {
+			firstPage = permissonMenu.UrlPath
 		}
 		parentId := permissonMenu.Id
-		permissonMenu.SecondaryList = models.GetPermissionsByParentId(parentId,user.Id)
+		permissonMenu.SecondaryList = models.GetPermissionsByParentId(parentId, user.Id)
 	}
 	//设置二级权限首次跳转页
 	for _, permissonMenu := range permissonMenuList {
-		if firstPage == ""{
+		if firstPage == "" {
 			for _, secondMenu := range permissonMenu.SecondaryList {
-				if firstPage== ""{
-					firstPage=secondMenu.UrlPath
+				if firstPage == "" {
+					firstPage = secondMenu.UrlPath
 					break
 				}
 
 			}
-		}else{
+		} else {
 			continue
 		}
 	}
 
 	type Ret struct {
-		FirstPage string `json:"first_page"`
-		PermissionList      []*models.WaIdPermission             `json:"permission_list"`
+		FirstPage      string                   `json:"first_page"`
+		PermissionList []*models.WaIdPermission `json:"permission_list"`
 	}
 	ret := new(Ret)
 	ret.PermissionList = permissonMenuList

+ 9 - 9
go/gopath/src/d5c-statement-api/filters/token_authentication_filter.go

@@ -3,12 +3,12 @@ package filters
 import (
 	"strings"
 
-	"github.com/astaxie/beego/context"
 	"github.com/astaxie/beego"
+	"github.com/astaxie/beego/context"
 
-	"d5c-statement-api/helpers"
-	"d5c-statement-api/models"
-	"d5c-statement-api/controllers"
+	"fohow-statement-api/controllers"
+	"fohow-statement-api/helpers"
+	"fohow-statement-api/models"
 )
 
 var NotRequiredAuthenticationPaths = []string{"/", "/v1/token", "/v1/token/"}
@@ -21,24 +21,24 @@ func abortWithJson(ctx *context.Context, status int, body string) {
 func TokenAuthenticationFilter(ctx *context.Context) {
 
 	// TODO 先判断路由是否匹配
-	beego.BeeLogger.Warn("request method : %s",ctx.Input.Method())
+	beego.BeeLogger.Warn("request method : %s", ctx.Input.Method())
 	method := ctx.Input.Method()
 	currentPath := ctx.Request.RequestURI
 	beego.BeeLogger.Warn("AuthenticationFilter: Current Path: %s", currentPath)
 	if method == "OPTIONS" {
 		return
 	}
-	if strings.Contains(currentPath,"/v1/bonus_gather/download"){
+	if strings.Contains(currentPath, "/v1/bonus_gather/download") {
 		return
 	}
-	if strings.Contains(currentPath,"/v1/static_data/list"){
+	if strings.Contains(currentPath, "/v1/static_data/list") {
 		return
 	}
-	if strings.Contains(currentPath,"/v1/static_data/static_data/list"){
+	if strings.Contains(currentPath, "/v1/static_data/static_data/list") {
 		return
 	}
 
-	if authenticationNotRequired, _ := helpers.Contain(currentPath, NotRequiredAuthenticationPaths); authenticationNotRequired && method !="DELETE" {
+	if authenticationNotRequired, _ := helpers.Contain(currentPath, NotRequiredAuthenticationPaths); authenticationNotRequired && method != "DELETE" {
 		return
 	}
 

go/gopath/src/d5c-statement-api/helpers/helpers.go → go/gopath/src/fohow-statement-api/helpers/helpers.go


+ 2 - 2
go/gopath/src/d5c-statement-api/main.go

@@ -1,8 +1,8 @@
 package main
 
 import (
-	"d5c-statement-api/filters"
-	_ "d5c-statement-api/routers"
+	"fohow-statement-api/filters"
+	_ "fohow-statement-api/routers"
 	"github.com/astaxie/beego"
 	"github.com/astaxie/beego/orm"
 	"github.com/astaxie/beego/plugins/cors"

+ 5 - 6
go/gopath/src/d5c-statement-api/models/cow_adopt.go

@@ -1,11 +1,11 @@
 package models
 
 import (
-	"github.com/astaxie/beego/orm"
 	"fmt"
+	"fohow-statement-api/cache"
 	"github.com/astaxie/beego"
+	"github.com/astaxie/beego/orm"
 	"time"
-	"d5c-statement-api/cache"
 )
 
 //养牛游戏领养牛总头数
@@ -45,6 +45,7 @@ func GetCowTotalCountByCowTable(useCache bool) int64 {
 	cache.Cache.Put(k, ret.Count, 2*time.Minute)
 	return ret.Count
 }
+
 //一段时间内新增领牛人数
 func GetAllCowAdoptCowCount(start, end time.Time, useCache bool) int64 {
 	k := fmt.Sprintf("models.GetAllCowAdoptCowCount(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -80,7 +81,6 @@ func GetAllCowAdoptCowCount(start, end time.Time, useCache bool) int64 {
 	return ret.Count
 }
 
-
 //一段时间内,不分有没有渠道的所有领养牛仔的数据
 func GetAllCowAdoptCowCountByDay(start, end time.Time, useCache bool) (dayFansList []*DayItem) {
 	k := fmt.Sprintf("models.GetAllCowAdoptCowCountByDay(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -104,7 +104,7 @@ func GetAllCowAdoptCowCountByDay(start, end time.Time, useCache bool) (dayFansLi
 			AND adopt_time < UNIX_TIMESTAMP('%s')
 		group by ymd;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&dayFansList)
 
@@ -117,7 +117,6 @@ func GetAllCowAdoptCowCountByDay(start, end time.Time, useCache bool) (dayFansLi
 	return dayFansList
 }
 
-
 //一段时间内,不分有没有渠道的所有领牛数据,分月
 func GetAllCowAdoptCowCountByMonth(start, end time.Time, useCache bool) (monthFansList []*MonthItem) {
 	k := fmt.Sprintf("models.GetAllCowAdoptCowCountByMonth(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -141,7 +140,7 @@ func GetAllCowAdoptCowCountByMonth(start, end time.Time, useCache bool) (monthFa
 			AND adopt_time < UNIX_TIMESTAMP('%s')
 		group by ym;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&monthFansList)
 

+ 1 - 1
go/gopath/src/d5c-statement-api/models/cow_game_record.go

@@ -313,4 +313,4 @@ func D5cGameRecordFeedReduceCountByTime(start, end time.Time) int64 {
 		return 0
 	}
 	return list.Count
-}
+}

+ 0 - 3
go/gopath/src/d5c-statement-api/models/cow_point_task.go

@@ -44,9 +44,6 @@ func GetCowDailySigninByDate(date time.Time) (list []*CowDailySignin) {
 	return list
 }
 
-
-
-
 //查询当日已完成任务的数量,按类别分组
 func GetCowFinishedTasksByDate(date int64) (continuity *CowFinishedTask, countdown *CowFinishedTask, interval *CowFinishedTask, article *CowFinishedTask, share *CowFinishedTask, vedio *CowFinishedTask, gap *CowFinishedTask) {
 	o := orm.NewOrm()

+ 61 - 72
go/gopath/src/d5c-statement-api/models/cow_punch_dt.go

@@ -2,33 +2,32 @@ package models
 
 import (
 	"fmt"
+	"fohow-statement-api/cache"
 	"github.com/astaxie/beego"
 	"github.com/astaxie/beego/orm"
-	"time"
-	"d5c-statement-api/cache"
 	"strconv"
+	"time"
 )
 
 type CowsDt struct {
-	Rank int64 `json:"rank"` //期次
-	RankName string `json:"rank_name"` //期次名称
-	Count       int64  `json:"count"`         //总人数
-	SucBl float64 `json:"bl"` //挑战成功百分比
+	Rank     int64   `json:"rank"`      //期次
+	RankName string  `json:"rank_name"` //期次名称
+	Count    int64   `json:"count"`     //总人数
+	SucBl    float64 `json:"bl"`        //挑战成功百分比
 }
 
-
 type CowPunchDt struct {
-	PunchId int64 `json:"punch_id"` //期次
-	PunchTitle string `json:"punch_title"` //期次名称
-	Food int64 `json:"food"` //报名消耗饲料
-	Mult int64 `json:"mult"` //补贴倍数
-	Count       int64  `json:"count"`         //总人数
-	SucCount    int64  `json:"success_count"`     //成功总人数
-	ExpiredCount int64 `json:"expired_count"` //过期总人数
-	FailCount int64 `json:"failed_count"` //失败总人数
-	FoodCount int64 `json:"food_count"` //瓜分饲料总额
-	TotalFood int64 `json:"total_food"` //实际瓜分总量
-	SucBl float64 `json:"success_bl"` //挑战成功百分比
+	PunchId      int64   `json:"punch_id"`      //期次
+	PunchTitle   string  `json:"punch_title"`   //期次名称
+	Food         int64   `json:"food"`          //报名消耗饲料
+	Mult         int64   `json:"mult"`          //补贴倍数
+	Count        int64   `json:"count"`         //总人数
+	SucCount     int64   `json:"success_count"` //成功总人数
+	ExpiredCount int64   `json:"expired_count"` //过期总人数
+	FailCount    int64   `json:"failed_count"`  //失败总人数
+	FoodCount    int64   `json:"food_count"`    //瓜分饲料总额
+	TotalFood    int64   `json:"total_food"`    //实际瓜分总量
+	SucBl        float64 `json:"success_bl"`    //挑战成功百分比
 }
 
 type SignedPunch struct {
@@ -37,14 +36,12 @@ type SignedPunch struct {
 	Tag string `json:"tag"` //任务
 }
 
-
 type DayPunchItem struct {
-	YearMonthDay  int64  `orm:"column(ymd)" json:"ymd"`
-	Count         int64  `orm:"column(c)"  json:"c"`
-	Day           int64  `orm:"column(d)"  json:"d"`
+	YearMonthDay int64 `orm:"column(ymd)" json:"ymd"`
+	Count        int64 `orm:"column(c)"  json:"c"`
+	Day          int64 `orm:"column(d)"  json:"d"`
 }
 
-
 //按期次统计所有打卡活动总量
 func GetCowPunchDtByDate() (list []*CowPunchDt) {
 
@@ -59,27 +56,26 @@ func GetCowPunchDtByDate() (list []*CowPunchDt) {
 		beego.BeeLogger.Warn("models.GetCowPunchDtByDate err[%s]", err)
 		return nil
 	}
-	for _,item := range list{
+	for _, item := range list {
 		//计算奖池总饲料
-		currentFood:=int64(item.Count*item.Food)
-		sendFood:=(currentFood*item.Mult/10)
-		item.TotalFood=currentFood+sendFood
+		currentFood := int64(item.Count * item.Food)
+		sendFood := (currentFood * item.Mult / 10)
+		item.TotalFood = currentFood + sendFood
 
-		sucCount:=GetSucCountByConfId(item.PunchId)
-		expiredCount:=GetExpiredCountByConfId(item.PunchId)
+		sucCount := GetSucCountByConfId(item.PunchId)
+		expiredCount := GetExpiredCountByConfId(item.PunchId)
 		//获取成功总数
-		item.ExpiredCount=expiredCount
-		item.SucCount=sucCount
-		item.FailCount=item.Count-sucCount
-		bl:=float64(sucCount)/float64(item.Count)*100
+		item.ExpiredCount = expiredCount
+		item.SucCount = sucCount
+		item.FailCount = item.Count - sucCount
+		bl := float64(sucCount) / float64(item.Count) * 100
 		bl, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", bl), 64)
-		item.SucBl=bl
+		item.SucBl = bl
 	}
 
 	return list
 }
 
-
 //获取当前期次过期总数量
 func GetExpiredCountByConfId(confId int64) int64 {
 	o := orm.NewOrm()
@@ -94,19 +90,18 @@ func GetExpiredCountByConfId(confId int64) int64 {
 	`
 
 	type Ret struct {
-		Count   int64   `json:"count"`
+		Count int64 `json:"count"`
 	}
 	var ret Ret
-	err := o.Raw(sql,confId,int64(3)).QueryRow(&ret)
+	err := o.Raw(sql, confId, int64(3)).QueryRow(&ret)
 
 	if err != nil {
-		beego.BeeLogger.Warn("models.GetSucCountByConfId(%d,%d) err[%s]",confId,err)
+		beego.BeeLogger.Warn("models.GetSucCountByConfId(%d,%d) err[%s]", confId, err)
 		return 0
 	}
 	return ret.Count
 }
 
-
 //获取当前期次成功总数量
 func GetSucCountByConfId(confId int64) int64 {
 	o := orm.NewOrm()
@@ -121,19 +116,18 @@ func GetSucCountByConfId(confId int64) int64 {
 	`
 
 	type Ret struct {
-		Count   int64   `json:"count"`
+		Count int64 `json:"count"`
 	}
 	var ret Ret
-	err := o.Raw(sql,confId,int64(2)).QueryRow(&ret)
+	err := o.Raw(sql, confId, int64(2)).QueryRow(&ret)
 
 	if err != nil {
-		beego.BeeLogger.Warn("models.GetSucCountByConfId(%d,%d) err[%s]",confId,err)
+		beego.BeeLogger.Warn("models.GetSucCountByConfId(%d,%d) err[%s]", confId, err)
 		return 0
 	}
 	return ret.Count
 }
 
-
 //按阶段统计所有养牛阶段总量
 func GetCowDtByRank() (list []*CowsDt) {
 
@@ -149,24 +143,24 @@ func GetCowDtByRank() (list []*CowsDt) {
 		return nil
 	}
 	var newCowsDtList []*CowsDt
-	allCount:=GetAllCountCow()
-	for _,item := range list{
-		if item.Rank==int64(8){
-			sucCount:=GetSucCountCow()
-			item.Count=item.Count-sucCount
+	allCount := GetAllCountCow()
+	for _, item := range list {
+		if item.Rank == int64(8) {
+			sucCount := GetSucCountCow()
+			item.Count = item.Count - sucCount
 		}
 
-		bl:=float64(item.Count)/float64(allCount)*100
+		bl := float64(item.Count) / float64(allCount) * 100
 		bl, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", bl), 64)
-		item.SucBl=bl
-		newCowsDtList=append(newCowsDtList,item)
+		item.SucBl = bl
+		newCowsDtList = append(newCowsDtList, item)
 	}
 
 	//统计养成牛总数,并加入该数组
-	cowItem:=GetSucCowDtByRank()
+	cowItem := GetSucCowDtByRank()
 
-	if cowItem!=nil{
-		newCowsDtList=append(newCowsDtList,cowItem)
+	if cowItem != nil {
+		newCowsDtList = append(newCowsDtList, cowItem)
 	}
 	return newCowsDtList
 }
@@ -179,17 +173,17 @@ func GetSucCowDtByRank() (item *CowsDt) {
 
 	sql := fmt.Sprintf("SELECT a.rank+1 as rank, count(1) AS count,b.name as rank_name from cows a left join cow_ranks b on a.rank=b.rank WHERE state=? GROUP BY rank ORDER BY a.rank ASC;")
 
-	 err := o.Raw(sql,int64(1)).QueryRow(&item)
+	err := o.Raw(sql, int64(1)).QueryRow(&item)
 
 	if err != nil {
 		beego.BeeLogger.Warn("models.GetCowPunchDtByDate err[%s]", err)
 		return nil
 	}
-	allCount:=GetAllCountCow()
-	bl:=float64(item.Count)/float64(allCount)*100
+	allCount := GetAllCountCow()
+	bl := float64(item.Count) / float64(allCount) * 100
 	bl, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", bl), 64)
-	item.SucBl=bl
-	item.RankName="养成人数"
+	item.SucBl = bl
+	item.RankName = "养成人数"
 	return item
 }
 
@@ -207,13 +201,13 @@ func GetSucCountCow() int64 {
 	`
 
 	type Ret struct {
-		Count   int64   `json:"count"`
+		Count int64 `json:"count"`
 	}
 	var ret Ret
-	err := o.Raw(sql,int64(1)).QueryRow(&ret)
+	err := o.Raw(sql, int64(1)).QueryRow(&ret)
 
 	if err != nil {
-		beego.BeeLogger.Warn("models.GetSucCountCow err[%s]",err)
+		beego.BeeLogger.Warn("models.GetSucCountCow err[%s]", err)
 		return 0
 	}
 	return ret.Count
@@ -233,21 +227,18 @@ func GetAllCountCow() int64 {
 	`
 
 	type Ret struct {
-		Count   int64   `json:"count"`
+		Count int64 `json:"count"`
 	}
 	var ret Ret
 	err := o.Raw(sql).QueryRow(&ret)
 
 	if err != nil {
-		beego.BeeLogger.Warn("models.GetSucCountCow err[%s]",err)
+		beego.BeeLogger.Warn("models.GetSucCountCow err[%s]", err)
 		return 0
 	}
 	return ret.Count
 }
 
-
-
-
 //按月查找购买总人数
 func GetPunchCount(start, end time.Time, useCache bool) int64 {
 	type Ret struct {
@@ -277,7 +268,6 @@ func GetPunchCount(start, end time.Time, useCache bool) int64 {
 	return ret.Count
 }
 
-
 //按天查找一段时间内会员报名的数据
 func GetAllPunchTotalByDay(start, end time.Time, useCache bool) (dayPunchList []*DayPunchItem) {
 	k := fmt.Sprintf("models.GetAllPunchTotalByDay(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -303,7 +293,7 @@ func GetAllPunchTotalByDay(start, end time.Time, useCache bool) (dayPunchList []
 		) a
 		group by ymd;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&dayPunchList)
 
@@ -315,14 +305,13 @@ func GetAllPunchTotalByDay(start, end time.Time, useCache bool) (dayPunchList []
 	return dayPunchList
 }
 
-
-func ContainsInDayPunchItemListStockTransferCount(ym int64, list []*DayPunchItem) int64{
+func ContainsInDayPunchItemListStockTransferCount(ym int64, list []*DayPunchItem) int64 {
 
 	if ym == 0 || list == nil || len(list) == 0 {
 		return 0
 	}
 
-	for _,each := range list {
+	for _, each := range list {
 
 		if each.YearMonthDay == ym {
 			return each.Count

+ 6 - 14
go/gopath/src/d5c-statement-api/models/cow_wx_user.go

@@ -1,11 +1,11 @@
 package models
 
 import (
-	"github.com/astaxie/beego/orm"
 	"fmt"
+	"fohow-statement-api/cache"
 	"github.com/astaxie/beego"
+	"github.com/astaxie/beego/orm"
 	"time"
-	"d5c-statement-api/cache"
 )
 
 //养牛游戏微信用户表的粉丝总数
@@ -48,7 +48,6 @@ func GetCowFansTotalCountByWxUserTable(useCache bool) int64 {
 	return ret.Count
 }
 
-
 //一段时间内粉丝关注人数,不分渠道
 func GetAllCowSubUserCount(start, end time.Time, useCache bool) int64 {
 	k := fmt.Sprintf("models.GetAllCowSubUserCount(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -121,7 +120,6 @@ func GetAllCowUnSubUserCount(start, end time.Time, useCache bool) int64 {
 	return ret.Count
 }
 
-
 //一段时间内,不分有没有渠道的所有粉丝关注数据,分日
 func GetAllCowSubUserCountByDay(start, end time.Time, useCache bool) (dayFansList []*DayItem) {
 	k := fmt.Sprintf("models.GetAllCowSubUserCountByDay(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -146,7 +144,7 @@ func GetAllCowSubUserCountByDay(start, end time.Time, useCache bool) (dayFansLis
 			AND subscribe=1
 		group by ymd;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&dayFansList)
 
@@ -183,7 +181,7 @@ func GetAllCowUnSubUserCountByDay(start, end time.Time, useCache bool) (dayFansL
 			AND subscribe=0
 		group by ymd;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m%d", "%d", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&dayFansList)
 
@@ -196,7 +194,6 @@ func GetAllCowUnSubUserCountByDay(start, end time.Time, useCache bool) (dayFansL
 	return dayFansList
 }
 
-
 //一段时间内,不分有没有渠道的所有粉丝关注数据,分月
 func GetAllCowSubUserCountByMonth(start, end time.Time, useCache bool) (monthFansList []*MonthItem) {
 	k := fmt.Sprintf("models.GetAllCowSubUserCountByMonth(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -221,7 +218,7 @@ func GetAllCowSubUserCountByMonth(start, end time.Time, useCache bool) (monthFan
 			AND subscribe_time < UNIX_TIMESTAMP('%s')
 		group by ym;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&monthFansList)
 
@@ -233,7 +230,6 @@ func GetAllCowSubUserCountByMonth(start, end time.Time, useCache bool) (monthFan
 	return monthFansList
 }
 
-
 //一段时间内,不分有没有渠道的所有粉丝取消关注数据,分月
 func GetAllCowUnSubUserCountByMonth(start, end time.Time, useCache bool) (monthFansList []*MonthItem) {
 	k := fmt.Sprintf("models.GetAllCowUnSubUserCountByMonth(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))
@@ -259,7 +255,7 @@ func GetAllCowUnSubUserCountByMonth(start, end time.Time, useCache bool) (monthF
 			AND unsubscribe_time < UNIX_TIMESTAMP('%s')
 		group by ym;
 	`
-	sql = fmt.Sprintf(sql,"%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
+	sql = fmt.Sprintf(sql, "%Y%m", "%m", start.Format("2006-01-02"), end.Format("2006-01-02"))
 
 	_, err := o.Raw(sql).QueryRows(&monthFansList)
 
@@ -271,10 +267,6 @@ func GetAllCowUnSubUserCountByMonth(start, end time.Time, useCache bool) (monthF
 	return monthFansList
 }
 
-
-
-
-
 //一段时间内,粉丝取消关注人数,不分渠道
 func GetAllCowOrderCount(start, end time.Time, useCache bool) int64 {
 	k := fmt.Sprintf("models.GetAllCowOrderCount(%s,%s)", start.Format("2006-01-02"), end.Format("2006-01-02"))

+ 0 - 0
go/gopath/src/d5c-statement-api/models/d5c_articles.go


Некоторые файлы не были показаны из-за большого количества измененных файлов