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")
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))
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")
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))