我有这些
if
应该检查时间戳的语句。最后
如果
声明似乎不起作用。这些时间戳值应该显示检索到的时间戳大于当前时间戳-两个月,但这种情况不会发生。当使用以下值运行最后一个
如果
语句被触发。
按要求:
订单日期2018-12-17T16:58:00-06:00
价值观:
one month 2592000
two months 5184000
current timestamp 1545247709.1553745
retrieved timestamp 1545026400
current - two months 1540063709.1553745
one month 259200 <class 'int'>
two months 5184000 <class 'int'>
current timestamp 1545252986.085405 <class 'float'>
retrieved timestamp 1545026400 <class 'int'>
if order_count > 1:
for result in results['orders']:
order_status_info= self_api.which_api('order_statuses/%d' % result['order_status_id'])
for customer_blocked_reason in customer_blocked_reasons:
if customer_blocked_reason in order_status_info['name']:
customer_is_blocked = True
order_id = 0
order_date = result['ordered_at']
two_month_seconds = (3600 * 24) * 60
one_month_seconds = (3600 * 24) * 30
stripped_date = order_date[:order_date.find("T")]
current_timestamp = time.time()
retrieved_timestamp = int(datetime.datetime.strptime(stripped_date, '%Y-%m-%d').strftime("%s"))
print("one month", one_month_seconds)
print("two months", two_month_seconds)
print("current timestamp", current_timestamp)
print("retrieved timestamp", retrieved_timestamp)
print("current - two months", current_timestamp - two_month_seconds)
if retrieved_timestamp > (current_timestamp - one_month_seconds) and not customer_is_blocked:
status['success'] = 1
status['message'] = "Customer Verified with orders older than 30 days and no blocking reasons"
break
elif customer_is_blocked:
status_change_result = self_order.update_status(order_statuses['order_hold_manager_review'])
status['success'] = 1
status['message'] = "Changed order status to Order Hold - Manager Review"
break
elif retrieved_timestamp < (current_timestamp - two_month_seconds):
status['success'] = 0
status['message'] = "There is more than 1 order, and none are greater than 60 days, we need to check manually"