ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 903


Ignore:
Timestamp:
Nov 25, 2006, 12:51:00 PM (13 years ago)
Author:
takanashi
Message:

メッセージキュー機能

Location:
OpenPNE/branches/takanashi/prj_takanashi
Files:
2 added
6 edited
8 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/do/send_messages.php

    r276 r903  
    2727        $c_member_id_from = 1;
    2828
    29         foreach ($requests['c_member_ids'] as $c_member_id) {
    30             if ($c_member_id_from == $c_member_id) continue;
     29        $send_num = 0;
     30        foreach ($requests['c_member_ids'] as $key => $c_member_id) {
     31            if ($c_member_id_from == $c_member_id) {
     32                $c_member_id_list[$key] = null;
     33                continue;
     34            }
    3135            switch ($send_type) {
    3236                case "mail":
     
    4044                break;
    4145            }
     46            $send_num++;
    4247        }
     48
     49        //送信履歴登録
     50        db_admin_insert_c_send_messages_history(
     51            $requests['subject'],
     52            $requests['body'],
     53            $send_num,
     54            $send_type,
     55            $requests['c_member_ids']
     56        );
    4357
    4458        switch ($send_type) {
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/do/send_messages_all.php

    r276 r903  
    2626        $c_member_id_list = p_common_c_member_id_list4null();
    2727
    28         foreach ($c_member_id_list as $c_member_id) {
    29             if ($c_member_id_from == $c_member_id) continue;
     28        $send_num = 0;
     29        foreach ($c_member_id_list as $key => $c_member_id) {
     30            if ($c_member_id_from == $c_member_id) {
     31                $c_member_id_list[$key] = null;
     32                continue;
     33            }
    3034            switch ($send_type) {
    3135                case "mail":
     
    3943                break;
    4044            }
     45            $send_num++;
    4146        }
     47
     48        //送信履歴登録
     49        db_admin_insert_c_send_messages_history(
     50            $requests['subject'],
     51            $requests['body'],
     52            $send_num,
     53            $send_type,
     54            $c_member_id_list
     55        );
    4256
    4357        switch ($send_type) {
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/do/send_messages_search.php

    r276 r903  
    2828        $c_member_id_list = _db_admin_c_member_id_list($cond_list);
    2929
    30         foreach ($c_member_id_list as $c_member_id) {
    31             if ($c_member_id_from == $c_member_id) continue;
     30        $send_num = 0;
     31        foreach ($c_member_id_list as $key => $c_member_id) {
     32            if ($c_member_id_from == $c_member_id) {
     33                $c_member_id_list[$key] = null;
     34                continue;
     35            }
    3236            switch ($send_type) {
    3337                case "mail":
     
    4145                break;
    4246            }
     47            $send_num++;
    4348        }
     49
     50        //送信履歴登録
     51        db_admin_insert_c_send_messages_history(
     52            $requests['subject'],
     53            $requests['body'],
     54            $send_num,
     55            $send_type,
     56            $c_member_id_list
     57        );
    4458
    4559        switch ($send_type) {
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/init.inc

    r2 r903  
    4343    'page_send_messages_all',
    4444    'page_send_messages',
     45    'page_send_messages_history_detail',
     46    'page_send_messages_history_list',
    4547    'do_delete_c_admin_user',
    4648    'do_delete_c_image',
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/lib/db_admin.php

    r882 r903  
    631631}
    632632
    633 //メッセージ受信メール(メールキュー蓄積対応)
     633//メッセージ受信メール(メール&メッセージキュー蓄積対応)
    634634function do_admin_send_message($c_member_id_from, $c_member_id_to, $subject, $body)
    635635{
    636636    //メッセージ
    637     $c_message_id = _do_insert_c_message($c_member_id_from, $c_member_id_to, $subject, $body);
    638 
    639     do_admin_send_message_mail_send($c_member_id_to, $c_member_id_from);
    640     do_admin_send_message_mail_send_ktai($c_member_id_to, $c_member_id_from);
    641 
    642     return $c_message_id;
     637    if (OPENPNE_MESSAGE_QUEUE) {
     638        //メッセージキューに蓄積
     639        db_admin_insert_c_message_queue($c_member_id_from, $c_member_id_to, $subject, $body);
     640        return true;
     641    } else {
     642        _do_insert_c_message($c_member_id_from, $c_member_id_to, $subject, $body);
     643        do_admin_send_message_mail_send($c_member_id_to, $c_member_id_from);
     644        do_admin_send_message_mail_send_ktai($c_member_id_to, $c_member_id_from);
     645        return true;
     646    }
     647
     648    return false;
    643649}
    644650
     
    18471853}
    18481854
     1855//メッセージ送信履歴を挿入
     1856function db_admin_insert_c_send_messages_history($subject, $body, $send_num, $type, $c_member_ids)
     1857{
     1858
     1859    //配列を文字列に変換
     1860    if($c_member_ids) {
     1861        $c_member_ids = implode("-",$c_member_ids);
     1862    } else {
     1863        return;
     1864    }
     1865
     1866    $data = array(
     1867        'subject'       => strval($subject),
     1868        'body'          => strval($body),
     1869        'send_num'      => intval($send_num),
     1870        'type'          => strval($type),
     1871        'c_member_ids'  => strval($c_member_ids),
     1872        'r_datetime'    => db_now()
     1873    );
     1874
     1875    return db_insert('c_send_messages_history', $data);
     1876
     1877}
     1878
     1879//メッセージ送信履歴を全て取得(ページャー付き)
     1880function db_admin_get_c_send_messages_history_all($page, $page_size, &$pager)
     1881{
     1882
     1883    $sql = 'SELECT * FROM c_send_messages_history ORDER BY c_send_messages_history_id DESC';
     1884
     1885    $history_list = db_get_all_page($sql, $page, $page_size, $params);
     1886
     1887    foreach ($history_list as $key => $history) {
     1888        $history_list[$key]['c_member_ids'] = explode("-", $history['c_member_ids']);
     1889    }
     1890
     1891    $sql = 'SELECT count(*) FROM c_send_messages_history';
     1892    $total_num = db_get_one($sql, $params);
     1893    $pager = admin_make_pager($page, $page_size, $total_num);
     1894
     1895    return $history_list;
     1896}
     1897
     1898//メッセージ送信履歴を一つ取得
     1899function db_admin_get_c_send_messages_history($c_send_messages_history_id)
     1900{
     1901
     1902    $sql = 'SELECT * FROM c_send_messages_history WHERE c_send_messages_history_id = ?';
     1903
     1904    $params = array(intval($c_send_messages_history_id));
     1905
     1906    $history = db_get_row($sql, $params);
     1907
     1908    $history['c_member_ids'] = explode("-", $history['c_member_ids']);
     1909
     1910    return $history;
     1911}
     1912
     1913//メッセージをキューに入れる
     1914function db_admin_insert_c_message_queue($c_member_id_from, $c_member_id_to, $subject, $body)
     1915{
     1916    $data = array(
     1917        'c_member_id_from' => intval($c_member_id_from),
     1918        'c_member_id_to'   => intval($c_member_id_to),
     1919        'subject'          => strval($subject),
     1920        'body'             => strval($body),
     1921    );
     1922    return db_insert('c_message_queue', $data);
     1923}
     1924
     1925//メッセージをキューから削除
     1926function db_admin_delete_c_message_queue($c_message_queue_id)
     1927{
     1928
     1929    $sql = "DELETE FROM c_message_queue WHERE c_message_queue_id = ?";
     1930    $params = array(intval($c_message_queue_id));
     1931
     1932    return db_query($sql, $params);
     1933}
     1934
    18491935?>
  • OpenPNE/branches/takanashi/prj_takanashi/webapp/modules/admin/templates/list_c_member.tpl

    r406 r903  
    243243<input type="submit" class="submit" value="すべてのメンバー ">
    244244</form>
     245<br><br>
     246
     247<a href="?m=({$module_name})&amp;a=page_({$hash_tbl->hash('send_messages_history_list')})">メッセージ/Eメール送信履歴</a>
    245248
    246249({if $pager})
Note: See TracChangeset for help on using the changeset viewer.