bnbweb/back/index.php
2022-11-14 23:49:28 +08:00

869 lines
29 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
require_once(ROOT_PATH . '/includes/lib_order.php');
/*------------------------------------------------------ */
//-- 框架
/*------------------------------------------------------ */
if ($_REQUEST['act'] == '')
{
$_REQUEST['act']='main';
}
/*------------------------------------------------------ */
//-- 顶部框架的内容
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'top')
{
// 获得管理员设置的菜单
$lst = array();
$nav = $db->GetOne('SELECT nav_list FROM ' . $ecs->table('admin_user') . " WHERE user_id = '" . $_SESSION['admin_id'] . "'");
if (!empty($nav))
{
$arr = explode(',', $nav);
foreach ($arr AS $val)
{
$tmp = explode('|', $val);
$lst[$tmp[1]] = $tmp[0];
}
}
// 获得管理员ID
$smarty->assign('back_name',BACK_NAME);
$smarty->assign('back_color',BACK_COLOR);
$smarty->assign('send_mail_on',$_CFG['send_mail_on']);
$smarty->assign('nav_list', $lst);
$smarty->assign('admin_id', $_SESSION['admin_id']);
$smarty->assign('certi', $_CFG['certi']);
$smarty->display('top.htm');
}
/*------------------------------------------------------ */
//-- 计算器
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'calculator')
{
$smarty->display('calculator.htm');
}
/*------------------------------------------------------ */
//-- 左边的框架
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'menu')
{
include_once('includes/inc_menu.php');
// 权限对照表
include_once('includes/inc_priv.php');
foreach ($modules AS $key => $value)
{
ksort($modules[$key]);
}
ksort($modules);
foreach ($modules AS $key => $val)
{
$menus[$key]['label'] = $_LANG[$key];
if (is_array($val))
{
foreach ($val AS $k => $v)
{
if ( isset($purview[$k]))
{
if (is_array($purview[$k]))
{
$boole = false;
foreach ($purview[$k] as $action)
{
$boole = $boole || admin_priv($action, '', false);
}
if (!$boole)
{
continue;
}
}
else
{
if (! admin_priv($purview[$k], '', false))
{
continue;
}
}
}
if ($k == 'ucenter_setup' && $_CFG['integrate_code'] != 'ucenter')
{
continue;
}
$menus[$key]['children'][$k]['label'] = $_LANG[$k];
$menus[$key]['children'][$k]['action'] = $v;
}
}
else
{
$menus[$key]['action'] = $val;
}
// 如果children的子元素长度为0则删除该组
if(empty($menus[$key]['children']))
{
unset($menus[$key]);
}
}
$smarty->assign('menus', $menus);
$smarty->assign('no_help', $_LANG['no_help']);
$smarty->assign('help_lang', $_CFG['lang']);
$smarty->assign('charset', EC_CHARSET);
$smarty->assign('admin_id', $_SESSION['admin_id']);
$smarty->display('menu.htm');
}
/*------------------------------------------------------ */
//-- 清除缓存
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'clear_cache')
{
clear_all_files();
sys_msg($_LANG['caches_cleared']);
}
/*------------------------------------------------------ */
//-- 主窗口
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'main')
{
ecs_header("Location: homestay.php?act=edit\n");
exit();
$gd = gd_version();
/* 检查文件目录属性 */
$warning = array();
if ($_CFG['shop_closed'])
{
$warning[] = $_LANG['shop_closed_tips'];
}
$open_basedir = ini_get('open_basedir');
if (!empty($open_basedir))
{
/* 如果 open_basedir 不为空,则检查是否包含了 upload_tmp_dir */
$open_basedir = str_replace(array("\\", "\\\\"), array("/", "/"), $open_basedir);
$upload_tmp_dir = ini_get('upload_tmp_dir');
if (empty($upload_tmp_dir))
{
if (stristr(PHP_OS, 'win'))
{
$upload_tmp_dir = getenv('TEMP') ? getenv('TEMP') : getenv('TMP');
$upload_tmp_dir = str_replace(array("\\", "\\\\"), array("/", "/"), $upload_tmp_dir);
}
else
{
$upload_tmp_dir = getenv('TMPDIR') === false ? '/tmp' : getenv('TMPDIR');
}
}
if (!stristr($open_basedir, $upload_tmp_dir))
{
$warning[] = sprintf($_LANG['temp_dir_cannt_read'], $upload_tmp_dir);
}
}
$result = file_mode_info('../cert');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], 'cert', $_LANG['cert_cannt_write']);
}
$result = file_mode_info('../' . DATA_DIR);
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], 'data', $_LANG['data_cannt_write']);
}
else
{
$result = file_mode_info('../' . DATA_DIR . '/afficheimg');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], DATA_DIR . '/afficheimg', $_LANG['afficheimg_cannt_write']);
}
$result = file_mode_info('../' . DATA_DIR . '/feedbackimg');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], DATA_DIR . '/feedbackimg', $_LANG['feedbackimg_cannt_write']);
}
}
$result = file_mode_info('../images');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], 'images', $_LANG['images_cannt_write']);
}
else
{
$result = file_mode_info('../' . IMAGE_DIR . '/upload');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], IMAGE_DIR . '/upload', $_LANG['imagesupload_cannt_write']);
}
}
$result = file_mode_info('../temp');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], 'images', $_LANG['tpl_cannt_write']);
}
$result = file_mode_info('../temp/backup');
if ($result < 2)
{
$warning[] = sprintf($_LANG['not_writable'], 'images', $_LANG['tpl_backup_cannt_write']);
}
if (!is_writeable('../' . DATA_DIR . '/order_print.html'))
{
$warning[] = $_LANG['order_print_canntwrite'];
}
clearstatcache();
$smarty->assign('warning_arr', $warning);
/* 管理员留言信息 */
$sql = 'SELECT message_id, sender_id, receiver_id, sent_time, readed, deleted, title, message, user_name ' .
'FROM ' . $ecs->table('admin_message') . ' AS a, ' . $ecs->table('admin_user') . ' AS b ' .
"WHERE a.sender_id = b.user_id AND a.receiver_id = '$_SESSION[admin_id]' AND ".
"a.readed = 0 AND deleted = 0 ORDER BY a.sent_time DESC";
$admin_msg = $db->GetAll($sql);
$smarty->assign('admin_msg', $admin_msg);
/* 已完成的订单 */
/*
$order['finished'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info').
" WHERE 1 " . order_query_sql('finished'));
$status['finished'] = CS_FINISHED;
*/
/* 待发货的订单: */
/*
$order['await_ship'] = $db->GetOne('SELECT COUNT(*)'.
' FROM ' .$ecs->table('order_info') .
" WHERE 1 " . order_query_sql('await_ship'));
$status['await_ship'] = CS_AWAIT_SHIP;
*/
/* 待付款的订单: */
/*
$order['await_pay'] = $db->GetOne('SELECT COUNT(*)'.
' FROM ' .$ecs->table('order_info') .
" WHERE 1 " . order_query_sql('await_pay'));
$status['await_pay'] = CS_AWAIT_PAY;
*/
/* “未确认”的订单 */
/*
$order['unconfirmed'] = $db->GetOne('SELECT COUNT(*) FROM ' .$ecs->table('order_info').
" WHERE 1 " . order_query_sql('unconfirmed'));
$status['unconfirmed'] = OS_UNCONFIRMED;
*/
/* “部分发货”的订单 */
/*
$order['shipped_part'] = $db->GetOne('SELECT COUNT(*) FROM ' .$ecs->table('order_info'));
$status['shipped_part'] = OS_SHIPPED_PART;
*/
// $today_start = mktime(0,0,0,date('m'),date('d'),date('Y'));
/*
$order['stats'] = $db->getRow('SELECT COUNT(*) AS oCount, IFNULL(SUM(order_amount), 0) AS oAmount' .
' FROM ' .$ecs->table('order_info'));
*/
$today_start=local_mktime(0,0,0,date('m'),date('d'),date('Y'));
$today_end=local_mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
$month_start=local_mktime(0,0,0,date('m'),1,date('Y'));
$month_end=local_mktime(23,59,59,date('m'),date('t'),date('Y'));
$time = gmtime();
/* 访问统计信息 */
$today = local_getdate();
/* 註冊人數 */
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users') .
' WHERE status = 1 and reg_time > ' . $today_start;
$today['user']=$db->getOne($sql);
/* 放點 */
//当前月份
$thismonth=date('m');
$smarty->assign('thismonth',$thismonth);
$smarty->assign('today',$today);
// $smarty->assign('order', $order);
// $smarty->assign('status', $status);
$mysql_ver = $db->version(); // 获得 MySQL 版本
/* 系统信息 */
$sys_info['os'] = PHP_OS;
$sys_info['ip'] = $_SERVER['SERVER_ADDR'];
$sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE'];
$sys_info['php_ver'] = PHP_VERSION;
$sys_info['mysql_ver'] = $mysql_ver;
$sys_info['zlib'] = function_exists('gzclose') ? $_LANG['yes']:$_LANG['no'];
$sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? $_LANG['yes']:$_LANG['no'];
$sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid') ? $_LANG['yes'] : $_LANG['no'];
$sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : $_LANG['no_timezone'];
$sys_info['socket'] = function_exists('fsockopen') ? $_LANG['yes'] : $_LANG['no'];
if ($gd == 0)
{
$sys_info['gd'] = 'N/A';
}
else
{
if ($gd == 1)
{
$sys_info['gd'] = 'GD1';
}
else
{
$sys_info['gd'] = 'GD2';
}
$sys_info['gd'] .= ' (';
/* 检查系统支持的图片类型 */
if ($gd && (imagetypes() & IMG_JPG) > 0)
{
$sys_info['gd'] .= ' JPEG';
}
if ($gd && (imagetypes() & IMG_GIF) > 0)
{
$sys_info['gd'] .= ' GIF';
}
if ($gd && (imagetypes() & IMG_PNG) > 0)
{
$sys_info['gd'] .= ' PNG';
}
$sys_info['gd'] .= ')';
}
/* IP库版本 */
$sys_info['ip_version'] = ecs_geoip('255.255.255.0');
/* 允许上传的最大文件大小 */
$sys_info['max_filesize'] = ini_get('upload_max_filesize');
$smarty->assign('sys_info', $sys_info);
/* 每月数据统计 ecmoban start zhou*/
$froms_tooltip = array(
'trigger'=>'item',
'formatter'=>'{a} <br/>{b} : {c} ({d}%)');
$froms_legend = array(
'orient'=>'vertical',
'x'=>'left',
'y'=>'20',
'data'=>array());
$froms_toolbox = array(
'show'=>true,
'feature'=>array(
'magicType'=>array(
'show'=>true,
'type'=>array('pie','funnel')
),
'restore'=>array('show'=>true),
'saveAsImage'=>array('show'=>true)
)
);
$froms_calculable = true;
$froms_series = array(
array(
'type'=>'pie',
'radius'=>'55%',
'center'=>array('50%','60%')));
$froms_data = array();
$froms_options = array();
$froms_legend['data'] = $froms_legend_data;
$froms_series[0]['data'] = $froms_data;
$froms_options['tooltip'] = $froms_tooltip;
$froms_options['legend'] = $froms_legend;
$froms_options['toolbox'] = $froms_toolbox;
$froms_options['calculabe'] = $froms_calculable;
$froms_options['series'] = $froms_series;
$smarty->assign('froms_option',json_encode($froms_options));
//註冊人數統計
$reg_tooltip = array('trigger'=>'axis');
$reg_legend = array('data'=>array());
$reg_toolbox = array(
'show'=>true,
'x'=>'right',
'feature'=>array(
'magicType'=>array(
'show'=>true,
'type'=>array('line','bar')),
'restore'=>array(
'show'=>true),
'saveAsImage'=>array(
'show'=>true)
));
$reg_calculable = true;
$reg_xAxis = array(
'type'=>'category',
'boundryGap'=>false,
'data'=>array());
$reg_yAxis = array(
'type'=>'value',
'axisLabel'=>array(
'formatter'=>'{value}人'));
$reg_series = array(
array(
'name'=>'註冊人數',
'type'=>'line',
'data'=>array(),
'markPoint'=>array(
'data'=>array(
array(
'type'=>'max',
'name'=>'最大值'),
array(
'type'=>'min',
'name'=>'最小值')))),
array(
'name'=>'驗證人數',
'type'=>'line',
'data'=>array(),
'markPoint'=>array(
'data'=>array(
array(
'type'=>'max',
'name'=>'最大值'),
array(
'type'=>'min',
'name'=>'最小值'))))
);
$sql = "SELECT DATE_FORMAT(FROM_UNIXTIME(reg_time) ,'%d') AS day , COUNT(*) AS count
FROM ".$ecs->table('users')." WHERE reg_time BETWEEN ".$month_start." AND ".$month_end;
$sql .=" GROUP BY day ORDER BY day ASC ";
$result = $db->query($sql);
while($row = mysqli_fetch_assoc($result))
{
$reg_series_data[intval($row['day'])] = floatval($row['count']);
}
$sql = "SELECT DATE_FORMAT(FROM_UNIXTIME(reg_time) ,'%d') AS day , COUNT(*) AS count
FROM ".$ecs->table('users')." WHERE status=1 and reg_time BETWEEN ".$month_start." AND ".$month_end;
$sql .=" GROUP BY day ORDER BY day ASC ";
$result = $db->query($sql);
while($row = mysqli_fetch_assoc($result))
{
$val_series_data[intval($row['day'])] = floatval($row['count']);
}
for($i = 1;$i<=date('d');$i++)
{
if(empty($reg_series_data[$i]))
{
$reg_series_data[$i] = 0;
}
if(empty($val_series_data[$i]))
{
$val_series_data[$i] = 0;
}
$reg_xAxis_data[] = $i;
}
$reg_xAxis['data'] = $reg_xAxis_data;
ksort($reg_series_data);
ksort($val_series_data);
$reg_series[0]['data'] = array_values($reg_series_data);
$reg_series[1]['data'] = array_values($val_series_data);
$reg_option['tooltip'] = $reg_tooltip;
$reg_option['legend'] = $reg_legend;
$reg_option['toolbox'] = $reg_toolbox;
$reg_option['calculable'] = $reg_calculable;
$reg_option['xAxis'] = $reg_xAxis;
$reg_option['yAxis'] = $reg_yAxis;
$reg_option['series'] = $reg_series;
$smarty->assign('reg_option',json_encode($reg_option));
//当月每日订单数统计
$orders_tooltip = array('trigger'=>'axis');
$orders_legend = array('data'=>array());
$orders_toolbox = array(
'show'=>true,
'x'=>'right',
'feature'=>array(
'magicType'=>array(
'show'=>true,
'type'=>array('line','bar')),
'restore'=>array(
'show'=>true),
'saveAsImage'=>array(
'show'=>true)
));
$orders_calculable = true;
$orders_xAxis = array(
'type'=>'category',
'boundryGap'=>false,
'data'=>array());
$orders_yAxis = array(
'type'=>'value',
'axisLabel'=>array(
'formatter'=>'{value}元'));
$orders_series = array(
array(
'name'=>'提取金額',
'type'=>'line',
'data'=>array(),
'markPoint'=>array(
'data'=>array(
array(
'type'=>'max',
'name'=>'最大值'),
array(
'type'=>'min',
'name'=>'最小值')))),
array(
'name'=>'充值金額',
'type'=>'line',
'data'=>array(),
'markPoint'=>array(
'data'=>array(
array(
'type'=>'max',
'name'=>'最大值'),
array(
'type'=>'min',
'name'=>'最小值'))))
);
for($i = 1;$i<=date('d');$i++)
{
if(empty($deposit_series_data[$i]))
{
$deposit_series_data[$i] = 0;
}
if(empty($repay_series_data[$i]))
{
$repay_series_data[$i] = 0;
}
$orders_xAxis_data[] = $i;
}
$orders_xAxis['data'] = $orders_xAxis_data;
ksort($deposit_series_data);
ksort($repay_series_data);
$orders_series[0]['data'] = array_values($repay_series_data);
$orders_series[1]['data'] = array_values($deposit_series_data);
$orders_option['tooltip'] = $orders_tooltip;
$orders_option['legend'] = $orders_legend;
$orders_option['toolbox'] = $orders_toolbox;
$orders_option['calculable'] = $orders_calculable;
$orders_option['xAxis'] = $orders_xAxis;
$orders_option['yAxis'] = $orders_yAxis;
$orders_option['series'] = $orders_series;
$smarty->assign('orders_option',json_encode($orders_option));
//當月營業金額統計
$sales_tooltip = array('trigger'=>'axis');
$sales_legend = array('data'=>array());
$sales_toolbox = array(
'show'=>true,
'x'=>'right',
'feature'=>array(
'magicType'=>array(
'show'=>true,
'type'=>array('line','bar')),
'restore'=>array(
'show'=>true),
'saveAsImage'=>array(
'show'=>true)
));
$sales_calculable = true;
$sales_xAxis = array(
'type'=>'category',
'boundryGap'=>false,
'data'=>array());
$sales_yAxis = array(
'type'=>'value',
'axisLabel'=>array(
'formatter'=>'{value}元'));
$sales_series = array(
array(
'name'=>'營業金额',
'type'=>'bar',
'data'=>array(),
'markPoint'=>array(
'data'=>array(
array(
'type'=>'max',
'name'=>'最大值'),
array(
'type'=>'min',
'name'=>'最小值')))));
for($i = 1;$i<=date('d');$i++)
{
if(empty($sales_series_data[$i]))
{
$sales_series_data[$i] = 0;
}
$sales_xAxis_data[] = $i;
}
$sales_xAxis['data'] = $sales_xAxis_data;
ksort($sales_series_data);
$sales_series[0]['data'] = array_values($sales_series_data);
$sales_option['tooltip'] = $sales_tooltip;
$sales_option['toolbox'] = $sales_toolbox;
$sales_option['calculable'] = $sales_calculable;
$sales_option['xAxis'] = $sales_xAxis;
$sales_option['yAxis'] = $sales_yAxis;
$sales_option['series'] = $sales_series;
$smarty->assign('sales_option',json_encode($sales_option));
/* ecmoban end */
assign_menu_info();
assign_query_info();
$smarty->assign('ecs_version', VERSION);
$smarty->assign('ecs_release', RELEASE);
$smarty->assign('ecs_lang', $_CFG['lang']);
$smarty->assign('ecs_charset', strtoupper(EC_CHARSET));
$smarty->assign('install_date', local_date($_CFG['date_format'], $_CFG['install_date']));
$smarty->display('start.htm');
}
/*------------------------------------------------------ */
//-- 拖动的帧
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'drag')
{
$smarty->display('drag.htm');;
}
/*------------------------------------------------------ */
//-- 检查订单
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'check_order')
{
if (empty($_SESSION['last_check']))
{
$_SESSION['last_check'] = gmtime();
make_json_result('', '', array('new_orders' => 0, 'new_paid' => 0));
}
/* 新註冊 */
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users').
" WHERE status =2 and last_time >= '".date('Y-m-d h:i:s',$_SESSION[last_check])."'";
$arr['new_user'] = $db->getOne($sql);
$_SESSION['last_check'] = gmtime();
if (!( is_numeric($arr['new_trans']) && is_numeric($arr['new_deposit']) && is_numeric($arr['new_repay']) && is_numeric($arr['new_user']) ))
{
make_json_error($db->error());
}
else
{
make_json_result('', '', $arr);
}
}
/*------------------------------------------------------ */
//-- 检查更新
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'check_new')
{
/* 新付款的订单 */
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users').
" WHERE status=2";
$arr['new_user'] = $db->getOne($sql);
if (!(is_numeric($arr['new_user']) && is_numeric($arr['new_deposit']) && is_numeric($arr['new_repay']) && is_numeric($arr['new_trans']) ))
{
make_json_error($db->error());
}
else
{
make_json_result('', '', $arr);
}
}
/*------------------------------------------------------ */
//-- 今日統計
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'start_stat')
{
$today_start=local_mktime(0,0,0,date('m'),date('d'),date('Y'));
/* 註冊會員 */
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users') .
' WHERE status = 1 and reg_time > ' . $today_start;
$arr['today_user'] = $db->getOne($sql);
if (!(is_numeric($arr['today_user']) && is_numeric($arr['today_deposit']) && is_numeric($arr['today_repay'])))
{
make_json_error($db->error());
}
else
{
make_json_result('', '', $arr);
}
}
/*------------------------------------------------------ */
//-- Totolist操作
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'save_todolist')
{
$content = json_str_iconv($_POST["content"]);
$sql = "UPDATE" .$GLOBALS['ecs']->table('admin_user'). " SET todolist='" . $content . "' WHERE user_id = " . $_SESSION['admin_id'];
$GLOBALS['db']->query($sql);
}
elseif ($_REQUEST['act'] == 'get_todolist')
{
$sql = "SELECT todolist FROM " .$GLOBALS['ecs']->table('admin_user'). " WHERE user_id = " . $_SESSION['admin_id'];
$content = $GLOBALS['db']->getOne($sql);
echo $content;
}
// 邮件群发处理
elseif ($_REQUEST['act'] == 'send_mail')
{
if ($_CFG['send_mail_on'] == 'off')
{
make_json_result('', $_LANG['send_mail_off'], 0);
exit();
}
$sql = "SELECT * FROM " . $ecs->table('email_sendlist') . " ORDER BY pri DESC, last_send ASC LIMIT 1";
$row = $db->getRow($sql);
//发送列表为空
if (empty($row['id']))
{
make_json_result('', $_LANG['mailsend_null'], 0);
}
//发送列表不为空,邮件地址为空
if (!empty($row['id']) && empty($row['email']))
{
$sql = "DELETE FROM " . $ecs->table('email_sendlist') . " WHERE id = '$row[id]'";
$db->query($sql);
$count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('email_sendlist'));
make_json_result('', $_LANG['mailsend_skip'], array('count' => $count, 'goon' => 1));
}
//查询相关模板
$sql = "SELECT * FROM " . $ecs->table('mail_templates') . " WHERE template_id = '$row[template_id]'";
$rt = $db->getRow($sql);
//如果是模板则将已存入email_sendlist的内容作为邮件内容
//否则即是杂质将mail_templates调出的内容作为邮件内容
if ($rt['type'] == 'template')
{
$rt['template_content'] = $row['email_content'];
}
if ($rt['template_id'] && $rt['template_content'])
{
if (send_mail('', $row['email'], $rt['template_subject'], $rt['template_content'], $rt['is_html']))
{
//发送成功
//从列表中删除
$sql = "DELETE FROM " . $ecs->table('email_sendlist') . " WHERE id = '$row[id]'";
$db->query($sql);
//剩余列表数
$count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('email_sendlist'));
if($count > 0)
{
$msg = sprintf($_LANG['mailsend_ok'],$row['email'],$count);
}
else
{
$msg = sprintf($_LANG['mailsend_finished'],$row['email']);
}
make_json_result('', $msg, array('count' => $count));
}
else
{
//发送出错
if ($row['error'] < 3)
{
$time = time();
$sql = "UPDATE " . $ecs->table('email_sendlist') . " SET error = error + 1, pri = 0, last_send = '$time' WHERE id = '$row[id]'";
}
else
{
//将出错超次的纪录删除
$sql = "DELETE FROM " . $ecs->table('email_sendlist') . " WHERE id = '$row[id]'";
}
$db->query($sql);
$count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('email_sendlist'));
make_json_result('', sprintf($_LANG['mailsend_fail'],$row['email']), array('count' => $count));
}
}
else
{
//无效的邮件队列
$sql = "DELETE FROM " . $ecs->table('email_sendlist') . " WHERE id = '$row[id]'";
$db->query($sql);
$count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('email_sendlist'));
make_json_result('', sprintf($_LANG['mailsend_fail'],$row['email']), array('count' => $count));
}
}
?>