Exemplo n.º 1
0
def getallqunuser(request):
    if request.method == "POST":
        pageNo = request.POST.get("page", None)  # 读取get数据,None为默认值
        userid = request.POST.get("userid", None)  # 读取get数据,None为默认值

    if request.method == "GET":
        pageNo = request.GET.get("page", None)  # 读取get数据,None为默认值
        userid = request.GET.get("userid", None)  # 读取get数据,None为默认值

    print("查询用户所在群下所有用户:用户ID:" + userid)

    result = {}

    page = PageForId()
    page.pageNo=pageNo
    page.userId=userid
    page.pageSize=20  #一次查询100个
    page.start=20*(pageNo-1)   #数据库本来就是从后向前查询的   在数据库中第0条记录就是最默认的记录
    allUsers = UserDAO.queryallqunuser(page)
    alluserback = []
    for i in range(len(allUsers)):
        alluserback.add(fun.user2else_back(allUsers[i]))


    print("查询到用户,数目为" ,len(alluserback))
    result["respcode"]= ResultCode.SUCCESS
    result["message"]= "查询用户成功!"
    result["data"]= alluserback
    result["errorcode"]= ResultCode.SUCCESS
    return result
Exemplo n.º 2
0
def getdifuser(request):
    if request.method == "POST":
        pageNo = request.POST.get("page", None)  # 读取get数据,None为默认值
        userid = request.POST.get("userid", None)  # 读取get数据,None为默认值
        showtype = request.POST.get("showtype", None)  # 读取get数据,None为默认值
    if request.method == "GET":
        pageNo = request.GET.get("page", None)  # 读取get数据,None为默认值
        userid = request.GET.get("userid", None)  # 读取get数据,None为默认值
        showtype = request.GET.get("showtype", None)  # 读取get数据,None为默认值

    print("查询各种各样的用户:用户ID:" + userid+"类型"+showtype)

    result = {}
    alluser =[]

    me = UserDAO.getUserInfoId(userid)
    if(not me):
        result["respcode"]= ResultCode.FAIL
        result["message"]= "用户不存在!请先注册登陆"
        result["data"]= ""
        result["errorcode"]= ResultCode.FAIL
        print("用户不存在")
        return result

    page = PageForId()
    page.pageNo=pageNo
    page.userId=userid
    page.pageSize=100  #一次查询100个
    page.deal=showtype
    totalPage = 0
    try:
        totalPage = MoreDAO.selectmorelistnumInfopage(page)
    except Exception as e1:
        print(e1)

    page.totalPage=totalPage
    page.pageSize=10
    page.start=10*(pageNo-1)   #数据库本来就是从后向前查询的   在数据库中第0条记录就是最默认的记录
    allmore = MoreDAO.selectmorelistInfopage(page)
    if(allmore  and  len(allmore) !=0):
        for i in range(len(allmore)):
            user1 = UserDAO.getUserInfoId(allmore[i].userid_destination)
            user_back = fun.user2else_back(user1)
            more = getuserdeal(userid,user1.id, ResultCode.USER_ZAN)
            if(more):
                user_back.ideal=ResultCode.USER_ZAN
            alluser.add(user_back)


    print("查询各种各样用户,数目为" ,len(alluser))
    result["respcode"]= ResultCode.SUCCESS
    result["message"]= "查询用户成功!"
    result["data"]= alluser
    result["errorcode"]= ResultCode.SUCCESS
    return result
Exemplo n.º 3
0
def getalldealdiaryforuserid(request):
    returnData={}
    if request.method == "POST":
        pageNo = request.POST.get("page", None)  # 读取post数据,None为默认值
        userid = request.POST.get("userid", None)  # 读取post数据,None为默认值
    if request.method == "GET":
        pageNo = request.GET.get("page", None)  # 读取get数据,None为默认值
        userid = request.GET.get("userid", None)  # 读取get数据,None为默认值

    print("查询指定用户日志处理接口参数:用户ID" + userid+"pageNo:"+pageNo)


    user = UserDAO.userInfoId(userid)

    page = PageForId()
    page.pageNo=pageNo
    page.userId=userid
    page.pageSize=10
    page.start=10*(pageNo-1)
    try:
        alluserdeal_back = []
        userelse = fun.user2else_back(user)
        alluserdeal = UserDealDAO.selectuserdealforuserid(page)
        for i in len(alluserdeal):

            userDeal_back = fun.userdeal2back(alluserdeal[i])
            userDeal_back.user(userelse)
            userDeal_back.qun(QunDAO.getqunInfoqunid(alluserdeal[i].qunid))
            alldealdiary_back = []
            alldealdiary = DiaryDealDAO.selectdealdiaryfordealid(userDeal_back.id)
            for t in range(len(alldealdiary)):
                dealDiary_Back = fun.dealdiary2back(alldealdiary[t])
                diary=DiaryDAO.selectDiary(alldealdiary[t].diaryid)
                diaryback=fun.diary2back(diary)
                dealDiary_Back.siary(diaryback)
                alldealdiary_back.add(dealDiary_Back)

            userDeal_back.alldealdiary(alldealdiary_back)
            alluserdeal_back.add(userDeal_back)

        returnData["respcode"]=ResultCode.SUCCESS
        returnData["message"]="查询所有日志处理成功!"
        returnData["data"]= alluserdeal_back
        returnData["errorcode"]=ResultCode.SUCCESS
        print("查询成功数目"+len(alluserdeal_back))

    except Exception as e:
        returnData["respcode"]=ResultCode.FAIL
        returnData["message"]= "查询所有日志处理失败!"
        returnData["errorcode"]= ResultCode.FAIL
        returnData["data"]=""
        print("查询失败")
    return returnData
Exemplo n.º 4
0
def getuserallimg(request):
    if request.method == "POST":
        pageNo = request.POST.get("page", None)  # 读取get数据,None为默认值
        userid = request.POST.get("userid", None)  # 读取get数据,None为默认值
    if request.method == "GET":
        pageNo = request.GET.get("page", None)  # 读取get数据,None为默认值
        userid = request.GET.get("userid", None)  # 读取get数据,None为默认值

    print("查询用户图片:用户ID:" + userid)

    result = {}
    allpic = []

    page = PageForId()
    page.pageNo=pageNo
    page.userId=userid
    page.pageSize=10  #一次查询100个
    page.start=10*(pageNo-1)   #数据库本来就是从后向前查询的   在数据库中第0条记录就是最默认的记录

    alldiary = DiaryDAO.selectimgdiarysforuser(page)

    if(alldiary  and  len(alldiary)!=0):
        for i in range(len(alldiary)):
            if(alldiary[i].imgone):
                allpic.add(alldiary[i].imgone)
            if(alldiary[i].imgtwo):
                allpic.add(alldiary[i].imgtwo)
            if(alldiary[i].imgthree):
                allpic.add(alldiary[i].imgthree)
            if(alldiary[i].imgfour):
                allpic.add(alldiary[i].imgfour)
            if(alldiary[i].imgfive):
                allpic.add(alldiary[i].imgfive)
            if(alldiary[i].imgsix):
                allpic.add(alldiary[i].imgsix)
            if(alldiary[i].imgseven):
                allpic.add(alldiary[i].imgseven)
            if(alldiary[i].imgeight):
                allpic.add(alldiary[i].imgeight)
            if(alldiary[i].imgnine):
                allpic.add(alldiary[i].imgnine)


    result["respcode"]= ResultCode.SUCCESS
    result["message"]= "查询群组图片成功!"
    result["data"]= allpic
    result["errorcode"]= ResultCode.SUCCESS
    return result