xhCommonService.php 933 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace common\services;
  3. use common\components\util;
  4. use Yii;
  5. use common\components\dict;
  6. use common\components\chuanglanSMS;
  7. class xhCommonService
  8. {
  9. /**
  10. * 发送短信
  11. * @param $mobile
  12. */
  13. public static function sendMobileMsg($mobile, $msg, $merchant = null)
  14. {
  15. $open = [];
  16. if (empty($open)) {
  17. util::fail('取平台信息错误');
  18. }
  19. $name = $open['name'];
  20. $sms = new chuanglanSMS('N2890342', 'abc178c7');
  21. $sign = isset($merchant) == true ? "【{$merchant['name']}】" : "【{$name}】";
  22. $msg .= $sign;
  23. $result = $sms->send($mobile, $msg);
  24. }
  25. /**
  26. * 传入最大的照片,输出三种照片:大 中 小
  27. */
  28. public static function getImgList($largeImg)
  29. {
  30. $extend = substr($largeImg, strrpos($largeImg, '.') + 1);
  31. $pre = substr($largeImg, 0, strrpos($largeImg, '.'));
  32. return ['small' => $pre . '_50.' . $extend, 'medium' => $pre . '_200.' . $extend, 'large' => $largeImg];
  33. }
  34. }