示例#1
0
文件: views.py 项目: five3/zyw
def member(req):
    logo_image = fun.get_site_logo(req)
    data = fun.warp_data(req.GET)
    info = controller.get_user_info(data)
    article_list = controller.get_user_article(data, req)
    # add credits
    controller.add_count_history(req.session.get('info',{}).get('id','0'), 'hudie')
    return render_to_response("zhiyuw/member.html", locals(), context_instance = RequestContext(req))
示例#2
0
def member(req):
    logo_image = fun.get_site_logo(req)
    data = fun.warp_data(req.GET)
    info = controller.get_user_info(data)
    article_list = controller.get_user_article(data, req)
    # add credits
    controller.add_count_history(
        req.session.get('info', {}).get('id', '0'), 'hudie')
    return render_to_response("zhiyuw/member.html",
                              locals(),
                              context_instance=RequestContext(req))
示例#3
0
文件: views.py 项目: five3/zyw
def comment(req):
    if req.method=='POST':
        data = fun.warp_data(req.POST)
        data['id'] = req.session.get('info',{}).get('id','0')
        if req.META.has_key('HTTP_X_FORWARDED_FOR'):
            data['ip'] =  req.META['HTTP_X_FORWARDED_FOR']
        else:
            data['ip'] = req.META['REMOTE_ADDR']
        # print data
        controller.add_comments(req, data)
        controller.add_count_history(req.session.get('info',{}).get('id','0'), 'comment')
        return HttpResponseRedirect(data.get('referer'))
示例#4
0
def comment(req):
    if req.method == 'POST':
        data = fun.warp_data(req.POST)
        data['id'] = req.session.get('info', {}).get('id', '0')
        if req.META.has_key('HTTP_X_FORWARDED_FOR'):
            data['ip'] = req.META['HTTP_X_FORWARDED_FOR']
        else:
            data['ip'] = req.META['REMOTE_ADDR']
        # print data
        controller.add_comments(req, data)
        controller.add_count_history(
            req.session.get('info', {}).get('id', '0'), 'comment')
        return HttpResponseRedirect(data.get('referer'))
示例#5
0
文件: views.py 项目: five3/zyw
def guanzhu(req):
    result = {'errorCode':0, 'msg':''}
    if not req.session.get('isLogin'):
        result = {'errorCode':-1, 'msg':'你还未登录'}
        return HttpResponse(json.dumps(result),content_type="application/json")
    if req.method=='POST':
        data = fun.warp_data(req.POST)
        data['uid'] = req.session['info'].get('id', 0)
        # print data
        r = controller.add_guanzhu(data)
        if r:
            controller.add_count(data['userid'], 'focus')
            controller.add_count_history(data['userid'], 'focus')
            return HttpResponse(json.dumps(result),content_type="application/json")
        else:
            result = {'errorCode':-2, 'msg':'已关注 '}
            return HttpResponse(json.dumps(result),content_type="application/json")
示例#6
0
文件: views.py 项目: five3/zyw
def qiye_comment(req):
    if req.method=='GET':
        logo_image = fun.get_site_logo(req)
        data = fun.warp_data(req.GET)
        info = controller.get_user_info(data)
        controller.add_count(data['userid'], 'shuoshuo')
        controller.add_count_history(req.session.get('info',{}).get('id','0'), 'shuoshuo')
        return render_to_response("zhiyuw/qiye_comment.html", locals(), context_instance = RequestContext(req))
    elif req.method=='POST':
        data = fun.warp_data(req.POST)
        if req.META.has_key('HTTP_X_FORWARDED_FOR'):
            data['ip'] =  req.META['HTTP_X_FORWARDED_FOR']
        else:
            data['ip'] = req.META['REMOTE_ADDR']
        if controller.post_qiye_comment(req, data):
            msg = '提交说说成功'
        else:
            msg = '提交说说失败'
        return render_to_response("zhiyuw/msg.html", locals(), context_instance = RequestContext(req))
示例#7
0
def guanzhu(req):
    result = {'errorCode': 0, 'msg': ''}
    if not req.session.get('isLogin'):
        result = {'errorCode': -1, 'msg': '你还未登录'}
        return HttpResponse(json.dumps(result),
                            content_type="application/json")
    if req.method == 'POST':
        data = fun.warp_data(req.POST)
        data['uid'] = req.session['info'].get('id', 0)
        # print data
        if not controller.has_complete_profile(data.get('uid')):
            result = {'errorCode': -2, 'msg': '请先完善个人资料中及履历表 '}
            return HttpResponse(json.dumps(result),
                                content_type="application/json")
        r = controller.add_guanzhu(data)
        if r:
            controller.add_count(data['userid'], 'focus')
            controller.add_count_history(data['userid'], 'focus')
            return HttpResponse(json.dumps(result),
                                content_type="application/json")
        else:
            result = {'errorCode': -3, 'msg': '已关注 '}
            return HttpResponse(json.dumps(result),
                                content_type="application/json")
示例#8
0
def qiye_comment(req):
    if req.method == 'GET':
        logo_image = fun.get_site_logo(req)
        data = fun.warp_data(req.GET)
        info = controller.get_user_info(data)
        controller.add_count(data['userid'], 'shuoshuo')
        controller.add_count_history(
            req.session.get('info', {}).get('id', '0'), 'shuoshuo')
        return render_to_response("zhiyuw/qiye_comment.html",
                                  locals(),
                                  context_instance=RequestContext(req))
    elif req.method == 'POST':
        data = fun.warp_data(req.POST)
        if req.META.has_key('HTTP_X_FORWARDED_FOR'):
            data['ip'] = req.META['HTTP_X_FORWARDED_FOR']
        else:
            data['ip'] = req.META['REMOTE_ADDR']
        if controller.post_qiye_comment(req, data):
            msg = '提交说说成功'
        else:
            msg = '提交说说失败'
        return render_to_response("zhiyuw/msg.html",
                                  locals(),
                                  context_instance=RequestContext(req))