summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jimbrella/sms.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/jimbrella/sms.py b/jimbrella/sms.py
index c8f013c..3ad9583 100644
--- a/jimbrella/sms.py
+++ b/jimbrella/sms.py
@@ -30,7 +30,7 @@ class SMS:
"""Call API to send generic SMS"""
req = dysmsapi_models.SendSmsRequest(
phone_numbers=phone_number,
- sign_name="JIBelief",
+ sign_name=config.get("sms", "signature"),
template_code=template_code,
template_param=json.dumps(template_param),
)
@@ -49,8 +49,29 @@ class SMS:
${name}同学,您已于${date}成功借用${umbid}号信用伞,请在三日内归还
"""
self._send(
- phone, "SMS_234140902", {"name": name, "date": date, "umbid": umbid}
+ phone,
+ config.get("sms", "template_borrow_success"),
+ {"name": name, "date": date, "umbid": umbid},
+ )
+
+ def return_success(self, phone: str, name: str, date: str, umbid: int):
+ """Current template: jimbrella_giveback_0
+
+ ${name}同学,您已于${date}成功归还${umbid}号信用伞
+ """
+ self._send(
+ phone,
+ config.get("sms", "template_return_success"),
+ {"name": name, "date": date, "umbid": umbid},
)
def remind_overdue(self, phone: str, name: str, date: str, umbid: int):
- self._send(phone, "TBD", {"name": name, "date": date, "umbid": umbid})
+ """Current template: jimbrella_overdue_0
+
+ ${name}同学,您在${date}借用的${umbid}号信用伞已超过3天时限,请及时归还
+ """
+ self._send(
+ phone,
+ config.get("sms", "template_remind_overdue"),
+ {"name": name, "date": date, "umbid": umbid},
+ )