From 8ce440c77da2a54581d1cc77789f34f7ba7c823d Mon Sep 17 00:00:00 2001 From: 陆恒 Date: Thu, 6 Aug 2020 17:05:03 +0800 Subject: [PATCH] 新增枪火联盟对应功能 --- src/HttpServer/jsonconf/GunLevelRewardConfig.json | 422 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/HttpServer/jsonconf/OnlineRewardConfig.json | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/HttpServer/jsonconf/WinLevelRewardConfig.json | 524 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/HttpServer/jsonconf/jsonconf.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/HttpServer/logic/constdef.go | 2 +- src/HttpServer/logic/datadef.go | 5 ++--- src/HttpServer/logic/function.go | 2 +- src/HttpServer/logic/httpserver.go | 20 ++++++++++---------- src/HttpServer/logic/logic.go | 56 +++++++++++++++++++++++++++++++++----------------------- 9 files changed, 1093 insertions(+), 38 deletions(-) create mode 100644 src/HttpServer/jsonconf/GunLevelRewardConfig.json create mode 100644 src/HttpServer/jsonconf/OnlineRewardConfig.json create mode 100644 src/HttpServer/jsonconf/WinLevelRewardConfig.json diff --git a/src/HttpServer/jsonconf/GunLevelRewardConfig.json b/src/HttpServer/jsonconf/GunLevelRewardConfig.json new file mode 100644 index 0000000..969e465 --- /dev/null +++ b/src/HttpServer/jsonconf/GunLevelRewardConfig.json @@ -0,0 +1,422 @@ +[ + { + "id": 1, + "gun_level": 1, + "Luckybag": 3.53, + "RewardVideo": 1 + }, + { + "id": 2, + "gun_level": 2, + "Luckybag": 2.61, + "RewardVideo": 1 + }, + { + "id": 3, + "gun_level": 3, + "Luckybag": 3.5, + "RewardVideo": 1 + }, + { + "id": 4, + "gun_level": 4, + "Luckybag": 3.82, + "RewardVideo": 1 + }, + { + "id": 5, + "gun_level": 5, + "Luckybag": 3.78, + "RewardVideo": 1 + }, + { + "id": 6, + "gun_level": 6, + "Luckybag": 1.73, + "RewardVideo": 1 + }, + { + "id": 7, + "gun_level": 7, + "Luckybag": 1.65, + "RewardVideo": 1 + }, + { + "id": 8, + "gun_level": 8, + "Luckybag": 2.3, + "RewardVideo": 1 + }, + { + "id": 9, + "gun_level": 9, + "Luckybag": 1.78, + "RewardVideo": 1 + }, + { + "id": 10, + "gun_level": 10, + "Luckybag": 1.14, + "RewardVideo": 1 + }, + { + "id": 11, + "gun_level": 11, + "Luckybag": 1.3, + "RewardVideo": 1 + }, + { + "id": 12, + "gun_level": 12, + "Luckybag": 1.23, + "RewardVideo": 1 + }, + { + "id": 13, + "gun_level": 13, + "Luckybag": 1.67, + "RewardVideo": 1 + }, + { + "id": 14, + "gun_level": 14, + "Luckybag": 1.68, + "RewardVideo": 1 + }, + { + "id": 15, + "gun_level": 15, + "Luckybag": 1.3, + "RewardVideo": 1 + }, + { + "id": 16, + "gun_level": 16, + "Luckybag": 1.09, + "RewardVideo": 1 + }, + { + "id": 17, + "gun_level": 17, + "Luckybag": 1.31, + "RewardVideo": 1 + }, + { + "id": 18, + "gun_level": 18, + "Luckybag": 1.07, + "RewardVideo": 1 + }, + { + "id": 19, + "gun_level": 19, + "Luckybag": 1.38, + "RewardVideo": 1 + }, + { + "id": 20, + "gun_level": 20, + "Luckybag": 1.02, + "RewardVideo": 1 + }, + { + "id": 21, + "gun_level": 21, + "Luckybag": 0.93, + "RewardVideo": 1 + }, + { + "id": 22, + "gun_level": 22, + "Luckybag": 0.95, + "RewardVideo": 1 + }, + { + "id": 23, + "gun_level": 23, + "Luckybag": 1.16, + "RewardVideo": 1 + }, + { + "id": 24, + "gun_level": 24, + "Luckybag": 1.26, + "RewardVideo": 1 + }, + { + "id": 25, + "gun_level": 25, + "Luckybag": 1.05, + "RewardVideo": 1 + }, + { + "id": 26, + "gun_level": 26, + "Luckybag": 1.13, + "RewardVideo": 1 + }, + { + "id": 27, + "gun_level": 27, + "Luckybag": 0.95, + "RewardVideo": 1 + }, + { + "id": 28, + "gun_level": 28, + "Luckybag": 1.01, + "RewardVideo": 1 + }, + { + "id": 29, + "gun_level": 29, + "Luckybag": 0.71, + "RewardVideo": 1 + }, + { + "id": 30, + "gun_level": 30, + "Luckybag": 0.84, + "RewardVideo": 1 + }, + { + "id": 31, + "gun_level": 31, + "Luckybag": 0.83, + "RewardVideo": 1 + }, + { + "id": 32, + "gun_level": 32, + "Luckybag": 1.07, + "RewardVideo": 1 + }, + { + "id": 33, + "gun_level": 33, + "Luckybag": 0.76, + "RewardVideo": 1 + }, + { + "id": 34, + "gun_level": 34, + "Luckybag": 0.82, + "RewardVideo": 1 + }, + { + "id": 35, + "gun_level": 35, + "Luckybag": 0.77, + "RewardVideo": 1 + }, + { + "id": 36, + "gun_level": 36, + "Luckybag": 0.9, + "RewardVideo": 1 + }, + { + "id": 37, + "gun_level": 37, + "Luckybag": 0.63, + "RewardVideo": 1 + }, + { + "id": 38, + "gun_level": 38, + "Luckybag": 0.91, + "RewardVideo": 1 + }, + { + "id": 39, + "gun_level": 39, + "Luckybag": 0.72, + "RewardVideo": 1 + }, + { + "id": 40, + "gun_level": 40, + "Luckybag": 0.79, + "RewardVideo": 1 + }, + { + "id": 41, + "gun_level": 41, + "Luckybag": 0.92, + "RewardVideo": 1 + }, + { + "id": 42, + "gun_level": 42, + "Luckybag": 0.78, + "RewardVideo": 1 + }, + { + "id": 43, + "gun_level": 43, + "Luckybag": 0.89, + "RewardVideo": 1 + }, + { + "id": 44, + "gun_level": 44, + "Luckybag": 0.8, + "RewardVideo": 1 + }, + { + "id": 45, + "gun_level": 45, + "Luckybag": 0.64, + "RewardVideo": 1 + }, + { + "id": 46, + "gun_level": 46, + "Luckybag": 0.56, + "RewardVideo": 1 + }, + { + "id": 47, + "gun_level": 47, + "Luckybag": 0.6, + "RewardVideo": 1 + }, + { + "id": 48, + "gun_level": 48, + "Luckybag": 0.63, + "RewardVideo": 1 + }, + { + "id": 49, + "gun_level": 49, + "Luckybag": 0.67, + "RewardVideo": 1 + }, + { + "id": 50, + "gun_level": 50, + "Luckybag": 0.67, + "RewardVideo": 1 + }, + { + "id": 51, + "gun_level": 51, + "Luckybag": 0.72, + "RewardVideo": 1 + }, + { + "id": 52, + "gun_level": 52, + "Luckybag": 0.78, + "RewardVideo": 1 + }, + { + "id": 53, + "gun_level": 53, + "Luckybag": 0.74, + "RewardVideo": 1 + }, + { + "id": 54, + "gun_level": 54, + "Luckybag": 0.63, + "RewardVideo": 1 + }, + { + "id": 55, + "gun_level": 55, + "Luckybag": 0.64, + "RewardVideo": 1 + }, + { + "id": 56, + "gun_level": 56, + "Luckybag": 0.51, + "RewardVideo": 1 + }, + { + "id": 57, + "gun_level": 57, + "Luckybag": 0.58, + "RewardVideo": 1 + }, + { + "id": 58, + "gun_level": 58, + "Luckybag": 0.61, + "RewardVideo": 1 + }, + { + "id": 59, + "gun_level": 59, + "Luckybag": 0.7, + "RewardVideo": 1 + }, + { + "id": 60, + "gun_level": 60, + "Luckybag": 0.7, + "RewardVideo": 1 + }, + { + "id": 61, + "gun_level": 61, + "Luckybag": 0.64, + "RewardVideo": 1 + }, + { + "id": 62, + "gun_level": 62, + "Luckybag": 0.61, + "RewardVideo": 1 + }, + { + "id": 63, + "gun_level": 63, + "Luckybag": 0.7, + "RewardVideo": 1 + }, + { + "id": 64, + "gun_level": 64, + "Luckybag": 0.86, + "RewardVideo": 1 + }, + { + "id": 65, + "gun_level": 65, + "Luckybag": 0.53, + "RewardVideo": 1 + }, + { + "id": 66, + "gun_level": 66, + "Luckybag": 0.64, + "RewardVideo": 1 + }, + { + "id": 67, + "gun_level": 67, + "Luckybag": 0.52, + "RewardVideo": 1 + }, + { + "id": 68, + "gun_level": 68, + "Luckybag": 0.51, + "RewardVideo": 1 + }, + { + "id": 69, + "gun_level": 69, + "Luckybag": 0.45, + "RewardVideo": 1 + }, + { + "id": 70, + "gun_level": 70, + "Luckybag": 0.56, + "RewardVideo": 1 + } +] \ No newline at end of file diff --git a/src/HttpServer/jsonconf/OnlineRewardConfig.json b/src/HttpServer/jsonconf/OnlineRewardConfig.json new file mode 100644 index 0000000..9532d7c --- /dev/null +++ b/src/HttpServer/jsonconf/OnlineRewardConfig.json @@ -0,0 +1,50 @@ +[ + { + "id": 1, + "time": 120, + "Luckybag": 0.43, + "RewardVideo": 0 + }, + { + "id": 2, + "time": 120, + "Luckybag": 0.31, + "RewardVideo": 0 + }, + { + "id": 3, + "time": 180, + "Luckybag": 0.44, + "RewardVideo": 1 + }, + { + "id": 4, + "time": 180, + "Luckybag": 0.27, + "RewardVideo": 1 + }, + { + "id": 5, + "time": 180, + "Luckybag": 0.41, + "RewardVideo": 1 + }, + { + "id": 6, + "time": 240, + "Luckybag": 0.47, + "RewardVideo": 1 + }, + { + "id": 7, + "time": 240, + "Luckybag": 0.41, + "RewardVideo": 1 + }, + { + "id": 8, + "time": 240, + "Luckybag": 0.36, + "RewardVideo": 1 + } +] \ No newline at end of file diff --git a/src/HttpServer/jsonconf/WinLevelRewardConfig.json b/src/HttpServer/jsonconf/WinLevelRewardConfig.json new file mode 100644 index 0000000..5d06716 --- /dev/null +++ b/src/HttpServer/jsonconf/WinLevelRewardConfig.json @@ -0,0 +1,524 @@ +[ + { + "id": 1, + "Win_Level": 3, + "LuckyBag": 1.94, + "RewardVideo": 1 + }, + { + "id": 2, + "Win_Level": 6, + "LuckyBag": 1.47, + "RewardVideo": 1 + }, + { + "id": 3, + "Win_Level": 9, + "LuckyBag": 1.71, + "RewardVideo": 1 + }, + { + "id": 4, + "Win_Level": 12, + "LuckyBag": 1.75, + "RewardVideo": 1 + }, + { + "id": 5, + "Win_Level": 15, + "LuckyBag": 1.92, + "RewardVideo": 1 + }, + { + "id": 6, + "Win_Level": 18, + "LuckyBag": 1.24, + "RewardVideo": 1 + }, + { + "id": 7, + "Win_Level": 21, + "LuckyBag": 1.24, + "RewardVideo": 1 + }, + { + "id": 8, + "Win_Level": 24, + "LuckyBag": 1.41, + "RewardVideo": 1 + }, + { + "id": 9, + "Win_Level": 27, + "LuckyBag": 0.98, + "RewardVideo": 1 + }, + { + "id": 10, + "Win_Level": 30, + "LuckyBag": 1.36, + "RewardVideo": 1 + }, + { + "id": 11, + "Win_Level": 33, + "LuckyBag": 1.41, + "RewardVideo": 1 + }, + { + "id": 12, + "Win_Level": 36, + "LuckyBag": 1.08, + "RewardVideo": 1 + }, + { + "id": 13, + "Win_Level": 39, + "LuckyBag": 1.03, + "RewardVideo": 1 + }, + { + "id": 14, + "Win_Level": 42, + "LuckyBag": 1.2, + "RewardVideo": 1 + }, + { + "id": 15, + "Win_Level": 45, + "LuckyBag": 1.24, + "RewardVideo": 1 + }, + { + "id": 16, + "Win_Level": 48, + "LuckyBag": 1.19, + "RewardVideo": 1 + }, + { + "id": 17, + "Win_Level": 51, + "LuckyBag": 1.18, + "RewardVideo": 1 + }, + { + "id": 18, + "Win_Level": 54, + "LuckyBag": 1.32, + "RewardVideo": 1 + }, + { + "id": 19, + "Win_Level": 57, + "LuckyBag": 0.66, + "RewardVideo": 1 + }, + { + "id": 20, + "Win_Level": 60, + "LuckyBag": 0.68, + "RewardVideo": 1 + }, + { + "id": 21, + "Win_Level": 63, + "LuckyBag": 0.69, + "RewardVideo": 1 + }, + { + "id": 22, + "Win_Level": 66, + "LuckyBag": 1.27, + "RewardVideo": 1 + }, + { + "id": 23, + "Win_Level": 69, + "LuckyBag": 0.68, + "RewardVideo": 1 + }, + { + "id": 24, + "Win_Level": 72, + "LuckyBag": 1.22, + "RewardVideo": 1 + }, + { + "id": 25, + "Win_Level": 75, + "LuckyBag": 0.93, + "RewardVideo": 1 + }, + { + "id": 26, + "Win_Level": 78, + "LuckyBag": 0.81, + "RewardVideo": 1 + }, + { + "id": 27, + "Win_Level": 81, + "LuckyBag": 0.59, + "RewardVideo": 1 + }, + { + "id": 28, + "Win_Level": 84, + "LuckyBag": 0.94, + "RewardVideo": 1 + }, + { + "id": 29, + "Win_Level": 87, + "LuckyBag": 0.79, + "RewardVideo": 1 + }, + { + "id": 30, + "Win_Level": 90, + "LuckyBag": 0.65, + "RewardVideo": 1 + }, + { + "id": 31, + "Win_Level": 93, + "LuckyBag": 0.81, + "RewardVideo": 1 + }, + { + "id": 32, + "Win_Level": 96, + "LuckyBag": 0.72, + "RewardVideo": 1 + }, + { + "id": 33, + "Win_Level": 99, + "LuckyBag": 0.91, + "RewardVideo": 1 + }, + { + "id": 34, + "Win_Level": 102, + "LuckyBag": 0.85, + "RewardVideo": 1 + }, + { + "id": 35, + "Win_Level": 105, + "LuckyBag": 0.53, + "RewardVideo": 1 + }, + { + "id": 36, + "Win_Level": 108, + "LuckyBag": 0.6, + "RewardVideo": 1 + }, + { + "id": 37, + "Win_Level": 111, + "LuckyBag": 0.59, + "RewardVideo": 1 + }, + { + "id": 38, + "Win_Level": 114, + "LuckyBag": 0.51, + "RewardVideo": 1 + }, + { + "id": 39, + "Win_Level": 117, + "LuckyBag": 0.6, + "RewardVideo": 1 + }, + { + "id": 40, + "Win_Level": 120, + "LuckyBag": 0.63, + "RewardVideo": 1 + }, + { + "id": 41, + "Win_Level": 123, + "LuckyBag": 0.65, + "RewardVideo": 1 + }, + { + "id": 42, + "Win_Level": 126, + "LuckyBag": 0.52, + "RewardVideo": 1 + }, + { + "id": 43, + "Win_Level": 129, + "LuckyBag": 0.51, + "RewardVideo": 1 + }, + { + "id": 44, + "Win_Level": 132, + "LuckyBag": 0.53, + "RewardVideo": 1 + }, + { + "id": 45, + "Win_Level": 135, + "LuckyBag": 0.59, + "RewardVideo": 1 + }, + { + "id": 46, + "Win_Level": 138, + "LuckyBag": 0.51, + "RewardVideo": 1 + }, + { + "id": 47, + "Win_Level": 141, + "LuckyBag": 0.39, + "RewardVideo": 1 + }, + { + "id": 48, + "Win_Level": 144, + "LuckyBag": 0.41, + "RewardVideo": 1 + }, + { + "id": 49, + "Win_Level": 147, + "LuckyBag": 0.59, + "RewardVideo": 1 + }, + { + "id": 50, + "Win_Level": 150, + "LuckyBag": 0.59, + "RewardVideo": 1 + }, + { + "id": 51, + "Win_Level": 153, + "LuckyBag": 0.41, + "RewardVideo": 1 + }, + { + "id": 52, + "Win_Level": 156, + "LuckyBag": 0.74, + "RewardVideo": 1 + }, + { + "id": 53, + "Win_Level": 159, + "LuckyBag": 0.56, + "RewardVideo": 1 + }, + { + "id": 54, + "Win_Level": 162, + "LuckyBag": 0.58, + "RewardVideo": 1 + }, + { + "id": 55, + "Win_Level": 165, + "LuckyBag": 0.56, + "RewardVideo": 1 + }, + { + "id": 56, + "Win_Level": 168, + "LuckyBag": 0.55, + "RewardVideo": 1 + }, + { + "id": 57, + "Win_Level": 171, + "LuckyBag": 0.73, + "RewardVideo": 1 + }, + { + "id": 58, + "Win_Level": 174, + "LuckyBag": 0.46, + "RewardVideo": 1 + }, + { + "id": 59, + "Win_Level": 177, + "LuckyBag": 0.5, + "RewardVideo": 1 + }, + { + "id": 60, + "Win_Level": 180, + "LuckyBag": 0.6, + "RewardVideo": 1 + }, + { + "id": 61, + "Win_Level": 183, + "LuckyBag": 0.45, + "RewardVideo": 1 + }, + { + "id": 62, + "Win_Level": 186, + "LuckyBag": 0.5, + "RewardVideo": 1 + }, + { + "id": 63, + "Win_Level": 189, + "LuckyBag": 0.57, + "RewardVideo": 1 + }, + { + "id": 64, + "Win_Level": 192, + "LuckyBag": 0.4, + "RewardVideo": 1 + }, + { + "id": 65, + "Win_Level": 195, + "LuckyBag": 0.43, + "RewardVideo": 1 + }, + { + "id": 66, + "Win_Level": 198, + "LuckyBag": 0.43, + "RewardVideo": 1 + }, + { + "id": 67, + "Win_Level": 201, + "LuckyBag": 0.56, + "RewardVideo": 1 + }, + { + "id": 68, + "Win_Level": 204, + "LuckyBag": 0.57, + "RewardVideo": 1 + }, + { + "id": 69, + "Win_Level": 207, + "LuckyBag": 0.54, + "RewardVideo": 1 + }, + { + "id": 70, + "Win_Level": 210, + "LuckyBag": 0.53, + "RewardVideo": 1 + }, + { + "id": 71, + "Win_Level": 213, + "LuckyBag": 0.31, + "RewardVideo": 1 + }, + { + "id": 72, + "Win_Level": 216, + "LuckyBag": 0.47, + "RewardVideo": 1 + }, + { + "id": 73, + "Win_Level": 219, + "LuckyBag": 0.34, + "RewardVideo": 1 + }, + { + "id": 74, + "Win_Level": 222, + "LuckyBag": 0.44, + "RewardVideo": 1 + }, + { + "id": 75, + "Win_Level": 225, + "LuckyBag": 0.49, + "RewardVideo": 1 + }, + { + "id": 76, + "Win_Level": 228, + "LuckyBag": 0.51, + "RewardVideo": 1 + }, + { + "id": 77, + "Win_Level": 231, + "LuckyBag": 0.34, + "RewardVideo": 1 + }, + { + "id": 78, + "Win_Level": 234, + "LuckyBag": 0.41, + "RewardVideo": 1 + }, + { + "id": 79, + "Win_Level": 237, + "LuckyBag": 0.57, + "RewardVideo": 1 + }, + { + "id": 80, + "Win_Level": 240, + "LuckyBag": 0.42, + "RewardVideo": 1 + }, + { + "id": 81, + "Win_Level": 243, + "LuckyBag": 0.47, + "RewardVideo": 1 + }, + { + "id": 82, + "Win_Level": 246, + "LuckyBag": 0.52, + "RewardVideo": 1 + }, + { + "id": 83, + "Win_Level": 249, + "LuckyBag": 0.41, + "RewardVideo": 1 + }, + { + "id": 84, + "Win_Level": 252, + "LuckyBag": 0.48, + "RewardVideo": 1 + }, + { + "id": 85, + "Win_Level": 255, + "LuckyBag": 0.52, + "RewardVideo": 1 + }, + { + "id": 86, + "Win_Level": 258, + "LuckyBag": 0.32, + "RewardVideo": 1 + }, + { + "id": 87, + "Win_Level": 261, + "LuckyBag": 0.57, + "RewardVideo": 1 + } +] \ No newline at end of file diff --git a/src/HttpServer/jsonconf/jsonconf.go b/src/HttpServer/jsonconf/jsonconf.go index 6f280b9..af0a950 100644 --- a/src/HttpServer/jsonconf/jsonconf.go +++ b/src/HttpServer/jsonconf/jsonconf.go @@ -44,11 +44,35 @@ type JiRedBagDesc struct { Cash int `json:"cash"` } +type GunLevelConfigDesc struct { + Id int `json:"id"` + Gun_level int `json:"gun_level"` + Luckybag float32 `json:"Luckybag"` + RewardVideo int `json:"RewardVideo"` +} + +type WinLevelConfigDesc struct { + Id int `json:"id"` + Win_Level int `json:"Win_Level"` + LuckyBag float32 `json:"LuckyBag"` + RewardVideo int `json:"RewardVideo"` +} + +type OnlineRewardConfigDesc struct { + Id int `json:"id"` + Time int `json:"time"` + Luckybag float32 `json:"Luckybag"` + RewardVideo int `json:"RewardVideo"` +} + type GameConfig struct { WithDrawConfig []WithDrawDesc ActiveWithdrawConfig []ActiveWithdrawConfigDesc GuanRedBag []GuanRedBagDesc JiRedBag []JiRedBagDesc + GunLevelConfig []GunLevelConfigDesc + WinLevelConfig []WinLevelConfigDesc + OnlineRewardConfig []OnlineRewardConfigDesc } @@ -56,6 +80,32 @@ func GetJsonConf() *GameConfig { return g_jsonconf } +func GetOnlieRdNum(id int) *OnlineRewardConfigDesc { + for _,v := range g_jsonconf.OnlineRewardConfig { + if v.Id == id { + return &v + } + } + return nil +} + +func GetWinLvRdNum(id int) *WinLevelConfigDesc { + for _,v := range g_jsonconf.WinLevelConfig { + if v.Id == id { + return &v + } + } + return nil +} + +func GetGunLvRdNum(lv int) *GunLevelConfigDesc { + for _,v := range g_jsonconf.GunLevelConfig { + if v.Id == lv { + return &v + } + } + return nil +} func GetJiConf(id int) *JiRedBagDesc { for _,val := range g_jsonconf.JiRedBag { diff --git a/src/HttpServer/logic/constdef.go b/src/HttpServer/logic/constdef.go index e3072e0..20e6861 100644 --- a/src/HttpServer/logic/constdef.go +++ b/src/HttpServer/logic/constdef.go @@ -56,7 +56,7 @@ const ( const ( WATCH_ADD_DAY_LIMIT = 50 //当天获取红包次数限制 FREE_REDBAG_NUM = 3 //玩家免费红包次数 - RANDNUMLIMIT = 10 //每日随机红包此树 + RANDNUMLIMIT = 8 //每日随机红包此树 READGOLDMULTI = 700 //阅读量到金币转化倍数 SDKOPGOLD_TYPEWE = 302 //微转发金币类型 ) diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 3b2c0a4..d53f433 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -124,13 +124,12 @@ type FetchredbagReq struct { Rtype int `json:"rtype"` Gameid string `json:"gameid"` Channel string `json:"channel"` + Param int `json:"param"` } type FetchredbagData struct { Guanrednum int `json:"guanrednum"` - Jirednum int `json:"jirednum"` - Randnum int `json:"randnum"` - Specialguannum int `json:"specialguannum"` + Timeredbagleft int `json:"timeredbagleft"` Getgold int `json:"getgold"` Walletgold int `json:"walletgold"` } diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index 0411b32..c036b6f 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -145,7 +145,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s initdata.WatchAddsTime = WATCH_ADD_DAY_LIMIT initdata.LeftFreeRB = FREE_REDBAG_NUM initdata.UpLvCostTime = 0 - initdata.PassLevel = 0 + initdata.PassLevel = 1 initdata.BigLevel = 1 initdata.SpecialLevel = 0 initdata.GuanRedNum = 0 diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index 7a9b8cf..8896fb5 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -37,16 +37,16 @@ func startServerHttpServe() { http.HandleFunc("/brainhole/test", TestDDT) //测试节后 //---------------------------------------------------------------------------------------- - http.HandleFunc("/brainhole/userlogin", UserLogin) //登录 - http.HandleFunc("/brainhole/syncuserdata", Syncuserdata) //同步完结数据 - http.HandleFunc("/brainhole/querygetcashinfo", Querdrawinfo) //获取提现档位信息接口 - http.HandleFunc("/brainhole/getcash", Getcash) //提现 - http.HandleFunc("/brainhole/getcashrecord", Getcashrecord) //提现记录列表 - http.HandleFunc("/brainhole/uploadlevel", Uploadlevel) //上报当前关卡 - http.HandleFunc("/brainhole/uploadbiglevel", Uploadbiglevel) //上报当前等级 - http.HandleFunc("/brainhole/uploadspeciallevel", Uploadspeciallevel) //上报当前等级 - http.HandleFunc("/brainhole/uploadtili", Uploadtili) //上报当前体力 - http.HandleFunc("/brainhole/fetchredbag", Fetchredbag) //领取红包 + http.HandleFunc("/gunshot/userlogin", UserLogin) //登录 + http.HandleFunc("/gunshot/syncuserdata", Syncuserdata) //同步完结数据 + http.HandleFunc("/gunshot/querygetcashinfo", Querdrawinfo) //获取提现档位信息接口 + http.HandleFunc("/gunshot/getcash", Getcash) //提现 + http.HandleFunc("/gunshot/getcashrecord", Getcashrecord) //提现记录列表 + http.HandleFunc("/gunshot/uploadlevel", Uploadlevel) //上报当前关卡 + http.HandleFunc("/gunshot/uploadbiglevel", Uploadbiglevel) //上报当前等级 + http.HandleFunc("/gunshot/uploadspeciallevel", Uploadspeciallevel) //上报当前等级 + http.HandleFunc("/gunshot/uploadtili", Uploadtili) //上报当前体力 + http.HandleFunc("/gunshot/fetchredbag", Fetchredbag) //领取红包 diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index f139fb9..73a26e2 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -7,7 +7,6 @@ import ( "common/redis" "encoding/json" "fmt" - "math/rand" "net/http" "strconv" "sync" @@ -277,15 +276,9 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { if rdata.Rtype == 1 { - //先判断一下是否可以领取 - if uinfo.GuanRedNum >= uinfo.PassLevel { - logger.Error("HandlerFetchredbag failed err=%v", err) - resp.Message = "没有可以领取的关卡红包" - resp.Code = 1 - break - } + //等级红包 - cfg := jsonconf.GetGuanConf(uinfo.GuanRedNum+1) + cfg := jsonconf.GetGunLvRdNum(rdata.Param) if cfg == nil { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "获取配置失败!" @@ -293,7 +286,8 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { break } - realgold, err := AddCoinToSdk(uuid, cfg.Cash, rdata.Gameid, rdata.Channel, 108) + addgold := int(cfg.Luckybag * 10000) + realgold, err := AddCoinToSdk(uuid, addgold, rdata.Gameid, rdata.Channel, 108) if err !=nil { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "服务器错误!" @@ -301,19 +295,20 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { break } - resp.Data.Getgold = cfg.Cash + resp.Data.Getgold = addgold resp.Data.Walletgold = realgold - uinfo.GuanRedNum ++ }else if rdata.Rtype == 2 { - if uinfo.JiRedNum+1 >= uinfo.BigLevel { + //关卡红包 + curprocess := (uinfo.PassLevel-1) / 3 + if uinfo.GuanRedNum >= curprocess { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "没有可以领取的等级红包" resp.Code = 1 break } - cfg := jsonconf.GetGuanConf(uinfo.JiRedNum+1) + cfg := jsonconf.GetWinLvRdNum(uinfo.GuanRedNum+1) if cfg == nil { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "获取配置失败!" @@ -321,7 +316,8 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { break } - realgold, err := AddCoinToSdk(uuid, cfg.Cash, rdata.Gameid, rdata.Channel, 108) + addgold := int(cfg.LuckyBag * 10000) + realgold, err := AddCoinToSdk(uuid, addgold, rdata.Gameid, rdata.Channel, 108) if err !=nil { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "服务器错误!" @@ -329,11 +325,12 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { break } - resp.Data.Getgold = cfg.Cash + resp.Data.Getgold = addgold resp.Data.Walletgold = realgold - uinfo.JiRedNum ++ + uinfo.GuanRedNum ++ }else if rdata.Rtype == 3{ + //时长红包 if uinfo.RandNum <= 0 { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "没有可以领取的随机红包次数了!" @@ -341,7 +338,17 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { break } - getnum := rand.Intn(200) + 100 + + cnt := RANDNUMLIMIT +1 - uinfo.RandNum + cfg := jsonconf.GetOnlieRdNum(cnt) + if cfg == nil { + logger.Error("HandlerFetchredbag failed err=%v", err) + resp.Message = "获取配置失败!" + resp.Code = 1 + break + } + + getnum := int(cfg.Luckybag*10000) realgold, err := AddCoinToSdk(uuid, getnum, rdata.Gameid, rdata.Channel, 108) if err !=nil { logger.Error("HandlerFetchredbag failed err=%v", err) @@ -355,7 +362,7 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { uinfo.RandNum-- }else { - if uinfo.SpecialLevel <= uinfo.SpecialNum { + /*if uinfo.SpecialLevel <= uinfo.SpecialNum { logger.Error("HandlerFetchredbag failed err=%v", err) resp.Message = "没有可以领取的随机红包次数了!" resp.Code = 1 @@ -374,17 +381,20 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { resp.Data.Getgold = getnum resp.Data.Walletgold = realgold - uinfo.SpecialNum++ + uinfo.SpecialNum++*/ + logger.Error("HandlerFetchredbag not right") + resp.Message = "类型不正确" + resp.Code = 1 + break } SaveUserInfo(uinfo,uniqueuuid) - resp.Data.Randnum = uinfo.RandNum + resp.Data.Timeredbagleft = uinfo.RandNum resp.Data.Guanrednum = uinfo.GuanRedNum - resp.Data.Jirednum = uinfo.JiRedNum - resp.Data.Specialguannum = uinfo.SpecialNum + resp.Code = 0 break } -- libgit2 0.21.0