Ejemplo n.º 1
0
Archivo: admin.py Proyecto: lucylqe/EC
    def POST(self):
        data = web.input(myfile={})
        yes = False
        myfile = data.pop("myfile")
        if 'collection' in data:
            collection = data.pop('collection')
            if collection == 'personnel_info':
                data['data_access'] = int(data['data_access'])
                data['credit'] = int(data['credit'])
                yes = Model.admin_personnel_info_Add(data)
            elif collection == 'papers_manager':
                filedir = 'static/upload/papers_research/'
                filename = myfile.filename.decode('utf-8')
                fout = open(filedir + filename, 'wb')
                fout.write(myfile.file.read())
                fout.close()
                data['href'] = filedir + filename
                yes = Model.admin_papers_manager_Add(data)
            else:
                pass
        else:
            yes = Model.adminAdd(data)

        return response(True, 'adminAdd成功') if yes else response(
            False, 'adminAdd操作失败')
Ejemplo n.º 2
0
 def GET(self):
     data = web.input()
     name_id = data['name_id']
     if Model.admin_personnel_info_Get(name_id=name_id):
         return response(False, '已注册')
     else:
         return response(True, 'OK')
Ejemplo n.º 3
0
 def GET(self):
     _id = web.input(id='-1')['_id']
     record = Model.wiki_article_get(_id=_id)
     if getNav(record[0]['postion'])[1]:  #此次条下不能有文章
         return response(False, '删除失败')
     if Model.wiki_del(_id):
         return response(True, '删除成功')
     else:
         return response(False, '删除失败')
Ejemplo n.º 4
0
 def GET(self):
     _id=web.input(id='-1')['_id']
     record=Model.wiki_article_get(_id=_id)
     if getNav(record[0]['postion'])[1]: #此次条下不能有文章
         return response(False,'删除失败')
     if Model.wiki_del(_id):
         return response(True,'删除成功')
     else:
         return response(False,'删除失败')
Ejemplo n.º 5
0
 def POST(self,categroy):
     data=web.input()
     yes=0
     _id=data.pop('_id')
     print _id
     if categroy=='baseIfor':
         yes=Model.admin_meeting_update(_id,data)
     if yes:
         return response(True,'Ok')
     else:
         return response(False,'数据库忙')           
Ejemplo n.º 6
0
 def POST(self,category):
     data=web.input()
     yes=0
     if category=='baseIfor':
         yes=Model.admin_meeting_add(data)
     elif category=='participants':
         data['category']='participants'
         yes=Model.admin_meeting_add(data)
     if yes:
         return response(True,'Ok')
     else:
         return response(False,'数据库忙')
Ejemplo n.º 7
0
 def POST(self,category):
     data=web.input()
     yes=0
     _id=data.pop('_id')
     print _id
     if category=='baseIfor':
         yes=Model.admin_meeting_del(_id)
     elif category=='participants':
         yes=Model.admin_meeting_del(_id)
     if yes:
         return response(True,'Ok')
     else:
         return response(False,'数据库忙')  
Ejemplo n.º 8
0
Archivo: admin.py Proyecto: lucylqe/EC
    def POST(self):
        data = web.input()
        yes = False
        if 'collection' in data:
            collection = data.pop('collection')
            if collection == 'personnel_info':
                data['data_access'] = int(data['data_access'])
                data['credit'] = int(data['credit'])
                yes = Model.admin_personnel_info_Edit(data)
            elif collection == 'papers_manager':
                yes = Model.admin_papers_manager_Edit(data)
        else:
            yes = Model.adminEdit(data)

        return response(True, '编辑成功') if yes else response(False, '编辑失败')
Ejemplo n.º 9
0
 def POST(self):
     data=web.input()  
     yes=False
     if 'collection' in  data :
         collection=data.pop('collection')
         if collection=='personnel_info':
             data['data_access']=int(data['data_access'])
             data['credit']=int(data['credit'])
             yes=Model.admin_personnel_info_Edit(data)
         elif collection=='papers_manager':
             yes=Model.admin_papers_manager_Edit(data)
     else: 
         yes=Model.adminEdit(data)
     
     return response(True,'编辑成功') if yes else response(False,'编辑失败')
Ejemplo n.º 10
0
 def POST(self):
     print 'write_blog函数调用POST'
     GetDict=web.input()
     #for i in web.input():
     #    print type(i),type(web.input()[i]),i,'-->',GetDict[i]
     try:
         _id,name_id,date,title,content=GetDict["_id"],GetDict["name_id"],GetDict["date"],GetDict["title"],GetDict["content"]
         try:classification=GetDict["classification"]
         except:classification="未分类博客" 
         if name_id and date and title and content:
             T=Model.Add_OR_Edit_blog_articles(_id,name_id,date,title,content,classification)
             return response(True,"操作成功!") if T else response(False,"数据库忙")
             #return web.seeother('/user_blog?name_id='+name_id)
         else:
             return response(False,"内容不能为空")
     except:
         raise '发博文请求错误'
Ejemplo n.º 11
0
Archivo: admin.py Proyecto: lucylqe/EC
    def POST(self):
        data = web.input()
        yes = False
        _id = data["_id"]
        if 'collection' in data:
            collection = data['collection']
            if collection == 'personnel_info':
                yes = Model.admin_personnel_info_Del(_id)
            elif collection == 'papers_manager':
                try:
                    #删除文件
                    from os import remove
                    href = data['href']
                    remove(href)
                    yes = Model.admin_papers_manager_Del(_id)
                except WindowsError:
                    pass
            else:
                pass
        else:
            yes = Model.adminDel(_id)

        return response(True, 'del删除成功') if yes else response(False, 'del删除失败')
Ejemplo n.º 12
0
 def POST(self):
     data=web.input()  
     yes=False
     _id=data["_id"]
     if 'collection' in  data :
         collection=data['collection']
         if collection =='personnel_info':
             yes=Model.admin_personnel_info_Del(_id)
         elif collection=='papers_manager':
             try:
                 #删除文件
                 from os import remove
                 href=data['href']
                 remove(href)
                 yes=Model.admin_papers_manager_Del(_id)
             except  WindowsError:
                 pass
         else:
             pass
     else: 
         yes = Model.adminDel(_id)
         
     return response(True,'del删除成功') if yes else response(False,'del删除失败')
Ejemplo n.º 13
0
 def POST(self):
     data=web.input(myfile={})
     yes=False
     myfile=data.pop("myfile")
     if 'collection' in  data :
         collection=data.pop('collection')
         if collection=='personnel_info':
             data['data_access']=int(data['data_access'])
             data['credit']=int(data['credit'])
             yes = Model.admin_personnel_info_Add(data)
         elif collection=='papers_manager':
             filedir='static/upload/papers_research/'
             filename=myfile.filename.decode('utf-8')
             fout=open(filedir+filename,'wb')
             fout.write(myfile.file.read())
             fout.close()
             data['href']=filedir+filename
             yes = Model.admin_papers_manager_Add(data)
         else:
             pass
     else:
         yes = Model.adminAdd(data)
     
     return response(True,'adminAdd成功') if yes else response(False,'adminAdd操作失败')
Ejemplo n.º 14
0
 def GET(self):
     data = web.input()
     if Model.wiki_article_get(postion=data['postion']):
         return response(True, 'NO')
     else:
         return response(True, 'OK')
Ejemplo n.º 15
0
 def GET(self):
     data=web.input()
     if Model.wiki_article_get(postion=data['postion']):
         return response(True,'NO')
     else:
         return response(True,'OK')