Beispiel #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 <= getFormatDate(date=date_before_30min)).all()
        if not list:
            app.logger.info("no data~~")
            return

        pay_target = PayService()
        for item in list:
            pay_target.closeOrder(pay_order_id=item.id)
        app.logger.info("it's over~~")
Beispiel #2
0
    def closeFuKuan(self, params=''):
        now = datetime.datetime.now()
        inter = app.config['JOB_STATUS_CHANGES']['minutes']
        date_before_30min = now + datetime.timedelta(minutes=int(inter))
        list = PayOrder.query.filter_by( status = -8 ).\
            filter( PayOrder.created_time <= getFormatDate( date = date_before_30min ) ).all()
        if not list:
            app.logger.info("no data~~")
            return

        pay_target = PayService()
        for item in list:
            pay_target.closeOrder(pay_order_id=item.id)
        app.logger.info("FuKuan is over~~")
        return
Beispiel #3
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.closeOrder(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 = getCurrentDate()
        db.session.add(pay_order_info)
        db.session.commit()

    return jsonify(resp)
Beispiel #4
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.closeOrder(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 = getCurrentDate()
        db.session.add(pay_order_info)
        db.session.commit()

    return jsonify(resp)
Beispiel #5
0
def memberOrderOps():
    resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
    req = request.values
    order_sn = req['order_sn'] if 'order_sn' in req else ''
    act = req['action'] if 'action' in req else ''
    pay_order_info = PayOrder.query.filter_by(order_sn=order_sn).first()
    if not pay_order_info:
        resp['code'] = -1
        resp['msg'] = "系统繁忙。请稍后再试~~"
        return jsonify(resp)

    if act == "cancel":
        target_pay = PayService()
        ret = target_pay.closeOrder(pay_order_id=pay_order_info.id)
        if not ret:
            resp['code'] = -1
            resp['msg'] = "系统繁忙。请稍后再试~~"
            return jsonify(resp)
    elif act == "pay":
        pay_order_info.status = -5
        pay_order_info.updated_time = getCurrentDate()
        print(pay_order_info.status, pay_order_info.updated_time)
        db.session.add(pay_order_info)
        db.session.commit()

    return jsonify(resp)
Beispiel #6
0
def orderOps():
    resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
    req = request.values
    member_info = g.member_info
    id = req['id'] if 'id' in req else ''
    act = req['act'] if 'act' in req else ''
    pay_order_item_info = PayOrderItem.query.filter_by(
        id=id, member_id=member_info.id).first()
    # print(pay_order_item_info)
    # print("11221211")
    if not pay_order_item_info:
        resp['code'] = -1
        resp['msg'] = "系统繁忙,请稍后再试~~"
        return jsonify(resp)

    if act == "cancel":
        target_pay = PayService()
        ret = target_pay.closeOrder(pay_order_item_id=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 = getCurrentDate()
#		db.session.add( pay_order_info )
#		db.session.commit()

    return jsonify(resp)