记录短信日志
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\admin\model\SmsLogModel::createSmsLog |
| 所属业务 | 消息通知 |
| 来源模块/系统 | 短信日志模型 |
功能说明
记录短信日志
调用示例
$phone_code = 86;
$phone = '13800138000';
$template_code = '123456';
$content = 'string';
$status = 1;
$fail_reason = '示例说明';
$rel_id = 0;
$type = 'client';
$ip = '192.0.2.1';
$port = 1;
$result = (new \app\admin\model\SmsLogModel())->createSmsLog($phone_code, $phone, $template_code, $content, $status, $fail_reason, $rel_id, $type, $ip, $port);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
phone_code | int | 否 | 86 | — | 国际区号 |
phone | string | 否 | — | — | 手机号 |
template_code | string | 否 | — | — | 模板标识 |
content | string | 否 | — | — | 模板内容 |
status | int | 是 | — | require | 发送状态(1=成功,0=失败) |
fail_reason | string | 否 | — | — | 失败原因 |
rel_id | int | 否 | 0 | — | 关联ID |
type | string | 否 | client | — | 关联类型(client=客户,admin=管理员) |
ip | string | 否 | — | — | 自动获取 IP |
port | int | 否 | — | — | 自动获取 端口号 |
返回值
未声明固定返回值。
正常返回
{}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |