コード例 #1
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def post(self, *args, **kwargs):
        """
        uid:
        aid:
        :return:
        """

        uid = (int)(self.get_argument("uid"))
        aid = (int)(self.get_argument("aid"))
        try:
            SVC_Article.upcountArticle(aid, uid)
        except Exception as e:
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg=""))
コード例 #2
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def post(self, *args, **kwargs):
        """
        uid:
        aid:
        :return:
        """

        uid = self.get_argument("uid")
        aid = (int)(self.get_argument("aid"))

        try:
            SVC_Article.delArticle(uid, aid)
        except Exception as e:
            logging.error(e)
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg=""))
コード例 #3
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def get(self, *args, **kwargs):
        """

        :return:
        """

        uid = self.get_argument("uid")
        aid = (int)(self.get_argument("aid"))

        res = False
        try:
            res = SVC_Article.checkUpcount(uid, aid)
        except Exception as e:
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg="", retdata=res))
コード例 #4
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def get(self, *args, **kwargs):
        """

        :return:
        """

        page = (int)(self.get_argument("page", 0))
        count = (int)(self.get_argument("count", 40))
        res = None
        try:
            res = SVC_Article.getNewestArticles(page, count)
        except Exception as e:
            logging.error(e)
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg="", retdata=res))
コード例 #5
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def post(self, *args, **kwargs):
        """

        :param aid:
        :param uid:
        :return:
        """
        uid = (int)(self.get_argument("uid"))
        aid = (int)(self.get_argument("aid"))
        try:
            ok, msg = SVC_Article.upcountArticleOnly(aid, uid)
        except Exception as e:
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        if ok:
            self.write(dict(errcode=RET.RET_OK, errmsg=""))
        else:
            self.write(dict(errcode=RET.RET_SERVERERR, errmsg=msg))
コード例 #6
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def get(self, *args, **kwargs):
        """
        獲取熱話題
        :return:
        """

        latest = (int)(self.get_argument("latest", 7))
        page = (int)(self.get_argument("page", 0))
        count = (int)(self.get_argument("count", 40))

        # 獲取熱門數據
        res = None
        try:
            res = SVC_Article.getArticleNewestHot(latest, page, count)
        except Exception as e:
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg="", retdata=res))
コード例 #7
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def get(self, *args, **kwargs):
        """
        id;話題id
        :return:
        """

        aid = (int)(self.get_argument("aid"))
        uid = (int)(self.get_argument("uid"))

        # 獲取文章數據
        res = None
        try:
            res = SVC_Article.getArticleById(aid)
        except Exception as e:
            logging.error(e)
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        # 獲取文章作者是不是 本請求的用戶 所關注的
        check = False
        author = res.get('uid', None)
        logging.debug(author)
        if author:
            try:
                check = SVC_UserFollower.check_user_folower_relation(
                    author, uid)
            except Exception as e:
                logging.error(e)
                self.write(
                    dict(errcode=RET.RET_SERVERERR,
                         errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
                raise e

            # 填寫粉絲關係數據
            res['follower'] = check

        self.write(dict(errcode=RET.RET_OK, errmsg="", retdata=res))
コード例 #8
0
ファイル: article.py プロジェクト: zjw0358/StockCompetition
    def post(self, *args, **kwargs):
        """
        uid:
        title:
        content:
        :return:
        """

        uid = self.get_argument("uid")
        title = self.get_argument("title")
        content = self.get_argument("content")

        try:
            aid = SVC_Article.addArticle(uid, title, content)
            SVC_Dongtai.add_dongtai_pub_topic(uid, aid, title)
        except Exception as e:
            logging.error(e)
            self.write(
                dict(errcode=RET.RET_SERVERERR,
                     errmsg=RETMSG_MAP[RET.RET_SERVERERR]))
            raise e

        self.write(dict(errcode=RET.RET_OK, errmsg=""))