Compare commits
335 Commits
Author | SHA1 | Date | |
---|---|---|---|
727765e853 | |||
796d1b59df | |||
0c8e57296f | |||
bc1517797c | |||
b431f02ab0 | |||
87b6eb66fc | |||
691d313e71 | |||
a709f7f513 | |||
94e4b77ec3 | |||
fd92cf0de1 | |||
fd55aa6a37 | |||
ab9aec5074 | |||
ad96dc3196 | |||
43eac6b408 | |||
14296a9073 | |||
9e77777f81 | |||
c03212df1c | |||
adf2337fde | |||
ea98c2e536 | |||
3898d38933 | |||
9a128116f8 | |||
64e5c5d78f | |||
d50eeb6a4c | |||
ac22be3a41 | |||
0e3b035077 | |||
9c5c6e5281 | |||
361d2d76bc | |||
7bd90b6a1d | |||
b193e159ad | |||
82162d6d3a | |||
d9ee206571 | |||
7db5c29e96 | |||
bc9c5d1068 | |||
5dedb86c6e | |||
bfec0050a5 | |||
8416be856d | |||
a6c20412e0 | |||
be793c3cb7 | |||
177cb8b34c | |||
f323500040 | |||
![]() |
cf5c9335de | ||
![]() |
b9762c39e2 | ||
![]() |
8e9cdaa81e | ||
![]() |
d2a7e9d8d5 | ||
![]() |
3492126047 | ||
![]() |
20725e4e41 | ||
![]() |
3e2834f7c6 | ||
![]() |
47b2860e55 | ||
![]() |
d30e14e9f7 | ||
![]() |
b85f8eb6ad | ||
![]() |
3c7e06bdd3 | ||
![]() |
b25affbbb7 | ||
![]() |
74f5e1a5f0 | ||
![]() |
6cd6a12a44 | ||
![]() |
bc888c9dc4 | ||
![]() |
c76277efd9 | ||
![]() |
e43a0b5b16 | ||
![]() |
0fb23f852f | ||
![]() |
98587539d6 | ||
![]() |
d9d85be98d | ||
![]() |
ea667a3cc3 | ||
![]() |
29fd19f8ec | ||
![]() |
76d0ba767d | ||
![]() |
f1817da7fc | ||
![]() |
90f7596e96 | ||
![]() |
7d90f7dc40 | ||
![]() |
281f6da355 | ||
![]() |
b92410e16b | ||
![]() |
d21db58753 | ||
![]() |
e75a46d646 | ||
![]() |
3f17b23e6b | ||
![]() |
c0673007d3 | ||
![]() |
2fe2e9844e | ||
![]() |
4e0dfa8013 | ||
![]() |
75f8cc259d | ||
![]() |
60c9abeb0c | ||
![]() |
4ea65f929a | ||
![]() |
dbb84f6f9e | ||
![]() |
3502b59da8 | ||
![]() |
4f150b5fa5 | ||
![]() |
6d36823dc2 | ||
![]() |
24abf20a58 | ||
![]() |
8cfc849ebf | ||
![]() |
cd7ff152c4 | ||
![]() |
c4b9dfa770 | ||
![]() |
4e29f94d64 | ||
![]() |
5fe6c934e1 | ||
![]() |
bd94484fec | ||
![]() |
03fac9e082 | ||
![]() |
45732f2f8a | ||
![]() |
7058327274 | ||
![]() |
f182eb33ae | ||
![]() |
ab4bfc7c7c | ||
![]() |
64b172ebdb | ||
![]() |
b8cf189e8f | ||
![]() |
971d8bded4 | ||
![]() |
c748641d1a | ||
![]() |
3f6955087e | ||
![]() |
b587ff9842 | ||
![]() |
c68a672e57 | ||
![]() |
583e193fce | ||
![]() |
c48861a913 | ||
![]() |
ec3afce24d | ||
![]() |
ffabf29e39 | ||
![]() |
9fa67d7092 | ||
![]() |
ce2a598c42 | ||
![]() |
c5b91836dc | ||
![]() |
4796f7e205 | ||
![]() |
eded5d0f8a | ||
![]() |
e390bcfb03 | ||
![]() |
42063e9cd9 | ||
![]() |
a0dec1f8d9 | ||
![]() |
1244a13981 | ||
![]() |
66f9775489 | ||
![]() |
8067d495bd | ||
![]() |
badf6a452a | ||
![]() |
6e16128598 | ||
![]() |
cef24e7a58 | ||
![]() |
eaf03ec09c | ||
![]() |
f70201abb1 | ||
![]() |
e60bcd317a | ||
![]() |
d46f12c4aa | ||
![]() |
c9cda18e3e | ||
![]() |
d0b839bb0e | ||
![]() |
70edc57d8f | ||
![]() |
a231d35453 | ||
![]() |
35b8c1a72d | ||
![]() |
87f923d42f | ||
![]() |
abfd76128f | ||
![]() |
5fe30985a6 | ||
![]() |
e7b58ef886 | ||
![]() |
dfa6ee5671 | ||
![]() |
c3d4fdc784 | ||
![]() |
3f5dee6f82 | ||
![]() |
08a8a3e735 | ||
![]() |
d8784ca3f5 | ||
![]() |
9ab95f62bd | ||
![]() |
42b38baf94 | ||
![]() |
5906db750d | ||
![]() |
d4ab444303 | ||
![]() |
13cc4bf78b | ||
![]() |
2bd2a7a99a | ||
![]() |
8d0a0d928f | ||
![]() |
032e403760 | ||
![]() |
00d105d68d | ||
![]() |
f94b4126bc | ||
![]() |
79beeda8c8 | ||
![]() |
faea8deb99 | ||
![]() |
7ca7dabaeb | ||
![]() |
8412b41afa | ||
![]() |
ffc7402ac4 | ||
![]() |
8a5443ba81 | ||
![]() |
bb99ca776a | ||
![]() |
0e9aba85c0 | ||
![]() |
2dede93d46 | ||
![]() |
72b1c79812 | ||
![]() |
1762065c8a | ||
![]() |
6818f518e7 | ||
![]() |
1b6f7dbba1 | ||
![]() |
a207fb292a | ||
![]() |
5393db0092 | ||
![]() |
aa19d351cd | ||
![]() |
a6ab95f38f | ||
![]() |
367fae0a70 | ||
![]() |
8ad37b081d | ||
![]() |
74f4521513 | ||
![]() |
d62d5a7ee9 | ||
![]() |
ce71769b2d | ||
![]() |
98cfcb646c | ||
![]() |
663430555e | ||
![]() |
26afda8f37 | ||
![]() |
eeffcd5df3 | ||
![]() |
b8ccbdd770 | ||
![]() |
41674f892a | ||
![]() |
2d37a501d8 | ||
![]() |
8cbd342c75 | ||
![]() |
8369a4890f | ||
![]() |
76a62734db | ||
![]() |
3eaaf25c1b | ||
![]() |
52cc4d2e96 | ||
![]() |
c6ca7bbf1d | ||
![]() |
c3e63de718 | ||
![]() |
42ce934916 | ||
![]() |
453132a6f4 | ||
![]() |
68f6653cbf | ||
![]() |
3f56768855 | ||
![]() |
6bdaf9b337 | ||
![]() |
073d073797 | ||
![]() |
51bc2a913b | ||
![]() |
f74895f3df | ||
![]() |
ee815331fc | ||
![]() |
774b455a19 | ||
![]() |
e1ecb6d690 | ||
![]() |
d5915aa8c6 | ||
![]() |
7dab957007 | ||
![]() |
87765dcfe6 | ||
![]() |
d6a3673293 | ||
![]() |
dd4c0cd123 | ||
![]() |
077324f548 | ||
![]() |
10b83cd49d | ||
![]() |
9c5c88b31d | ||
![]() |
74bab3600c | ||
![]() |
a413a2494c | ||
![]() |
5f934af2f2 | ||
![]() |
0fd221011e | ||
![]() |
8f5d2e5a8f | ||
![]() |
c65346af31 | ||
![]() |
7153a609a6 | ||
![]() |
2471a80a30 | ||
![]() |
c6d994c308 | ||
![]() |
3f2b75f00e | ||
![]() |
d928411d30 | ||
![]() |
3f2931ee48 | ||
![]() |
45c3b811f2 | ||
![]() |
f0fe5c6686 | ||
![]() |
942919e670 | ||
![]() |
f771cc440e | ||
![]() |
2089437778 | ||
![]() |
398b6f5aa8 | ||
![]() |
10c086f082 | ||
![]() |
7697c74c54 | ||
![]() |
e3be6c82f7 | ||
![]() |
8f32dc45b3 | ||
![]() |
cbda367a33 | ||
![]() |
1d26b220ea | ||
![]() |
debf0c7def | ||
![]() |
3c8fcf760e | ||
![]() |
247aa4bde5 | ||
![]() |
69907abec1 | ||
![]() |
4f6aee7c28 | ||
![]() |
9e58278f3a | ||
![]() |
8786f49b37 | ||
![]() |
af91d6116f | ||
![]() |
5da0e744ce | ||
![]() |
811974ac00 | ||
![]() |
0ff4a491a0 | ||
![]() |
5c22c5e1fc | ||
![]() |
f69d584bb3 | ||
![]() |
3a89491530 | ||
![]() |
ee316fccea | ||
![]() |
133548133d | ||
![]() |
58720a2435 | ||
![]() |
61d1f1e071 | ||
![]() |
f8738d39cb | ||
![]() |
50842ca3b9 | ||
![]() |
f952666e0d | ||
![]() |
2e4a110b61 | ||
![]() |
2e23292eea | ||
![]() |
de6e75cb58 | ||
![]() |
6ddbfb87fc | ||
![]() |
04f2916b68 | ||
![]() |
9189386f19 | ||
![]() |
c0e36c7c52 | ||
![]() |
b28f51250a | ||
![]() |
4a78275955 | ||
![]() |
3b4659239d | ||
![]() |
bfcfbf5390 | ||
![]() |
059a8db38a | ||
![]() |
ab83e6cb6f | ||
![]() |
6eeb119c08 | ||
![]() |
f7e013a4b1 | ||
![]() |
4358b82697 | ||
![]() |
e2cbe958b9 | ||
![]() |
be916ac98d | ||
![]() |
a69111c02d | ||
![]() |
d49f221046 | ||
![]() |
23e9a20238 | ||
![]() |
bebcf76776 | ||
![]() |
b7c8fdfa2a | ||
![]() |
728396d024 | ||
![]() |
290edb3757 | ||
![]() |
4079b885e9 | ||
![]() |
d8f430f88d | ||
![]() |
93c252b0d8 | ||
![]() |
8f68be90d6 | ||
![]() |
5ff979a6ac | ||
![]() |
84a52b0729 | ||
![]() |
d0fa752a37 | ||
![]() |
b1ddb2107a | ||
![]() |
0e057bea69 | ||
![]() |
3ddd703fee | ||
![]() |
629cc33ca8 | ||
![]() |
55f53c1d82 | ||
![]() |
a78458ace3 | ||
![]() |
822ffa83d0 | ||
![]() |
bce6eb9970 | ||
![]() |
a2f52ca607 | ||
![]() |
98b0743778 | ||
![]() |
72df840b09 | ||
![]() |
ff9247b980 | ||
![]() |
16d09aa707 | ||
![]() |
81f241fb72 | ||
![]() |
1f0fcc3c0b | ||
![]() |
8bf608e858 | ||
![]() |
59a38a4db5 | ||
![]() |
4b20544256 | ||
![]() |
b07bf89431 | ||
![]() |
b002811a82 | ||
![]() |
ac06dafdde | ||
![]() |
4cba2c04f2 | ||
![]() |
2b48bbb344 | ||
![]() |
2719426c8a | ||
![]() |
6a69777c87 | ||
![]() |
f939d653d5 | ||
![]() |
06d2c7e9e7 | ||
![]() |
fae1cbd940 | ||
![]() |
d074234ece | ||
![]() |
1bc085ea69 | ||
![]() |
fffea28bfb | ||
![]() |
2ca134a077 | ||
![]() |
33366eb68a | ||
![]() |
1759cb85b9 | ||
![]() |
bcf307a92b | ||
![]() |
25ee6dcf54 | ||
![]() |
51031d9095 | ||
![]() |
271e169b81 | ||
![]() |
7cd542ecb5 | ||
![]() |
70b7ae00d2 | ||
![]() |
a2341f717b | ||
![]() |
b81a68c342 | ||
![]() |
59072dc71a | ||
![]() |
2b3b391281 | ||
![]() |
d93379764f | ||
![]() |
df7b678893 | ||
![]() |
03f5d21a3f | ||
![]() |
8641e8b26c | ||
![]() |
c4d50b1f3c | ||
![]() |
e6b510659d | ||
![]() |
dd89582443 | ||
![]() |
faba99120d | ||
![]() |
0f42baade0 | ||
![]() |
e555aca96a | ||
![]() |
a2e06ae3dd | ||
![]() |
0ce6f37e39 | ||
![]() |
9098a00488 |
@ -119,6 +119,10 @@
|
||||
"switch_name": "circuitTask",
|
||||
"switch_desc": "30-巡回赛任务"
|
||||
},
|
||||
{
|
||||
"switch_name": "ui.recharge",
|
||||
"switch_desc": "31-充值按钮显示开关"
|
||||
},
|
||||
{
|
||||
"switch_name": "only.allowed.superWhiteList",
|
||||
"switch_desc": "100-只允许至尊白名单用户登录登录"
|
||||
|
0
bin/wheelserver/bin/.gitkeep
Normal file
0
bin/wheelserver/bin/.gitkeep
Normal file
3
bin/wheelserver/config/config.json
Normal file
3
bin/wheelserver/config/config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"shop_secret": "6KJSOy=0oKbf@U^xtIR3"
|
||||
}
|
5
bin/wheelserver/config/web3service.cluster.json
Normal file
5
bin/wheelserver/config/web3service.cluster.json
Normal file
@ -0,0 +1,5 @@
|
||||
[
|
||||
{
|
||||
"url": "http://127.0.0.1:7682"
|
||||
}
|
||||
]
|
9
bin/wheelserver/config/wheeldb.json
Normal file
9
bin/wheelserver/config/wheeldb.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"host": "mysql-test.kingsome.cn",
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "wheeldb_dev_1",
|
||||
"max_open_conns": 1,
|
||||
"max_idle_conns": 1
|
||||
}
|
6
bin/wheelserver/config/wheelserver.cluster.json
Normal file
6
bin/wheelserver/config/wheelserver.cluster.json
Normal file
@ -0,0 +1,6 @@
|
||||
[
|
||||
{
|
||||
"instance_id": 1,
|
||||
"http_listen_port": 3001
|
||||
}
|
||||
]
|
9
bin/wheelserver/res/buff@buff.json
Normal file
9
bin/wheelserver/res/buff@buff.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"can_stack": 1,
|
||||
"duration_time": 3600,
|
||||
"buff_id": 10001,
|
||||
"name": "\u4e09\u500d\u79ef\u5206\u5361",
|
||||
"buff_effect": 1
|
||||
}
|
||||
]
|
16
bin/wheelserver/res/friend@friend.json
Normal file
16
bin/wheelserver/res/friend@friend.json
Normal file
@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"reward_type": 1,
|
||||
"type": 1,
|
||||
"id": 1,
|
||||
"param1": 1,
|
||||
"reward": 100
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"type": 2,
|
||||
"id": 2,
|
||||
"param1": 1,
|
||||
"reward": 500
|
||||
}
|
||||
]
|
7
bin/wheelserver/res/global@global.json
Normal file
7
bin/wheelserver/res/global@global.json
Normal file
@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"type": 1,
|
||||
"id": 1,
|
||||
"number": 3
|
||||
}
|
||||
]
|
210
bin/wheelserver/res/item@item.json
Normal file
210
bin/wheelserver/res/item@item.json
Normal file
@ -0,0 +1,210 @@
|
||||
[
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 1,
|
||||
"price_type": 1,
|
||||
"price": 100,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV1 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 720,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10001,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 2,
|
||||
"price_type": 1,
|
||||
"price": 500,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV2 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 2400,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10002,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 3,
|
||||
"price_type": 1,
|
||||
"price": 1680,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV3 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 6000,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10003,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 4,
|
||||
"price_type": 1,
|
||||
"price": 4200,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV4 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 9600,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10004,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 5,
|
||||
"price_type": 1,
|
||||
"price": 6720,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV5 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 14400,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10005,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 6,
|
||||
"price_type": 1,
|
||||
"price": 10080,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV6 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 19200,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10006,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "Vision",
|
||||
"level": 7,
|
||||
"price_type": 1,
|
||||
"price": 13400,
|
||||
"produce_type": 1,
|
||||
"accelerate_price": 100,
|
||||
"introduce": "LV7 Vision Chip",
|
||||
"accelerate_type": 1,
|
||||
"item_type": 1,
|
||||
"produce": 24000,
|
||||
"time": 1440,
|
||||
"buff_list": "",
|
||||
"id": 10007,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"name": "score",
|
||||
"level": 1,
|
||||
"price_type": 1,
|
||||
"price": 100,
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u79ef\u5206",
|
||||
"accelerate_type": "",
|
||||
"item_type": 2,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": "",
|
||||
"id": 20001,
|
||||
"icon": "item/Gem_icon"
|
||||
},
|
||||
{
|
||||
"name": "Universal Dice",
|
||||
"level": 1,
|
||||
"price_type": "",
|
||||
"price": "",
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u6307\u5b9a\u8272\u5b50",
|
||||
"accelerate_type": "",
|
||||
"item_type": 3,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": "",
|
||||
"id": 20002,
|
||||
"icon": "item/Monopoly_dice_icon2"
|
||||
},
|
||||
{
|
||||
"name": "Triple Points Card",
|
||||
"level": 1,
|
||||
"price_type": "",
|
||||
"price": "",
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u79ef\u52063\u500d\u5361",
|
||||
"accelerate_type": "",
|
||||
"item_type": 4,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": 10001,
|
||||
"id": 20003,
|
||||
"icon": "item/triple_card"
|
||||
},
|
||||
{
|
||||
"name": "Points gift (small)",
|
||||
"level": 1,
|
||||
"price_type": "",
|
||||
"price": "",
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u79ef\u5206\u5c0f\u793c\u5305",
|
||||
"accelerate_type": "",
|
||||
"item_type": 5,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": "",
|
||||
"id": 20004,
|
||||
"icon": "item/gift01"
|
||||
},
|
||||
{
|
||||
"name": "Points gift (big)",
|
||||
"level": 1,
|
||||
"price_type": "",
|
||||
"price": "",
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u79ef\u5206\u5927\u793c\u5305",
|
||||
"accelerate_type": "",
|
||||
"item_type": 6,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": "",
|
||||
"id": 20005,
|
||||
"icon": "item/gift02"
|
||||
},
|
||||
{
|
||||
"name": "Dice",
|
||||
"level": 1,
|
||||
"price_type": "",
|
||||
"price": "",
|
||||
"produce_type": "",
|
||||
"accelerate_price": "",
|
||||
"introduce": "\u666e\u901a\u8272\u5b50",
|
||||
"accelerate_type": "",
|
||||
"item_type": 7,
|
||||
"produce": "",
|
||||
"time": "",
|
||||
"buff_list": "",
|
||||
"id": 20006,
|
||||
"icon": "item/Monopoly_dice_icon"
|
||||
}
|
||||
]
|
260
bin/wheelserver/res/mapGrid@mapGrid.json
Normal file
260
bin/wheelserver/res/mapGrid@mapGrid.json
Normal file
@ -0,0 +1,260 @@
|
||||
[
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "20001:5000",
|
||||
"id": 0,
|
||||
"pos": ""
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "20001:3000",
|
||||
"id": 1,
|
||||
"pos": "326:93"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 2,
|
||||
"pos": "381:70"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 3,
|
||||
"pos": "428:40"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 4,
|
||||
"pos": "474:14"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 5,
|
||||
"pos": "426:-10"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 6,
|
||||
"pos": "381:-36"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 7,
|
||||
"pos": "334:-64"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 8,
|
||||
"pos": "286:-90"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 9,
|
||||
"pos": "240:-63"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 10,
|
||||
"pos": "192:-38"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 11,
|
||||
"pos": "142:-12"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "20002:2",
|
||||
"id": 12,
|
||||
"pos": "90:14"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 13,
|
||||
"pos": "40:-12"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 14,
|
||||
"pos": "14:-38"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 15,
|
||||
"pos": "-56:-66"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 16,
|
||||
"pos": "-4:-96"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "20003:1",
|
||||
"id": 17,
|
||||
"pos": "45:-130"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 18,
|
||||
"pos": "4:-160"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 19,
|
||||
"pos": "-48:-186"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 20,
|
||||
"pos": "-96:-160"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 21,
|
||||
"pos": "-148:-135"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 22,
|
||||
"pos": "-200:-108"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "20006:2",
|
||||
"id": 23,
|
||||
"pos": "-248:-80"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 24,
|
||||
"pos": "-296:-54"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 25,
|
||||
"pos": "-342:-28"
|
||||
},
|
||||
{
|
||||
"direction": "",
|
||||
"reward": "",
|
||||
"id": 26,
|
||||
"pos": "-390:0"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "20001:1000",
|
||||
"id": 27,
|
||||
"pos": "-344:34"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 28,
|
||||
"pos": "-294:64"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 29,
|
||||
"pos": "-336:100"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 30,
|
||||
"pos": "-388:140"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 31,
|
||||
"pos": "-340:170"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "20002:2",
|
||||
"id": 32,
|
||||
"pos": "-270:204"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 33,
|
||||
"pos": "-212:174"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 34,
|
||||
"pos": "-156:142"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 35,
|
||||
"pos": "-102:160"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 36,
|
||||
"pos": "-46:180"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "20003:2",
|
||||
"id": 37,
|
||||
"pos": "10:202"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 38,
|
||||
"pos": "54:176"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 39,
|
||||
"pos": "108:148"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 40,
|
||||
"pos": "162:116"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 41,
|
||||
"pos": "212:90"
|
||||
},
|
||||
{
|
||||
"direction": 1,
|
||||
"reward": "",
|
||||
"id": 42,
|
||||
"pos": "270:64"
|
||||
}
|
||||
]
|
102
bin/wheelserver/res/reward@reward.json
Normal file
102
bin/wheelserver/res/reward@reward.json
Normal file
@ -0,0 +1,102 @@
|
||||
[
|
||||
{
|
||||
"reward_1": 11,
|
||||
"reward_2": 20,
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"reward_1": 21,
|
||||
"reward_2": 30,
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"reward_1": 31,
|
||||
"reward_2": 40,
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"reward_1": 41,
|
||||
"reward_2": 50,
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"reward_1": 51,
|
||||
"reward_2": 60,
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"reward_1": 61,
|
||||
"reward_2": 70,
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"reward_1": 71,
|
||||
"reward_2": 80,
|
||||
"id": 7
|
||||
},
|
||||
{
|
||||
"reward_1": 81,
|
||||
"reward_2": 90,
|
||||
"id": 8
|
||||
},
|
||||
{
|
||||
"reward_1": 91,
|
||||
"reward_2": 100,
|
||||
"id": 9
|
||||
},
|
||||
{
|
||||
"reward_1": 101,
|
||||
"reward_2": 110,
|
||||
"id": 10
|
||||
},
|
||||
{
|
||||
"reward_1": 111,
|
||||
"reward_2": 120,
|
||||
"id": 11
|
||||
},
|
||||
{
|
||||
"reward_1": 121,
|
||||
"reward_2": 130,
|
||||
"id": 12
|
||||
},
|
||||
{
|
||||
"reward_1": 131,
|
||||
"reward_2": 140,
|
||||
"id": 13
|
||||
},
|
||||
{
|
||||
"reward_1": 141,
|
||||
"reward_2": 150,
|
||||
"id": 14
|
||||
},
|
||||
{
|
||||
"reward_1": 151,
|
||||
"reward_2": 160,
|
||||
"id": 15
|
||||
},
|
||||
{
|
||||
"reward_1": 161,
|
||||
"reward_2": 170,
|
||||
"id": 16
|
||||
},
|
||||
{
|
||||
"reward_1": 171,
|
||||
"reward_2": 180,
|
||||
"id": 17
|
||||
},
|
||||
{
|
||||
"reward_1": 181,
|
||||
"reward_2": 190,
|
||||
"id": 18
|
||||
},
|
||||
{
|
||||
"reward_1": 191,
|
||||
"reward_2": 200,
|
||||
"id": 19
|
||||
},
|
||||
{
|
||||
"reward_1": 201,
|
||||
"reward_2": 210,
|
||||
"id": 20
|
||||
}
|
||||
]
|
152
bin/wheelserver/res/shopGoods@shopGoods.json
Normal file
152
bin/wheelserver/res/shopGoods@shopGoods.json
Normal file
@ -0,0 +1,152 @@
|
||||
[
|
||||
{
|
||||
"goods_id": 1001,
|
||||
"price": 1,
|
||||
"introduce": "Dice*1",
|
||||
"amount": 1,
|
||||
"item_id": 20006,
|
||||
"type": 1,
|
||||
"id": 1,
|
||||
"icon": "item/Monopoly_dice_icon"
|
||||
},
|
||||
{
|
||||
"goods_id": 1002,
|
||||
"price": 1,
|
||||
"introduce": "Dice*2",
|
||||
"amount": 2,
|
||||
"item_id": 20006,
|
||||
"type": 1,
|
||||
"id": 2,
|
||||
"icon": "item/Monopoly_dice_icon12"
|
||||
},
|
||||
{
|
||||
"goods_id": 1003,
|
||||
"price": 1,
|
||||
"introduce": "Dice*3",
|
||||
"amount": 3,
|
||||
"item_id": 20006,
|
||||
"type": 1,
|
||||
"id": 3,
|
||||
"icon": "item/Monopoly_dice_icon13"
|
||||
},
|
||||
{
|
||||
"goods_id": 1004,
|
||||
"price": 1,
|
||||
"introduce": "Dice*4",
|
||||
"amount": 4,
|
||||
"item_id": 20006,
|
||||
"type": 1,
|
||||
"id": 4,
|
||||
"icon": "item/Monopoly_dice_icon14"
|
||||
},
|
||||
{
|
||||
"goods_id": 1005,
|
||||
"price": 1,
|
||||
"introduce": "universal Dice*1",
|
||||
"amount": 1,
|
||||
"item_id": 20002,
|
||||
"type": 1,
|
||||
"id": 5,
|
||||
"icon": "item/Monopoly_dice_icon2"
|
||||
},
|
||||
{
|
||||
"goods_id": 1006,
|
||||
"price": 1,
|
||||
"introduce": "universal Dice*2",
|
||||
"amount": 2,
|
||||
"item_id": 20002,
|
||||
"type": 1,
|
||||
"id": 6,
|
||||
"icon": "item/Monopoly_dice_icon22"
|
||||
},
|
||||
{
|
||||
"goods_id": 1007,
|
||||
"price": 1,
|
||||
"introduce": "universal Dice*3",
|
||||
"amount": 3,
|
||||
"item_id": 20002,
|
||||
"type": 1,
|
||||
"id": 7,
|
||||
"icon": "item/Monopoly_dice_icon23"
|
||||
},
|
||||
{
|
||||
"goods_id": 1008,
|
||||
"price": 1,
|
||||
"introduce": "Triple Points Card",
|
||||
"amount": 1,
|
||||
"item_id": 20003,
|
||||
"type": 1,
|
||||
"id": 8,
|
||||
"icon": "item/triple_card"
|
||||
},
|
||||
{
|
||||
"goods_id": 1009,
|
||||
"price": 1,
|
||||
"introduce": "Level 1 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10001,
|
||||
"type": 2,
|
||||
"id": 9,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1010,
|
||||
"price": 1,
|
||||
"introduce": "Level 2 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10002,
|
||||
"type": 2,
|
||||
"id": 10,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1011,
|
||||
"price": 1,
|
||||
"introduce": "Level 3 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10003,
|
||||
"type": 2,
|
||||
"id": 11,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1012,
|
||||
"price": 1,
|
||||
"introduce": "Level 4 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10004,
|
||||
"type": 2,
|
||||
"id": 12,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1013,
|
||||
"price": 1,
|
||||
"introduce": "Level 5 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10005,
|
||||
"type": 2,
|
||||
"id": 13,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1014,
|
||||
"price": 1,
|
||||
"introduce": "Level 6 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10006,
|
||||
"type": 2,
|
||||
"id": 14,
|
||||
"icon": "item/icon_chip"
|
||||
},
|
||||
{
|
||||
"goods_id": 1015,
|
||||
"price": 1,
|
||||
"introduce": "Level 7 chip",
|
||||
"amount": 1,
|
||||
"item_id": 10007,
|
||||
"type": 2,
|
||||
"id": 15,
|
||||
"icon": "item/icon_chip"
|
||||
}
|
||||
]
|
100
bin/wheelserver/res/task@task.json
Normal file
100
bin/wheelserver/res/task@task.json
Normal file
@ -0,0 +1,100 @@
|
||||
[
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u7d2f\u8ba1\u8d5a\u53d6\u591a\u5c11\u79ef\u5206",
|
||||
"name": "Earn points cumulatively",
|
||||
"param2": 2,
|
||||
"param1": 1000,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10001,
|
||||
"condition": 2,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u9080\u8bf7\u591a\u5c11\u597d\u53cb",
|
||||
"name": "Invite friends",
|
||||
"param2": 0,
|
||||
"param1": 2,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10002,
|
||||
"condition": 1,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u6210\u529f\u8f6c\u53d1\u7ed9\u5176\u4ed6\u4eba",
|
||||
"name": "Successfully forwarded to others",
|
||||
"param2": 0,
|
||||
"param1": 1,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 1,
|
||||
"id": 10003,
|
||||
"condition": 1,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u6295\u63b7\u9ab0\u5b50",
|
||||
"name": "Throw the dice",
|
||||
"param2": 7,
|
||||
"param1": 3,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10004,
|
||||
"condition": 3,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u4f7f\u7528\u7279\u6b8a\u9ab0\u5b50",
|
||||
"name": "Use universal dice",
|
||||
"param2": 3,
|
||||
"param1": 1,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10005,
|
||||
"condition": 3,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u4f7f\u75283\u500d\u79ef\u5206\u5361",
|
||||
"name": "Use triple points card",
|
||||
"param2": 4,
|
||||
"param1": 1,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10006,
|
||||
"condition": 3,
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"reward_type": 1,
|
||||
"Icon1": "",
|
||||
"des": "\u8d2d\u4e70\u82af\u7247",
|
||||
"name": "buy chips",
|
||||
"param2": 1,
|
||||
"param1": 1,
|
||||
"reward": 100,
|
||||
"_Beizhu": "",
|
||||
"type": 2,
|
||||
"id": 10007,
|
||||
"condition": 4,
|
||||
"icon": ""
|
||||
}
|
||||
]
|
222
database/wheeldb.sql
Normal file
222
database/wheeldb.sql
Normal file
@ -0,0 +1,222 @@
|
||||
-- MySQL dump 10.14 Distrib 5.5.41-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: wheeldb
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.5.41-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `version`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `version`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `version` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`version` int(11) NOT NULL DEFAULT '0' COMMENT '版本号',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `version` (`version`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_param`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_param`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_param` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`param_name` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '事件名',
|
||||
`param_val1` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '参数1',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
UNIQUE KEY `idx_param_name` (`param_name`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_user`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_user`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_user` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'accountid',
|
||||
`uid` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'uid',
|
||||
`gid` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'gid',
|
||||
`openid` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'openid',
|
||||
`version` int(11) NOT NULL DEFAULT '0' COMMENT 'version',
|
||||
`avatar` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'avatar',
|
||||
`nickname` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'nickname',
|
||||
`invited` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'invited',
|
||||
`ext` varchar(255) CHARACTER SET utf8 COMMENT 'ext',
|
||||
`plat` int(11) NOT NULL DEFAULT '0' COMMENT 'plat',
|
||||
`plat_vip` int(11) NOT NULL DEFAULT '0' COMMENT 'plat_vip',
|
||||
`score` bigint(11) NOT NULL DEFAULT '0' COMMENT 'score',
|
||||
`dice` int(11) NOT NULL DEFAULT '0' COMMENT '骰子数',
|
||||
`spec_dice` int(11) NOT NULL DEFAULT '0' COMMENT '特殊骰子数(道具)',
|
||||
`last_present_dice_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后赠送骰子时间',
|
||||
`curr_grid` int(11) NOT NULL DEFAULT '0' COMMENT '当前格子',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
UNIQUE KEY `uk_account_id` (`account_id`),
|
||||
KEY `idx_openid` (`openid`),
|
||||
KEY `idx_invited` (`invited`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_invite_record`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_invite_record`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_invite_record` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`inviter` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '邀请者',
|
||||
`invitee` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '被邀请者',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
UNIQUE KEY `uk_inviter_invitee` (`inviter`, `invitee`),
|
||||
KEY `idx_inviter` (`inviter`),
|
||||
KEY `idx_invitee` (`invitee`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_chip`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_chip`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_chip` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'accountid',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量',
|
||||
`expiretime` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
|
||||
`calc_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次计算分数时间',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
KEY `idx_account_id` (`account_id`),
|
||||
KEY `idx_account_id_item_id` (`account_id`, `item_id`),
|
||||
KEY `idx_expiretime` (`expiretime`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_log`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_log`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_log` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型',
|
||||
`subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型',
|
||||
`param1` varchar(666) NOT NULL DEFAULT '' COMMENT 'param1',
|
||||
`param2` varchar(666) NOT NULL DEFAULT '' COMMENT 'param2',
|
||||
`param3` varchar(666) NOT NULL DEFAULT '' COMMENT 'param3',
|
||||
`param4` varchar(666) NOT NULL DEFAULT '' COMMENT 'param4',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `account_id_type_subtype` (`account_id`, `type`, `subtype`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_buff`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_buff`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_buff` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`buff_id` int(11) NOT NULL DEFAULT '0' COMMENT 'buff id',
|
||||
`expires_time` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
KEY `idx_account_id` (`account_id`),
|
||||
KEY `idx_account_id_buff_id` (`account_id`, `buff_id`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_bag`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_bag`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_bag` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'accountid',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
KEY `idx_account_id` (`account_id`),
|
||||
KEY `idx_account_id_item_id` (`account_id`, `item_id`),
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_inapp_order`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_inapp_order`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_inapp_order` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id',
|
||||
`sp_order_id` varchar(64) DEFAULT NULL COMMENT '渠道方订单id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `order_id` (`order_id`),
|
||||
KEY `account_id` (`account_id`),
|
||||
KEY `sp_order_id` (`sp_order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:52:06
|
@ -103,6 +103,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
BC_POLY_POLY_TG = 5
|
||||
BC_POLY_POLY_METAKASK = 13
|
||||
)
|
||||
|
||||
|
218
server/wheelserver/api/v1/activity/activity.go
Normal file
218
server/wheelserver/api/v1/activity/activity.go
Normal file
@ -0,0 +1,218 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"math/rand"
|
||||
"q5"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ActivityApi struct {
|
||||
}
|
||||
|
||||
func (this *ActivityApi) RollDice(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
ForwardPoint int32 `json:"forward_point"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
if reqJson.ForwardPoint < 0 || reqJson.ForwardPoint > 6 {
|
||||
f5.RspErr(c, 401, "forward_point param error")
|
||||
return
|
||||
}
|
||||
user := new(model.User)
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(s.GetAccountId(), nowTime); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error1")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 500, "server internal error2")
|
||||
return
|
||||
}
|
||||
if reqJson.ForwardPoint == 0 && user.Dice <= 0 {
|
||||
f5.RspErr(c, 1, "dice not enough")
|
||||
return
|
||||
}
|
||||
rewardMeta := mt.Table.Reward.RandElement()
|
||||
if rewardMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error3")
|
||||
return
|
||||
}
|
||||
score := rewardMeta.RandScore()
|
||||
if score <= 0 {
|
||||
f5.RspErr(c, 500, "server internal error4")
|
||||
return
|
||||
}
|
||||
if reqJson.ForwardPoint > 0 {
|
||||
if user.SpecDice <= 0 {
|
||||
f5.RspErr(c, 1, "spec dice not enough")
|
||||
return
|
||||
}
|
||||
if err := user.DecSpecDice(1); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error5")
|
||||
return
|
||||
}
|
||||
} else if err := user.DecDice(1); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error5")
|
||||
return
|
||||
}
|
||||
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Point int32 `json:"point"`
|
||||
}{}
|
||||
rspObj.Point = int32(1 + rand.Intn(6))
|
||||
if reqJson.ForwardPoint > 0 {
|
||||
rspObj.Point = reqJson.ForwardPoint
|
||||
}
|
||||
if err, ok := service.Buff.HasBuffEffect(s.GetAccountId(),
|
||||
constant.BUFF_EFFECT_SCORE_CARD_X3); err == nil {
|
||||
if ok {
|
||||
score *= 3
|
||||
}
|
||||
} else {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
var gridMeta *mt.MapGrid
|
||||
if user.CurrGrid+rspObj.Point > mt.Table.MapGrid.GetMaxGridId() {
|
||||
user.CurrGrid = user.CurrGrid + rspObj.Point - mt.Table.MapGrid.GetMaxGridId()
|
||||
gridMeta = mt.Table.MapGrid.GetById(int64(user.CurrGrid))
|
||||
if gridMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
gridMeta = mt.Table.MapGrid.GetById(int64(user.CurrGrid + rspObj.Point))
|
||||
if gridMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
user.CurrGrid += rspObj.Point
|
||||
}
|
||||
user.UpdateFields([]string{"curr_grid"})
|
||||
items := gridMeta.GetRewardItems()
|
||||
if items == nil {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
|
||||
fullgrid := false
|
||||
if len(*items) > 0 {
|
||||
gridawarded := false
|
||||
userAwardgrids := user.GetAwardGrids()
|
||||
for _, id := range userAwardgrids {
|
||||
if id == user.CurrGrid {
|
||||
gridawarded = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !gridawarded {
|
||||
for _, item := range *items {
|
||||
rspObj.GetOrCreateAward().AddItem(item.ItemId, item.ItemNum)
|
||||
}
|
||||
|
||||
awardgridids := mt.Table.MapGrid.GetAwardGridIdList()
|
||||
user.AddAwardGrid(user.CurrGrid)
|
||||
userAwardgrids = user.GetAwardGrids()
|
||||
if len(awardgridids) <= len(userAwardgrids) {
|
||||
fullgrid = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rspObj.GetOrCreateAward().AddItem(constant.VIRTUAL_ITEM_SCORE, score)
|
||||
|
||||
bageffect, taskupdate := service.Award.HandleAwards(user, rspObj.GetOrCreateAward())
|
||||
if bageffect {
|
||||
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "bag")
|
||||
}
|
||||
|
||||
if fullgrid {
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "fullgrid")
|
||||
}
|
||||
|
||||
itemtype := constant.ITEM_TYPE_SPEC_DICE
|
||||
if reqJson.ForwardPoint == 0 {
|
||||
itemtype = constant.ITEM_TYPE_DICE
|
||||
}
|
||||
|
||||
if service.Task.UpdateTaskProgress(s.GetAccountId(), int32(itemtype), 1, nil) || taskupdate{
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
rspObj.GetOrCreateSideEffect().GetOrCreateUser().FromModel(user)
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *ActivityApi) Claim(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
|
||||
user := new(model.User)
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(s.GetAccountId(), nowTime); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error1")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 500, "server internal error2")
|
||||
return
|
||||
}
|
||||
|
||||
awardgridids := mt.Table.MapGrid.GetAwardGridIdList()
|
||||
userAwardgrids := user.GetAwardGrids()
|
||||
if len(awardgridids) != len(userAwardgrids) {
|
||||
f5.RspErr(c, 500, "bad reques")
|
||||
return
|
||||
}
|
||||
|
||||
rspObj := vo.BaseVo{}
|
||||
|
||||
gridMeta := mt.Table.MapGrid.GetById(0)
|
||||
if gridMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
|
||||
items := gridMeta.GetRewardItems()
|
||||
if items == nil {
|
||||
f5.RspErr(c, 500, "server internal error7")
|
||||
return
|
||||
}
|
||||
|
||||
user.CurrGrid = 1
|
||||
user.AwardGrids = ""
|
||||
user.UpdateFields([]string{"curr_grid", "award_grids"})
|
||||
|
||||
for _, item := range *items {
|
||||
rspObj.GetOrCreateAward().AddItem(item.ItemId, item.ItemNum)
|
||||
}
|
||||
|
||||
bageffect, taskupdate := service.Award.HandleAwards(user, rspObj.GetOrCreateAward())
|
||||
if bageffect {
|
||||
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "bag")
|
||||
}
|
||||
|
||||
if taskupdate {
|
||||
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
rspObj.GetOrCreateSideEffect().GetOrCreateUser().FromModel(user)
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/activity/enter.go
Normal file
5
server/wheelserver/api/v1/activity/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package activity
|
||||
|
||||
type ApiGroup struct {
|
||||
ActivityApi
|
||||
}
|
89
server/wheelserver/api/v1/bag/bag.go
Normal file
89
server/wheelserver/api/v1/bag/bag.go
Normal file
@ -0,0 +1,89 @@
|
||||
package bag
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"q5"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type BagApi struct {
|
||||
}
|
||||
|
||||
func (this *BagApi) List(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
err, items := service.Bag.List(s.GetAccountId())
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.BagItem `json:"data"`
|
||||
}{
|
||||
Data: []*vo.BagItem{},
|
||||
}
|
||||
for _, m := range items {
|
||||
v := new(vo.BagItem)
|
||||
v.FromModel(m)
|
||||
q5.AppendSlice(&rspObj.Data, v)
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *BagApi) UseItem(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
ItemUniId string `json:"item_uniid"`
|
||||
ItemNum int32 `json:"item_num"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
}{}
|
||||
bagItem := new(model.Bag)
|
||||
if err, found := bagItem.FindByItemUniId(s.GetAccountId(), q5.ToInt64(reqJson.ItemUniId)); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 1, "item not found")
|
||||
return
|
||||
}
|
||||
if bagItem.ItemNum < reqJson.ItemNum {
|
||||
f5.RspErr(c, 1, "item not enough")
|
||||
return
|
||||
}
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
itemMeta := mt.Table.Item.GetById(int64(bagItem.ItemId))
|
||||
if itemMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
if itemMeta.GetItemType() != constant.ITEM_TYPE_SCORE_DOUBLE_CARD {
|
||||
f5.RspErr(c, 500, "cant use")
|
||||
return
|
||||
}
|
||||
service.Buff.Add(s.GetAccountId(), itemMeta.GetBuffList())
|
||||
bagItem.DecItemNum(1, int32(nowTime))
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "buff")
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "bag")
|
||||
if service.Task.UpdateTaskProgress(s.GetAccountId(), itemMeta.GetItemType(), reqJson.ItemNum, nil) {
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/bag/enter.go
Normal file
5
server/wheelserver/api/v1/bag/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package bag
|
||||
|
||||
type ApiGroup struct {
|
||||
BagApi
|
||||
}
|
38
server/wheelserver/api/v1/buff/buff.go
Normal file
38
server/wheelserver/api/v1/buff/buff.go
Normal file
@ -0,0 +1,38 @@
|
||||
package buff
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/constant"
|
||||
"main/common"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type BuffApi struct {
|
||||
}
|
||||
|
||||
func (this *BuffApi) List(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
err, buffs := service.Buff.List(s.GetAccountId())
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Buff `json:"data"`
|
||||
}{
|
||||
Data : []*vo.Buff{},
|
||||
}
|
||||
for _, m := range buffs {
|
||||
v := new(vo.Buff)
|
||||
v.FromModel(m)
|
||||
q5.AppendSlice(&rspObj.Data, v)
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/buff/enter.go
Normal file
5
server/wheelserver/api/v1/buff/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package buff
|
||||
|
||||
type ApiGroup struct {
|
||||
BuffApi
|
||||
}
|
36
server/wheelserver/api/v1/chip/chip.go
Normal file
36
server/wheelserver/api/v1/chip/chip.go
Normal file
@ -0,0 +1,36 @@
|
||||
package chip
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/service"
|
||||
"main/constant"
|
||||
"main/common"
|
||||
"main/vo"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ChipApi struct {
|
||||
}
|
||||
|
||||
func (this *ChipApi) List(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
err, chips := service.Chip.List(s.GetAccountId())
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Chip `json:"data"`
|
||||
}{}
|
||||
for _, m := range chips {
|
||||
v := new(vo.Chip)
|
||||
v.FromModel(m)
|
||||
q5.AppendSlice(&rspObj.Data, v)
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/chip/enter.go
Normal file
5
server/wheelserver/api/v1/chip/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package chip
|
||||
|
||||
type ApiGroup struct {
|
||||
ChipApi
|
||||
}
|
31
server/wheelserver/api/v1/enter.go
Normal file
31
server/wheelserver/api/v1/enter.go
Normal file
@ -0,0 +1,31 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"main/api/v1/activity"
|
||||
"main/api/v1/chip"
|
||||
"main/api/v1/friend"
|
||||
"main/api/v1/item"
|
||||
"main/api/v1/mission"
|
||||
"main/api/v1/shop"
|
||||
"main/api/v1/user"
|
||||
"main/api/v1/buff"
|
||||
"main/api/v1/bag"
|
||||
"main/api/v1/gm"
|
||||
"main/api/v1/inapp_shop"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
ActivityApiGroup activity.ApiGroup
|
||||
ChipApiGroup chip.ApiGroup
|
||||
FriendApiGroup friend.ApiGroup
|
||||
ItemApiGroup item.ApiGroup
|
||||
MissionApiGroup mission.ApiGroup
|
||||
ShopApiGroup shop.ApiGroup
|
||||
UserApiGroup user.ApiGroup
|
||||
BuffApiGroup buff.ApiGroup
|
||||
BagApiGroup bag.ApiGroup
|
||||
GmApiGroup gm.ApiGroup
|
||||
InAppShopApiGroup inapp_shop.ApiGroup
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
5
server/wheelserver/api/v1/friend/enter.go
Normal file
5
server/wheelserver/api/v1/friend/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package friend
|
||||
|
||||
type ApiGroup struct {
|
||||
FriendApi
|
||||
}
|
32
server/wheelserver/api/v1/friend/friend.go
Normal file
32
server/wheelserver/api/v1/friend/friend.go
Normal file
@ -0,0 +1,32 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FriendApi struct {
|
||||
}
|
||||
|
||||
func (this *FriendApi) List(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
err, friends := service.Friend.List(s.GetAccountId())
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Friend `json:"data"`
|
||||
}{
|
||||
Data: friends,
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/gm/enter.go
Normal file
5
server/wheelserver/api/v1/gm/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package gm
|
||||
|
||||
type ApiGroup struct {
|
||||
GmApi
|
||||
}
|
45
server/wheelserver/api/v1/gm/gm.go
Normal file
45
server/wheelserver/api/v1/gm/gm.go
Normal file
@ -0,0 +1,45 @@
|
||||
package gm
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/constant"
|
||||
"main/common"
|
||||
"main/vo"
|
||||
"main/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type GmApi struct {
|
||||
}
|
||||
|
||||
func (this *GmApi) ExecCmd(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if f5.IsOnlineEnv() {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
Cmd string `json:"cmd"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
cmds := strings.Split(reqJson.Cmd, " ")
|
||||
if len(cmds) <= 0 {
|
||||
f5.RspErr(c, 401, "cmd param error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
}{}
|
||||
if len(cmds) > 1 {
|
||||
service.GM.DispatchCmd(s, cmds[0], cmds[1:len(cmds)], &rspObj.BaseVo)
|
||||
} else {
|
||||
service.GM.DispatchCmd(s, cmds[0], []string{}, &rspObj.BaseVo)
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/inapp_shop/enter.go
Normal file
5
server/wheelserver/api/v1/inapp_shop/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package inapp_shop
|
||||
|
||||
type ApiGroup struct {
|
||||
InAppShopApi
|
||||
}
|
202
server/wheelserver/api/v1/inapp_shop/inapp_shop.go
Normal file
202
server/wheelserver/api/v1/inapp_shop/inapp_shop.go
Normal file
@ -0,0 +1,202 @@
|
||||
package inapp_shop
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"q5"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type InAppShopApi struct {
|
||||
}
|
||||
|
||||
func (this *InAppShopApi) Purchase(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
GoodsNum int32 `json:"goods_num"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
goodsMeta := mt.Table.ShopGoods.GetById(int64(reqJson.GoodsId))
|
||||
if goodsMeta == nil {
|
||||
f5.RspErr(c, 401, "goodsId params error")
|
||||
return
|
||||
}
|
||||
if reqJson.GoodsNum != 1 {
|
||||
f5.RspErr(c, 401, "goodsNum params error")
|
||||
return
|
||||
}
|
||||
nowTime := int32(f5.GetApp().GetRealSeconds())
|
||||
orderModel := new(model.InAppOrder)
|
||||
orderModel.OrderId = q5.ToString(f5.GetApp().NewLockNodeUuid())
|
||||
orderModel.AccountId = s.GetAccountId()
|
||||
orderModel.GoodsId = reqJson.GoodsId
|
||||
orderModel.CreateTime = nowTime
|
||||
orderModel.ModifyTime = nowTime
|
||||
if err := orderModel.Create(); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
OrderId string `json:"order_id"`
|
||||
}{}
|
||||
rspObj.OrderId = orderModel.OrderId
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *InAppShopApi) OrderInfo(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
orderId := c.Param("order_id")
|
||||
orderModel := new(model.InAppOrder)
|
||||
if err, found := orderModel.Find(s.GetAccountId(), orderId); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 1, "not found")
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data struct {
|
||||
OrderId string `json:"order_id"`
|
||||
Status int32 `json:"status"`
|
||||
} `json:"data"`
|
||||
}{}
|
||||
rspObj.Data.OrderId = orderModel.OrderId
|
||||
rspObj.Data.Status = orderModel.Status
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *InAppShopApi) Callback(c *gin.Context) {
|
||||
reqObj := struct {
|
||||
Channel string `json:"channel"`
|
||||
Records []map[string]interface{} `json:"records"`
|
||||
Signature string `json:"sign"`
|
||||
}{}
|
||||
|
||||
if err := c.ShouldBindJSON(&reqObj); err != nil || len(reqObj.Records) == 0 {
|
||||
f5.RspErr(c, 401, "invalid params")
|
||||
return
|
||||
}
|
||||
|
||||
keys := []string{}
|
||||
rec := reqObj.Records[0]
|
||||
for k := range rec {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
strb := strings.Builder{}
|
||||
strb.WriteString("channel=")
|
||||
strb.WriteString(reqObj.Channel)
|
||||
for _, k := range keys {
|
||||
strb.WriteByte('&')
|
||||
strb.WriteString(k)
|
||||
strb.WriteByte('=')
|
||||
strb.WriteString(q5.SafeToString(rec[k]))
|
||||
}
|
||||
|
||||
secret := mt.Table.Config.GetShopSecret()
|
||||
mac := hmac.New(sha256.New, []byte(secret))
|
||||
_, _ = mac.Write([]byte(strb.String()))
|
||||
|
||||
sign := strings.ToLower(hex.EncodeToString(mac.Sum(nil)))
|
||||
// f5.GetSysLog().Info("%s, %s, %s, %s", strb.String(), secret, sign, strings.ToLower(reqObj.Signature))
|
||||
if !strings.EqualFold(sign, strings.ToLower(reqObj.Signature)) {
|
||||
f5.RspErr(c, 401, "invalid sign")
|
||||
return
|
||||
}
|
||||
|
||||
orderId := q5.SafeToString(rec["gameOrderId"])
|
||||
orderModel := new(model.InAppOrder)
|
||||
if err, found := orderModel.FindByOrderId(orderId); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 1, "order not found")
|
||||
return
|
||||
}
|
||||
|
||||
status := q5.SafeToInt32(rec["status"])
|
||||
if status <= orderModel.Status {
|
||||
f5.RspErr(c, 401, "invalid status")
|
||||
return
|
||||
}
|
||||
|
||||
orderModel.Status = status
|
||||
orderModel.SpOrderId = q5.SafeToString(rec["orderId"])
|
||||
orderModel.ModifyTime = int32(f5.GetApp().GetRealSeconds())
|
||||
if orderModel.UpdateFields([]string{"status", "sp_order_id", "modifytime"}) != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
|
||||
f5.RspErr(c, 0, "")
|
||||
|
||||
ordergoods := mt.Table.ShopGoods.GetById(int64(orderModel.GoodsId))
|
||||
if ordergoods == nil {
|
||||
f5.GetSysLog().Error("fail dispatch goods:%s", orderId)
|
||||
return
|
||||
}
|
||||
|
||||
itemcfg := mt.Table.Item.GetById(int64(ordergoods.GetItemId()))
|
||||
if itemcfg == nil {
|
||||
f5.GetSysLog().Error("item error, fail dispatch goods:%s, %d", orderId, ordergoods.GetItemId())
|
||||
return
|
||||
}
|
||||
|
||||
user := new(model.User)
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(orderModel.AccountId, nowTime); err != nil {
|
||||
f5.GetSysLog().Error("internal error, fail dispatch goods:%s", orderId)
|
||||
return
|
||||
} else if !found {
|
||||
f5.GetSysLog().Error("not found user, fail dispatch goods:%s, %s", orderId, orderModel.AccountId)
|
||||
return
|
||||
}
|
||||
|
||||
switch itemcfg.GetItemType() {
|
||||
case constant.ITEM_TYPE_DICE:
|
||||
user.AddDice(ordergoods.GetAmount())
|
||||
case constant.ITEM_TYPE_SPEC_DICE:
|
||||
user.AddSpecDice(ordergoods.GetAmount())
|
||||
case constant.ITEM_TYPE_CHIP:
|
||||
for i := int32(0); i < ordergoods.GetAmount(); i++ {
|
||||
chip := new(model.Chip)
|
||||
chip.AccountId = orderModel.AccountId
|
||||
chip.ItemId = itemcfg.GetId()
|
||||
chip.ItemNum = 1
|
||||
chip.ExpireTime = int32(nowTime) + itemcfg.GetTime()*60
|
||||
chip.CreateTime = int32(nowTime)
|
||||
chip.ModifyTime = int32(nowTime)
|
||||
if chip.Create() != nil {
|
||||
f5.GetSysLog().Error("internal error, fail dispatch chip:%s, %s", orderId, orderModel.AccountId)
|
||||
}
|
||||
}
|
||||
case constant.ITEM_TYPE_SCORE_DOUBLE_CARD:
|
||||
service.Award.AddItem(orderModel.AccountId, itemcfg.GetId(), ordergoods.GetAmount(), nil)
|
||||
}
|
||||
|
||||
service.Task.UpdateTaskProgress(orderModel.AccountId, itemcfg.GetItemType(), ordergoods.GetAmount(), nil)
|
||||
}
|
5
server/wheelserver/api/v1/item/enter.go
Normal file
5
server/wheelserver/api/v1/item/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package item
|
||||
|
||||
type ApiGroup struct {
|
||||
ItemApi
|
||||
}
|
11
server/wheelserver/api/v1/item/item.go
Normal file
11
server/wheelserver/api/v1/item/item.go
Normal file
@ -0,0 +1,11 @@
|
||||
package item
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ItemApi struct {
|
||||
}
|
||||
|
||||
func (this *ItemApi) List(c *gin.Context) {
|
||||
}
|
5
server/wheelserver/api/v1/mission/enter.go
Normal file
5
server/wheelserver/api/v1/mission/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package mission
|
||||
|
||||
type ApiGroup struct {
|
||||
MissionApi
|
||||
}
|
167
server/wheelserver/api/v1/mission/mission.go
Normal file
167
server/wheelserver/api/v1/mission/mission.go
Normal file
@ -0,0 +1,167 @@
|
||||
package mission
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"q5"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type MissionApi struct {
|
||||
}
|
||||
|
||||
func (this *MissionApi) List(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Mission `json:"data"`
|
||||
}{}
|
||||
|
||||
rspObj.ErrCode, rspObj.ErrMsg = service.Task.List(s.GetAccountId(), &rspObj.Data)
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *MissionApi) UpdateTask(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
MissionId int32 `json:"mission_id"`
|
||||
}{}
|
||||
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Mission `json:"data"`
|
||||
}{}
|
||||
|
||||
task := new(model.Task)
|
||||
err, found := task.Find(s.GetAccountId())
|
||||
if err != nil || !found {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
|
||||
tasks := task.GetTaskItems()
|
||||
if tasks == nil {
|
||||
f5.RspErr(c, 401, "bad request")
|
||||
return
|
||||
}
|
||||
|
||||
taskitem, ok := tasks[reqJson.MissionId]
|
||||
if !ok {
|
||||
f5.RspErr(c, 401, "bad request")
|
||||
return
|
||||
}
|
||||
|
||||
taskMeta := mt.Table.Task.GetById(int64(taskitem.MissionId))
|
||||
if taskMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
|
||||
if taskMeta.GetConditon() != constant.TASK_COND_FRONT ||
|
||||
taskitem.Target <= taskitem.Current {
|
||||
f5.RspErr(c, 401, "bad request")
|
||||
return
|
||||
}
|
||||
|
||||
taskitem.Target++
|
||||
task.UpdateTasks(tasks)
|
||||
|
||||
for _, taskitem := range tasks {
|
||||
missionVo := new(vo.Mission)
|
||||
missionVo.FromModel(taskitem)
|
||||
q5.AppendSlice(&rspObj.Data, missionVo)
|
||||
}
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *MissionApi) ClaimTaskAward(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
reqJson := struct {
|
||||
MissionId int32 `json:"mission_id"`
|
||||
}{}
|
||||
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 401, "params parse error")
|
||||
return
|
||||
}
|
||||
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Mission `json:"data"`
|
||||
}{}
|
||||
|
||||
task := new(model.Task)
|
||||
err, found := task.Find(s.GetAccountId())
|
||||
if err != nil || !found {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
|
||||
tasks := task.GetTaskItems()
|
||||
if tasks == nil {
|
||||
f5.RspErr(c, 401, "bad request")
|
||||
return
|
||||
}
|
||||
|
||||
taskitem, ok := tasks[reqJson.MissionId]
|
||||
if !ok || taskitem.Current != taskitem.Target {
|
||||
f5.RspErr(c, 401, "bad request")
|
||||
return
|
||||
}
|
||||
|
||||
taskMeta := mt.Table.Task.GetById(int64(taskitem.MissionId))
|
||||
if taskMeta == nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
|
||||
user := new(model.User)
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(s.GetAccountId(), nowTime); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error1")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 500, "server internal error2")
|
||||
return
|
||||
}
|
||||
|
||||
if taskMeta.GetRewardType() == constant.TASK_AWARD_SCORE {
|
||||
user.AddScore(taskMeta.GetReward())
|
||||
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.ITEM_TYPE_SCORE, taskMeta.GetReward(), &tasks) {
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
rspObj.GetOrCreateAward().AddItem(constant.VIRTUAL_ITEM_SCORE, taskMeta.GetReward())
|
||||
}
|
||||
|
||||
taskitem.Award = 1
|
||||
task.UpdateTasks(tasks)
|
||||
|
||||
for _, taskitem := range tasks {
|
||||
missionVo := new(vo.Mission)
|
||||
missionVo.FromModel(taskitem)
|
||||
q5.AppendSlice(&rspObj.Data, missionVo)
|
||||
}
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/shop/enter.go
Normal file
5
server/wheelserver/api/v1/shop/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package shop
|
||||
|
||||
type ApiGroup struct {
|
||||
ShopApi
|
||||
}
|
105
server/wheelserver/api/v1/shop/shop.go
Normal file
105
server/wheelserver/api/v1/shop/shop.go
Normal file
@ -0,0 +1,105 @@
|
||||
package shop
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"q5"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ShopApi struct {
|
||||
}
|
||||
|
||||
func (this *ShopApi) Goods(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
Data []*vo.Goods `json:"goods"`
|
||||
}{}
|
||||
mt.Table.Item.Traverse(func (itemMeta *mt.Item) bool {
|
||||
if itemMeta.GetItemType() != constant.ITEM_TYPE_CHIP {
|
||||
return true
|
||||
}
|
||||
goodsVo := new(vo.Goods)
|
||||
goodsVo.ItemId = itemMeta.GetId()
|
||||
q5.AppendSlice(&rspObj.Data, goodsVo)
|
||||
return true
|
||||
})
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *ShopApi) Buy(c *gin.Context) {
|
||||
reqJson := struct {
|
||||
ItemId int32 `json:"item_id"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 1, err.Error())
|
||||
return
|
||||
}
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
}{}
|
||||
user := new(model.User)
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(s.GetAccountId(), nowTime); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
itemMeta := mt.Table.Item.GetById(int64(reqJson.ItemId))
|
||||
if itemMeta == nil {
|
||||
f5.RspErr(c, 500, "item_id error1")
|
||||
return
|
||||
}
|
||||
if itemMeta.GetItemType() == constant.VIRTUAL_ITEM_SCORE {
|
||||
f5.RspErr(c, 500, "item_id error2")
|
||||
return
|
||||
}
|
||||
if itemMeta.GetPrice() < 0 {
|
||||
f5.RspErr(c, 500, "config error")
|
||||
return
|
||||
}
|
||||
if user.Score < int64(itemMeta.GetPrice()) {
|
||||
f5.RspErr(c, 1, "score not enough")
|
||||
return
|
||||
}
|
||||
if err := user.DecScore(itemMeta.GetPrice()); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error5")
|
||||
return
|
||||
}
|
||||
chip := new(model.Chip)
|
||||
chip.AccountId = s.GetAccountId()
|
||||
chip.ItemId = itemMeta.GetId()
|
||||
chip.ItemNum = 1
|
||||
chip.ExpireTime = int32(nowTime) + itemMeta.GetTime() * 60
|
||||
chip.CreateTime = int32(nowTime)
|
||||
chip.ModifyTime = int32(nowTime)
|
||||
if chip.Create() != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj.SideEffect = new(vo.SideEffect)
|
||||
rspObj.SideEffect.User = new(vo.User)
|
||||
rspObj.SideEffect.User.FromModel(user)
|
||||
rspObj.SideEffect.User.HourlyEarnings = service.Chip.GetHourEarning(user.AccountId)
|
||||
if service.Task.UpdateTaskProgress(s.GetAccountId(), itemMeta.GetItemType(), 1, nil) {
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
5
server/wheelserver/api/v1/user/enter.go
Normal file
5
server/wheelserver/api/v1/user/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package user
|
||||
|
||||
type ApiGroup struct {
|
||||
UserApi
|
||||
}
|
97
server/wheelserver/api/v1/user/user.go
Normal file
97
server/wheelserver/api/v1/user/user.go
Normal file
@ -0,0 +1,97 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"main/model"
|
||||
"main/service"
|
||||
"main/vo"
|
||||
"q5"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type UserApi struct {
|
||||
}
|
||||
|
||||
func (this *UserApi) Login(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
user := new(model.User)
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
UserInfo vo.User `json:"user_info"`
|
||||
ServerTime int32 `json:"server_time"`
|
||||
}{}
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
rspObj.ServerTime = int32(nowTime)
|
||||
err, found := user.Find(s.GetAccountId(), nowTime)
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
user.AccountId = s.GetAccountId()
|
||||
user.Uid = s.GetUid()
|
||||
user.Gid = s.GetGid()
|
||||
user.OpenId = s.GetOpenId()
|
||||
user.Invited = s.GetInvited()
|
||||
user.Avatar = ""
|
||||
user.NickName = s.GetNickName()
|
||||
user.Score = 0
|
||||
user.Dice = constant.PRESENT_DICE_LIMIT//mt.Table.Global.GetDailyDiceNum()
|
||||
user.LastPresentDiceTime = q5.ToInt32(nowTime)
|
||||
user.CurrGrid = 1
|
||||
user.CreateTime = q5.ToInt32(nowTime)
|
||||
user.ModifyTime = q5.ToInt32(nowTime)
|
||||
if user.Create() != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
f5.GetMsgQueue().FireEvent(constant.MSG_CREATE_USER, q5.Args{user})
|
||||
service.Task.List(s.GetAccountId(), nil)
|
||||
} else {
|
||||
earning := service.Chip.CalcScore(s.GetAccountId())
|
||||
if earning > 0 {
|
||||
user.AddScore(earning)
|
||||
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.ITEM_TYPE_SCORE, earning, nil) {
|
||||
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if user.NickName != s.GetNickName() {
|
||||
user.UpdateName()
|
||||
}
|
||||
f5.GetMsgQueue().FireEvent(constant.MSG_LOGIN, q5.Args{user})
|
||||
rspObj.UserInfo.FromModel(user)
|
||||
if found {
|
||||
rspObj.UserInfo.HourlyEarnings = service.Chip.GetHourEarning(user.AccountId)
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *UserApi) Info(c *gin.Context) {
|
||||
s := c.MustGet(constant.SESSION_KEY).(common.Session)
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
user := new(model.User)
|
||||
rspObj := struct {
|
||||
vo.BaseVo
|
||||
UserInfo vo.User `json:"user_info"`
|
||||
}{}
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
if err, found := user.Find(s.GetAccountId(), nowTime); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
} else if !found {
|
||||
f5.RspErr(c, 1, "server internal error")
|
||||
return
|
||||
}
|
||||
rspObj.UserInfo.FromModel(user)
|
||||
rspObj.UserInfo.HourlyEarnings = service.Chip.GetHourEarning(user.AccountId)
|
||||
c.JSON(200, rspObj)
|
||||
}
|
55
server/wheelserver/app/app.go
Normal file
55
server/wheelserver/app/app.go
Normal file
@ -0,0 +1,55 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mt"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type app struct {
|
||||
initCb func()
|
||||
unInitCb func()
|
||||
}
|
||||
|
||||
func (this *app) GetPkgName() string {
|
||||
return "wheelserver"
|
||||
}
|
||||
|
||||
func (this *app) GetHttpListenPort() int32 {
|
||||
return mt.Table.WheelServerCluster.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *app) Run(initCb func(), unInitCb func()) {
|
||||
this.initCb = initCb
|
||||
this.unInitCb = unInitCb
|
||||
f5.Run(this)
|
||||
}
|
||||
|
||||
func (this *app) Init() {
|
||||
f5.GetSysLog().Info("wheelserver start")
|
||||
f5.LoadMetaTable(mt.Table)
|
||||
this.registerDataSources()
|
||||
this.initCb()
|
||||
}
|
||||
|
||||
func (this *app) UnInit() {
|
||||
this.unInitCb()
|
||||
}
|
||||
|
||||
func (this *app) Update() {
|
||||
}
|
||||
|
||||
func (this *app) registerDataSources() {
|
||||
f5.GetApp().RegisterOrmDb(
|
||||
constant.WHEEL_DB,
|
||||
mt.Table.WheelDb.GetById(0).GetHost(),
|
||||
mt.Table.WheelDb.GetById(0).GetPort(),
|
||||
mt.Table.WheelDb.GetById(0).GetUser(),
|
||||
mt.Table.WheelDb.GetById(0).GetPasswd(),
|
||||
mt.Table.WheelDb.GetById(0).GetDatabase(),
|
||||
)
|
||||
}
|
||||
|
||||
func (this *app) HasTask() bool {
|
||||
return false
|
||||
}
|
12
server/wheelserver/app/export.go
Normal file
12
server/wheelserver/app/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _app = new(app)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.APP_MODULE_IDX, _app)
|
||||
}
|
50
server/wheelserver/common/types.go
Normal file
50
server/wheelserver/common/types.go
Normal file
@ -0,0 +1,50 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type JwtUserInfo struct {
|
||||
Id string `json:"id"`
|
||||
Uid string `json:"uid"`
|
||||
Gid string `json:"gid"`
|
||||
OpenId string `json:"openid"`
|
||||
Version int32 `json:"version"`
|
||||
Plat int32 `json:"plat"`
|
||||
PlatVip int32 `json:"platVip"`
|
||||
Invited string `json:"invited"`
|
||||
Ext interface{} `json:"ext"`
|
||||
NickName string `json:"nickname"`
|
||||
}
|
||||
|
||||
type App interface {
|
||||
Run(func(), func())
|
||||
}
|
||||
|
||||
type RouterMgr interface {
|
||||
}
|
||||
|
||||
type ModelMgr interface {
|
||||
}
|
||||
|
||||
type ServiceMgr interface {
|
||||
}
|
||||
|
||||
type Session interface {
|
||||
GetAccountId() string
|
||||
GetId() string
|
||||
GetUid() string
|
||||
GetGid() string
|
||||
GetOpenId() string
|
||||
GetVersion() int32
|
||||
GetPlat() int32
|
||||
GetPlatVip() int32
|
||||
GetInvited() string
|
||||
GetNickName() string
|
||||
IsGuest() int32
|
||||
GetExt() string
|
||||
}
|
||||
|
||||
type SessionMgr interface {
|
||||
CreateGuestSession() Session
|
||||
CreateJwtSession(*JwtUserInfo) Session
|
||||
}
|
72
server/wheelserver/constant/constant.go
Normal file
72
server/wheelserver/constant/constant.go
Normal file
@ -0,0 +1,72 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
WHEEL_DB = "wheeldb"
|
||||
)
|
||||
|
||||
const (
|
||||
APP_MODULE_IDX = iota
|
||||
ROUTER_MGR_MODULE_IDX
|
||||
MODEL_MGR_MODULE_IDX
|
||||
SERVICE_MGR_MODULE_IDX
|
||||
SESSION_MGR_MODULE_IDX
|
||||
MAX_MODULE_IDX
|
||||
)
|
||||
|
||||
const (
|
||||
PLAT_ID_TG = 5
|
||||
)
|
||||
|
||||
const (
|
||||
SESSION_KEY = "session"
|
||||
)
|
||||
|
||||
const (
|
||||
MSG_LOGIN = iota
|
||||
MSG_CREATE_USER
|
||||
)
|
||||
|
||||
const (
|
||||
VIRTUAL_ITEM_SCORE = 20001
|
||||
)
|
||||
|
||||
const (
|
||||
ITEM_TYPE_CHIP = 1
|
||||
ITEM_TYPE_SCORE = 2
|
||||
ITEM_TYPE_SPEC_DICE = 3
|
||||
ITEM_TYPE_SCORE_DOUBLE_CARD = 4
|
||||
ITEM_TYPE_SCORE_SMALL_GIFT_PACK = 5
|
||||
ITEM_TYPE_SCORE_BIG_GIFT_PACK = 6
|
||||
ITEM_TYPE_DICE = 7
|
||||
)
|
||||
|
||||
const (
|
||||
SIDE_EFFECT_BUFF = "buff"
|
||||
SIDE_EFFECT_BAG = "bag"
|
||||
)
|
||||
|
||||
const (
|
||||
BUFF_EFFECT_SCORE_CARD_X3 = 1
|
||||
)
|
||||
|
||||
const (
|
||||
PRESENT_DICE_LIMIT = 6
|
||||
PRESENT_DICE_LOOP = 1800
|
||||
)
|
||||
|
||||
const (
|
||||
TASK_TYPE_ONCE = 1
|
||||
TASK_TYPE_DAILY = 2
|
||||
TASK_TYPE_RANGE = 3
|
||||
)
|
||||
|
||||
const (
|
||||
TASK_COND_FRONT = 1
|
||||
TASK_COND_BACK_GAIN = 2
|
||||
TASK_COND_BACK_USE = 3
|
||||
TASK_COND_BACK_BUY = 4
|
||||
)
|
||||
|
||||
const (
|
||||
TASK_AWARD_SCORE = 1
|
||||
)
|
1
server/wheelserver/event/create_user.go
Normal file
1
server/wheelserver/event/create_user.go
Normal file
@ -0,0 +1 @@
|
||||
package event
|
1
server/wheelserver/event/login.go
Normal file
1
server/wheelserver/event/login.go
Normal file
@ -0,0 +1 @@
|
||||
package event
|
79
server/wheelserver/global/global.go
Normal file
79
server/wheelserver/global/global.go
Normal file
@ -0,0 +1,79 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"q5"
|
||||
)
|
||||
|
||||
var modules [constant.MAX_MODULE_IDX]q5.Module
|
||||
var initOrders = []int32{
|
||||
constant.ROUTER_MGR_MODULE_IDX,
|
||||
constant.MODEL_MGR_MODULE_IDX,
|
||||
constant.SERVICE_MGR_MODULE_IDX,
|
||||
constant.SESSION_MGR_MODULE_IDX,
|
||||
}
|
||||
|
||||
var app common.App
|
||||
var routerMgr common.RouterMgr
|
||||
var modelMgr common.ModelMgr
|
||||
var serviceMgr common.ServiceMgr
|
||||
var sessionMgr common.SessionMgr
|
||||
|
||||
func GetApp() common.App {
|
||||
return app
|
||||
}
|
||||
|
||||
func GetRouterMgr() common.RouterMgr {
|
||||
return routerMgr
|
||||
}
|
||||
|
||||
func GetSessionMgr() common.SessionMgr {
|
||||
return sessionMgr
|
||||
}
|
||||
|
||||
func RegModule(idx int32, m q5.Module) {
|
||||
fmt.Printf("RegModule module %d\n", idx)
|
||||
modules[idx] = m
|
||||
switch idx {
|
||||
case constant.APP_MODULE_IDX:
|
||||
{
|
||||
app = m.(common.App)
|
||||
}
|
||||
case constant.ROUTER_MGR_MODULE_IDX:
|
||||
{
|
||||
routerMgr = m.(common.RouterMgr)
|
||||
}
|
||||
case constant.MODEL_MGR_MODULE_IDX:
|
||||
{
|
||||
modelMgr = m.(common.ModelMgr)
|
||||
}
|
||||
case constant.SERVICE_MGR_MODULE_IDX:
|
||||
{
|
||||
serviceMgr = m.(common.ServiceMgr)
|
||||
}
|
||||
case constant.SESSION_MGR_MODULE_IDX:
|
||||
{
|
||||
sessionMgr = m.(common.SessionMgr)
|
||||
}
|
||||
default:
|
||||
{
|
||||
panic("unknow module")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func InitModules() {
|
||||
for _, val := range initOrders {
|
||||
fmt.Printf("init module %d\n", val)
|
||||
modules[val].Init()
|
||||
}
|
||||
}
|
||||
|
||||
func UnInitModules() {
|
||||
for _, val := range initOrders {
|
||||
fmt.Printf("unInit module %d", val)
|
||||
modules[val].UnInit()
|
||||
}
|
||||
}
|
63
server/wheelserver/go.mod
Normal file
63
server/wheelserver/go.mod
Normal file
@ -0,0 +1,63 @@
|
||||
module wheelserver
|
||||
|
||||
go 1.20
|
||||
|
||||
require q5 v1.0.0
|
||||
|
||||
require f5 v1.0.0
|
||||
|
||||
require jccommon v1.0.0
|
||||
|
||||
require (
|
||||
golang.org/x/sync v0.6.0 // indirect
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect
|
||||
)
|
||||
|
||||
require main v1.0.0
|
||||
|
||||
require github.com/gin-gonic/gin v1.10.0
|
||||
|
||||
require (
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gomodule/redigo v1.8.3 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
google.golang.org/protobuf v1.34.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/driver/mysql v1.5.1 // indirect
|
||||
gorm.io/gorm v1.25.1 // indirect
|
||||
)
|
||||
|
||||
replace q5 => ../../third_party/q5
|
||||
|
||||
replace f5 => ../../third_party/f5
|
||||
|
||||
replace jccommon => ../jccommon
|
||||
|
||||
replace main => ./
|
113
server/wheelserver/go.sum
Normal file
113
server/wheelserver/go.sum
Normal file
@ -0,0 +1,113 @@
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.0/go.mod h1:BFCz+RF+1szSkrGNJLYn2ng2PtfzBiKR6fynTvS2A/k=
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1 h1:pqxEIwlCztD0T9ZygGfOrw4NK/F9iotnCnPJVADKbkE=
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1/go.mod h1:CSi0tuu0QrALbWdiQZwqFL8SbBhj4e2MJzkvNfjY0Us=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
|
||||
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/gomodule/redigo v1.8.3 h1:HR0kYDX2RJZvAup8CsiJwxB4dTCSC0AaUq6S4SiLwUc=
|
||||
github.com/gomodule/redigo v1.8.3/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2 h1:Rl5+9rA0kG3vsO1qhncMPRT5eHICihAMQYJkD7u/i4M=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw=
|
||||
gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o=
|
||||
gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64=
|
||||
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
14
server/wheelserver/initialize/enter.go
Normal file
14
server/wheelserver/initialize/enter.go
Normal file
@ -0,0 +1,14 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
_ "main/app"
|
||||
. "main/global"
|
||||
_ "main/router"
|
||||
_ "main/model"
|
||||
_ "main/service"
|
||||
_ "main/session"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
GetApp().Run(InitModules, UnInitModules)
|
||||
}
|
9
server/wheelserver/main.go
Normal file
9
server/wheelserver/main.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"main/initialize"
|
||||
)
|
||||
|
||||
func main() {
|
||||
initialize.Init()
|
||||
}
|
17
server/wheelserver/makefile
Normal file
17
server/wheelserver/makefile
Normal file
@ -0,0 +1,17 @@
|
||||
compile:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -o ../../bin/wheelserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
debug:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -ldflags "-X q5.optDebug=1" -o ../../bin/wheelserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
clean:
|
||||
@rm -f ../../bin/wheelserver/bin
|
||||
@echo "clean done"
|
24
server/wheelserver/middleware/cors.go
Normal file
24
server/wheelserver/middleware/cors.go
Normal file
@ -0,0 +1,24 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
// "net/http"
|
||||
)
|
||||
|
||||
func Cors() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
method := c.Request.Method
|
||||
//origin := c.Request.Header.Get("Origin")
|
||||
//if origin != "" {
|
||||
//c.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
|
||||
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
|
||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
//}
|
||||
if method == "OPTIONS" {
|
||||
c.AbortWithStatus(200)
|
||||
}
|
||||
c.Next()
|
||||
}
|
||||
}
|
101
server/wheelserver/middleware/jwtauth.go
Normal file
101
server/wheelserver/middleware/jwtauth.go
Normal file
@ -0,0 +1,101 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"fmt"
|
||||
"jccommon"
|
||||
"main/mt"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"q5"
|
||||
|
||||
. "main/global"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func MaybeJwtAuth(c *gin.Context) {
|
||||
internalJwtAuth(c, true)
|
||||
}
|
||||
|
||||
func JwtAuth(c *gin.Context) {
|
||||
internalJwtAuth(c, false)
|
||||
}
|
||||
|
||||
/*
|
||||
'Authorization Bearer {JwtToken}'
|
||||
*/
|
||||
func internalJwtAuth(c *gin.Context, maybe bool) {
|
||||
tokenHeader := c.Request.Header.Get("Authorization")
|
||||
jwtToken := ""
|
||||
if len(tokenHeader) > 8 {
|
||||
jwtToken = tokenHeader[7:]
|
||||
} else {
|
||||
if maybe {
|
||||
s := GetSessionMgr().CreateGuestSession()
|
||||
c.Set(constant.SESSION_KEY, s)
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
}
|
||||
internalMetaMaskJwtAuth(c, jwtToken)
|
||||
}
|
||||
|
||||
func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
|
||||
params := map[string]string{
|
||||
"c": "MetaMaskJwt",
|
||||
"a": "verify",
|
||||
}
|
||||
jsonReqObj := &struct {
|
||||
Data string `json:"data"`
|
||||
}{
|
||||
Data: jwtToken,
|
||||
}
|
||||
jsonRspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Decoded *common.JwtUserInfo `json:"decoded"`
|
||||
}{}
|
||||
rspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}{}
|
||||
paramsStr := q5.EncodeJson(jsonReqObj)
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3ServiceCluster.RandElement().GetUrl())
|
||||
f5.GetHttpCliMgr().SendGoStyleJsonRspPost(
|
||||
url,
|
||||
params,
|
||||
jsonRspObj,
|
||||
q5.HTTP_HEADER_JSON,
|
||||
paramsStr,
|
||||
func(rsp f5.HttpCliResponse) {
|
||||
if rsp.GetErr() != nil ||
|
||||
!rsp.JsonParseOk() {
|
||||
rspObj.ErrCode = 500
|
||||
rspObj.ErrMsg = "server internal error"
|
||||
c.JSON(200, rspObj)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
|
||||
rspObj.ErrMsg = jsonRspObj.ErrMsg
|
||||
if q5.SafeToInt32(rspObj.ErrCode) != 0 {
|
||||
rspObj.ErrCode = 501
|
||||
rspObj.ErrMsg = "jwt error"
|
||||
c.JSON(200, rspObj)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if jsonRspObj.Decoded.Plat != jccommon.BC_POLY_POLY_TG {
|
||||
rspObj.ErrCode = 501
|
||||
rspObj.ErrMsg = "not support this platform"
|
||||
c.JSON(200, rspObj)
|
||||
c.Abort()
|
||||
f5.GetSysLog().Info("not support this platform:%s", rsp.GetRawData())
|
||||
return
|
||||
}
|
||||
s := GetSessionMgr().CreateJwtSession(jsonRspObj.Decoded)
|
||||
c.Set(constant.SESSION_KEY, s)
|
||||
c.Next()
|
||||
})
|
||||
}
|
71
server/wheelserver/model/bag.go
Normal file
71
server/wheelserver/model/bag.go
Normal file
@ -0,0 +1,71 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"errors"
|
||||
"main/constant"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Bag struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
|
||||
AccountId string `gorm:"column:account_id"`
|
||||
ItemId int32 `gorm:"column:item_id"`
|
||||
ItemNum int32 `gorm:"column:item_num"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *Bag) TableName() string {
|
||||
return "t_bag"
|
||||
}
|
||||
|
||||
func (this *Bag) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Bag) FindByItemId(accountId string, itemId int32) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ? and item_id = ?", accountId, itemId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Bag) FindByItemUniId(accountId string, itemUniId int64) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ? and idx = ?", accountId, itemUniId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Bag) AddItemNum(itemNum int32, nowTime int32) error {
|
||||
this.ItemNum += itemNum
|
||||
this.ModifyTime = nowTime
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
"item_num", "modifytime").Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Bag) DecItemNum(itemNum int32, nowTime int32) error {
|
||||
this.ItemNum -= itemNum
|
||||
if this.ItemNum < 0 {
|
||||
this.ItemNum = 0
|
||||
}
|
||||
this.ModifyTime = nowTime
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
"item_num", "modifytime").Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
60
server/wheelserver/model/buff.go
Normal file
60
server/wheelserver/model/buff.go
Normal file
@ -0,0 +1,60 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"errors"
|
||||
"main/constant"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Buff struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
|
||||
AccountId string `gorm:"column:account_id"`
|
||||
BuffId int32 `gorm:"column:buff_id"`
|
||||
ExpiresTime int32 `gorm:"column:expires_time"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *Buff) TableName() string {
|
||||
return "t_buff"
|
||||
}
|
||||
|
||||
func (this *Buff) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Buff) UpdateFields(fields []string) error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
fields).Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Buff) FindByBuffUniId(accountId string, buffUniId int64) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ? and idx = ?", accountId, buffUniId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Buff) FindByBuffId(accountId string, buffId int32) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ? and buff_id = ?", accountId, buffId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Buff) UpdateExpireTime() error {
|
||||
return this.UpdateFields([]string{"expires_time", "modifytime"})
|
||||
}
|
36
server/wheelserver/model/chip.go
Normal file
36
server/wheelserver/model/chip.go
Normal file
@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type Chip struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
|
||||
AccountId string `gorm:"column:account_id"`
|
||||
ItemId int32 `gorm:"column:item_id"`
|
||||
ItemNum int32 `gorm:"column:item_num"`
|
||||
ExpireTime int32 `gorm:"column:expiretime;<-:create"`
|
||||
CalcTime int32 `gorm:"column:calc_time"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *Chip) TableName() string {
|
||||
return "t_chip"
|
||||
}
|
||||
|
||||
func (this *Chip) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Chip) UpdateCalcTime() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
"calc_time", "modifytime").Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
12
server/wheelserver/model/export.go
Normal file
12
server/wheelserver/model/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _modelMgr = new(modelMgr)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.MODEL_MGR_MODULE_IDX, _modelMgr)
|
||||
}
|
66
server/wheelserver/model/inapp_order.go
Normal file
66
server/wheelserver/model/inapp_order.go
Normal file
@ -0,0 +1,66 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"f5"
|
||||
"main/constant"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type InAppOrder struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
|
||||
OrderId string `gorm:"column:order_id"`
|
||||
SpOrderId string `gorm:"column:sp_order_id"`
|
||||
AccountId string `gorm:"column:account_id;<-:create"`
|
||||
GoodsId int32 `gorm:"column:goods_id;<-:create"`
|
||||
Status int32 `gorm:"column:status"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *InAppOrder) TableName() string {
|
||||
return "t_inapp_order"
|
||||
}
|
||||
|
||||
func (this *InAppOrder) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *InAppOrder) UpdateFields(fields []string) error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
fields).Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *InAppOrder) Find(accountId string, orderId string) (error, bool) {
|
||||
// if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
// this, "account_id = ? AND order_id = ?", accountId, orderId); result.Error != nil &&
|
||||
// !errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
// return result.Error, false
|
||||
// } else {
|
||||
// return nil, result.RowsAffected > 0
|
||||
// }
|
||||
|
||||
err, ok := this.FindByOrderId(orderId)
|
||||
if err != nil {
|
||||
return err, false
|
||||
} else {
|
||||
return nil, ok && this.AccountId == accountId
|
||||
}
|
||||
}
|
||||
|
||||
func (this *InAppOrder) FindByOrderId(orderId string) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "order_id = ?", orderId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
25
server/wheelserver/model/invite_record.go
Normal file
25
server/wheelserver/model/invite_record.go
Normal file
@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type InviteRecord struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
|
||||
Inviter string `gorm:"column:inviter;"`
|
||||
Invitee string `gorm:"column:invitee;"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *InviteRecord) TableName() string {
|
||||
return "t_invite_record"
|
||||
}
|
||||
|
||||
func (this *InviteRecord) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
30
server/wheelserver/model/log.go
Normal file
30
server/wheelserver/model/log.go
Normal file
@ -0,0 +1,30 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type Log struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
|
||||
AccountId string `gorm:"column:account_id"`
|
||||
Type string `gorm:"column:type"`
|
||||
SubType string `gorm:"column:sub_type"`
|
||||
Param1 string `gorm:"column:param1"`
|
||||
Param2 string `gorm:"column:param2"`
|
||||
Param3 string `gorm:"column:param3"`
|
||||
Param4 string `gorm:"column:param4"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *Log) TableName() string {
|
||||
return "t_log"
|
||||
}
|
||||
|
||||
func (this *Log) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
12
server/wheelserver/model/modelmgr.go
Normal file
12
server/wheelserver/model/modelmgr.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
type modelMgr struct {
|
||||
}
|
||||
|
||||
func (this *modelMgr) Init() {
|
||||
|
||||
}
|
||||
|
||||
func (this *modelMgr) UnInit() {
|
||||
|
||||
}
|
109
server/wheelserver/model/task.go
Normal file
109
server/wheelserver/model/task.go
Normal file
@ -0,0 +1,109 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"f5"
|
||||
"main/constant"
|
||||
"q5"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type TaskItem struct {
|
||||
MissionId int32 `json:"mission_id"`
|
||||
Current int32 `json:"current"`
|
||||
Target int32 `json:"target"`
|
||||
Award int32 `json:"award"`
|
||||
Time int64 `json:"time"`
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
|
||||
AccountId string `gorm:"column:account_id;primaryKey"`
|
||||
Data string `gorm:"column:data"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *Task) TableName() string {
|
||||
return "t_task"
|
||||
}
|
||||
|
||||
func (this *Task) UpdateFields(fields []string) error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
fields).Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Task) Find(accountId string) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ?", accountId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Task) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Task) UpdateTasks(tasks map[int32]*TaskItem) error {
|
||||
if tasks == nil || len(tasks) < 1 {
|
||||
return errors.New("")
|
||||
}
|
||||
|
||||
sb := strings.Builder{}
|
||||
for _, item := range tasks {
|
||||
sb.WriteString(q5.SafeToString(item.MissionId))
|
||||
sb.WriteByte(',')
|
||||
sb.WriteString(q5.SafeToString(item.Current))
|
||||
sb.WriteByte(',')
|
||||
sb.WriteString(q5.SafeToString(item.Target))
|
||||
sb.WriteByte(',')
|
||||
sb.WriteString(q5.SafeToString(item.Award))
|
||||
sb.WriteByte(',')
|
||||
sb.WriteString(q5.SafeToString(item.Time))
|
||||
sb.WriteByte('|')
|
||||
}
|
||||
|
||||
t.Data = sb.String()
|
||||
t.ModifyTime = int32(f5.GetApp().GetRealSeconds())
|
||||
if err := t.UpdateFields([]string{"data", "modifytime"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Task) GetTaskItems() map[int32]*TaskItem {
|
||||
if this.Data != "" {
|
||||
Tasks := map[int32]*TaskItem{}
|
||||
taskitems := strings.Split(this.Data, "|")
|
||||
for _, itemstr := range taskitems {
|
||||
strs := strings.Split(itemstr, ",")
|
||||
if len(strs) < 5 {
|
||||
continue
|
||||
}
|
||||
taskitem := new(TaskItem)
|
||||
taskitem.MissionId = q5.SafeToInt32(strs[0])
|
||||
taskitem.Current = q5.SafeToInt32(strs[1])
|
||||
taskitem.Target = q5.SafeToInt32(strs[2])
|
||||
taskitem.Award = q5.SafeToInt32(strs[3])
|
||||
taskitem.Time = q5.SafeToInt64(strs[4])
|
||||
Tasks[taskitem.MissionId] = taskitem
|
||||
}
|
||||
|
||||
return Tasks
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
189
server/wheelserver/model/user.go
Normal file
189
server/wheelserver/model/user.go
Normal file
@ -0,0 +1,189 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"f5"
|
||||
"main/constant"
|
||||
"q5"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
|
||||
AccountId string `gorm:"column:account_id;primaryKey"`
|
||||
Uid string `gorm:"column:uid"`
|
||||
Gid string `gorm:"column:gid"`
|
||||
OpenId string `gorm:"column:openid"`
|
||||
Version int32 `gorm:"column:version"`
|
||||
Avatar string `gorm:"column:avatar"`
|
||||
NickName string `gorm:"column:nickname"`
|
||||
Invited string `gorm:"column:invited"`
|
||||
Ext string `gorm:"column:ext"`
|
||||
Plat int32 `gorm:"column:plat"`
|
||||
PlatVip int32 `gorm:"column:plat_vip"`
|
||||
Score int64 `gorm:"column:score"`
|
||||
Dice int32 `gorm:"column:dice"`
|
||||
SpecDice int32 `gorm:"column:spec_dice"`
|
||||
LastPresentDiceTime int32 `gorm:"column:last_present_dice_time"`
|
||||
CurrGrid int32 `gorm:"column:curr_grid"`
|
||||
AwardGrids string `gorm:"column:award_grids"`
|
||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||
ModifyTime int32 `gorm:"column:modifytime"`
|
||||
}
|
||||
|
||||
func (this *User) TableName() string {
|
||||
return "t_user"
|
||||
}
|
||||
|
||||
func (this *User) UpdateFields(fields []string) error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
fields).Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) Find(accountId string, nowTime int64) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ?", accountId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
if result.RowsAffected > 0 {
|
||||
if this.Dice < constant.PRESENT_DICE_LIMIT && this.LastPresentDiceTime+constant.PRESENT_DICE_LOOP < int32(nowTime) {
|
||||
present := (int32(nowTime) - this.LastPresentDiceTime) / constant.PRESENT_DICE_LOOP
|
||||
if this.Dice+present < constant.PRESENT_DICE_LIMIT {
|
||||
this.Dice += present
|
||||
this.LastPresentDiceTime += present * constant.PRESENT_DICE_LOOP
|
||||
} else {
|
||||
this.Dice = constant.PRESENT_DICE_LIMIT
|
||||
this.LastPresentDiceTime = q5.ToInt32(nowTime)
|
||||
}
|
||||
|
||||
if err := this.UpdateFields([]string{"dice", "last_present_dice_time"}); err != nil {
|
||||
return err, false
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
||||
func (this *User) Create() error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) AddDice(num int32) error {
|
||||
if num < 1 {
|
||||
return errors.New("")
|
||||
}
|
||||
return this.DecDice(-num)
|
||||
}
|
||||
|
||||
func (this *User) DecDice(num int32) error {
|
||||
if this.Dice < num {
|
||||
return errors.New("")
|
||||
}
|
||||
oldDice := this.Dice
|
||||
this.Dice -= num
|
||||
updatepresentTime := false
|
||||
if (num < 0 && oldDice < constant.PRESENT_DICE_LIMIT && this.Dice >= constant.PRESENT_DICE_LIMIT) ||
|
||||
(num > 0 && oldDice >= constant.PRESENT_DICE_LIMIT && this.Dice < constant.PRESENT_DICE_LIMIT) {
|
||||
this.LastPresentDiceTime = int32(f5.GetApp().GetRealSeconds())
|
||||
updatepresentTime = true
|
||||
}
|
||||
|
||||
updatefileds := []string{"dice"}
|
||||
if updatepresentTime {
|
||||
updatefileds = append(updatefileds, "last_present_dice_time")
|
||||
}
|
||||
|
||||
if err := this.UpdateFields(updatefileds); err != nil {
|
||||
this.Dice = oldDice
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) AddSpecDice(num int32) error {
|
||||
this.SpecDice += num
|
||||
if err := this.UpdateFields([]string{"spec_dice"}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) DecSpecDice(num int32) error {
|
||||
if this.SpecDice < num {
|
||||
return errors.New("")
|
||||
}
|
||||
oldSpecDice := this.SpecDice
|
||||
this.SpecDice -= num
|
||||
if err := this.UpdateFields([]string{"spec_dice"}); err != nil {
|
||||
this.SpecDice = oldSpecDice
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) DecScore(num int32) error {
|
||||
if this.Score < int64(num) {
|
||||
return errors.New("")
|
||||
}
|
||||
oldScore := this.Score
|
||||
this.Score -= int64(num)
|
||||
if err := this.UpdateFields([]string{"score"}); err != nil {
|
||||
this.Score = oldScore
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) AddScore(score int32) error {
|
||||
if score <= 0 {
|
||||
return nil
|
||||
}
|
||||
oldScore := this.Score
|
||||
this.Score += int64(score)
|
||||
if err := this.UpdateFields([]string{"score"}); err != nil {
|
||||
this.Score = oldScore
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) UpdateName() error {
|
||||
return this.UpdateFields([]string{"nickname"})
|
||||
}
|
||||
|
||||
func (this *User) AddAwardGrid(gridid int32) error {
|
||||
awardGridsList := this.GetAwardGrids()
|
||||
if len(awardGridsList) > 0 {
|
||||
this.AwardGrids += ","
|
||||
}
|
||||
|
||||
this.AwardGrids += q5.SafeToString(gridid)
|
||||
return this.UpdateFields([]string{"award_grids"})
|
||||
}
|
||||
|
||||
func (this *User) ClearAwardGrid() error {
|
||||
this.AwardGrids = ""
|
||||
return this.UpdateFields([]string{"award_grids"})
|
||||
}
|
||||
|
||||
func (this *User) GetAwardGrids() []int32 {
|
||||
gridstr := strings.Split(this.AwardGrids, ",")
|
||||
awardGridsList := []int32{}
|
||||
for _, item := range gridstr {
|
||||
if item != "" {
|
||||
awardGridsList = append(awardGridsList, q5.SafeToInt32(item))
|
||||
}
|
||||
}
|
||||
|
||||
return awardGridsList
|
||||
}
|
15
server/wheelserver/mt/Buff.go
Normal file
15
server/wheelserver/mt/Buff.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Buff struct {
|
||||
mtb.Buff
|
||||
buffList []int32
|
||||
}
|
||||
|
||||
type BuffTable struct {
|
||||
f5.IdMetaTable[Buff]
|
||||
}
|
26
server/wheelserver/mt/Config.go
Normal file
26
server/wheelserver/mt/Config.go
Normal file
@ -0,0 +1,26 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
mtb.Config
|
||||
}
|
||||
|
||||
type ConfigTable struct {
|
||||
f5.IdMetaTable[Config]
|
||||
selfConf *Config
|
||||
}
|
||||
|
||||
func (this *ConfigTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(0))
|
||||
if this.selfConf == nil {
|
||||
panic("无法读取config.json")
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ConfigTable) GetShopSecret() string {
|
||||
return this.selfConf.GetShopSecret()
|
||||
}
|
14
server/wheelserver/mt/Friend.go
Normal file
14
server/wheelserver/mt/Friend.go
Normal file
@ -0,0 +1,14 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Friend struct {
|
||||
mtb.Friend
|
||||
}
|
||||
|
||||
type FriendTable struct {
|
||||
f5.IdMetaTable[Friend]
|
||||
}
|
30
server/wheelserver/mt/Item.go
Normal file
30
server/wheelserver/mt/Item.go
Normal file
@ -0,0 +1,30 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/mtb"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Item struct {
|
||||
mtb.Item
|
||||
buffList []int32
|
||||
}
|
||||
|
||||
type ItemTable struct {
|
||||
f5.IdMetaTable[Item]
|
||||
}
|
||||
|
||||
func (this *Item) Init1() {
|
||||
if this.Item.GetBuffList() != "" {
|
||||
tmpStrs := strings.Split(this.Item.GetBuffList(), "|")
|
||||
for _, val := range(tmpStrs) {
|
||||
q5.AppendSlice(&this.buffList, q5.ToInt32(val))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Item) GetBuffList() []int32 {
|
||||
return this.buffList
|
||||
}
|
71
server/wheelserver/mt/MapGrid.go
Normal file
71
server/wheelserver/mt/MapGrid.go
Normal file
@ -0,0 +1,71 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
"q5"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type MapGridRewardItem struct {
|
||||
ItemId int32
|
||||
ItemNum int32
|
||||
}
|
||||
|
||||
type MapGrid struct {
|
||||
mtb.MapGrid
|
||||
rewardItems []*MapGridRewardItem
|
||||
}
|
||||
|
||||
type MapGridTable struct {
|
||||
f5.IdMetaTable[MapGrid]
|
||||
awardGrids []*MapGrid
|
||||
maxGridId int32
|
||||
}
|
||||
|
||||
func (this *MapGrid) Init1() {
|
||||
if this.MapGrid.GetReward() == "" {
|
||||
return
|
||||
}
|
||||
tmpStrs := strings.Split(this.MapGrid.GetReward(), "|")
|
||||
for _, tmpStr := range tmpStrs {
|
||||
tmpStrs2 := strings.Split(tmpStr, ":")
|
||||
if len(tmpStrs2) > 1 {
|
||||
p := new(MapGridRewardItem)
|
||||
p.ItemId = q5.ToInt32(tmpStrs2[0])
|
||||
p.ItemNum = q5.ToInt32(tmpStrs2[1])
|
||||
q5.AppendSlice(&this.rewardItems, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *MapGrid) GetRewardItems() *[]*MapGridRewardItem {
|
||||
return &this.rewardItems
|
||||
}
|
||||
|
||||
func (this *MapGridTable) PostInit1() {
|
||||
this.Traverse(func(gridMeta *MapGrid) bool {
|
||||
if gridMeta.GetId() > this.maxGridId {
|
||||
this.maxGridId = gridMeta.GetId()
|
||||
}
|
||||
if len(gridMeta.rewardItems) > 0 {
|
||||
this.awardGrids = append(this.awardGrids, gridMeta)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (this *MapGridTable) GetMaxGridId() int32 {
|
||||
return this.maxGridId
|
||||
}
|
||||
|
||||
func (this *MapGridTable) GetAwardGridIdList() []int32 {
|
||||
idlist := []int32{}
|
||||
for _, item := range this.awardGrids {
|
||||
if item.GetId() > 0 {
|
||||
idlist = append(idlist, item.GetId())
|
||||
}
|
||||
}
|
||||
|
||||
return idlist
|
||||
}
|
28
server/wheelserver/mt/Reward.go
Normal file
28
server/wheelserver/mt/Reward.go
Normal file
@ -0,0 +1,28 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"math/rand"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Reward struct {
|
||||
mtb.Reward
|
||||
}
|
||||
|
||||
type RewardTable struct {
|
||||
f5.IdMetaTable[Reward]
|
||||
}
|
||||
|
||||
func (this *Reward) Init1() {
|
||||
if this.GetReward1() <= 0 {
|
||||
panic("Reward.reward_1 config error")
|
||||
}
|
||||
if this.GetReward1() > this.GetReward1(){
|
||||
panic("Reward.reward_2 config error")
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Reward) RandScore() int32 {
|
||||
return int32(int(this.GetReward1()) + rand.Intn(int(this.GetReward2() - this.GetReward1())))
|
||||
}
|
14
server/wheelserver/mt/ShopGoods.go
Normal file
14
server/wheelserver/mt/ShopGoods.go
Normal file
@ -0,0 +1,14 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type ShopGoods struct {
|
||||
mtb.ShopGoods
|
||||
}
|
||||
|
||||
type ShopGoodsTable struct {
|
||||
f5.IdMetaTable[ShopGoods]
|
||||
}
|
14
server/wheelserver/mt/Task.go
Normal file
14
server/wheelserver/mt/Task.go
Normal file
@ -0,0 +1,14 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
mtb.Task
|
||||
}
|
||||
|
||||
type TaskTable struct {
|
||||
f5.IdMetaTable[Task]
|
||||
}
|
19
server/wheelserver/mt/Web3ServiceCluster.go
Normal file
19
server/wheelserver/mt/Web3ServiceCluster.go
Normal file
@ -0,0 +1,19 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Web3ServiceCluster struct {
|
||||
mtb.Web3ServiceCluster
|
||||
}
|
||||
|
||||
type Web3ServiceClusterTable struct {
|
||||
f5.IdMetaTable[Web3ServiceCluster]
|
||||
selfConf *Web3ServiceCluster
|
||||
}
|
||||
|
||||
func (this *Web3ServiceCluster) Init1() {
|
||||
|
||||
}
|
17
server/wheelserver/mt/WheelDb.go
Normal file
17
server/wheelserver/mt/WheelDb.go
Normal file
@ -0,0 +1,17 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type WheelDb struct {
|
||||
mtb.WheelDb
|
||||
}
|
||||
|
||||
type WheelDbTable struct {
|
||||
f5.IdMetaTable[WheelDb]
|
||||
}
|
||||
|
||||
func (this *WheelDb) Init1() {
|
||||
}
|
30
server/wheelserver/mt/WheelServerCluster.go
Normal file
30
server/wheelserver/mt/WheelServerCluster.go
Normal file
@ -0,0 +1,30 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type WheelServerCluster struct {
|
||||
mtb.WheelServerCluster
|
||||
}
|
||||
|
||||
type WheelServerClusterTable struct {
|
||||
f5.IdMetaTable[WheelServerCluster]
|
||||
selfConf *WheelServerCluster
|
||||
}
|
||||
|
||||
func (this *WheelServerCluster) Init1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *WheelServerClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *WheelServerClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("loginserver集群无法读取本服配置")
|
||||
}
|
||||
}
|
83
server/wheelserver/mt/export.go
Normal file
83
server/wheelserver/mt/export.go
Normal file
@ -0,0 +1,83 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type table struct {
|
||||
WheelServerCluster *WheelServerClusterTable
|
||||
Config *ConfigTable
|
||||
Web3ServiceCluster *Web3ServiceClusterTable
|
||||
WheelDb *WheelDbTable
|
||||
Item *ItemTable
|
||||
Friend *FriendTable
|
||||
Global *GlobalTable
|
||||
Reward *RewardTable
|
||||
Task *TaskTable
|
||||
Buff *BuffTable
|
||||
MapGrid *MapGridTable
|
||||
ShopGoods *ShopGoodsTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func(this *table) {
|
||||
this.WheelServerCluster = f5.New(func(this *WheelServerClusterTable) {
|
||||
this.FileName = "../config/wheelserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
})
|
||||
|
||||
this.Web3ServiceCluster = f5.New(func(this *Web3ServiceClusterTable) {
|
||||
this.FileName = "../config/web3service.cluster.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.Config = f5.New(func(this *ConfigTable) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.WheelDb = f5.New(func(this *WheelDbTable) {
|
||||
this.FileName = "../config/wheeldb.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.Item = f5.New(func(this *ItemTable) {
|
||||
this.FileName = "../res/item@item.json"
|
||||
this.PrimKey = "id"
|
||||
})
|
||||
|
||||
this.Friend = f5.New(func(this *FriendTable) {
|
||||
this.FileName = "../res/friend@friend.json"
|
||||
this.PrimKey = "id"
|
||||
})
|
||||
|
||||
this.Global = f5.New(func(this *GlobalTable) {
|
||||
this.FileName = "../res/global@global.json"
|
||||
this.PrimKey = "type"
|
||||
})
|
||||
|
||||
this.Reward = f5.New(func(this *RewardTable) {
|
||||
this.FileName = "../res/reward@reward.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.Task = f5.New(func(this *TaskTable) {
|
||||
this.FileName = "../res/task@task.json"
|
||||
this.PrimKey = "id"
|
||||
})
|
||||
|
||||
this.Buff = f5.New(func(this *BuffTable) {
|
||||
this.FileName = "../res/buff@buff.json"
|
||||
this.PrimKey = "buff_id"
|
||||
})
|
||||
|
||||
this.MapGrid = f5.New(func(this *MapGridTable) {
|
||||
this.FileName = "../res/mapGrid@mapGrid.json"
|
||||
this.PrimKey = "id"
|
||||
})
|
||||
|
||||
this.ShopGoods = f5.New(func(this *ShopGoodsTable) {
|
||||
this.FileName = "../res/shopGoods@shopGoods.json"
|
||||
this.PrimKey = "goods_id"
|
||||
})
|
||||
|
||||
})
|
32
server/wheelserver/mt/global.go
Normal file
32
server/wheelserver/mt/global.go
Normal file
@ -0,0 +1,32 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Global struct {
|
||||
mtb.Global
|
||||
}
|
||||
|
||||
type GlobalTable struct {
|
||||
f5.IdMetaTable[Global]
|
||||
}
|
||||
|
||||
func (this *GlobalTable) GetDailyDiceNum() int32 {
|
||||
meta := this.GetById(1)
|
||||
if meta == nil {
|
||||
return 0
|
||||
} else {
|
||||
return meta.GetNumber()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *GlobalTable) GetBosonNum() int32 {
|
||||
meta := this.GetById(2)
|
||||
if meta == nil {
|
||||
return 0
|
||||
} else {
|
||||
return meta.GetNumber()
|
||||
}
|
||||
}
|
584
server/wheelserver/mtb/mtb.auto_gen.go
Normal file
584
server/wheelserver/mtb/mtb.auto_gen.go
Normal file
@ -0,0 +1,584 @@
|
||||
package mtb
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type WheelServerCluster struct {
|
||||
instance_id int32
|
||||
http_listen_port int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type WheelDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Web3ServiceCluster struct {
|
||||
url string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
id int32
|
||||
level int32
|
||||
price_type int32
|
||||
item_type int32
|
||||
time int32
|
||||
produce_type int32
|
||||
produce int32
|
||||
accelerate_type int32
|
||||
accelerate_price int32
|
||||
price int32
|
||||
buff_list string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Friend struct {
|
||||
id int32
|
||||
level int32
|
||||
reward_type int32
|
||||
reward int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Global struct {
|
||||
id int32
|
||||
type_ int32
|
||||
number int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Reward struct {
|
||||
id int32
|
||||
reward_1 int32
|
||||
reward_2 int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
id int32
|
||||
type_ int32
|
||||
conditon int32
|
||||
param1 int32
|
||||
param2 int32
|
||||
reward_type int32
|
||||
reward int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Buff struct {
|
||||
buff_id int32
|
||||
buff_effect int32
|
||||
duration_time int32
|
||||
can_stack int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type MapGrid struct {
|
||||
id int32
|
||||
reward string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type ShopGoods struct {
|
||||
shop_id int32
|
||||
goods_id int32
|
||||
item_id int32
|
||||
amount int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
shop_secret string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *WheelServerCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *WheelServerCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelServerCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *WheelServerCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *WheelDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *WheelDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *WheelDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *WheelDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *WheelDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *WheelDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Web3ServiceCluster) GetUrl() string {
|
||||
return this.url
|
||||
}
|
||||
|
||||
func (this *Web3ServiceCluster) HasUrl() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *Item) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetLevel() int32 {
|
||||
return this.level
|
||||
}
|
||||
|
||||
func (this *Item) HasLevel() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetPriceType() int32 {
|
||||
return this.price_type
|
||||
}
|
||||
|
||||
func (this *Item) HasPriceType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetItemType() int32 {
|
||||
return this.item_type
|
||||
}
|
||||
|
||||
func (this *Item) HasItemType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetTime() int32 {
|
||||
return this.time
|
||||
}
|
||||
|
||||
func (this *Item) HasTime() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetProduceType() int32 {
|
||||
return this.produce_type
|
||||
}
|
||||
|
||||
func (this *Item) HasProduceType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 9)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetProduce() int32 {
|
||||
return this.produce
|
||||
}
|
||||
|
||||
func (this *Item) HasProduce() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetAccelerateType() int32 {
|
||||
return this.accelerate_type
|
||||
}
|
||||
|
||||
func (this *Item) HasAccelerateType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetAcceleratePrice() int32 {
|
||||
return this.accelerate_price
|
||||
}
|
||||
|
||||
func (this *Item) HasAcceleratePrice() bool {
|
||||
return (this._flags1_ & (uint64(1) << 8)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetPrice() int32 {
|
||||
return this.price
|
||||
}
|
||||
|
||||
func (this *Item) HasPrice() bool {
|
||||
return (this._flags1_ & (uint64(1) << 10)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetBuffList() string {
|
||||
return this.buff_list
|
||||
}
|
||||
|
||||
func (this *Item) HasBuffList() bool {
|
||||
return (this._flags1_ & (uint64(1) << 11)) > 0
|
||||
}
|
||||
|
||||
func (this *Friend) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *Friend) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Friend) GetLevel() int32 {
|
||||
return this.level
|
||||
}
|
||||
|
||||
func (this *Friend) HasLevel() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Friend) GetRewardType() int32 {
|
||||
return this.reward_type
|
||||
}
|
||||
|
||||
func (this *Friend) HasRewardType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Friend) GetReward() int32 {
|
||||
return this.reward
|
||||
}
|
||||
|
||||
func (this *Friend) HasReward() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *Global) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *Global) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Global) GetType() int32 {
|
||||
return this.type_
|
||||
}
|
||||
|
||||
func (this *Global) HasType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Global) GetNumber() int32 {
|
||||
return this.number
|
||||
}
|
||||
|
||||
func (this *Global) HasNumber() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Reward) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *Reward) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Reward) GetReward1() int32 {
|
||||
return this.reward_1
|
||||
}
|
||||
|
||||
func (this *Reward) HasReward1() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Reward) GetReward2() int32 {
|
||||
return this.reward_2
|
||||
}
|
||||
|
||||
func (this *Reward) HasReward2() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *Task) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetType() int32 {
|
||||
return this.type_
|
||||
}
|
||||
|
||||
func (this *Task) HasType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetConditon() int32 {
|
||||
return this.conditon
|
||||
}
|
||||
|
||||
func (this *Task) HasConditon() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetParam1() int32 {
|
||||
return this.param1
|
||||
}
|
||||
|
||||
func (this *Task) HasParam1() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetParam2() int32 {
|
||||
return this.param2
|
||||
}
|
||||
|
||||
func (this *Task) HasParam2() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetRewardType() int32 {
|
||||
return this.reward_type
|
||||
}
|
||||
|
||||
func (this *Task) HasRewardType() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *Task) GetReward() int32 {
|
||||
return this.reward
|
||||
}
|
||||
|
||||
func (this *Task) HasReward() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *Buff) GetBuffId() int32 {
|
||||
return this.buff_id
|
||||
}
|
||||
|
||||
func (this *Buff) HasBuffId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Buff) GetBuffEffect() int32 {
|
||||
return this.buff_effect
|
||||
}
|
||||
|
||||
func (this *Buff) HasBuffEffect() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Buff) GetDurationTime() int32 {
|
||||
return this.duration_time
|
||||
}
|
||||
|
||||
func (this *Buff) HasDurationTime() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Buff) GetCanStack() int32 {
|
||||
return this.can_stack
|
||||
}
|
||||
|
||||
func (this *Buff) HasCanStack() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *MapGrid) GetId() int32 {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *MapGrid) HasId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *MapGrid) GetReward() string {
|
||||
return this.reward
|
||||
}
|
||||
|
||||
func (this *MapGrid) HasReward() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *ShopGoods) GetShopId() int32 {
|
||||
return this.shop_id
|
||||
}
|
||||
|
||||
func (this *ShopGoods) HasShopId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *ShopGoods) GetGoodsId() int32 {
|
||||
return this.goods_id
|
||||
}
|
||||
|
||||
func (this *ShopGoods) HasGoodsId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *ShopGoods) GetItemId() int32 {
|
||||
return this.item_id
|
||||
}
|
||||
|
||||
func (this *ShopGoods) HasItemId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *ShopGoods) GetAmount() int32 {
|
||||
return this.amount
|
||||
}
|
||||
|
||||
func (this *ShopGoods) HasAmount() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetShopSecret() string {
|
||||
return this.shop_secret
|
||||
}
|
||||
|
||||
func (this *Config) HasShopSecret() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *WheelServerCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *WheelDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
||||
func (this *Web3ServiceCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.url, "url", &this._flags1_, 1, kv)
|
||||
}
|
||||
|
||||
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.level, "level", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.price_type, "price_type", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.item_type, "item_type", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.time, "time", &this._flags1_, 5, kv)
|
||||
f5.ReadMetaTableField(&this.produce_type, "produce_type", &this._flags1_, 9, kv)
|
||||
f5.ReadMetaTableField(&this.produce, "produce", &this._flags1_, 6, kv)
|
||||
f5.ReadMetaTableField(&this.accelerate_type, "accelerate_type", &this._flags1_, 7, kv)
|
||||
f5.ReadMetaTableField(&this.accelerate_price, "accelerate_price", &this._flags1_, 8, kv)
|
||||
f5.ReadMetaTableField(&this.price, "price", &this._flags1_, 10, kv)
|
||||
f5.ReadMetaTableField(&this.buff_list, "buff_list", &this._flags1_, 11, kv)
|
||||
}
|
||||
|
||||
func (this *Friend) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.level, "level", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.reward_type, "reward_type", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.reward, "reward", &this._flags1_, 4, kv)
|
||||
}
|
||||
|
||||
func (this *Global) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.type_, "type", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.number, "number", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *Reward) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.reward_1, "reward_1", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.reward_2, "reward_2", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *Task) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.type_, "type", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.conditon, "conditon", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.param1, "param1", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.param2, "param2", &this._flags1_, 5, kv)
|
||||
f5.ReadMetaTableField(&this.reward_type, "reward_type", &this._flags1_, 6, kv)
|
||||
f5.ReadMetaTableField(&this.reward, "reward", &this._flags1_, 7, kv)
|
||||
}
|
||||
|
||||
func (this *Buff) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.buff_id, "buff_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.buff_effect, "buff_effect", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.duration_time, "duration_time", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.can_stack, "can_stack", &this._flags1_, 6, kv)
|
||||
}
|
||||
|
||||
func (this *MapGrid) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.reward, "reward", &this._flags1_, 2, kv)
|
||||
}
|
||||
|
||||
func (this *ShopGoods) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.shop_id, "shop_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.goods_id, "goods_id", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.item_id, "item_id", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.amount, "amount", &this._flags1_, 4, kv)
|
||||
}
|
||||
|
||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.shop_secret, "shop_secret", &this._flags1_, 1, kv)
|
||||
}
|
98
server/wheelserver/proto/mt.proto
Normal file
98
server/wheelserver/proto/mt.proto
Normal file
@ -0,0 +1,98 @@
|
||||
package mt;
|
||||
|
||||
option go_package = ".;mt";
|
||||
|
||||
message WheelServerCluster
|
||||
{
|
||||
optional int32 instance_id = 1;
|
||||
optional int32 http_listen_port = 3;
|
||||
}
|
||||
|
||||
message WheelDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message Web3ServiceCluster
|
||||
{
|
||||
optional string url = 1;
|
||||
}
|
||||
|
||||
message Item
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 level = 2;
|
||||
optional int32 price_type = 3;
|
||||
optional int32 item_type = 4;
|
||||
optional int32 time = 5;
|
||||
optional int32 produce_type = 9;
|
||||
optional int32 produce = 6;
|
||||
optional int32 accelerate_type = 7;
|
||||
optional int32 accelerate_price = 8;
|
||||
optional int32 price = 10;
|
||||
optional string buff_list = 11;
|
||||
}
|
||||
|
||||
message Friend
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 level = 2;
|
||||
optional int32 reward_type = 3;
|
||||
optional int32 reward = 4;
|
||||
}
|
||||
|
||||
message Global
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 type = 2;
|
||||
optional int32 number = 3;
|
||||
}
|
||||
|
||||
message Reward
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 reward_1 = 2;
|
||||
optional int32 reward_2 = 3;
|
||||
}
|
||||
|
||||
message Task
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional int32 type = 2;
|
||||
optional int32 conditon = 3;
|
||||
optional int32 param1 = 4;
|
||||
optional int32 param2 = 5;
|
||||
optional int32 reward_type = 6;
|
||||
optional int32 reward = 7;
|
||||
}
|
||||
|
||||
message Buff
|
||||
{
|
||||
optional int32 buff_id = 1;
|
||||
optional int32 buff_effect = 2;
|
||||
optional int32 duration_time = 3;
|
||||
optional int32 can_stack = 6;
|
||||
}
|
||||
|
||||
message MapGrid
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional string reward = 2;
|
||||
}
|
||||
|
||||
message ShopGoods
|
||||
{
|
||||
optional int32 shop_id = 1;
|
||||
optional int32 goods_id = 2;
|
||||
optional int32 item_id = 3;
|
||||
optional int32 amount = 4;
|
||||
}
|
||||
|
||||
message Config
|
||||
{
|
||||
optional string shop_secret = 1;
|
||||
}
|
2
server/wheelserver/proto/protoc-gen.bat
Normal file
2
server/wheelserver/proto/protoc-gen.bat
Normal file
@ -0,0 +1,2 @@
|
||||
protoc --go_out=..\cs .\cs_*.proto
|
||||
protoc --go_out=..\ss .\ss_*.proto
|
19
server/wheelserver/router/activity/activity.go
Normal file
19
server/wheelserver/router/activity/activity.go
Normal file
@ -0,0 +1,19 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"f5"
|
||||
v1 "main/api/v1"
|
||||
"main/middleware"
|
||||
)
|
||||
|
||||
type ActivityRouter struct{}
|
||||
|
||||
func (this *ActivityRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.ActivityApiGroup
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/activity/roll_dice",
|
||||
middleware.JwtAuth,
|
||||
api.ActivityApi.RollDice)
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/activity/claim",
|
||||
middleware.JwtAuth,
|
||||
api.ActivityApi.Claim)
|
||||
}
|
5
server/wheelserver/router/activity/enter.go
Normal file
5
server/wheelserver/router/activity/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package activity
|
||||
|
||||
type RouterGroup struct {
|
||||
ActivityRouter
|
||||
}
|
19
server/wheelserver/router/bag/bag.go
Normal file
19
server/wheelserver/router/bag/bag.go
Normal file
@ -0,0 +1,19 @@
|
||||
package bag
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type BagRouter struct{}
|
||||
|
||||
func (this *BagRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.BagApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/bag/list",
|
||||
middleware.JwtAuth,
|
||||
api.BagApi.List)
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/bag/use_item",
|
||||
middleware.JwtAuth,
|
||||
api.BagApi.UseItem)
|
||||
}
|
5
server/wheelserver/router/bag/enter.go
Normal file
5
server/wheelserver/router/bag/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package bag
|
||||
|
||||
type RouterGroup struct {
|
||||
BagRouter
|
||||
}
|
16
server/wheelserver/router/buff/buff.go
Normal file
16
server/wheelserver/router/buff/buff.go
Normal file
@ -0,0 +1,16 @@
|
||||
package buff
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type BuffRouter struct{}
|
||||
|
||||
func (this *BuffRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.BuffApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/buff/list",
|
||||
middleware.JwtAuth,
|
||||
api.BuffApi.List)
|
||||
}
|
5
server/wheelserver/router/buff/enter.go
Normal file
5
server/wheelserver/router/buff/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package buff
|
||||
|
||||
type RouterGroup struct {
|
||||
BuffRouter
|
||||
}
|
16
server/wheelserver/router/chip/chip.go
Normal file
16
server/wheelserver/router/chip/chip.go
Normal file
@ -0,0 +1,16 @@
|
||||
package chip
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
"main/middleware"
|
||||
)
|
||||
|
||||
type ChipRouter struct{}
|
||||
|
||||
func (this *ChipRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.ChipApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/chip/list",
|
||||
middleware.JwtAuth,
|
||||
api.ChipApi.List)
|
||||
}
|
5
server/wheelserver/router/chip/enter.go
Normal file
5
server/wheelserver/router/chip/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package chip
|
||||
|
||||
type RouterGroup struct {
|
||||
ChipRouter
|
||||
}
|
12
server/wheelserver/router/export.go
Normal file
12
server/wheelserver/router/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _routerMgr = new(routerMgr)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.ROUTER_MGR_MODULE_IDX, _routerMgr)
|
||||
}
|
5
server/wheelserver/router/friend/enter.go
Normal file
5
server/wheelserver/router/friend/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package friend
|
||||
|
||||
type RouterGroup struct {
|
||||
FriendRouter
|
||||
}
|
16
server/wheelserver/router/friend/friend.go
Normal file
16
server/wheelserver/router/friend/friend.go
Normal file
@ -0,0 +1,16 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type FriendRouter struct{}
|
||||
|
||||
func (this *FriendRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.FriendApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/friend/list",
|
||||
middleware.JwtAuth,
|
||||
api.FriendApi.List)
|
||||
}
|
5
server/wheelserver/router/gm/enter.go
Normal file
5
server/wheelserver/router/gm/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package gm
|
||||
|
||||
type RouterGroup struct {
|
||||
GMRouter
|
||||
}
|
16
server/wheelserver/router/gm/gm.go
Normal file
16
server/wheelserver/router/gm/gm.go
Normal file
@ -0,0 +1,16 @@
|
||||
package gm
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type GMRouter struct{}
|
||||
|
||||
func (this *GMRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.GmApiGroup
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/gm/exec_cmd",
|
||||
middleware.JwtAuth,
|
||||
api.GmApi.ExecCmd)
|
||||
}
|
5
server/wheelserver/router/inapp_shop/enter.go
Normal file
5
server/wheelserver/router/inapp_shop/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package inapp_shop
|
||||
|
||||
type RouterGroup struct {
|
||||
InAppShopRouter
|
||||
}
|
21
server/wheelserver/router/inapp_shop/inapp_shop.go
Normal file
21
server/wheelserver/router/inapp_shop/inapp_shop.go
Normal file
@ -0,0 +1,21 @@
|
||||
package inapp_shop
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type InAppShopRouter struct{}
|
||||
|
||||
func (this *InAppShopRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.InAppShopApiGroup
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/inapp_shop/purchase",
|
||||
middleware.JwtAuth,
|
||||
api.InAppShopApi.Purchase)
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/inapp_shop/order/:order_id",
|
||||
middleware.JwtAuth,
|
||||
api.InAppShopApi.OrderInfo)
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/inapp_shop/callback",
|
||||
api.InAppShopApi.Callback)
|
||||
}
|
5
server/wheelserver/router/item/enter.go
Normal file
5
server/wheelserver/router/item/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package item
|
||||
|
||||
type RouterGroup struct {
|
||||
ItemRouter
|
||||
}
|
13
server/wheelserver/router/item/item.go
Normal file
13
server/wheelserver/router/item/item.go
Normal file
@ -0,0 +1,13 @@
|
||||
package item
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type ItemRouter struct{}
|
||||
|
||||
func (this *ItemRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.ItemApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/item/list", api.ItemApi.List)
|
||||
}
|
5
server/wheelserver/router/mission/enter.go
Normal file
5
server/wheelserver/router/mission/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package mission
|
||||
|
||||
type RouterGroup struct {
|
||||
MissionRouter
|
||||
}
|
22
server/wheelserver/router/mission/mission.go
Normal file
22
server/wheelserver/router/mission/mission.go
Normal file
@ -0,0 +1,22 @@
|
||||
package mission
|
||||
|
||||
import (
|
||||
"f5"
|
||||
v1 "main/api/v1"
|
||||
"main/middleware"
|
||||
)
|
||||
|
||||
type MissionRouter struct{}
|
||||
|
||||
func (this *MissionRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.MissionApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/v1/mission/list",
|
||||
middleware.JwtAuth,
|
||||
api.MissionApi.List)
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/mission/update",
|
||||
middleware.JwtAuth,
|
||||
api.MissionApi.UpdateTask)
|
||||
f5.GetApp().GetGinEngine().POST("/api/v1/mission/claim",
|
||||
middleware.JwtAuth,
|
||||
api.MissionApi.ClaimTaskAward)
|
||||
}
|
53
server/wheelserver/router/routermgr.go
Normal file
53
server/wheelserver/router/routermgr.go
Normal file
@ -0,0 +1,53 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/router/activity"
|
||||
"main/router/chip"
|
||||
"main/router/friend"
|
||||
"main/router/item"
|
||||
"main/router/mission"
|
||||
"main/router/shop"
|
||||
"main/router/user"
|
||||
"main/router/bag"
|
||||
"main/router/buff"
|
||||
"main/router/gm"
|
||||
"main/router/inapp_shop"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
activity activity.RouterGroup
|
||||
chip chip.RouterGroup
|
||||
friend friend.RouterGroup
|
||||
item item.RouterGroup
|
||||
mission mission.RouterGroup
|
||||
shop shop.RouterGroup
|
||||
user user.RouterGroup
|
||||
bag bag.RouterGroup
|
||||
buff buff.RouterGroup
|
||||
gm gm.RouterGroup
|
||||
inappShop inapp_shop.RouterGroup
|
||||
}
|
||||
|
||||
func (this *routerMgr) Init() {
|
||||
f5.GetApp().GetGinEngine().Use(middleware.Cors())
|
||||
this.activity.ActivityRouter.InitRouter()
|
||||
this.chip.ChipRouter.InitRouter()
|
||||
this.friend.FriendRouter.InitRouter()
|
||||
this.item.ItemRouter.InitRouter()
|
||||
this.mission.MissionRouter.InitRouter()
|
||||
this.shop.ShopRouter.InitRouter()
|
||||
this.user.UserRouter.InitRouter()
|
||||
this.bag.BagRouter.InitRouter()
|
||||
this.buff.BuffRouter.InitRouter()
|
||||
this.gm.GMRouter.InitRouter()
|
||||
this.inappShop.InAppShopRouter.InitRouter()
|
||||
|
||||
f5.GetSysLog().Info("routerMgr.init")
|
||||
|
||||
}
|
||||
|
||||
func (this *routerMgr) UnInit() {
|
||||
|
||||
}
|
5
server/wheelserver/router/shop/enter.go
Normal file
5
server/wheelserver/router/shop/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package shop
|
||||
|
||||
type RouterGroup struct {
|
||||
ShopRouter
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user