Example #1
0
    def post(self):
        data = json.loads(self.request.body.decode("utf-8"))

        (result_code, dts_id) = yield DtsMgr.createDts(self.p_userid, data)

        self.set_status(result_code)
        if dts_id:
            self.write({"id": dts_id})

        self.finish()
Example #2
0
    def post(self):
        data = json.loads(self.request.body.decode("utf-8"))

        logging.info("begin to create dts %r" % data)

        userid = str(data.get("userid", ""))
        pingpang_id = data.get("pingpangId", "")
        
        if not userid:
            self.set_status(403)
            self.finish()
            return

        (result_code, dts_id) = yield DtsMgr.createDts(userid, data)
        self.set_status(result_code)

        result_body = {"pingpangId":pingpang_id}

        if dts_id:
            result_body["id"] = dts_id

        self.write(result_body)

        self.finish()