/** * 获取积分列表 * @param */ public function getIntegralList($platform = '', $start = '', $end = '') { $where = array(' available=1 '); if (!empty($platform)) { $where[] = " platform={$platform} "; } if (!empty($start)) { $where[] = " present_start>={$start} "; } if (!empty($end)) { $where[] = " present_end<{$end} "; } $sql = 'SELECT * FROM ' . $this->table; if (count($where) > 0) { $sql .= ' WHERE ' . implode(' AND ', $where); } $integral_list = $this->db->getAll($sql); // 获取可赠送积分的销售平台 $role_list = get_role_list(1); foreach ($integral_list as &$val) { $val['present_start'] = date('Y-m-d', $val['present_start']); $val['present_end'] = date('Y-m-d', $val['present_end']); if ($val['platform'] == 0) { $val['platform'] = '全平台'; } else { foreach ($role_list as $v) { if ($v['role_id'] = $val['platform']) { $val['platform'] = $v['role_name']; } } } } return $integral_list; }
if (intval($_CFG['captcha']) & CAPTCHA_ADMIN && gd_version() > 0) { $smarty->assign('gd_version', gd_version()); $smarty->assign('random', mt_rand()); } $smarty->display('login.htm'); } elseif ($_REQUEST['act'] == 'list') { /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['admin_role']); $smarty->assign('action_link', array('href' => 'role.php?act=add', 'text' => $_LANG['admin_add_role'])); $smarty->assign('full_page', 1); $smarty->assign('admin_list', get_role_list()); /* 显示页面 */ assign_query_info(); $smarty->display('role_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $smarty->assign('admin_list', get_role_list()); make_json_result($smarty->fetch('role_list.htm')); } elseif ($_REQUEST['act'] == 'add') { /* 检查权限 */ admin_priv('admin_manage'); include_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/priv_action.php'; $priv_str = ''; /* 获取权限的分组数据 */ $sql_query = "SELECT action_id, parent_id, action_code, relevance FROM " . $ecs->table('admin_action') . " WHERE parent_id = 0"; $res = $db->query($sql_query); while ($rows = $db->FetchRow($res)) { $priv_arr[$rows['action_id']] = $rows; } /* 按权限组查询底级的权限名称 */ $sql = "SELECT action_id, parent_id, action_code, relevance FROM " . $ecs->table('admin_action') . " WHERE parent_id " . db_create_in(array_keys($priv_arr)); $result = $db->query($sql);
$sql = "SELECT user_id, user_name, email, password, agency_id, role_id FROM " . $ecs->table('admin_user') . " WHERE user_id = '" . $_REQUEST['id'] . "'"; $user_info = $db->getRow($sql); /* 取得该管理员负责的办事处名称 */ if ($user_info['agency_id'] > 0) { $sql = "SELECT agency_name FROM " . $ecs->table('agency') . " WHERE agency_id = '{$user_info['agency_id']}'"; $user_info['agency_name'] = $db->getOne($sql); } /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['admin_edit']); $smarty->assign('action_link', array('text' => $_LANG['admin_list'], 'href' => 'privilege.php?act=list')); $smarty->assign('user', $user_info); /* 获得该管理员的权限 */ $priv_str = $db->getOne("SELECT action_list FROM " . $ecs->table('admin_user') . " WHERE user_id = '{$_GET['id']}'"); /* 如果被编辑的管理员拥有了all这个权限,将不能编辑 */ if ($priv_str != 'all') { $smarty->assign('select_role', get_role_list()); } $smarty->assign('form_act', 'update'); $smarty->assign('action', 'edit'); assign_query_info(); $smarty->display('privilege_info.htm'); } elseif ($_REQUEST['act'] == 'update' || $_REQUEST['act'] == 'update_self') { /* 变量初始化 */ $admin_id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $admin_name = !empty($_REQUEST['user_name']) ? trim($_REQUEST['user_name']) : ''; $admin_email = !empty($_REQUEST['email']) ? trim($_REQUEST['email']) : ''; $password = !empty($_POST['new_password']) ? ", password = '******'new_password']) . "'" : ''; if ($_REQUEST['act'] == 'update') { /* 查看是否有权限编辑其他管理员的信息 */ if ($_SESSION['admin_id'] != $_REQUEST['id']) { admin_priv('admin_manage');
$res = crm_msg("成功回收{$count}个顾客", $code); } else { $res = crm_msg('回收失败'); } } else { $res = crm_msg('回收失败'); } die($json->encode($res)); } elseif ($_REQUEST['act'] == 'user_lose') { $options = array(2 => '两个月', 3 => '三个月', 4 => '更长时间'); $smarty->assign('options', $options); $smarty->assign('service_time', $_REQUEST['service_time']); $smarty->assign('order_time', $_REQUEST['order_time']); $smarty->assign('manner', $_REQUEST['manner']); if (admin_priv('referrals_list_all', '', false)) { $platform = get_role_list(' WHERE role_id>32 '); $platform_list = array(); foreach ($platform as $val) { $platform_list[$val['role_id']] = $val['role_name']; } $smarty->assign('platform', $platform_list); } $user_list = user_lose(); // 输出数据 $smarty->assign('user_list', $user_list['user_list']); $smarty->assign('act', $_REQUEST['act']); $smarty->assign('condition', '&' . implode('&', $user_list['condition'])); $smarty->assign('page', $user_list['page']); $smarty->assign('page_count', $user_list['page_count']); $smarty->assign('record_count', $user_list['record_count']); $smarty->assign('page_set', $user_list['page_set']);
} else { $month = date('Y-m', $nowtime); $max_day = date('t', $nowtime); } for ($i = 1; $i <= $max_day; $i++) { if ($i < 10) { $days_list[$month][] = '0' . $i; } else { $days_list[$month][] = $i; } } $_REQUEST['day'] = isset($_REQUEST['day']) ? $_REQUEST['day'] : date('Y-m-d', $nowtime); $order_list = order_list(); // 读取订单列表 $smarty->assign('day', $_REQUEST['day']); $smarty->assign('platform', get_role_list(1)); $smarty->assign('brand_list', brand_list()); // 支付方式 $sql = 'SELECT pay_id,pay_name FROM ' . $GLOBALS['ecs']->table('payment') . " WHERE enabled=1 ORDER BY pay_id"; $pay_list = $GLOBALS['db']->getAll($sql); $smarty->assign('pay_list', $pay_list); // 配送方式 $smarty->assign('shipping_list', shipping_list(3)); $sch_condition = preg_replace('/&day=.*.\\d$/', '', $order_list['condition']); $smarty->assign('act', $_REQUEST['act']); $smarty->assign('month', $month); $smarty->assign('days_list', $days_list); $smarty->assign('order_list', $order_list['orders']); if (isset($_REQUEST['order_class'])) { $smarty->assign('order_class', $_REQUEST['order_class']); $sch_condition .= '&order_class=' . $_REQUEST['order_class'];
$quantity = intval($_REQUEST['quantity']); $storage_id = intval($_REQUEST['storage_id']); $res = array('req_msg' => true, 'code' => false, 'message' => '', 'timeout' => 2000); if ($storage_id) { $sql_update = 'UPDATE ' . $GLOBALS['ecs']->table('inventory_storage') . " SET actual_quantity={$quantity} WHERE storage_id={$storage_id}"; $res['code'] = $GLOBALS['db']->query($sql_update); if ($res['code']) { record_operate($sql_update, 'inventory_storage'); $res['message'] = '修改成功'; $res['quantity'] = '<label onclick = "modActualQuantity(this,' . $quantity . ",{$storage_id})\">{$quantity}"; $res['storage_id'] = $storage_id; } } die($json->encode($res)); } elseif ($_REQUEST['act'] == 'stock_alarm_site') { $role_list = $tmp_role_list = get_role_list(); $admin_list = get_role_admin_list(); array_unshift($tmp_role_list, array('role_id' => 0, 'role_name' => '未分配部门')); foreach ($tmp_role_list as &$role) { foreach ($admin_list as $admin) { if ($role['role_id'] == $admin['role_id']) { $role['admin_list'][] = $admin; unset($admin); } } } $smarty->assign('admin_list', $tmp_role_list); $smarty->assign('role_list', $role_list); $res['main'] = $smarty->fetch('stock_alarm_site.htm'); die($json->encode($res)); } elseif ($_REQUEST['act'] == 'list_admin') {
<br /> <?php echo $_lang["tree_show_protected_message"]; ?> </td> </tr> <tr> <th><?php echo $_lang["default_role_title"]; ?> </th> <td> <select name="default_role"> <?php echo get_role_list(); ?> </select> <div><?php echo $_lang["default_role_message"]; ?> </div> </td> </tr> <tr> <th><?php echo $_lang["validate_referer_title"]; ?> </th> <td>
$present_start = strtotime($_POST['present_start']); $present_end = strtotime($_POST['present_end']); $validity = intval($_POST['validity']); $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('integral') . '(integral_title, platform, integral_way, scale, present_start, present_end, validity)VALUES' . "('{$integral_title}', {$platform}, {$integral_way}, {$scale}, {$present_start}, {$present_end}, {$validity})"; if ($GLOBALS['db']->query($sql)) { $links = array(array('text' => '积分管理', 'href' => 'integral.php?act=list')); sys_msg('添加成功', 0, $links); } } elseif ($_REQUEST['act'] == 'edit') { admin_priv('marketing'); $integral_id = intval($_GET['id']); $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('integral') . " WHERE integral_id={$integral_id}"; $integral = $GLOBALS['db']->getRow($sql); $integral['present_start'] = date('Y-m-d', $integral['present_start']); $integral['present_end'] = date('Y-m-d', $integral['present_end']); $smarty->assign('role_list', get_role_list(1)); $smarty->assign('integral', $integral); $smarty->assign('action', 'update'); $smarty->display('integral_info.htm'); } elseif ($_REQUEST['act'] == 'update') { admin_priv('marketing'); $integral_id = intval($_POST['id']); $integral_title = mysql_real_escape_string(trim($_POST['integral_title'])); $platform = intval($_POST['platform']); $integral_way = intval($_POST['integral_way']); switch ($integral_way) { case 1: case 3: $scale = intval($_POST['scale']); break; case 2:
} else { $res['message'] = '添加失败'; } die($json->encode($res)); } elseif ($_REQUEST['act'] == 'control_task') { $behave = mysql_real_escape_string($_REQUEST['behave']); $task_id = intval($_REQUEST['task_id']); $tr_index = intval($_REQUEST['tr_index']); switch ($behave) { case 'mod_form': $res['tr_index'] = $tr_index; $res['task_id'] = $task_id; $period_list = get_period_list(); $group_list = get_only_group_list(); if (admin_priv('all', '', false)) { $platform_list = get_role_list(1); $role_group_list = get_role_group_list(); $smarty->assign('platform_list', $platform_list); $smarty->assign('role_group_list', $role_group_list); } $sql_select = 'SELECT task_id,task_name,purpose_value,platform,group_id,period_id,deadline FROM ' . $GLOBALS['ecs']->table('tasks') . " WHERE task_id={$task_id}"; $task_info = $GLOBALS['db']->getRow($sql_select); if (!empty($task_info['deadline'])) { $task_info['deadline'] = date('Y-m-d', $task_info['deadline']); } $smarty->assign('task_info', $task_info); $smarty->assign('behave', $behave); $smarty->assign('period_list', $period_list); $res['main'] = $smarty->fetch('tasks_site_form.htm'); break; case 'mod_done':
function GetRoleList($var, $gm) { global $tbl_sys_msg, $tbl_user_role_list_function, $page_main; $js_src = <<<_js_src <script type="text/javascript" src="/js/checkbox.js" ></script> <script type="text/javascript"> function OnClick(role_name,obj){ \tdocument.form1.target = "_self"; \tdocument.form1.serverid.value = \$(obj).parents("tr").find(".server").attr("title"); \tdocument.form1.action_name.value = '97'; \tdocument.form1.role_name.value = role_name; \tdocument.form1.submit(); } function role_rename(role_name,obj){ \tdocument.form1.target = "_blank"; \tdocument.form1.serverid.value = \$(obj).parents("tr").find(".server").attr("title"); \tdocument.form1.action_name.value = '179'; \tdocument.form1.role_name.value = role_name; \tvar new_name = prompt("%s",""); \tif(new_name==null) return; \tdocument.form1.new_name.value = new_name; \tvar reason = prompt("%s",""); \tif(reason==null) return; \tdocument.form1.reason.value = reason; \tdocument.form1.submit(); } function role_delete(role_name,role_id,obj){ \tdocument.form1.target = "_blank"; \tdocument.form1.serverid.value = \$(obj).parents("tr").find(".server").attr("title"); \tdocument.form1.action_name.value = '186'; \tdocument.form1.role_name.value = role_name; \tdocument.form1.role_id.value = role_id; \tvar reason = prompt("%s",""); \tif(reason==null) return; \tdocument.form1.reason.value = reason; \tdocument.form1.submit(); } function role_back(role_name,role_id,obj){ \tdocument.form1.target = "_blank"; \tdocument.form1.serverid.value = \$(obj).parents("tr").find(".server").attr("title"); \tdocument.form1.action_name.value = '187'; \tdocument.form1.role_name.value = role_name; \tdocument.form1.role_id.value = role_id; \tvar reason = prompt("%s",""); \tif(reason==null) return; \tdocument.form1.reason.value = reason; \tdocument.form1.submit(); } </script> _js_src; printf($js_src, $tbl_user_role_list_function[3], $tbl_sys_msg["reason"], $tbl_sys_msg["reason"], $tbl_sys_msg["reason"]) . "\n"; form($var, $gm); echo "<input type='hidden' name='role_name' />\n"; echo "<input type='hidden' name='role_id' />\n"; echo "<input type='hidden' name='new_name' />\n"; echo "<input type='hidden' name='reason' />\n"; checkbox(false, true); ReturnAndBack(); echo "<table class='list_table'>\n"; echo "<tr><th style=\"text-align:left;\"><input type=\"checkbox\" onclick=\"checkboxAll(this,'role')\" />" . $page_main["role_name"] . "</th>\n<th>" . $tbl_sys_msg["status"] . "</th>\n<th>" . $tbl_sys_msg["class"] . "</th>\n<th>" . $tbl_sys_msg["camp"] . "</th>\n<th>" . $page_main["level"] . "</th>\n<th>" . $tbl_sys_msg["CreateTime"] . "</th><th>" . $tbl_sys_msg["server"] . "</th><th>" . $page_main["type"] . "</th><th>" . $tbl_sys_msg["act"] . "</th></tr>\n"; $urs = $var["urs"]; global $tbl_serv_partition; foreach ($tbl_serv_partition[$var["gameId"]] as $group) { foreach ($group as $i) { get_role_list($urs, $i); } } echo "</table>\n"; ReturnAndBack(); echo "</form>\n"; return true; }
function action_edit() { // 全局变量 // $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; /* 不能编辑demo这个管理员 */ if ($_SESSION['admin_name'] == 'demo') { $link[] = array('text' => $_LANG['back_list'], 'href' => 'privilege.php?act=list'); sys_msg($_LANG['edit_admininfo_cannot'], 0, $link); } $_REQUEST['id'] = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; /* 查看是否有权限编辑其他管理员的信息 */ if ($_SESSION['supplier_user_id'] != $_REQUEST['id']) { admin_priv('admin_manage'); } /* 获取管理员信息 */ $sql = "SELECT user_id, user_name, email, password, agency_id, role_id, supplier_id FROM " . $ecs->table('supplier_admin_user') . " WHERE user_id = '" . $_REQUEST['id'] . "' AND supplier_id=" . $_SESSION['supplier_id']; $user_info = $db->getRow($sql); /* 取得该管理员负责的办事处名称 */ if ($user_info['agency_id'] > 0) { $sql = "SELECT agency_name FROM " . $ecs->table('agency') . " WHERE agency_id = '{$user_info['agency_id']}'"; $user_info['agency_name'] = $db->getOne($sql); } /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['admin_edit']); $smarty->assign('action_link', array('text' => $_LANG['admin_list'], 'href' => 'privilege.php?act=list')); $smarty->assign('user', $user_info); /* 获得该管理员的权限 */ $priv_str = $db->getOne("SELECT action_list FROM " . $ecs->table('supplier_admin_user') . " WHERE user_id = '{$_GET['id']}' AND supplier_id = '{$_SESSION['supplier_id']}'"); /* 如果被编辑的管理员拥有了all这个权限,将不能编辑 */ if ($priv_str != 'all') { $smarty->assign('select_role', get_role_list()); } $smarty->assign('form_act', 'update'); $smarty->assign('action', 'edit'); assign_query_info(); $smarty->display('privilege_info.htm'); }
foreach ($list as $v) { $traderates_list[$v['admin_id']] = array(1 => 0, 0, 0); } foreach ($list as $v) { $admin_list[$v['admin_id']] = $v; $traderates_list[$v['admin_id']][$v['traderates']] = $v['total']; $total['traderates'][$v['traderates']] += $v['total']; } foreach ($admin_list as $k => &$a) { $a['traderates'] = $traderates_list[$k]; ksort($a['traderates']); } array_push($admin_list, $total); } $smarty->assign('depart_list', array(array('depart_id' => 7, 'depart_name' => '客服二部'), array('depart_id' => 8, 'depart_name' => '客服一部'))); $smarty->assign('role_list', get_role_list('', 'role_id,role_name', " AND depart_id IN(7,8)")); $smarty->assign('list', $admin_list); $res['main'] = $smarty->fetch('traderates.htm'); die($json->encode($res)); } elseif ($_REQUEST['act'] == 'express_fee_report') { $shipping_list = get_shipping_list(''); $role_list = get_role(' role_id IN(' . ONLINE_STORE . ',' . OFFLINE_SALE . ') AND role_type>0 '); $depart_list = get_department(' AND depart_id IN(' . SALE_DEPART . ')'); $shipping_list = get_shipping_list(''); $list = express_fee_report($shipping_list); $smarty->assign('list', $list); $smarty->assign('shipping_list', $shipping_list); $smarty->assign('depart_list', $depart_list); $smarty->assign('role_list', $role_list); $smarty->assign('shipping_list', $shipping_list); $res['main'] = $smarty->fetch('express_fee_report.htm');
订单总额 订单总量 配送方式 支付方式 各个团队订单总额 各个团队订单总量 整体销量走势及订单量走势 每个客服订单量及销量走势 每个团队的销量及订单量走势 */ /* 默认情况下获取整体的销量 */ if ($_REQUEST['act'] == 'trend') { admin_priv('trend'); $role_list = get_role_list(1); if (in_array($_POST['trend'], array('day', 'week', 'month', 'year'))) { $trend = $_POST['trend']; } $start = isDataType(trim($_POST['start'])); $end = isDataType(trim($_POST['end'])); $team = intval($_POST['team']); $saler = trim($_POST['saler']); // 初始化查询条件 $where = " WHERE order_status=5 AND pay_status=2"; if ($start && $end) { $end_time = counting_period($start, $end, $trend); } else { // 获取当前的年月 $start = date('Y-m-1'); $end = date('Y-m-d');