xhCommonService.php 915 B

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