diff options
author | Frederick Yin <fkfd@fkfd.me> | 2022-02-22 21:36:13 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2022-02-22 21:36:13 +0800 |
commit | 5ba73fd46dbc7baef6745c9226c13eb5190834a6 (patch) | |
tree | d5242dd9cc4370c592be31151ca47eecdc7ec4fe | |
parent | c9d9b6914cd3bf3201e8c04be90210da58ae0b5f (diff) |
Impl return_success and remind_overdue SMS
-rw-r--r-- | jimbrella/sms.py | 27 |
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}, + ) |