|
@@ -10,6 +10,7 @@ import (
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm"
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"log-server/global"
|
|
"log-server/global"
|
|
|
|
|
+ "log-server/model/log"
|
|
|
"log-server/model/task"
|
|
"log-server/model/task"
|
|
|
"log-server/model/task/control"
|
|
"log-server/model/task/control"
|
|
|
"log-server/model/task/request"
|
|
"log-server/model/task/request"
|
|
@@ -350,7 +351,7 @@ func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info requ
|
|
|
offset := info.PageSize * (info.Page - 1)
|
|
offset := info.PageSize * (info.Page - 1)
|
|
|
db := global.GVA_DB.Model(&task.GameTask{})
|
|
db := global.GVA_DB.Model(&task.GameTask{})
|
|
|
var apiList []task.GameTaskUnion
|
|
var apiList []task.GameTaskUnion
|
|
|
- db = db.Select("game_task.*, task_conf.add_fee_notice, task_conf.simulator_type")
|
|
|
|
|
|
|
+ db = db.Select("game_task.*, task_conf.add_fee_notice, task_conf.simulator_type, task_conf.push_pay_ratio")
|
|
|
db = db.Joins("left join task_conf on task_conf.task_id = game_task.task_id")
|
|
db = db.Joins("left join task_conf on task_conf.task_id = game_task.task_id")
|
|
|
db = db.Where("is_del = ?", -1)
|
|
db = db.Where("is_del = ?", -1)
|
|
|
if api.TaskName != "" {
|
|
if api.TaskName != "" {
|
|
@@ -433,6 +434,7 @@ func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info requ
|
|
|
apiReply.RetainedTargetH = apiInfo.RetainedTargetH
|
|
apiReply.RetainedTargetH = apiInfo.RetainedTargetH
|
|
|
apiReply.NewTargetH = apiInfo.NewTargetH
|
|
apiReply.NewTargetH = apiInfo.NewTargetH
|
|
|
apiReply.StopTime = apiInfo.StopTime.Format("2006-01-02 15:04:05")
|
|
apiReply.StopTime = apiInfo.StopTime.Format("2006-01-02 15:04:05")
|
|
|
|
|
+ apiReply.PushPayRatio = apiInfo.PushPayRatio
|
|
|
if apiInfo.Status == 1 {
|
|
if apiInfo.Status == 1 {
|
|
|
apiReply.StopTime = ""
|
|
apiReply.StopTime = ""
|
|
|
}
|
|
}
|
|
@@ -908,7 +910,7 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
|
|
|
n, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
|
|
n, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
|
|
|
_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, requestData.PayTarget-gameTask.PayTarget+n)
|
|
_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, requestData.PayTarget-gameTask.PayTarget+n)
|
|
|
}
|
|
}
|
|
|
- go s.common.FreeSendMsg(requestData.PayTarget-gameTask.PayTarget, requestData.PayTarget, taskData.TaskId, taskData.TaskName, taskData.User)
|
|
|
|
|
|
|
+ //go s.common.FreeSendMsg(requestData.PayTarget-gameTask.PayTarget, requestData.PayTarget, taskData.TaskId, taskData.TaskName, taskData.User)
|
|
|
//msg := "# 监控报警 " + time.Now().Format("2006-01-02 15:04:05")
|
|
//msg := "# 监控报警 " + time.Now().Format("2006-01-02 15:04:05")
|
|
|
//msg += "\n"
|
|
//msg += "\n"
|
|
|
//msg += "**" + taskData.User + "**"
|
|
//msg += "**" + taskData.User + "**"
|
|
@@ -1314,3 +1316,141 @@ func (apiService *GameTask) GetRetentionRatio(ctx context.Context, ratioRequest
|
|
|
err = json.Unmarshal(data, &gameRatio)
|
|
err = json.Unmarshal(data, &gameRatio)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func (apiService *GameTask) UploadGameCharacter(ctx context.Context, rqet request.UploadGameCharacterRequest) (err error) {
|
|
|
|
|
+ if rqet.Character == "" || rqet.GameId == 0 || rqet.Account == "" {
|
|
|
|
|
+ return errors.New("参数错误")
|
|
|
|
|
+ }
|
|
|
|
|
+ var entity log.GameCharacter
|
|
|
|
|
+ res := global.GVA_DB.Where("game_id = ? and account = ? and `character` = ?", rqet.GameId, rqet.Account, rqet.Character).First(&entity)
|
|
|
|
|
+ if res.Error != nil {
|
|
|
|
|
+ if res.Error == gorm.ErrRecordNotFound {
|
|
|
|
|
+ entity.Character = rqet.Character
|
|
|
|
|
+ entity.GameId = rqet.GameId
|
|
|
|
|
+ entity.Account = rqet.Account
|
|
|
|
|
+ global.GVA_DB.Save(&entity)
|
|
|
|
|
+ key := fmt.Sprintf("%d:%s:%s", rqet.GameId, rqet.Account, rqet.Character)
|
|
|
|
|
+ apiService.SetGameCharacter(ctx, key, entity)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (apiService *GameTask) UploadGameCharacter1(ctx context.Context, rqet request.UploadGameCharacterRequest) (err error) {
|
|
|
|
|
+ if rqet.Character == "" || rqet.GameId == 0 || rqet.Account == "" {
|
|
|
|
|
+ return errors.New("参数错误")
|
|
|
|
|
+ }
|
|
|
|
|
+ if !apiService.GetGameCharacter(ctx, rqet) {
|
|
|
|
|
+ var entity log.GameCharacter
|
|
|
|
|
+ entity.Character = rqet.Character
|
|
|
|
|
+ entity.GameId = rqet.GameId
|
|
|
|
|
+ entity.Account = rqet.Account
|
|
|
|
|
+ global.GVA_DB.Save(&entity)
|
|
|
|
|
+ key := fmt.Sprintf("%d:%s:%s", rqet.GameId, rqet.Account, rqet.Character)
|
|
|
|
|
+ apiService.SetGameCharacter(ctx, key, entity)
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (apiService *GameTask) SetGameCharacter(ctx context.Context, key string, entity log.GameCharacter) {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (apiService *GameTask) GetGameCharacter(ctx context.Context, rqet request.UploadGameCharacterRequest) (bl bool) {
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *GameTask) PushCompleteTaskData(date string) {
|
|
|
|
|
+ s.PushTaskToYl(date)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *GameTask) PushTaskToYl(date string) {
|
|
|
|
|
+ global.GVA_LOG.Warn("推送任务导api.yilian.run")
|
|
|
|
|
+ var apiList []response.GetGameTargetComplete
|
|
|
|
|
+ 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.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 not in(?)", []int{1000770})
|
|
|
|
|
+ db = db.Where("create_date = ?", date)
|
|
|
|
|
+
|
|
|
|
|
+ err := db.Find(&apiList).Error
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ global.GVA_LOG.Error("GameTaskTargetInfoPush select fail", zap.Error(err))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if len(apiList) < 1 {
|
|
|
|
|
+ global.GVA_LOG.Warn("GameTaskTargetInfoPush select not data")
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ var infos []request.GetGameTargetCompleteInfo
|
|
|
|
|
+ for _, api := range apiList {
|
|
|
|
|
+ var info request.GetGameTargetCompleteInfo
|
|
|
|
|
+ info.GameId = api.TaskId
|
|
|
|
|
+ info.GameName = api.TaskName
|
|
|
|
|
+ info.PayComplete = api.PayComplete + api.HandPayComplete
|
|
|
|
|
+ info.PayTarget = api.PayTarget
|
|
|
|
|
+ info.NewComplete = api.NewComplete + api.HandNewComplete
|
|
|
|
|
+ info.NewTarget = api.NewTarget
|
|
|
|
|
+ info.RetainedComplete = api.RetainedComplete + api.HandRetainedComplete
|
|
|
|
|
+ info.RetainedTarget = api.RetainedTarget
|
|
|
|
|
+ info.IsComplete = api.IsComplete
|
|
|
|
|
+ if api.IsComplete == -1 {
|
|
|
|
|
+ info.IsComplete = 0
|
|
|
|
|
+ }
|
|
|
|
|
+ info.Username = api.User
|
|
|
|
|
+ info.TheDate = api.CreateDate
|
|
|
|
|
+ infos = append(infos, info)
|
|
|
|
|
+ }
|
|
|
|
|
+ if len(infos) < 1 {
|
|
|
|
|
+ global.GVA_LOG.Warn("推送任务数据同步识别 GameTaskTargetInfoPush")
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ _, err = s.RequestControlBackend(infos)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ global.GVA_LOG.Error("推送任务数据同步识别", zap.Error(err))
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *GameTask) RequestControlBackend(requestData []request.GetGameTargetCompleteInfo) (d string, err error) {
|
|
|
|
|
+ //url := global.GVA_CONFIG.ExtranetDomain.Control + CreateTaskUrl
|
|
|
|
|
+ url := global.GVA_CONFIG.ExtranetDomain.YlControl + "/bpm_api/data_optimize"
|
|
|
|
|
+ requestMap := map[string]interface{}{
|
|
|
|
|
+ "jsonData": requestData,
|
|
|
|
|
+ }
|
|
|
|
|
+ data, code, err := utils.HttpPostReplyCode2(url, requestMap)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ global.GVA_LOG.Error("RequestControlBackend fail", zap.Error(err))
|
|
|
|
|
+ }
|
|
|
|
|
+ if code != 200 {
|
|
|
|
|
+ msg := fmt.Sprintf("status:%d,data:%s", code, string(data))
|
|
|
|
|
+ global.GVA_LOG.Warn(msg)
|
|
|
|
|
+ return string(data), errors.New(string(data))
|
|
|
|
|
+ }
|
|
|
|
|
+ msg := fmt.Sprintf("status:%d,data:%s", code, string(data))
|
|
|
|
|
+ global.GVA_LOG.Warn(msg)
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *GameTask) GetWindowTask(pcCode string, id int) (list interface{}, d string, err error) {
|
|
|
|
|
+ //url := global.GVA_CONFIG.ExtranetDomain.Control + CreateTaskUrl
|
|
|
|
|
+ //url := global.GVA_CONFIG.ExtranetDomain.YlControl + "/bpm_api/data_optimize"
|
|
|
|
|
+ //requestMap := map[string]interface{}{
|
|
|
|
|
+ // "jsonData": requestData,
|
|
|
|
|
+ //}
|
|
|
|
|
+ //data, code, err := utils.HttpPostReplyCode2(url, requestMap)
|
|
|
|
|
+ //if err != nil {
|
|
|
|
|
+ // global.GVA_LOG.Error("RequestControlBackend fail", zap.Error(err))
|
|
|
|
|
+ //}
|
|
|
|
|
+ //if code != 200 {
|
|
|
|
|
+ // msg := fmt.Sprintf("status:%d,data:%s", code, string(data))
|
|
|
|
|
+ // global.GVA_LOG.Warn(msg)
|
|
|
|
|
+ // return string(data), errors.New(string(data))
|
|
|
|
|
+ //}
|
|
|
|
|
+ //msg := fmt.Sprintf("status:%d,data:%s", code, string(data))
|
|
|
|
|
+ //global.GVA_LOG.Warn(msg)
|
|
|
|
|
+ return
|
|
|
|
|
+}
|