| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- // +----------------------------------------------------------------------
- // | Fanwe 方维直播系统
- // +----------------------------------------------------------------------
- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: 云淡风轻(1956838968@qq.com)
- // +----------------------------------------------------------------------
- class DealMsgListAction extends CommonAction{
- public function index()
- {
- if(trim($_REQUEST['dest'])!='')
- $condition['dest'] = array('like','%'.trim($_REQUEST['dest']).'%');
- if(trim($_REQUEST['content'])!='')
- $condition['content'] = array('like','%'.trim($_REQUEST['content']).'%');
- $this->assign("default_map",$condition);
-
- parent::index();
- }
-
- public function show_content()
- {
- $id = intval($_REQUEST['id']);
- header("Content-Type:text/html; charset=utf-8");
- echo htmlspecialchars(M("DealMsgList")->where("id=".$id)->getField("content"));
- }
-
- public function send()
- {
- $id = intval($_REQUEST['id']);
- $msg_item = M("DealMsgList")->getById($id);
- if($msg_item)
- {
- if($msg_item['send_type']==0)
- {
- //短信
- require_once APP_ROOT_PATH."system/utils/es_sms.php";
- $sms = new sms_sender();
-
- $result = $sms->sendSms($msg_item['dest'],$msg_item['content']);
- $msg_item['result'] = $result['msg'];
- $msg_item['is_success'] = intval($result['status']);
- $msg_item['send_time'] = get_gmtime();
- M("DealMsgList")->save($msg_item);
- if($result['status'])
- {
- save_log(l("SEND_NOW").l("SUCCESS"),1);
- header("Content-Type:text/html; charset=utf-8");
- echo l("SEND_NOW").l("SUCCESS");
- }
- else
- {
- save_log(l("SEND_NOW").l("FAILED").$result['msg'],0);
- header("Content-Type:text/html; charset=utf-8");
- echo l("SEND_NOW").l("FAILED").$result['msg'];
- }
- }
- else
- {
- //邮件
- require_once APP_ROOT_PATH."system/utils/es_mail.php";
- $mail = new mail_sender();
-
- $mail->AddAddress($msg_item['dest']);
- $mail->IsHTML($msg_item['is_html']); // 设置邮件格式为 HTML
- $mail->Subject = $msg_item['title']; // 标题
- $mail->Body = $msg_item['content']; // 内容
- $result = $mail->Send();
-
- $msg_item['result'] = $mail->ErrorInfo;
- $msg_item['is_success'] = intval($result);
- $msg_item['send_time'] = get_gmtime();
- M("DealMsgList")->save($msg_item);
- if($result)
- {
- save_log(l("SEND_NOW").l("SUCCESS"),1);
- header("Content-Type:text/html; charset=utf-8");
- echo l("SEND_NOW").l("SUCCESS");
- }
- else
- {
- save_log(l("SEND_NOW").l("FAILED").$mail->ErrorInfo,0);
- header("Content-Type:text/html; charset=utf-8");
- echo l("SEND_NOW").l("FAILED").$mail->ErrorInfo;
- }
-
- }
- }
- else
- {
- header("Content-Type:text/html; charset=utf-8");
- echo l("SEND_NOW").l("FAILED");
- }
- }
-
- public function foreverdelete() {
- //彻底删除指定记录
- $ajax = intval($_REQUEST['ajax']);
- $id = $_REQUEST ['id'];
- if (isset ( $id )) {
- $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
- $rel_data = M(MODULE_NAME)->where($condition)->findAll();
- foreach($rel_data as $data)
- {
- $info[] = $data['id'];
- }
- if($info) $info = implode(",",$info);
- $list = M(MODULE_NAME)->where ( $condition )->delete();
-
- if ($list!==false) {
- save_log($info.l("FOREVER_DELETE_SUCCESS"),1);
- $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
- } else {
- save_log($info.l("FOREVER_DELETE_FAILED"),0);
- $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
- }
- } else {
- $this->error (l("INVALID_OPERATION"),$ajax);
- }
- }
-
- }
- ?>
|