diff --git a/app-wx/config/params.php b/app-wx/config/params.php index f1f8102..999cd1a 100644 --- a/app-wx/config/params.php +++ b/app-wx/config/params.php @@ -2,5 +2,5 @@ return [ 'adminEmail' => 'admin@example.com', 'testLoginPhones' => ['13900139001000'], - 'VERSION' => 'v0.1.0 build 23', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数 + 'VERSION' => 'v0.1.0 build 24', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数 ]; diff --git a/app-wx/controllers/SiteController.php b/app-wx/controllers/SiteController.php index 85d49ab..52d2b30 100644 --- a/app-wx/controllers/SiteController.php +++ b/app-wx/controllers/SiteController.php @@ -2,9 +2,6 @@ namespace app\wx\controllers; use Yii; -use app\wx\models\Engineer; -use common\models\EngineerProfile; -use common\helpers\WxHelper; use common\models\SysSetting; use stdClass; @@ -42,8 +39,6 @@ class SiteController extends BaseController /** * 构造user的共用信息 */ - - return $this->render('index'); } diff --git a/app-wx/modules/order/controllers/DefaultController.php b/app-wx/modules/order/controllers/DefaultController.php index 8444dac..108cdac 100644 --- a/app-wx/modules/order/controllers/DefaultController.php +++ b/app-wx/modules/order/controllers/DefaultController.php @@ -7,6 +7,7 @@ use yii\helpers\HtmlPurifier; use yii\base\Exception; use yii\log\Logger; +use common\helpers\Utils; use common\helpers\ImageManager; use domain\order\RepairOrder; use domain\order\RepairOrderImages; @@ -132,11 +133,11 @@ class DefaultController extends BaseController 您好,维修厂${maintainer}已进行维修,预计完成时间${dateTime},预估维修内容${repairPlan},预估维修费用${repairPrice},维修厂地址:${address},联系电话:${tel} * */ $smsVars = ['maintainer' => '', 'tel' => '', 'address' => '', 'dateTime' => '', 'repairPlan' => '', 'repairPrice' => '']; - $smsVars['maintainer'] = $orderModel->maintainer_name; + $smsVars['maintainer'] = Utils::cutStrTxt($orderModel->maintainer_name); $smsVars['tel'] = $orderModel->maintainer_tel; - $smsVars['address'] = $orderModel->maintainer_address; + $smsVars['address'] = Utils::cutStrTxt($orderModel->maintainer_address); $smsVars['dateTime'] = date('Y年m月d日 H点', $orderModel->predict_finish_time); - $smsVars['repairPlan'] = $orderModel->predict_fault; + $smsVars['repairPlan'] = Utils::cutStrTxt($orderModel->predict_fault); $smsVars['repairPrice'] = $orderModel->predict_price; $phone = $orderModel->contact_mobile; $sms = new SmsMessage(); @@ -155,7 +156,7 @@ class DefaultController extends BaseController $smsVars = ['maintainer' => '', 'code' => '', 'tel' => '']; $smsVars['tel'] = Yii::$app->params['SERVICE_PHONE']; - $smsVars['maintainer'] = $orderModel->maintainer_name; + $smsVars['maintainer'] = Utils::cutStrTxt($orderModel->maintainer_name); $smsVars['code'] = $orderModel->short_uuid." "; //防止后面的文字和这个参数粘贴在一起 $phone = $orderModel->contact_mobile; $sms = new SmsMessage(); @@ -166,10 +167,14 @@ class DefaultController extends BaseController public function actionSms() { $userId = $this->getUserId(); - $orderModel = RepairOrderRepository::findOne(['id' => 12]); - //$result = $this->sendSubmitSMS($orderModel, $userId); - //var_dump($result); - //$this->sendFinishSMS($orderModel, $userId); + $orderModel = RepairOrderRepository::findOne(['id' => 18]); + //$result1 = $this->sendSubmitSMS($orderModel, $userId); + + //$result2 = $this->sendFinishSMS($orderModel, $userId); + + //var_dump($result1); + //var_dump($result2); + } /** diff --git a/common/helpers/Utils.php b/common/helpers/Utils.php index fc47949..ec7762e 100644 --- a/common/helpers/Utils.php +++ b/common/helpers/Utils.php @@ -434,6 +434,23 @@ class Utils } /** + * 裁剪字符串长度 + * @param $str + * @return string + */ + public static function cutStrTxt($str, $maxLen = 20) + { + $strLen = mb_strlen($str); + if ($strLen <= $maxLen && $strLen > 0) { + return $str; + } elseif($strLen > $maxLen) { + return mb_substr($str, 0, $maxLen-2).'……'; + } else { + return ''; + } + } + + /** * 获取秒数对应的天/时/分 * @param $time * @return string -- libgit2 0.21.0