forked from mailgyc/doudizhu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
364da08
commit 0ad0d0d
Showing
13 changed files
with
166 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
运行: | ||
|
||
pip3 install tornado bcrypt pymysql | ||
pip3 install tornado bcrypt pymysql msgpack | ||
|
||
python3 main.py | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from concurrent.futures import ThreadPoolExecutor | ||
|
||
from tornado.escape import json_encode | ||
from tornado.web import RequestHandler | ||
|
||
from db import torndb | ||
|
||
|
||
class BaseHandler(RequestHandler): | ||
|
||
@property | ||
def db(self) -> torndb.Connection: | ||
return self.application.db | ||
|
||
@property | ||
def executor(self) -> ThreadPoolExecutor: | ||
return self.application.executor | ||
|
||
def data_received(self, chunk): | ||
pass | ||
|
||
def get_current_user(self): | ||
return self.get_secure_cookie("user") | ||
|
||
def set_current_user(self, uid, username): | ||
info = { | ||
'uid': uid, | ||
'username': username, | ||
} | ||
self.set_secure_cookie('user', json_encode(info)) | ||
|
||
def on_finish(self): | ||
# self.session.flush() | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.