本文整理汇总了Python中sellcard.common.Method.getReqVal方法的典型用法代码示例。如果您正苦于以下问题:Python Method.getReqVal方法的具体用法?Python Method.getReqVal怎么用?Python Method.getReqVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sellcard.common.Method
的用法示例。
在下文中一共展示了Method.getReqVal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: order
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def order(request):
today = datetime.date.today()
today = datetime.datetime.strftime(today, '%Y-%m-%d')
shop = mth.getReqVal(request,'shop','')
start = mth.getReqVal(request,'start',today)
end = mth.getReqVal(request,'end',today)
startTime = start + ' 00:00:00'
endTime = end + ' 23:59:59'
conn = mth.getMysqlConn()
cur = conn.cursor()
saleSql = 'select a.order_sn,a.buyer_company,b.is_pay,b.pay_value as no_pay,' \
'c.bank_name,c.pay_value,c.pay_id,c.bank_sn,c.pay_company,c.change_time ' \
'from orders as a inner join order_payment_info as b on a.order_sn = b.order_id left join order_payment_credit as c on a.order_sn = c.order_id '\
'where a.add_time>="{start}" and a.add_time<="{end}" and a.shop_code ="{shop}" and b.pay_id=4 ' \
'order by b.is_pay,a.order_sn' \
.format(start=startTime, end=endTime, shop=shop)
cur.execute(saleSql)
saleList = cur.fetchall()
saleData,saleTotalPay,saleTotalNoPay= mergeData(saleList)
data = saleData
totalPay = saleTotalPay
totalNoPay = saleTotalNoPay
data = sorted(data,key=itemgetter('is_pay','order_sn'),reverse=True)
return render(request, 'report/card/nopay/order.html', locals())
示例2: login
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def login(request):
user_name = mtu.getReqVal(request,"user_name","").strip()
password = mtu.getReqVal(request,"password","").strip()
vcode = mtu.getReqVal(request,"vcode","").strip()
try:
vcode2 = request.session["s_vcode"]
except:
vcode2 = ""
response_data = {}
try:
if vcode == vcode2:
# 查询用户信息
user = AdminUser.objects.get(user_name=user_name,is_enable='0')
upwd = user.password
password = mtu.md5(password)
shop_code=user.shop_code
rates = DiscountRate.objects.values('val_min','val_max','discount_rate').filter(shopcode=shop_code)
discLevelList = Shops.objects.values('disc_level').filter(shop_code=shop_code)
discLevel = ''
if len(discLevelList)>0:
discLevel = discLevelList[0]['disc_level']
rateList=[]
for rate in rates:
item={}
item['val_min']=float(rate['val_min'])
item['val_max']=float(rate['val_max'])
item['discount_rate']=float(rate['discount_rate'])
rateList.append(item)
if upwd == password:
request.session["s_uname"] = user.user_name
request.session["s_unameChinese"] = user.name
request.session["s_roleid"] = user.role_id
request.session["s_shopid"] = user.shop_id
request.session["s_shopcode"] = user.shop_code
request.session["s_depart"] = user.depart
request.session["s_uid"] = user.id
request.session["s_rates"] = rateList
request.session["disc_level"] = discLevel
#售卡前台
response_data['homeurl'] = cts.URL_HOME[0]
request.session["homeurl"] = response_data['homeurl']
# 查询菜单权限
purlist = findNavByRcode(user.role_id)
request.session["s_umenu"] = getMenu(purlist)
response_data['status'] = "0"
else:
response_data['status'] = "2"
else:
response_data['status'] = "3"
except Exception as e:
print(e)
response_data['status'] = "1"
return HttpResponse(json.dumps(response_data), content_type="application/json")
示例3: order2
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def order2(request):
shops = base.findShop()
today = datetime.date.today()
monthFirst = str(datetime.date.today().replace(day=1))
today = str(today)
shop = mth.getReqVal(request, 'shop', '')
start = mth.getReqVal(request, 'start', monthFirst)
end = mth.getReqVal(request, 'end', today)
startTime = start + ' 00:00:00'
endTime = end + ' 23:59:59'
whereShop ='a.shop_code ="'+shop+'" ' if shop else '1=1'
conn = mth.getMysqlConn()
cur = conn.cursor()
saleSql = 'select a.order_sn,a.shop_code,a.add_time,a.buyer_company,b.pay_value,b.received_time,c.change_time ' \
' from orders as a inner join order_payment_info as b on a.order_sn = b.order_id left join order_payment_credit as c on a.order_sn = c.order_id ' \
' where a.add_time>="{start}" and a.add_time<="{end}" and b.pay_id=4 and {whereShop}' \
' order by a.order_sn' \
.format(start=startTime, end=endTime,whereShop=whereShop)
cur.execute(saleSql)
listSale = cur.fetchall()
cur.close()
conn.close()
return render(request, 'report/card/nopay/order2.html', locals())
示例4: index
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def index(request):
shop = request.session.get('s_shopcode')
today = str(datetime.date.today())
couponType = mth.getReqVal(request, 'couponType', '')
batch = mth.getReqVal(request, 'batch', '').strip()
start = mth.getReqVal(request, 'start', today)
end = mth.getReqVal(request, 'end', today)
endTime = datetime.datetime.strptime(end, '%Y-%m-%d') + datetime.timedelta(1)
page = mth.getReqVal(request, 'page', 1)
kwargs = {}
kwargs.setdefault('payment_type', 4)
kwargs.setdefault('shop_code', shop)
if couponType != '':
kwargs.setdefault('type', couponType)
if batch != '':
kwargs.setdefault('batch', batch)
if start != '':
kwargs.setdefault('start_date__gte', start)
if end != '':
kwargs.setdefault('start_date__lte', endTime)
List = KfJobsCoupon.objects.values('shop_code', 'coupon_code', 'create_user_name',
'type', 'batch', 'start_date', 'end_date', 'values', 'range', 'pay_account',
'credit_account').filter(credit_account__lt=F('pay_account'), **kwargs).order_by('create_date')
# 表单分页开始
paginator = Paginator(List, 8)
try:
List = paginator.page(page)
if List.number > 1:
page_up = List.previous_page_number
else:
page_up = 1
if List.number < List.paginator.num_pages:
page_down = List.next_page_number
else:
page_down = List.paginator.num_pages
except Exception as e:
print(e)
# 表单分页结束
return render(request,'voucher/credit/List.html',locals())
示例5: query
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def query(request):
shopCode = request.session.get('s_shopcode')
pageNum =mtu.getReqVal(request,"pageNum","1")
user_phone = request.POST.get("user_phone","")
state = request.POST.get("state","")
karrs = {}
karrs.setdefault("state__in",[0,1])
if user_phone:
karrs.setdefault("user_phone__contains",user_phone)
if state:
karrs.setdefault("state",state)
if shopCode:
karrs.setdefault("shop_code",shopCode)
order_list = OrderUpCard.objects.values("order_sn","total_amount","total_price","action_type","user_name",
"user_phone","state","add_time",)\
.filter(**karrs)\
.order_by("-order_sn")
page = Paginator(order_list, __EACH_PAGE_SHOW_NUMBER, allow_empty_first_page=True).page(int(pageNum))
result = {"page": page, "pageNum": str(pageNum)}
result.setdefault("user_phone", user_phone)
result.setdefault("state", state)
return render(request, 'card/fill/cardFillQuery.html', result)
示例6: index
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def index(request):
if request.method == 'POST':
operator = str(request.session.get('s_uid', ''))
shopcode = request.session.get('s_shopcode', '')
today = datetime.datetime.today().replace(hour=23,minute=59,second=59)
monthFirstDay = datetime.datetime.today().replace(day=1,hour=0,minute=0,second=0,microsecond=0)
start = request.POST.get('start')
if not start:
start = monthFirstDay
end = request.POST.get('end')
endStr = datetime.datetime.strptime(end,'%Y-%m-%d')+datetime.timedelta(1)
if not end:
end = today
buyerName = (mth.getReqVal(request,"buyerName","")).strip()
#售卡数据
queryWhereSale1 = " and b.buyer_name='"+buyerName+"'" if buyerName else ''
queryWhereSale2 = " and b.add_time >='{start}' and b.add_time <='{end}' ".format(start=start, end=endStr)
conn = mth.getMysqlConn()
cur = conn.cursor()
sqlSale="select a.pay_value,b.order_sn,b.operator_id,b.add_time,b.buyer_name,b.buyer_tel,b.paid_amount, " \
" IFNULL(c.pay_value, 0) as credit_value, a.pay_id " \
" from order_payment_info as a ,orders as b " \
" left join (select sum(p.pay_value) as pay_value, p.order_id from order_payment_credit p group by p.order_id) as c " \
" on b.order_sn = c.order_id " \
" where a.order_id=b.order_sn and a.pay_id in (4, 3) and a.is_pay != '1' and b.shop_code ='"+shopcode+"'"+queryWhereSale1+queryWhereSale2
cur.execute(sqlSale)
listSale = cur.fetchall()
cur.close()
conn.close()
return render(request, 'card/nopay/ordinary.html', locals())
示例7: create
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def create(request):
# 在服务端session中添加key认证,避免用户重复提交表单
token = 'allow' # 可以采用随机数
request.session['postToken'] = token
coupon_code = mth.getReqVal(request, 'coupon_code', '')
coupon_info = KfJobsCoupon.objects.values('pay_account', 'credit_account').get(coupon_code=coupon_code)
receivable = float(coupon_info['pay_account']) - float(coupon_info['credit_account'])
return render(request,'voucher/credit/create.html',locals())
示例8: index
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def index(request):
"""
发行代金券列表controllers
:param request:
:return:列表view
"""
shopcode = request.session.get('s_shopcode')
if shopcode is None:
shopcode = '9999'
today = str(datetime.date.today())
couponType = mth.getReqVal(request, 'couponType', '')
printed = mth.getReqVal(request, 'printed', '')
issueSn = mth.getReqVal(request, 'issueSn', '').strip()
batch = mth.getReqVal(request, 'batch', '').strip()
start = mth.getReqVal(request, 'start', today)
end = mth.getReqVal(request, 'end', today)
endTime = datetime.datetime.strptime(end, '%Y-%m-%d') + datetime.timedelta(1)
page = mth.getReqVal(request, 'page', 1)
kwargs = {}
kwargs.setdefault('shop_code', shopcode)
if couponType != '':
kwargs.setdefault('type', couponType)
if batch != '':
kwargs.setdefault('batch', batch)
if start != '':
kwargs.setdefault('start_date__gte', start)
if end != '':
kwargs.setdefault('start_date__lte', endTime)
List = KfJobsCoupon.objects.values(
'shop_code', 'create_user_name', 'type', 'batch', 'start_date', 'values', 'coupon_code',
'amount', 'print_amount', 'end_date', 'discount', 'range').filter(**kwargs).order_by('batch')
# 表单分页开始
paginator = Paginator(List, 8)
try:
List = paginator.page(page)
if List.number > 1:
page_up = List.previous_page_number
else:
page_up = 1
if List.number < List.paginator.num_pages:
page_down = List.next_page_number
else:
page_down = List.paginator.num_pages
except Exception as e:
print(e)
# 表单分页结束
return render(request, 'voucher/issue/List.html', locals())
示例9: gotcard
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def gotcard(request):
order_sn = mtu.getReqVal(request,"order_sn","")
if order_sn:
try:
order = OrderUpCard.objects.values("order_sn","total_amount","total_price","action_type","user_name",
"user_phone","state","add_time",).get(order_sn=order_sn)
orderInfoList = OrderUpCardInfo.objects.values("card_no","card_value","card_balance",).filter(order_sn=order_sn,card_attr=1)
except Exception as e:
print(e)
return render(request, 'card/fill/cardFillModify.html', locals())
示例10: info
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def info(request):
order_sn = mtu.getReqVal(request,"order_sn","")
if order_sn:
try:
order = OrderUpCard.objects.values("order_sn","total_amount","total_price","action_type","user_name",
"user_phone","state","add_time","fill_price","fill_amount","diff_price").get(order_sn=order_sn)
cardInList = OrderUpCardInfo.objects.values("card_no","card_value","card_balance",).filter(order_sn=order_sn,card_attr=1)
cardOutList = OrderUpCardInfo.objects.values("card_no", "card_value", "card_balance", ).filter(order_sn=order_sn, card_attr=2)
diff_amount = order["fill_price"] - order["total_price"]
except Exception as e:
print(e)
return render(request, 'card/fill/cardFillInfo.html', locals())
示例11: cardInfo
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def cardInfo(request):
shopCode = mth.getReqVal(request,'shopcode','')
cardType = mth.getReqVal(request,'cardtype','')
page = mth.getReqVal(request,'page',1)
cardList = CardInventory.objects.values('card_no','card_value','card_blance','card_status','charge_time','sheetid')\
.filter(card_blance=cardType,shop_code=shopCode,card_status='1',card_action='1',card_blance__gt='0')\
.order_by('card_no')
totalBalance = 0.00
totalNum = 0
for row in cardList:
totalBalance += float(row['card_blance'])
totalNum +=1
paginator = Paginator(cardList,20)
try:
cardList = paginator.page(page)
except Exception as e:
print(e)
return render(request, 'report/card/stock/stockGroupByCardNo.html', locals())
示例12: index
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def index(request):
"""
用户列表controllers
:param request:
:return:列表view
"""
roleList = Role.objects.values().order_by('id')
shopList = Shops.objects.values().order_by('shop_code')
shop_code = mth.getReqVal(request, 'shop_code', '')
depart = mth.getReqVal(request, 'depart', '')
role = mth.getReqVal(request, 'role', '')
user_name = mth.getReqVal(request, 'user_name', '')
# 表单分页参数开始
page = mth.getReqVal(request, 'page', 1)
show_num = mth.getReqVal(request, 'show_num', 8)
# 表单分页参数结束
kwargs = {}
if shop_code != '':
kwargs.setdefault('shop_code', shop_code)
if depart != '':
kwargs.setdefault('depart', depart)
if role != '':
kwargs.setdefault('role_id', role)
if user_name != '':
List = AdminUser.objects.values('id', 'user_name', 'name', 'shop_code', 'depart', 'role_id',
'last_login', 'last_ip').filter(
Q(user_name__icontains=user_name) | Q(name__icontains=user_name),
**kwargs).order_by('last_login')
else:
List = AdminUser.objects.values('id', 'user_name', 'name', 'shop_code', 'depart', 'role_id',
'last_login', 'last_ip').filter(**kwargs).order_by('last_login')
# 表单分页开始
paginator = Paginator(List, show_num)
try:
List = paginator.page(page)
if List.number > 1:
page_up = List.previous_page_number
else:
page_up = 1
if List.number < List.paginator.num_pages:
page_down = List.next_page_number
else:
page_down = List.paginator.num_pages
except Exception as e:
print(e)
# 表单分页结束
return render(request, 'system/user/List.html', locals())
示例13: detail
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def detail(request):
today = datetime.date.today()
page = mth.getReqVal(request, 'page', 1)
shop_code = request.GET.get('shop')
pay_id = request.GET.get('pay_id')
shop = request.session.get('s_shopcode', '')
role_id = request.session.get('s_roleid')
if role_id == '9':
shopsCode = mth.getCityShopsCode('T')
if shop_code not in shopsCode:
return render(request, '500.html', locals())
elif role_id == '8':
shopsCode = mth.getCityShopsCode('C')
if shop_code not in shopsCode:
return render(request, '500.html', locals())
elif role_id == '10' or role_id == '2' or role_id == '12':
if shop != shop_code:
return render(request, '500.html', locals())
start = request.GET.get('start', today)
end = request.GET.get('end', today)
endTime = str(datetime.datetime.strptime(end, '%Y-%m-%d').date() + datetime.timedelta(1))
conn = mth.getMysqlConn()
cur = conn.cursor()
if pay_id == '3':
sql = " select a.order_sn,a.action_type,b.is_pay,b.pay_value,c.bank_name,c.bank_sn,c.pay_company" \
" from orders as a inner join order_payment_info as b on a.order_sn = b.order_id left join order_payment_credit as c on a.order_sn = c.order_id"\
" where a.add_time>='{start}' and a.add_time<='{end}' and a.shop_code ='{shop}' and b.pay_id=3" \
" order by b.is_pay,a.order_sn"\
.format(start=start, end=endTime, shop=shop_code)
else:
sql = " select a.order_sn,a.action_type,a.buyer_name,a.buyer_tel,a.buyer_company,b.pay_value,b.is_pay" \
" from orders as a ,order_payment_info as b" \
" where a.order_sn = b.order_id and a.shop_code = '{shop}' and a.add_time >= '{start}'" \
" and a.add_time <= '{end}' and b.pay_id = '{pay}'"\
.format(shop=shop_code,start=start,end=end,pay=pay_id)
cur.execute(sql)
List = cur.fetchall()
for item in List:
if item['pay_value']:
item['pay_value'] = float(item['pay_value'])
else:
item['pay_value'] = 0
return render(request, 'report/card/saleGroupByShop/Detail.html', locals())
示例14: updatePwd
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def updatePwd(request):
data = {}
if request.method == 'POST':
userId =request.session["s_uid"]
try:
newPwd = mtu.getReqVal(request,"newPwd","")
pwd = mtu.md5(newPwd)
AdminUser.objects.filter(id=userId).update(password=pwd)
data["result"] = "0"
except Exception as e:
print(e)
return render(request,'restPassword.html',locals())
示例15: index
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getReqVal [as 别名]
def index(request):
if request.method == 'POST':
company = mth.getReqVal(request, 'company', '')
# 表单分页参数开始
page = mth.getReqVal(request, 'page', 1)
show_num = mth.getReqVal(request, 'show_num', 8)
# 表单分页参数结束
if company != '':
List = Vip.objects.values('id', 'company', 'person', 'tel', 'add_time').filter(
Q(company__icontains=company) | Q(person__icontains=company)).order_by('id')
else:
List = Vip.objects.values('id', 'company', 'person', 'tel', 'add_time').order_by('id')
# for row in List:
# row['bank_list'] = VipBank.objects.values('id', 'bank_name').filter(vip_id=row['id'])
# 表单分页开始
paginator = Paginator(List, show_num)
try:
List = paginator.page(page)
if List.number > 1:
page_up = List.previous_page_number
else:
page_up = 1
if List.number < List.paginator.num_pages:
page_down = List.next_page_number
else:
page_down = List.paginator.num_pages
except Exception as e:
print(e)
# 表单分页结束
return render(request, 'vip/manage.html', locals())