Skip to content

Conversation

leeQT
Copy link

@leeQT leeQT commented Nov 16, 2018

No description provided.

self.view = view

def book_ticket(self,act_id):
acts = Activity.objects.select_for_update().filter(id=int(act_id))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有为票据加锁。

if currentTime > activity.book_end.timestamp():
return self.reply_text('对不起,抢票已经截止')
if Ticket.objects.filter(student_id = self.user.student_id, activity = activity, status = Ticket.STATUS_VALID):
return self.reply_text('一个人只能抢一张票哦 ^口..口^')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

某些活动允许一个人抢多张票,此处逻辑不太正确。

currentTime = datetime.datetime.now().timestamp()
for ticket in tickets:
if ticket.status == Ticket.STATUS_VALID:
str1 = '有效票未使用'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'str1'命名过于随意,语意不清。

self.check_input('username', 'password')
username = self.input['username']
password = self.input['password']
# try:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释掉的代码应及时删除。

try:
wechat_menu = CustomWeChatView.lib.get_wechat_menu()
current_btns = list()
for b in wechat_menu:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‘b’命名过于随意,语意不清。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant