Beispiel #1
0
}
//短信内容是否为空
if (empty($Message)) {
    $arrs[0]['flag'] = 'fail';
    $arrs[0]['tomobile'] = 'All';
    $arrs[0]['msg'] = '短信内容不能为空';
    $result = json_encode($arrs);
    $result = preg_replace("#\\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $result);
    echo $result;
    exit;
}
//根据短信内容字数计算发送条数
$length = mb_strlen($Message, 'UTF8') + 4;
$num = ceil($length / 63);
//手机号加密密钥
$aeskeyMobile = getAESKey('Mobile');
$MsgTo = explode(';', $MsgTo);
$jsonIndex = 0;
foreach ($MsgTo as $toMobile) {
    if (!empty($toMobile)) {
        //发送短信
        $SendResult = verifycodesms($toMobile, $Message, $sendTime);
        if (!is_numeric($SendResult)) {
            $msg = '其他错误';
        } else {
            switch ($SendResult) {
                case 0:
                    $msg = '发送成功';
                    $flag = 'success';
                    break;
                case -2:
Beispiel #2
0
function sendMobileMsg()
{
    global $needSend;
    $aeskeyMobile = getAESKey('Mobile');
    //给领导集中发送短信通知
    foreach ($needSend as $uid => $allmsg) {
        $mergedContent = '【温馨提示】领导您好,';
        $mergedMobile = '';
        foreach ($allmsg as $atuid => $info) {
            $present = '';
            $next = '';
            switch ($info['level']) {
                case 1:
                    $header = '【温馨提示】领导您好,' . $info['name'];
                    $present = '部处';
                    $next = '单位负责人';
                    break;
                case 3:
                    $header = '【温馨提示】领导您好,' . $info['name'];
                    $present = '单位负责人';
                    $next = '主管副校长';
                    break;
                case 7:
                    $header = '【温馨提示】领导您好,' . $info['name'];
                    $present = '主管副校长';
                    $next = '校长';
                    break;
                case 10:
                    if ($mergedMobile) {
                        $mergedContent .= '、' . $info['name'] . '有' . $info['count'] . '条';
                    } else {
                        $mergedMobile = $info['mobile'];
                        $mergedContent = '【温馨提示】领导您好,' . $info['name'] . '有' . $info['count'] . '条';
                    }
                    $present = '校长';
                    $next = '校长';
                    break;
                default:
                    $header = '【温馨提示】领导您好,' . $info['name'];
                    break;
            }
            if ($info['level'] != 10) {
                $content = $header . '有' . $info['count'] . $info['msg'];
                $mobile = M_decode($info['mobile'], $aeskeyMobile);
                $sendtime = '';
                insertMsg($mobile, $uid, $info['mobile'], $content, $sendtime);
            }
            foreach ($info['cc'] as $ccuid => $ccmix) {
                list($ccmobile, $cclevel) = explode(',', $ccmix);
                // switch ($cclevel) {
                //     case 1:
                //         $header = '【温馨提示】领导您好,您';
                //         break;
                //     default:
                //         $header = '【温馨提示】领导您好,'.$info['name'];
                //         break;
                // }
                // if ($info['level'] != 10) {
                //     $content = $header.'有'.$info['count'].'条诉求在规定的时间内未处理,已上报给'.$present.'处,若不处理,将于'.fancyDate($info['dateline']).'上报给'.$next.'.';
                // } else {
                //     $content = $header.'有'.$info['count'].'条诉求在规定的时间内未处理,已上报给'.$present.'处.';
                // }
                $header = '【温馨提示】领导您好,' . $info['name'];
                $content = $header . '有' . $info['count'] . '条诉求在规定的时间内未处理,已上报给' . $present . '处.';
                $mobile = M_decode($ccmobile, $aeskeyMobile);
                $sendtime = '';
                insertMsg($mobile, $ccuid, $ccmobile, $content, $sendtime);
            }
        }
        if ($mergedMobile) {
            $content = $mergedContent . '诉求未处理,请您安排处理.';
            $mobile = M_decode($mergedMobile, $aeskeyMobile);
            $sendtime = '';
            insertMsg($mobile, $uid, $mergedMobile, $content, $sendtime);
        }
    }
}