|
@@ -5,6 +5,7 @@ import (
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"errors"
|
|
"errors"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "github.com/xuri/excelize/v2"
|
|
|
"go.uber.org/zap"
|
|
"go.uber.org/zap"
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm"
|
|
|
"log-server/global"
|
|
"log-server/global"
|
|
@@ -510,19 +511,23 @@ func (s *GameTask) DeleteGameTask(api request.GameTaskRequest) (err error) {
|
|
|
//@description: 分页获取数据,
|
|
//@description: 分页获取数据,
|
|
|
//@param: card card.Card, info request.PageInfo, order string, desc bool
|
|
//@param: card card.Card, info request.PageInfo, order string, desc bool
|
|
|
//@return: list interface{}, total int64, err error
|
|
//@return: list interface{}, total int64, err error
|
|
|
-func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetCompleteRequest, info request.PageInfo, order string, desc bool, isTx bool) (list interface{}, total int64, err error) {
|
|
|
|
|
|
|
+func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetCompleteRequest, info request.PageInfo, order string, desc bool, isTx bool) (apiList []response.GetGameTargetComplete, total int64, err error) {
|
|
|
limit := info.PageSize
|
|
limit := info.PageSize
|
|
|
offset := info.PageSize * (info.Page - 1)
|
|
offset := info.PageSize * (info.Page - 1)
|
|
|
- if api.CreateDate == "" {
|
|
|
|
|
- api.CreateDate = time.Now().Format("2006-01-02")
|
|
|
|
|
|
|
+ startDate := time.Now().Format("2006-01-02")
|
|
|
|
|
+ endDate := time.Now().Format("2006-01-02")
|
|
|
|
|
+ if len(api.Date) == 2 {
|
|
|
|
|
+ startDate = api.Date[0]
|
|
|
|
|
+ endDate = api.Date[1]
|
|
|
}
|
|
}
|
|
|
db := global.GVA_DB.Table("game_target_complete gtc")
|
|
db := global.GVA_DB.Table("game_target_complete gtc")
|
|
|
- db = db.Select("gtc.id,gtc.task_id,gt.task_name,gtc.new_target,gt.login_method,gt.user,gtc.pay_target,gtc.retained_target," +
|
|
|
|
|
|
|
+ db = db.Select("gtc.id,gtc.task_id,gt.task_name,gt.game_id_xmy,gtc.new_target,gt.login_method,gt.user,gtc.pay_target,gtc.retained_target," +
|
|
|
"gtc.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete,gtc.hand_new_complete," +
|
|
"gtc.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete,gtc.hand_new_complete," +
|
|
|
"gtc.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total")
|
|
"gtc.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total")
|
|
|
db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
|
|
db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
|
|
|
- db = db.Where("gtc.create_date = ?", api.CreateDate)
|
|
|
|
|
- var apiList []response.GetGameTargetComplete
|
|
|
|
|
|
|
+ //db = db.Where("gtc.create_date = ?", api.CreateDate)
|
|
|
|
|
+ db = db.Where("create_date >= ? and create_date <= ?", startDate, endDate)
|
|
|
|
|
+
|
|
|
if api.TaskName != "" {
|
|
if api.TaskName != "" {
|
|
|
db = db.Where("gt.task_name LIKE ?", "%"+api.TaskName+"%")
|
|
db = db.Where("gt.task_name LIKE ?", "%"+api.TaskName+"%")
|
|
|
}
|
|
}
|
|
@@ -532,6 +537,9 @@ func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetComp
|
|
|
if isTx {
|
|
if isTx {
|
|
|
db = db.Where("gt.game_port_id = ?", 1)
|
|
db = db.Where("gt.game_port_id = ?", 1)
|
|
|
}
|
|
}
|
|
|
|
|
+ if api.GamePortId != 0 {
|
|
|
|
|
+ db = db.Where("gt.game_port_id = ?", api.GamePortId)
|
|
|
|
|
+ }
|
|
|
if api.TaskId != 0 {
|
|
if api.TaskId != 0 {
|
|
|
db = db.Where("gtc.task_id = ?", api.TaskId)
|
|
db = db.Where("gtc.task_id = ?", api.TaskId)
|
|
|
}
|
|
}
|
|
@@ -573,10 +581,8 @@ func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetComp
|
|
|
loginMethod, _ := strconv.Atoi(api.LoginMethod)
|
|
loginMethod, _ := strconv.Atoi(api.LoginMethod)
|
|
|
apiList[i].LoginMethod = LoginMethod[loginMethod]
|
|
apiList[i].LoginMethod = LoginMethod[loginMethod]
|
|
|
apiList[i].CreateDate = date[0]
|
|
apiList[i].CreateDate = date[0]
|
|
|
- apiList[i].RetainedComplete = api.RetainedComplete
|
|
|
|
|
- apiList[i].PayComplete = api.PayComplete
|
|
|
|
|
- apiList[i].NewComplete = api.NewComplete
|
|
|
|
|
- apiList[i].Amount = api.Amount
|
|
|
|
|
|
|
+ apiList[i].NewComplete = api.NewComplete + api.HandNewComplete
|
|
|
|
|
+ apiList[i].RetainedComplete = api.RetainedComplete + api.HandRetainedComplete
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return apiList, total, err
|
|
return apiList, total, err
|
|
@@ -793,8 +799,8 @@ func (s *GameTask) TargetStatistics(date string) (apiList []control.TargetStatis
|
|
|
targetStatistics.TargetActive = target.RetainedTarget
|
|
targetStatistics.TargetActive = target.RetainedTarget
|
|
|
targetStatistics.TargetPay = target.PayTarget
|
|
targetStatistics.TargetPay = target.PayTarget
|
|
|
targetStatistics.TargetNew = target.NewTarget
|
|
targetStatistics.TargetNew = target.NewTarget
|
|
|
- targetStatistics.CompleteNew = target.NewComplete
|
|
|
|
|
- targetStatistics.CompleteActive = target.RetainedComplete
|
|
|
|
|
|
|
+ targetStatistics.CompleteNew = target.NewComplete + target.HandNewComplete
|
|
|
|
|
+ targetStatistics.CompleteActive = target.RetainedComplete + target.HandRetainedComplete
|
|
|
targetStatistics.CompletePay = target.PayComplete
|
|
targetStatistics.CompletePay = target.PayComplete
|
|
|
targetStatistics.XmyId = target.GameIdXmy
|
|
targetStatistics.XmyId = target.GameIdXmy
|
|
|
targetStatistics.QqId = target.TxGameId
|
|
targetStatistics.QqId = target.TxGameId
|
|
@@ -1004,3 +1010,66 @@ func (s *GameTask) GetFeeAccountList(taskId int) (fa []FeeAccount, err error) {
|
|
|
}
|
|
}
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func (exa *GameTask) TaskStatisticsList2Excel(infoList []response.GetGameTargetComplete, filePath string) error {
|
|
|
|
|
+ excel := excelize.NewFile()
|
|
|
|
|
+ excel.SetSheetRow("Sheet1", "A1", &[]string{
|
|
|
|
|
+ "日期",
|
|
|
|
|
+ "任务id",
|
|
|
|
|
+ "任务名称",
|
|
|
|
|
+ "登录方式",
|
|
|
|
|
+ "目标新增",
|
|
|
|
|
+ "目标付费",
|
|
|
|
|
+ "目标活跃",
|
|
|
|
|
+ "完成新增",
|
|
|
|
|
+ "完成付费",
|
|
|
|
|
+ "完成活跃",
|
|
|
|
|
+ "未完新增",
|
|
|
|
|
+ "未完付费",
|
|
|
|
|
+ "未完活跃",
|
|
|
|
|
+ "负责人",
|
|
|
|
|
+ "完成",
|
|
|
|
|
+ "手动付费",
|
|
|
|
|
+ "手动付费金额",
|
|
|
|
|
+ "付费流水"})
|
|
|
|
|
+ for i, statisticsLog := range infoList {
|
|
|
|
|
+ axis := fmt.Sprintf("A%d", i+2)
|
|
|
|
|
+ newNo := 0
|
|
|
|
|
+ retainedNo := 0
|
|
|
|
|
+ payNo := 0
|
|
|
|
|
+ isComplete := "是"
|
|
|
|
|
+ if statisticsLog.IsComplete == -1 {
|
|
|
|
|
+ isComplete = "否"
|
|
|
|
|
+ }
|
|
|
|
|
+ if statisticsLog.PayComplete < statisticsLog.PayTarget {
|
|
|
|
|
+ payNo = statisticsLog.PayTarget - statisticsLog.PayComplete
|
|
|
|
|
+ }
|
|
|
|
|
+ if statisticsLog.RetainedComplete+statisticsLog.HandRetainedComplete < statisticsLog.RetainedTarget {
|
|
|
|
|
+ retainedNo = statisticsLog.RetainedTarget - statisticsLog.RetainedComplete - statisticsLog.HandRetainedComplete
|
|
|
|
|
+ }
|
|
|
|
|
+ if statisticsLog.NewComplete+statisticsLog.HandNewComplete < statisticsLog.NewTarget {
|
|
|
|
|
+ newNo = statisticsLog.NewTarget - statisticsLog.NewComplete - statisticsLog.HandNewComplete
|
|
|
|
|
+ }
|
|
|
|
|
+ excel.SetSheetRow("Sheet1", axis, &[]interface{}{
|
|
|
|
|
+ statisticsLog.CreateDate[:10],
|
|
|
|
|
+ statisticsLog.TaskId,
|
|
|
|
|
+ statisticsLog.TaskName,
|
|
|
|
|
+ statisticsLog.LoginMethod,
|
|
|
|
|
+ statisticsLog.NewTarget,
|
|
|
|
|
+ statisticsLog.PayTarget,
|
|
|
|
|
+ statisticsLog.RetainedTarget,
|
|
|
|
|
+ statisticsLog.NewComplete + statisticsLog.NewComplete,
|
|
|
|
|
+ statisticsLog.PayComplete,
|
|
|
|
|
+ statisticsLog.RetainedComplete + statisticsLog.HandRetainedComplete,
|
|
|
|
|
+ newNo,
|
|
|
|
|
+ payNo,
|
|
|
|
|
+ retainedNo,
|
|
|
|
|
+ statisticsLog.User,
|
|
|
|
|
+ isComplete,
|
|
|
|
|
+ statisticsLog.HandPayComplete,
|
|
|
|
|
+ statisticsLog.HandAmountTotal,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ err := excel.SaveAs(filePath)
|
|
|
|
|
+ return err
|
|
|
|
|
+}
|