Bladeren bron

调用短信平台发送短信时,变量超过限制截取。

gzjzss 7 jaren geleden
bovenliggende
commit
934eb85218
1 gewijzigde bestanden met toevoegingen van 11 en 11 verwijderingen
  1. 11 11
      application/libraries/Notices.php

+ 11 - 11
application/libraries/Notices.php

@@ -71,9 +71,9 @@ class Notices{
             }elseif($this->setting['sms_type'] == '20' ){
                 $sms_content = array(
                     "workorder_id"=>$workorder['workorder_id'],
-                    "workorder_name"=>$workorder['workorder_name'],
+                    "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                     "workorder_type"=>$workorder['type'],
-                    "remark_content"=>$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']
+                    "remark_content"=>strlen($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'])<=18?$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']:substr($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'],0,18).".."
                 );
                 $resp = $this->Aliyunsms->sendSms($receive_user['mobile'],$this->setting['template_codes'][0],$sms_content);
                 if($resp['Code'] == 'OK'){
@@ -184,10 +184,10 @@ class Notices{
                 }elseif($this->setting['sms_type'] == '20' ){
                     $sms_content = array(
                         "workorder_id"=>$workorder['workorder_id'],
-                        "workorder_name"=>$workorder['workorder_name'],
+                        "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                         "workorder_type"=>$workorder['type'],
                         "receive_user_name"=>$receive_user['name'],
-                        "remark_content"=>$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']
+                        "remark_content"=>strlen($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'])<=18?$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']:substr($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'],0,18).".."
                     );
                     $resp = $this->Aliyunsms->sendSms($notices_log['mobile'],$this->setting['template_codes'][1],$sms_content);
                     if($resp['Code'] == 'OK'){
@@ -298,10 +298,10 @@ class Notices{
                 }elseif($this->setting['sms_type'] == '20' ){
                     $sms_content = array(
                         "workorder_id"=>$workorder['workorder_id'],
-                        "workorder_name"=>$workorder['workorder_name'],
+                        "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                         "workorder_type"=>$workorder['type'],
                         "receive_user_name"=>$receive_user['name'],
-                        "remark_content"=>$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']
+                        "remark_content"=>strlen($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'])<=18?$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']:substr($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'],0,18).".."
                     );
                     $resp = $this->Aliyunsms->sendSms($notices_log['mobile'],$this->setting['template_codes'][2],$sms_content);
                     if($resp['Code'] == 'OK'){
@@ -417,10 +417,10 @@ class Notices{
                 }elseif($this->setting['sms_type'] == '20' ){
                     $sms_content = array(
                         "workorder_id"=>$workorder['workorder_id'],
-                        "workorder_name"=>$workorder['workorder_name'],
+                        "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                         "workorder_type"=>$workorder['type'],
                         "receive_user_name"=>$receive_user['name'],
-                        "remark_content"=>$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']
+                        "remark_content"=>strlen($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'])<=18?$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']:substr($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'],0,18).".."
                     );
                     $resp = $this->Aliyunsms->sendSms($notices_log['mobile'],$this->setting['template_codes'][3],$sms_content);
                     if($resp['Code'] == 'OK'){
@@ -522,9 +522,9 @@ class Notices{
             }elseif($this->setting['sms_type'] == '20' ){
                 $sms_content = array(
                     "workorder_id"=>$workorder['workorder_id'],
-                    "workorder_name"=>$workorder['workorder_name'],
+                    "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                     "workorder_type"=>$workorder['type'],
-                    "remark_content"=>$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']
+                    "remark_content"=>strlen($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'])<=18?$workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content']:substr($workorder['remark_list'][count($workorder['remark_list'])-1]['remark_content'],0,18).".."
                 );
                 $resp = $this->Aliyunsms->sendSms($receive_user['mobile'],$this->setting['template_codes'][4],$sms_content);
                 if($resp['Code'] == 'OK'){
@@ -617,7 +617,7 @@ class Notices{
             }elseif($this->setting['sms_type'] == '20' ){
                 $sms_content = array(
                     "workorder_id"=>$workorder['workorder_id'],
-                    "workorder_name"=>$workorder['workorder_name'],
+                    "workorder_name"=>strlen($workorder['workorder_name'])<=18?$workorder['workorder_name']:substr($workorder['workorder_name'],0,18)."..",
                     "workorder_type"=>$workorder['type']
                 );
                 $resp = $this->Aliyunsms->sendSms($receive_user['mobile'],$this->setting['template_codes'][4],$sms_content);