Пример #1
0
 def get(self):
     data = {'act': 'postlist'}
     try:
         args = request.args
         if 'pid' in args:
             data.update({'post_ID': args['pid']})
     except:
         pass
     print(data)
     return logicClient.logic(self.c.connect(2, data))
Пример #2
0
 def delete(self):
     data = {
         'act': 'postDel',
     }
     try:
         args = request.args
         if 'pid' in args:
             data.update({'post_ID': args['pid']})
         arg = dict(request.get_json(force=False))
         data.update({'token': arg['token']})
     except:
         pass
     print(data)
     return logicClient.logic(self.c.connect(4, data))
Пример #3
0
 def post(self):
     try:
         c = clientServer.client()
         arg = dict(request.get_json(force=False))
         data = {
             'act': 'login',
             'account': arg['account'],
             'password': arg['password']
         }
         print(data)
         r = logicClient.logic(c.connect(1, data))
         return r
     except:
         return wrongProtocol
Пример #4
0
 def post(self):
     try:
         arg = dict(request.get_json(force=False))
         data = {
             'act': 'post',
             'title': arg['title'],
             'content': arg['content'],
             'class_ID': arg['class_ID'],
             'token': arg['token']
         }
         print(data)
         r = logicClient.logic(self.c.connect(3, data))
         return r
     except:
         return wrongProtocol
Пример #5
0
 def post(self):
     try:
         arg = dict(request.get_json(force=False))
         args = request.args
         data = {
             'act': 'comment',
             'post_ID': args['pid'],
             'msg_content': arg['content'],
             'token': arg['token']
         }
         print(data)
         r = logicClient.logic(self.c.connect(6, data))
         return r
     except:
         return wrongProtocol
Пример #6
0
 def post(self):
     try:
         c = clientServer.client()
         arg = dict(request.get_json(force=False))
         data = {
             'act': 'register',
             'name': arg['name'],
             'nickname': arg['nickname'],
             'account': arg['account'],
             'password': arg['password'],
             'school': arg['school'],
             'email': arg['email']
         }
         print(data)
         r = logicClient.logic(c.connect(0, data))
         return r
     except:
         return wrongProtocol
Пример #7
0
 def put(self):
     data = {
         'act': 'postEdit',
     }
     try:
         arg = dict(request.get_json(force=False))
         args = request.args
         data.update({
             'post_ID': args['pid'],
             'title': arg['title'],
             'content': arg['content'],
             'token': arg['token']
         })
         print(data)
         r = logicClient.logic(self.c.connect(5, data))
         return r
     except:
         return wrongProtocol
Пример #8
0
 def get(self):
     data = {}
     try:
         c = clientServer.client()
         arg = dict(request.get_json(force=False))
         if 'pid' in arg:
             data = {
                 'act': 'Like',
                 'from': arg['from'],
                 'post_ID': arg['pid'],
                 'token': arg['token']
             }
         elif 'mid' in arg:
             data = {
                 'act': 'Like',
                 'from': arg['from'],
                 'msg_ID': arg['mid'],
                 'token': arg['token']
             }
         print(data)
         r = logicClient.logic(c.connect(9, data))
         return r
     except:
         return wrongProtocol