예제 #1
0
    def run(self, params):
        now = datetime.datetime.now()
        date_before_30min = now + datetime.timedelta(minutes=-30)
        list = PayOrder.query.filter_by( status = -8 ).\
         filter(PayOrder.created_time <= get_format_date(date = date_before_30min)).all()
        if not list:
            app.logger.info("no data~~")
            return

        pay_target = PayService()
        for item in list:
            pay_target.close_order(pay_order_id=item.id)
        app.logger.info("it's over~~")
예제 #2
0
def orderOps():
	resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
	req = request.values
	member_info = g.member_info
	order_sn = req['order_sn'] if 'order_sn' in req else ''
	act = req['act'] if 'act' in req else ''
	pay_order_info = PayOrder.query.filter_by(order_sn=order_sn, member_id=member_info.id).first()
	if not pay_order_info:
		resp['code'] = -1
		resp['msg'] = "系统繁忙。请稍后再试~~"
		return jsonify(resp)


	if act == "cancel":
		target_pay = PayService( )
		ret = target_pay.close_order(pay_order_id=pay_order_info.id)
		if not ret:
			resp['code'] = -1
			resp['msg'] = "系统繁忙。请稍后再试~~"
			return jsonify(resp)
	elif act == "confirm":
		pay_order_info.express_status = 1
		pay_order_info.updated_time = get_current_date()
		db.session.add( pay_order_info )
		db.session.commit()

	return jsonify(resp)