SmsRecord.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\admin\model;
  3. use support\Model;
  4. class SmsRecord extends Model
  5. {
  6. /**
  7. * 短信发送记录表
  8. * The table associated with the model.
  9. *
  10. * @var string
  11. */
  12. protected $table = 'sms_record';
  13. /**
  14. * The primary key associated with the table.
  15. *
  16. * @var string
  17. */
  18. protected $primaryKey = 'record_id';
  19. /**
  20. * Indicates if the model should be timestamped.
  21. *
  22. * @var bool
  23. */
  24. /**
  25. * Notes:插入验证码数据
  26. * @param int $mobile
  27. * @param string $message
  28. * @param string $template_id
  29. * @param int $user_id
  30. * @return int
  31. * User: yym
  32. * Date: 2022/7/23
  33. */
  34. public static function InsertData(int $mobile, string $message, string $template_id, int $user_id = 0)
  35. {
  36. $insert = array(
  37. 'record_user_id' => $user_id,
  38. 'record_phone' => $mobile,
  39. 'record_ip' => get_ip(),
  40. 'record_template' => $template_id,
  41. 'record_content' => $message,
  42. 'record_create_time' => time(),
  43. 'record_update_time' => time()
  44. );
  45. return static::insertGetId($insert);
  46. }
  47. }