|
|
@@ -85,7 +85,7 @@ class SmsFree implements Sms
|
|
|
public function getMessage($country, $phone_num): array
|
|
|
{
|
|
|
$url = "https://smsfree.cc/api/";
|
|
|
- $_num = str_replace(['+', ' '], ['', ''], $country.$phone_num);
|
|
|
+ $_num = str_replace(['+', ' '], ['', ''], $country . $phone_num);
|
|
|
$data = [
|
|
|
'page' => 1,
|
|
|
'phone' => $_num,
|
|
|
@@ -93,10 +93,31 @@ class SmsFree implements Sms
|
|
|
];
|
|
|
$result = Curl::post($url, $data);
|
|
|
$result = json_decode($result, true);
|
|
|
- $response=array_map(function ($a) {
|
|
|
+ $response = array_map(function ($a) {
|
|
|
+ $rtime = date("m-d H:i", $a['time']);
|
|
|
+ $htime = date("H:i", $a['time']);
|
|
|
+ $time = time() - $a['time'];
|
|
|
+ if ($time < 60) {
|
|
|
+ $str = '刚刚';
|
|
|
+ } elseif ($time < 60 * 60) {
|
|
|
+ $min = floor($time / 60);
|
|
|
+ $str = $min . '分钟前';
|
|
|
+ } elseif ($time < 60 * 60 * 24) {
|
|
|
+ $h = floor($time / (60 * 60));
|
|
|
+ $str = $h . '小时前 ';
|
|
|
+ } elseif ($time < 60 * 60 * 24 * 3) {
|
|
|
+ $d = floor($time / (60 * 60 * 24));
|
|
|
+ if ($d == 1) {
|
|
|
+ $str = '昨天 ' . $htime;
|
|
|
+ } else {
|
|
|
+ $str = '前天 ' . $htime;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $str = $rtime;
|
|
|
+ }
|
|
|
return [
|
|
|
'from' => $a['from'],
|
|
|
- 'time' => date("Y-m-d H:i:s",intval($a['time'])),//date("Y-m-d H:i:s",a['time']),
|
|
|
+ 'time' => $str,
|
|
|
'message' => $a['data'],
|
|
|
];
|
|
|
}, $result['Message']);
|