def getChapter(self, novelNo, chapterNo, chapterTitle):
     Log.info("getChapter novelNo [ %s ] chapterNo [ %s ] "
              " chapterTitle [ %s ]  " % (novelNo, chapterNo, chapterTitle))
     fileTools = FileTools(systemCode.baseFolder + u'/SourceUrlFile/' +
                           novelNo + u'/' + chapterNo + chapterTitle +
                           u'.n')
     content = fileTools.readFile()
     result = ResponseChapterContent(content)
     return ObjectJson.convert_to_dict(result)
    def userGetChapter(self, novelNo, chapterNo, chapterTitle, id):
        Log.info("userGetChapter novelNo [ %s ] chapterNo [ %s ] "
                 " chapterTitle [ %s ]  user id [%s]" %
                 (novelNo, chapterNo, chapterTitle, id))
        fileTools = FileTools(systemCode.baseFolder + u'/SourceUrlFile/' +
                              novelNo + u'/' + chapterNo + chapterTitle +
                              u'.n')
        content = fileTools.readFile()

        split = systemCode.fileContentSplit
        userReadInfo = id + split + novelNo + split + chapterNo + split + chapterTitle
        fileTools = FileTools(systemCode.userReadNovelFile)
        readInfo = fileTools.readFile()
        if userReadInfo not in readInfo:
            fileTools = FileTools(systemCode.userReadNovelFile)
            fileTools.fileWriteAppend(userReadInfo)
        result = ResponseChapterContent(content)
        return ObjectJson.convert_to_dict(result)
 def registry(self, username, password, org):
     if org != 'Super':
         return systemCode.registryErrorOrg
     elif username == '' or password == '':
         return systemCode.registryErrorNameOrPwd
     else:
         fileTools = FileTools(systemCode.userInfoFile)
         allUser = fileTools.readFile()
         if username in allUser:
             return systemCode.registryErrorAlready
         else:
             split = systemCode.fileContentSplit
             millis = int(round(time.time() * 100000))
             rand = random.randint(1, 1000)
             id = millis + rand
             user = str(
                 id
             ) + split + username + split + password + split + org + u'\r\n'
             fileTools = FileTools(systemCode.userInfoFile)
             fileTools.fileWriteAppend(user)
             user = ResponseUser(id, username, password, org)
             return ObjectJson.convert_to_dict(user)