Exemple #1
0
def delete(request,pid):
    try :
        price = PriceRate.objects.get(id=pid)
        price.delete()
    except:
        return json_response({'ret':False,'message':u'删除出错'})
    return json_response({'ret':True,'message':u'删除成功'})
Exemple #2
0
def delete(request,rid):
    try :
        rev = Product_Reviews.objects.get(id=rid)
        rev.delete()
    except:
        return json_response({'ret':False,'message':u'删除出错'})
    return json_response({'ret':True,'message':u'删除成功'})
Exemple #3
0
def delete(request,hid):
    try :
        hotel = Hotels.objects.get(id=hid)
        hotel.delete()
    except:
        return json_response({'ret':False,'message':u'删除出错'})
    return json_response({'ret':True,'message':u'删除成功'})
Exemple #4
0
def delete(request,pid):
    try :
        product = Products.objects.get(id=cid)
        product.delete()
    except:
        return json_response({'ret':False,'message':u'删除出错'})
    return json_response({'ret':True,'message':u'删除成功'})
Exemple #5
0
def delete(request, cid):
    try:
        city = City.objects.get(id=cid)
        city.delete()
    except:
        return json_response({"ret": False, "message": u"删除出错"})
    return json_response({"ret": True, "message": u"删除成功"})
Exemple #6
0
def delete(request,oid):
    try :
        order = Orders.objects.get(oid=int(oid))
        order.status=3
        order.save()
    except:
        return json_response({'ret':False,'message':u'删除出错'})
    return json_response({'ret':True,'message':u'删除成功'})
def delete(request):
	delete = request.REQUEST.get("delete","")
	de = delete.split(",")
	 
	for d in de:
	  
		customer = UserCustomer.objects.filter(id=d)[0].delete()
		 
	return json_response({"a":111})
Exemple #8
0
    def decorate(*args):
        request = args[0]
        try:
            token = request.META['HTTP_TOKEN']
            uid = request.META['HTTP_UID']
            name_uid = decrypt(token).split('|')
            try:
                user = User.objects.get(id=uid)
                if user.username != name_uid[0]:
                    return json_response({'ret':False,'msg':u'认证失败','code':1000})
                if not user.is_staff:
                    return json_response({'ret':False,'msg':u'认证失败,您已被禁用,请联系管理员','code':1000})
            except Exception,e:
                return json_response({'ret':False,'msg':'认证失败','code':1000})

            if token != encrypt(user.username+'|'+uid):
                return json_response({'ret':False,'msg':'认证失败','code':1000})
            else:
                user.last_login = datetime.datetime.now()
                user.save()
                return func(*args)
def create(request):
	businessID = request.REQUEST.get("business","")
	customer = request.REQUEST.get("customer","")
	if businessID == "":
		return json_response({"status":0,"mess":"NONE"})
	if customer == "":
		return json_response({"status":0,"mess":"NONE"})
	customerID = customer.split(",")
	user = request.user
	try:
		is_exist = UserBusiness.objects.get(businessId=businessID,userId=user.id)
		for i in customerID:
			try :
				is_exist_customer = UserCustomer.objects.get(business_id=is_exist.id,customerId=i)
			except Exception, e:
				print e
				customer = UserCustomer()
				customer.customerId = i
				customer.business_id = is_exist.id
				customer.save()
		return json_response({"status":1})
Exemple #10
0
def pubuliu(request):

    customer =   request.REQUEST.get('customer','')

    customer_codes =  customer.split(',')
    
    chartData = []
    for customer in customer_codes:
        #channels = get_customer_Channel(customer['code'],nowbusiness.code)
        channels = get_customer_Channel(customer.split('-')[0],1)
        cs = []
        if len(channels) == 0:
            continue

        for channel in channels:
            cs.append(channel['channelCode'])
        outdata = get_data_by_Channel(cs,4)
        chartData.append({'customer':str(customer.split('-')[1]),'outdata':map(toint,outdata)} )
     
    return json_response({'chart_data':chartData})
Exemple #11
0
        request = args[0]
        try:
            token = request.META['HTTP_TOKEN']
            uid = request.META['HTTP_UID']
            name_uid = decrypt(token).split('|')
            try:
                user = User.objects.get(id=uid)
                if user.username != name_uid[0]:
                    return json_response({'ret':False,'msg':u'认证失败','code':1000})
                if not user.is_staff:
                    return json_response({'ret':False,'msg':u'认证失败,您已被禁用,请联系管理员','code':1000})
            except Exception,e:
                return json_response({'ret':False,'msg':'认证失败','code':1000})

            if token != encrypt(user.username+'|'+uid):
                return json_response({'ret':False,'msg':'认证失败','code':1000})
            else:
                user.last_login = datetime.datetime.now()
                user.save()
                return func(*args)
        except:
            return json_response({'ret':False,'msg':'认证失败','code':1000})
    return decorate

def current_user(request):
    try:
        user = request.session['user']
        return {'current_user': user}
    except:
        return {'current_user': None}
Exemple #12
0
def index(request):
    text = request.REQUEST.get('text','')
    if not text:
        return json_response({'ret':False,'data':[]}) 
    return json_response({'ret':True,'data':search_book(text)})
Exemple #13
0
				customer = UserCustomer()
				customer.customerId = i
				customer.business_id = is_exist.id
				customer.save()
		return json_response({"status":1})
	except Exception, e:
		print e
		userbusiness = UserBusiness()
		userbusiness.businessId = businessID
		userbusiness.userId = user.id
		userbusiness.save()
		userbusinessid = userbusiness.id
		for i in customerID:
			customer = UserCustomer()
			customer.customerId = i
			customer.business_id = userbusinessid
			customer.save()
		return json_response({"status":1})
	return json_response({"status":2})

@csrf_exempt
@render_to("business/index.html")
def delete(request):
	delete = request.REQUEST.get("delete","")
	de = delete.split(",")
	 
	for d in de:
	  
		customer = UserCustomer.objects.filter(id=d)[0].delete()
		 
	return json_response({"a":111})
Exemple #14
0
def server_error_404(request):
    return json_response({'ret':False,'msg':u'找不到指定页面','code':1002})
Exemple #15
0
def server_error_500(request):
    return json_response({'ret':False,'msg':u'系统错误','code':1000})