| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace biz\message\services;
- use biz\admin\classes\AdminClass;
- use biz\base\services\BaseService;
- use biz\merchant\services\MerchantService;
- use biz\message\classes\InformAdminClass;
- use common\components\sms;
- use common\components\weixinUtil;
- use common\services\xhTMessageService;
- use Yii;
- class InformAdminService extends BaseService
- {
- public static $baseFile = '\biz\message\classes\InformAdminClass';
- //通知到员工 shish 2020.1.1
- public static function inform($merchantId, $type, $params)
- {
- $adminList = AdminClass::getAllNoticeAdmin($merchantId);
- if (empty($adminList)) {
- return false;
- }
- $TMList = xhTMessageService::getList($merchantId);
- $merchant = MerchantService::getById($merchantId);
- foreach ($adminList as $adminKey => $admin) {
- $openId = $admin['openId'];
- $informWay = !empty($openId) && $admin['subscribe'] == 1 ? 'wx' : 'sms';
- $sendData = InformAdminClass::inform($params, $type, $informWay, $TMList);
- if (!empty($openId) && $admin['subscribe'] == 1) {
- $respond = weixinUtil::sendTaskInform($sendData, $merchant);
- Yii::info('tm:' . json_encode($respond));
- } else {
- $mobile = $admin['mobile'];
- sms::merchantSend($mobile, $sendData, $merchant);
- }
- }
- }
-
- }
|