|
|
@@ -318,6 +318,104 @@ func (apiService *GameTask) GetGameTaskInfoList(api task.GameTask, info request.
|
|
|
return apisReply, option, total, err
|
|
|
}
|
|
|
|
|
|
+//获取启用状态的任务
|
|
|
+func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info request.PageInfo, order string, desc bool) (list interface{}, options interface{}, total int64, err error) {
|
|
|
+ limit := info.PageSize
|
|
|
+ offset := info.PageSize * (info.Page - 1)
|
|
|
+ db := global.GVA_DB.Model(&task.GameTask{})
|
|
|
+ var apiList []task.GameTaskUnion
|
|
|
+ db = db.Select("game_task.*, task_conf.add_fee_notice")
|
|
|
+ db = db.Joins("left join task_conf on task_conf.task_id = game_task.task_id")
|
|
|
+ db = db.Where("is_del = ?", -1)
|
|
|
+ if api.TaskName != "" {
|
|
|
+ db = db.Where("task_name LIKE ?", "%"+api.TaskName+"%")
|
|
|
+ }
|
|
|
+
|
|
|
+ if api.User != "" {
|
|
|
+ db = db.Where("game_task.user LIKE ?", "%"+api.User+"%")
|
|
|
+ }
|
|
|
+
|
|
|
+ if api.Status != 0 {
|
|
|
+ db = db.Where("status = ?", api.Status)
|
|
|
+ }
|
|
|
+
|
|
|
+ if api.TaskId != 0 {
|
|
|
+ db = db.Where("task_id = ?", api.TaskId)
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取启用状态的任务
|
|
|
+ db = db.Where("status = 1")
|
|
|
+ err = db.Count(&total).Error
|
|
|
+
|
|
|
+ //查找厂商名称,登录类型名称、账号类型名称
|
|
|
+ option := task.Option{}
|
|
|
+ global.GVA_DB.Table("game_channel").Select("id", "channel_name").Find(&option.GamePortOptions)
|
|
|
+ global.GVA_DB.Table("login_type").Select("id", "login_name").Find(&option.LoginTypeOptions)
|
|
|
+ global.GVA_DB.Table("account_type").Select("id", "type_name").Find(&option.AccountTypeOptions)
|
|
|
+ global.GVA_DB.Table("game_list").Select("id", "game_name").Find(&option.GameListOptions)
|
|
|
+ //fmt.Println(option)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return apiList, option, total, err
|
|
|
+ } else {
|
|
|
+ db = db.Limit(limit).Offset(offset)
|
|
|
+ if order != "" {
|
|
|
+ var OrderStr string
|
|
|
+ // 设置有效排序key 防止sql注入
|
|
|
+ // 感谢 Tom4t0 提交漏洞信息
|
|
|
+ orderMap := make(map[string]bool, 4)
|
|
|
+ orderMap["id"] = true
|
|
|
+ orderMap["task_name"] = true
|
|
|
+ orderMap["user"] = true
|
|
|
+ if orderMap[order] {
|
|
|
+ if desc {
|
|
|
+ OrderStr = order + " desc"
|
|
|
+ } else {
|
|
|
+ OrderStr = order
|
|
|
+ }
|
|
|
+ } else { // didn't matched any order key in `orderMap`
|
|
|
+ err = fmt.Errorf("非法的排序字段: %v", order)
|
|
|
+ return apiList, option, total, err
|
|
|
+ }
|
|
|
+
|
|
|
+ err = db.Order(OrderStr).Find(&apiList).Error
|
|
|
+ } else {
|
|
|
+ err = db.Order("id desc").Find(&apiList).Error
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var apisReply []*response.GetGameTaskListUnionReply
|
|
|
+ if len(apiList) != 0 {
|
|
|
+ for _, apiInfo := range apiList {
|
|
|
+ var apiReply = new(response.GetGameTaskListUnionReply)
|
|
|
+ apiReply.Status = apiInfo.Status
|
|
|
+ apiReply.TaskId = apiInfo.TaskId
|
|
|
+ apiReply.TaskName = apiInfo.TaskName
|
|
|
+ apiReply.AddFeeNotice = apiInfo.AddFeeNotice
|
|
|
+ apiReply.GamePort = GamePort[apiInfo.GamePortId]
|
|
|
+ apiReply.AccountType = AccountType[apiInfo.AccountType]
|
|
|
+ apiReply.LoginMethod = LoginMethod[apiInfo.LoginMethod]
|
|
|
+ apiReply.CreateTime = apiInfo.CreateTime.Format("2006-01-02 15:04:05")
|
|
|
+ apiReply.User = apiInfo.User
|
|
|
+ apiReply.Date = apiInfo.Date.Format("2006-01-02")
|
|
|
+ apiReply.GameName = apiInfo.GameName
|
|
|
+ apiReply.UpdateTime = apiInfo.UpdateTime.Format("2006-01-02 15:04:05")
|
|
|
+ apiReply.NewTarget = apiInfo.NewTarget
|
|
|
+ apiReply.PayTarget = apiInfo.PayTarget
|
|
|
+ apiReply.RetainedTarget = apiInfo.RetainedTarget
|
|
|
+ apiReply.PayPrice = apiInfo.PayPrice
|
|
|
+ apiReply.RetainedTargetH = apiInfo.RetainedTargetH
|
|
|
+ apiReply.NewTargetH = apiInfo.NewTargetH
|
|
|
+ apiReply.StopTime = apiInfo.StopTime.Format("2006-01-02 15:04:05")
|
|
|
+ if apiInfo.Status == 1 {
|
|
|
+ apiReply.StopTime = ""
|
|
|
+ }
|
|
|
+ apisReply = append(apisReply, apiReply)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return apisReply, option, total, err
|
|
|
+}
|
|
|
+
|
|
|
//@author: [piexlmax](https://github.com/piexlmax)
|
|
|
//@function: GetGameTaskById
|
|
|
//@description: 根据id获取GameTask
|
|
|
@@ -523,7 +621,7 @@ func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetComp
|
|
|
db := global.GVA_DB.Table("game_target_complete gtc")
|
|
|
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.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total")
|
|
|
+ "gtc.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total, gtc.aupr, gtc.total_amount")
|
|
|
db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
|
|
|
//db = db.Where("gtc.create_date = ?", api.CreateDate)
|
|
|
db = db.Where("create_date >= ? and create_date <= ?", startDate, endDate)
|
|
|
@@ -652,7 +750,7 @@ func (s *GameTask) QQCardUsedLogUploadXjf(gameId int, account string, money int)
|
|
|
func (c *GameTask) GetGameTaskTargetById(id int, date string) (api response.GetGameTargetComplete, err error) {
|
|
|
db := global.GVA_DB.Table("game_target_complete gtc")
|
|
|
db = db.Select("gtc.task_id,gt.task_name,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.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete, gtc.aupr, gtc.total_amount")
|
|
|
db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
|
|
|
db = db.Where("gtc.task_id = ?", id)
|
|
|
db = db.Where("gtc.create_date = ?", date)
|
|
|
@@ -683,6 +781,8 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
|
|
|
"hand_retained_complete": requestData.HandRetainedComplete + gameTask.HandRetainedComplete,
|
|
|
"hand_pay_complete": requestData.HandPayComplete + gameTask.HandPayComplete,
|
|
|
"hand_amount_total": requestData.HandAmountTotal + gameTask.HandAmountTotal,
|
|
|
+ "aupr": requestData.Aupr,
|
|
|
+ "total_amount": requestData.TotalAmount,
|
|
|
}
|
|
|
date := time.Now().Format("2006-01-02")
|
|
|
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
|
|
|
@@ -782,7 +882,7 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
|
|
|
msg += "**" + taskData.User + "**"
|
|
|
msg += "\n"
|
|
|
msg += taskData.TaskName + ", 付费目标改为" + strconv.Itoa(requestData.PayTarget)
|
|
|
- url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b"
|
|
|
+ url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b111"
|
|
|
var sendData SendMsg
|
|
|
sendData.MsgType = "markdown"
|
|
|
sendData.Markdown.Content = msg
|