private static function sms($mobile) { // \Yii::$app->wx->setGhId(\app\models\MGh::GH_XIANGYANGUNICOM); $long_url = 'http://wosotech.com/wx/web/index.php?r=wapx/sm-qr' . '&mobile=' . $mobile; // $short_url = \Yii::$app->wx->WxGetShortUrl($long_url); $short_url = DwzService::baidu($long_url); if (false == $short_url) { $short_url = DwzService::qqurl($long_url); if (false == $short_url) { $short_url = DwzService::so985($long_url); if (false == $short_url) { \Yii::$app->wx->setGhId(MGh::GH_XIANGYANGUNICOM); $short_url = \Yii::$app->wx->WxGetShortUrl($long_url); } } } $content = "【襄阳联通】诚邀您({$mobile})关注官方微信号,猛戳" . $short_url . '!最高50元红包即送!'; U::yjhu_W(mb_strlen($content)); // $content = mb_substr($content, 0, 67); // $content = $mobile . ' ' . $short_url; $s = \Yii::$app->sm->S($mobile, $content, '', null, true); // $ret = \app\models\sm\ESmsGuodu::yjhu_test($mobile, $content); $ret = $s->isSendOk(); if ($ret) { $smslog = SmsMarketingLog::findOne(['mobile' => $mobile]); if (empty($smslog)) { $smslog = new SmsMarketingLog(); $smslog->mobile = $mobile; $smslog->first_sendtime = time(); $smslog->last_sendtime = time(); $smslog->send_count = 1; $smslog->save(false); } else { $smslog->send_count++; $smslog->last_sendtime = time(); $smslog->save(false); } } return $ret; }
public function actionDwz() { $long_url = 'http://wosotech.com/wx/web/index.php?r=wapx/sm-qr' . '&mobile=18971288549'; $short_url = \app\models\DwzService::baidu($long_url); echo "Baidu\t" . mb_strlen($short_url) . ': ' . $short_url . PHP_EOL; $short_url = \app\models\DwzService::so985($long_url); echo "985so\t" . mb_strlen($short_url) . ': ' . $short_url . PHP_EOL; // $short_url = \app\models\DwzService::sina($long_url); // echo "Sina\t".mb_strlen($short_url).': '.$short_url . PHP_EOL; $short_url = \app\models\DwzService::qqurl($long_url); echo "QQURL\t" . mb_strlen($short_url) . ': ' . $short_url . PHP_EOL; }