Commit 4cd24400 by Aeolus

update

parent 8a4a7948
......@@ -97,6 +97,7 @@ class NfcCard(Base):
money = Column(INTEGER(10), nullable=False)
mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='1咻咻')
status = Column(TINYINT(4), nullable=False, comment='状态0停用1正常')
limit_count = Column(TINYINT(1), nullable=False, comment='限制消费次数')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
......
......@@ -54,6 +54,48 @@ def run_nfc_card_activate():
return BaseResponse()
@nfc_card_route.route("edit", methods=["POST"])
def run_nfc_card_edit():
json_data = request.get_json()
card_no = json_data["card_no"]
user_name = json_data.get("user_name", None)
phone = json_data.get("phone", None)
limit_count = json_data.get("limit_count", None)
card = NfcCard.query.filter_by(card_no=card_no, status=1).first()
if not card:
return jsonify(NFC_CARD_NOT_EXIST)
if user_name:
card.nick_name = user_name
if phone:
card.phone = phone
if limit_count:
card.limit_count = limit_count
db.session.add(card)
db.session.commit()
return BaseResponse()
@nfc_card_route.route("delete", methods=["POST"])
def run_nfc_card_delete():
json_data = request.get_json()
card_no = json_data["card_no"]
card = NfcCard.query.filter_by(card_no=card_no, status=1).first()
if not card:
return jsonify(NFC_CARD_NOT_EXIST)
card.status = -1
db.session.add(card)
db.session.commit()
return BaseResponse()
@nfc_card_route.route("my_cards", methods=["POST"])
def get_my_cards():
json_data = request.get_json()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment