本文整理汇总了PHP中local_strtotime函数的典型用法代码示例。如果您正苦于以下问题:PHP local_strtotime函数的具体用法?PHP local_strtotime怎么用?PHP local_strtotime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了local_strtotime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_sales_order
/**
* 取得销售排行数据信息
* @param bool $is_pagination 是否分页
* @return array 销售排行数据
*/
function get_sales_order($is_pagination = true)
{
$filter['start_date'] = empty($_REQUEST['start_date']) ? '' : local_strtotime($_REQUEST['start_date']);
$filter['end_date'] = empty($_REQUEST['end_date']) ? '' : local_strtotime($_REQUEST['end_date']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_num' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = " WHERE og.order_id = oi.order_id " . order_query_sql('finished', 'oi.');
if ($filter['start_date']) {
$where .= " AND oi.add_time >= '" . $filter['start_date'] . "'";
}
if ($filter['end_date']) {
$where .= " AND oi.add_time <= '" . $filter['end_date'] . "'";
}
$sql = "SELECT COUNT(distinct(og.goods_id)) FROM " . $GLOBALS['ecs']->table('order_info') . ' AS oi,' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT og.goods_id, og.goods_sn, og.goods_name, oi.order_status, " . "SUM(og.goods_number) AS goods_num, SUM(og.goods_number * og.goods_price) AS turnover " . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . " GROUP BY og.goods_id " . ' ORDER BY ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
if ($is_pagination) {
$sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
}
$sales_order_data = $GLOBALS['db']->getAll($sql);
foreach ($sales_order_data as $key => $item) {
$sales_order_data[$key]['wvera_price'] = price_format($item['goods_num'] ? $item['turnover'] / $item['goods_num'] : 0);
$sales_order_data[$key]['short_name'] = sub_str($item['goods_name'], 30, true);
$sales_order_data[$key]['turnover'] = price_format($item['turnover']);
$sales_order_data[$key]['taxis'] = $key + 1;
}
$arr = array('sales_order_data' => $sales_order_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例2: getDawnTime
function getDawnTime()
{
$now = gmtime();
$date = local_date('Y-m-d 0:0:0', $now);
$now = local_strtotime($date);
return $now;
}
示例3: get_user_orderinfo
function get_user_orderinfo($is_pagination = true)
{
global $db, $ecs, $start_date, $end_date;
$filter['start_date'] = empty($_REQUEST['start_date']) ? $start_date : local_strtotime($_REQUEST['start_date']);
$filter['end_date'] = empty($_REQUEST['end_date']) ? $end_date : local_strtotime($_REQUEST['end_date']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'order_num' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = "WHERE u.user_id = o.user_id " . "AND u.user_id > 0 " . order_query_sql('finished', 'o.');
if ($filter['start_date']) {
$where .= " AND o.add_time >= '" . $filter['start_date'] . "'";
}
if ($filter['end_date']) {
$where .= " AND o.add_time <= '" . $filter['end_date'] . "'";
}
$sql = "SELECT count(distinct(u.user_id)) FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
/* 计算订单各种费用之和的语句 */
$total_fee = " SUM(" . order_amount_field() . ") AS turnover ";
$sql = "SELECT u.user_id, u.user_name, COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . " GROUP BY u.user_id" . " ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'];
if ($is_pagination) {
$sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
}
$user_orderinfo = array();
$res = $db->query($sql);
while ($items = $db->fetchRow($res)) {
$items['turnover'] = price_format($items['turnover']);
$user_orderinfo[] = $items;
}
$arr = array('user_orderinfo' => $user_orderinfo, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例4: get_stock_control_log
function get_stock_control_log()
{
$result = get_filter();
if ($result === false) {
$filter = array();
$filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
$filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-30 days') : $_REQUEST['start_date'];
$filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
if (strpos($filter['start_date'], '-') !== false) {
$filter['start_date'] = local_strtotime($filter['start_date']);
$filter['end_date'] = local_strtotime($filter['end_date']);
}
$where = agency_where();
/*add by hg for date 2014-04-21 可选商品*/
if (if_agency()) {
if (!empty($filter['admin_agency_id'])) {
$where .= " AND (a.admin_agency_id = {$filter['admin_agency_id']} ) ";
} else {
$where .= " AND (a.admin_agency_id = 0 ) ";
}
}
if (!empty($filter['keyword'])) {
$where .= " AND (a.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%' or a.stock_number LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
}
if ($filter['start_date']) {
$where = $where . " AND a.log_time >= '{$filter['start_date']}'";
}
if ($filter['end_date']) {
$where = $where . " AND a.log_time <= '" . ($filter['end_date'] + 86400) . "'";
}
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获取库存日志管理数据 */
$sql = 'SELECT a.* ' . 'FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$arr = array();
$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
while ($rows = $GLOBALS['db']->fetchRow($res)) {
$rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['log_time']);
$rows['out_type_remarks'] = $GLOBALS['db']->getOne("SELECT remarks FROM " . $GLOBALS['ecs']->table('stock_out_type') . " WHERE id = '" . $rows['out_type_id'] . "' ");
$arr[] = $rows;
}
$GLOBALS['smarty']->assign('start_date', local_date('Y-m-d', $filter['start_date']));
$GLOBALS['smarty']->assign('end_date', local_date('Y-m-d', $filter['end_date']));
$filter['start_date'] = local_date('Y-m-d', $filter['start_date']);
$filter['end_date'] = local_date('Y-m-d', $filter['end_date']);
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例5: get_sale_list
/**
* 取得销售明细数据信息
* @param bool $is_pagination 是否分页
* @return array 销售明细数据
*/
function get_sale_list($is_pagination = true)
{
/* 时间参数 */
$filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-7 days') : local_strtotime($_REQUEST['start_date']);
$filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : local_strtotime($_REQUEST['end_date']);
/* 查询数据的条件 */
$where = " WHERE og.order_id = oi.order_id" . order_query_sql('finished', 'oi.') . " AND oi.add_time >= '" . $filter['start_date'] . "' AND oi.add_time < '" . ($filter['end_date'] + 86400) . "'";
$sql = "SELECT COUNT(og.goods_id) FROM " . $GLOBALS['ecs']->table('order_info') . ' AS oi,' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = 'SELECT og.goods_id, og.goods_sn, og.goods_name, og.goods_number AS goods_num, og.goods_price ' . 'AS sales_price, oi.add_time AS sales_time, oi.order_id, oi.order_sn ' . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . " ORDER BY sales_time DESC, goods_num DESC";
if ($is_pagination) {
$sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
}
$sale_list_data = $GLOBALS['db']->getAll($sql);
foreach ($sale_list_data as $key => $item) {
$sale_list_data[$key]['sales_price'] = price_format($sale_list_data[$key]['sales_price']);
$sale_list_data[$key]['sales_time'] = local_date($GLOBALS['_CFG']['time_format'], $sale_list_data[$key]['sales_time']);
}
$arr = array('sale_list_data' => $sale_list_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例6: get_next_time
function get_next_time($cron)
{
$y = local_date('Y', $GLOBALS['timestamp']);
$mo = local_date('n', $GLOBALS['timestamp']);
$d = local_date('j', $GLOBALS['timestamp']);
$w = local_date('w', $GLOBALS['timestamp']);
$h = local_date('G', $GLOBALS['timestamp']);
$sh = $sm = 0;
$sy = $y;
if ($cron['day']) {
$sd = $cron['day'];
$smo = $mo + 1;
} else {
$sd = $d;
$smo = $mo;
if ($cron['week'] != '') {
$sd += $cron['week'] - $w + 7;
}
}
if ($cron['hour']) {
$sh = $cron['hour'];
if (empty($cron['day']) && $cron['week'] == '') {
$sd++;
}
}
//$next = gmmktime($sh,$sm,0,$smo,$sd,$sy);
$next = local_strtotime("{$sy}-{$smo}-{$sd} {$sh}:{$sm}:0");
if ($next < $GLOBALS['timestamp']) {
if ($cron['m']) {
return $GLOBALS['timestamp'] + 60 - intval(local_date('s', $GLOBALS['timestamp']));
} else {
return $GLOBALS['timestamp'];
}
} else {
return $next;
}
}
示例7: update_touch_goods
/**
* 更新商品销量
*/
private function update_touch_goods($order)
{
$sql = 'select pay_status from ' . $this->model->pre . 'order_info where order_id = "' . $order . '"';
$pay_status = $this->model->query($sql);
$pay_status = $pay_status[0];
if ($pay_status == 2) {
/* 统计时间段 */
$period = C('top10_time');
// 近一个月(30天)
if ($period == 1) {
// 一年
$ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
} elseif ($period == 2) {
// 半年
$ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
} elseif ($period == 3) {
// 三个月
$ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
} elseif ($period == 4) {
// 一个月
$ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
} else {
$ext = '';
}
$sql = 'select goods_id from ' . $this->model->pre . 'order_info where order_id = "' . $order . '"';
$arrGoodsid = $this->model->query($sql);
$sql = 'select extension_code from ' . $this->model->pre . 'order_info where order_id = "' . $order . '"';
$extension_code = $this->model->query($sql);
if ($extension_code == '') {
foreach ($arrGoodsid as $key => $val) {
/* 查询该商品销量 */
$sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'as count FROM ' . $this->pre . 'order_info AS o, ' . $this->pre . 'order_goods AS g ' . "WHERE o.order_id = g.order_id " . " AND g.goods_id = '" . $val['goods_id'] . "' AND o.pay_status = '2' " . $ext;
$res = $this->model->query($sql);
$sales_count = $res[0]['count'];
$nCount = $this->query('select COUNT(*) from ' . $this->model->pre . 'touch_goods where goods_id = "' . $val['goods_id'] . '"');
if ($nCount[0]['COUNT(*)'] == 0) {
$this->model->query("INSERT INTO " . $this->model->pre . "touch_goods (`goods_id` ,`sales_volume` ) VALUES ( '" . $val['goods_id'] . "' , '0')");
}
$sql = 'update ' . $this->model->pre . 'touch_goods AS a set a.sales_volume = ' . $sales_count . " WHERE goods_id=" . $val['goods_id'];
$this->model->query($sql);
}
}
}
}
示例8: get_goods_rank
/**
* 获得指定商品的销售排名
*
* @access public
* @param integer $goods_id
* @return integer
*/
function get_goods_rank($goods_id)
{
/* 统计时间段 */
$period = intval($GLOBALS['_CFG']['top10_time']);
if ($period == 1) {
$ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
} elseif ($period == 2) {
$ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
} elseif ($period == 3) {
$ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
} elseif ($period == 4) {
$ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
} else {
$ext = '';
}
/* 查询该商品销量 */
$sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '{$goods_id}'" . $ext;
$sales_count = $GLOBALS['db']->getOne($sql);
if ($sales_count > 0) {
/* 只有在商品销售量大于0时才去计算该商品的排行 */
$sql = 'SELECT DISTINCT SUM(goods_number) AS num ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . $ext . " GROUP BY g.goods_id HAVING num > {$sales_count}";
$res = $GLOBALS['db']->query($sql);
$rank = $GLOBALS['db']->num_rows($res) + 1;
if ($rank > 10) {
$rank = 0;
}
} else {
$rank = 0;
}
return $rank;
}
示例9: order_list
/**
* 获取订单列表信息
*
* @access public
* @param
*
* @return void
*/
function order_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤信息 */
$filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
if (!empty($_GET['is_ajax']) && $_GET['is_ajax'] == 1) {
$_REQUEST['consignee'] = json_str_iconv($_REQUEST['consignee']);
//$_REQUEST['address'] = json_str_iconv($_REQUEST['address']);
}
$filter['consignee'] = empty($_REQUEST['consignee']) ? '' : trim($_REQUEST['consignee']);
$filter['email'] = empty($_REQUEST['email']) ? '' : trim($_REQUEST['email']);
$filter['address'] = empty($_REQUEST['address']) ? '' : trim($_REQUEST['address']);
$filter['zipcode'] = empty($_REQUEST['zipcode']) ? '' : trim($_REQUEST['zipcode']);
$filter['tel'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
$filter['mobile'] = empty($_REQUEST['mobile']) ? 0 : intval($_REQUEST['mobile']);
$filter['country'] = empty($_REQUEST['country']) ? 0 : intval($_REQUEST['country']);
$filter['province'] = empty($_REQUEST['province']) ? 0 : intval($_REQUEST['province']);
$filter['city'] = empty($_REQUEST['city']) ? 0 : intval($_REQUEST['city']);
$filter['district'] = empty($_REQUEST['district']) ? 0 : intval($_REQUEST['district']);
$filter['shipping_id'] = empty($_REQUEST['shipping_id']) ? 0 : intval($_REQUEST['shipping_id']);
$filter['pay_id'] = empty($_REQUEST['pay_id']) ? 0 : intval($_REQUEST['pay_id']);
$filter['order_status'] = isset($_REQUEST['order_status']) ? intval($_REQUEST['order_status']) : -1;
$filter['shipping_status'] = isset($_REQUEST['shipping_status']) ? intval($_REQUEST['shipping_status']) : -1;
$filter['pay_status'] = isset($_REQUEST['pay_status']) ? intval($_REQUEST['pay_status']) : -1;
$filter['user_id'] = empty($_REQUEST['user_id']) ? 0 : intval($_REQUEST['user_id']);
$filter['user_name'] = empty($_REQUEST['user_name']) ? '' : trim($_REQUEST['user_name']);
$filter['composite_status'] = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
$filter['group_buy_id'] = isset($_REQUEST['group_buy_id']) ? intval($_REQUEST['group_buy_id']) : 0;
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$filter['start_time'] = empty($_REQUEST['start_time']) ? '' : (strpos($_REQUEST['start_time'], '-') > 0 ? local_strtotime($_REQUEST['start_time']) : $_REQUEST['start_time']);
$filter['end_time'] = empty($_REQUEST['end_time']) ? '' : (strpos($_REQUEST['end_time'], '-') > 0 ? local_strtotime($_REQUEST['end_time']) : $_REQUEST['end_time']);
$where = 'WHERE 1 ';
if ($filter['order_sn']) {
$where .= " AND o.order_sn LIKE '%" . mysql_like_quote($filter['order_sn']) . "%'";
}
if ($filter['consignee']) {
$where .= " AND o.consignee LIKE '%" . mysql_like_quote($filter['consignee']) . "%'";
}
if ($filter['email']) {
$where .= " AND o.email LIKE '%" . mysql_like_quote($filter['email']) . "%'";
}
if ($filter['address']) {
$where .= " AND o.address LIKE '%" . mysql_like_quote($filter['address']) . "%'";
}
if ($filter['zipcode']) {
$where .= " AND o.zipcode LIKE '%" . mysql_like_quote($filter['zipcode']) . "%'";
}
if ($filter['tel']) {
$where .= " AND o.tel LIKE '%" . mysql_like_quote($filter['tel']) . "%'";
}
if ($filter['mobile']) {
$where .= " AND o.mobile LIKE '%" . mysql_like_quote($filter['mobile']) . "%'";
}
if ($filter['country']) {
$where .= " AND o.country = '{$filter['country']}'";
}
if ($filter['province']) {
$where .= " AND o.province = '{$filter['province']}'";
}
if ($filter['city']) {
$where .= " AND o.city = '{$filter['city']}'";
}
if ($filter['district']) {
$where .= " AND o.district = '{$filter['district']}'";
}
if ($filter['shipping_id']) {
$where .= " AND o.shipping_id = '{$filter['shipping_id']}'";
}
if ($filter['pay_id']) {
$where .= " AND o.pay_id = '{$filter['pay_id']}'";
}
if ($filter['order_status'] != -1) {
$where .= " AND o.order_status = '{$filter['order_status']}'";
}
if ($filter['shipping_status'] != -1) {
$where .= " AND o.shipping_status = '{$filter['shipping_status']}'";
}
if ($filter['pay_status'] != -1) {
$where .= " AND o.pay_status = '{$filter['pay_status']}'";
}
if ($filter['user_id']) {
$where .= " AND o.user_id = '{$filter['user_id']}'";
}
if ($filter['user_name']) {
$where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['user_name']) . "%'";
}
if ($filter['start_time']) {
$where .= " AND o.add_time >= '{$filter['start_time']}'";
}
if ($filter['end_time']) {
//.........这里部分代码省略.........
示例10: get_inoutlist
function get_inoutlist()
{
$result = get_filter();
if ($result === false) {
$filter = array();
$filter['sid'] = empty($_REQUEST['sid']) ? '0' : intval($_REQUEST['sid']);
$filter['ssid'] = empty($_REQUEST['ssid']) ? '0' : intval($_REQUEST['ssid']);
$filter['inout_status'] = empty($_REQUEST['inout_status']) ? '0' : intval($_REQUEST['inout_status']);
$filter['inout_type'] = empty($_REQUEST['inout_type']) ? '0' : intval($_REQUEST['inout_type']);
$filter['add_time1'] = empty($_REQUEST['add_time1']) ? '' : (strpos($_REQUEST['add_time1'], '-') > 0 ? local_strtotime($_REQUEST['add_time1']) : $_REQUEST['add_time1']);
$filter['add_time2'] = empty($_REQUEST['add_time2']) ? '' : (strpos($_REQUEST['add_time2'], '-') > 0 ? local_strtotime($_REQUEST['add_time2']) : $_REQUEST['add_time2']);
$filter['inout_sn'] = empty($_REQUEST['inout_sn']) ? '' : trim($_REQUEST['inout_sn']);
$filter['takegoods_man'] = empty($_REQUEST['takegoods_man']) ? '' : trim($_REQUEST['takegoods_man']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'rec_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = 'AND store_type_id=0 ';
if ($filter['ssid']) {
$where .= " AND store_id = '" . $filter['ssid'] . "' ";
} else {
if ($filter['sid']) {
$where .= " AND store_id in " . get_ssid_list($filter['sid']);
}
}
if ($filter['inout_status']) {
$where .= " AND inout_status = '" . $filter['inout_status'] . "' ";
}
if ($filter['inout_type']) {
$where .= " AND inout_type = '" . $filter['inout_type'] . "' ";
}
if ($filter['add_time1']) {
$where .= " AND add_time>= '" . $filter['add_time1'] . "' ";
}
if ($filter['add_time2']) {
$where .= " AND add_time<= '" . $filter['add_time2'] . "' ";
}
if ($filter['inout_sn']) {
$where .= " AND inout_sn = '" . $filter['inout_sn'] . "' ";
}
if ($filter['takegoods_man']) {
$where .= " AND takegoods_man like '%" . $filter['takegoods_man'] . "%' ";
}
//获取当前管理员负责的store_id列表
$storeid_list = "";
$sql1 = "select store_id from " . $GLOBALS['ecs']->table('store_adminer') . " where admin_id = '{$_SESSION['admin_id']}' ";
$res1 = $GLOBALS['db']->query($sql1);
while ($row1 = $GLOBALS['db']->fetchRow($res1)) {
$storeid_list .= $storeid_list ? "," : "";
$storeid_list .= $row1['store_id'];
$sql2 = "select store_id from " . $GLOBALS['ecs']->table('store_main') . " where parent_id = '{$row1['store_id']}' ";
$res2 = $GLOBALS['db']->query($sql2);
while ($row2 = $GLOBALS['db']->fetchRow($res2)) {
$storeid_list .= $storeid_list ? "," : "";
$storeid_list .= $row2['store_id'];
}
}
if ($storeid_list) {
$where .= " AND store_id in ({$storeid_list}) ";
}
/* 记录总数 */
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获取入库单数据 */
$sql = 'SELECT * ' . 'FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$arr = array();
$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
while ($rows = $GLOBALS['db']->fetchRow($res)) {
$rows['store_name'] = get_store_fullname($rows['store_id']);
$rows['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
$rows['inout_status_name'] = $GLOBALS['_LANG']['inout_status'][$rows['inout_status']];
$rows['inout_type_name'] = get_inout_type_name($rows['inout_type']);
$rows['admin_name'] = $GLOBALS['db']->getOne("select admin_name from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' ");
if ($rows['inout_status'] == 1) {
//是否有提交申请的权利
$sql_sh = "select rec_id from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' and admin_id='{$_SESSION['admin_id']}' ";
$rec_id_sh = $GLOBALS['db']->getOne($sql_sh);
if (!$rec_id_sh) {
$rows['tjsq'] = 0;
} else {
$rows['tjsq'] = 1;
}
}
$arr[] = $rows;
}
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例11: add_user
/**
* 插入会员信息
*
**/
public function add_user($username, $password, $email, $agencyNameId, $md = '0')
{
if ($md == '0') {
$GLOBALS['user']->add_user($username, $password, $email);
} else {
$GLOBALS['user']->add_user($username, $password, $email, -1, 0, 0, $password);
}
$user_id = $GLOBALS['db']->insert_id();
$update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
$update_data['top_rank'] = $agencyNameId;
$update_data['tm_mark'] = '1';
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $update_data, 'UPDATE', 'user_id = ' . $user_id);
return $user_id;
//注释发送邮件
//send_mail($username, $email, '欢迎登陆天下店平台', "<p>尊敬的天下店用户:</p><p>您好!</p><p>你的账号是:<span style='color:red'>$username</span></p><p>初始密码是:<span style='color:red'>$password</span></p><p>温馨提示:为了你的账号安全请尽快修改密码!</p><p>http://o2o.txd168.com/</p>", 1);
}
示例12: admin_priv
}
/* 权限判断 */
admin_priv('user_account_manage');
/*------------------------------------------------------ */
//--数据查询
/*------------------------------------------------------ */
/* 时间参数 */
$start_date = $end_date = '';
if (isset($_POST) && !empty($_POST)) {
$start_date = local_strtotime($_POST['start_date']);
$end_date = local_strtotime($_POST['end_date']);
} elseif (isset($_GET['start_date']) && !empty($_GET['end_date'])) {
$start_date = local_strtotime($_GET['start_date']);
$end_date = local_strtotime($_GET['end_date']);
} else {
$today = local_strtotime(local_date('d-m-Y'));
$start_date = $today - 86400 * 7;
$end_date = $today;
}
/*------------------------------------------------------ */
//--商品明细列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
$account = $money_list = array();
$account['voucher_amount'] = get_total_amount($start_date, $end_date);
//充值总额
$account['to_cash_amount'] = get_total_amount($start_date, $end_date, 1);
//提现总额
$sql = " SELECT IFNULL(SUM(user_money), 0) AS user_money, IFNULL(SUM(frozen_money), 0) AS frozen_money FROM " . $ecs->table('account_log') . " WHERE `change_time` >= " . $start_date . " AND `change_time` < " . ($end_date + 86400);
$money_list = $db->getRow($sql);
$account['user_money'] = price_format($money_list['user_money']);
示例13: strlen
$temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index];
$extend_field_str .= " ('" . $user_id_arr['user_id'] . "', '" . $val['id'] . "', '" . $temp_field_content . "'),";
}
}
$extend_field_str = substr($extend_field_str, 0, -1);
if ($extend_field_str) {
$sql = 'INSERT INTO ' . $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str;
$db->query($sql);
}
/* 更新会员的其它信息 */
$other = array();
$other['credit_line'] = $credit_line;
$other['user_rank'] = $rank;
$other['sex'] = $sex;
$other['birthday'] = $birthday;
$other['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
$other['msn'] = isset($_POST['extend_field1']) ? htmlspecialchars(trim($_POST['extend_field1'])) : '';
$other['qq'] = isset($_POST['extend_field2']) ? htmlspecialchars(trim($_POST['extend_field2'])) : '';
$other['office_phone'] = isset($_POST['extend_field3']) ? htmlspecialchars(trim($_POST['extend_field3'])) : '';
$other['home_phone'] = isset($_POST['extend_field4']) ? htmlspecialchars(trim($_POST['extend_field4'])) : '';
$other['mobile_phone'] = isset($_POST['extend_field5']) ? htmlspecialchars(trim($_POST['extend_field5'])) : '';
$db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '{$username}'");
/* 记录管理员操作 */
admin_log($_POST['username'], 'add', 'users');
/* 提示信息 */
$link[] = array('text' => $_LANG['go_back'], 'href' => 'users.php?act=list');
sys_msg(sprintf($_LANG['add_success'], htmlspecialchars(stripslashes($_POST['username']))), 0, $link);
} elseif ($_REQUEST['act'] == 'edit') {
/* 检查权限 */
admin_priv('users_manage');
$sql = "SELECT u.user_name, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn, u.office_phone, u.home_phone, u.mobile_phone" . " FROM " . $ecs->table('users') . " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='{$_GET['id']}'";
示例14: sprintf
$cache_id = sprintf('%X', crc32($cache_id));
/* 如果没有缓存,生成缓存 */
if (!$smarty->is_cached('auction.dwt', $cache_id)) {
//取货品信息
if ($auction['product_id'] > 0) {
$goods_specifications = get_specifications_list($auction['goods_id']);
$good_products = get_good_products($auction['goods_id'], 'AND product_id = ' . $auction['product_id']);
$_good_products = explode('|', $good_products[0]['goods_attr']);
$products_info = '';
foreach ($_good_products as $value) {
$products_info .= ' ' . $goods_specifications[$value]['attr_name'] . ':' . $goods_specifications[$value]['attr_value'];
}
$smarty->assign('products_info', $products_info);
unset($goods_specifications, $good_products, $_good_products, $products_info);
}
$auction['gmt_end_time'] = local_strtotime($auction['end_time']);
$smarty->assign('auction', $auction);
/* 取得拍卖商品信息 */
$goods_id = $auction['goods_id'];
$goods = goods_info($goods_id);
if (empty($goods)) {
ecs_header("Location: ./\n");
exit;
}
$goods['url'] = build_uri('goods', array('gid' => $goods_id), $goods['goods_name']);
$smarty->assign('auction_goods', $goods);
/* 出价记录 */
$smarty->assign('auction_log', auction_log($id));
//模板赋值
$smarty->assign('cfg', $_CFG);
assign_template();
示例15: get_goods_sales_count
function get_goods_sales_count($goods_id)
{
/* 统计时间段 */
//$period = intval($GLOBALS['_CFG']['top10_time']);
$period = 4;
//近一个月(30天)
if ($period == 1) {
// 一年
$ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
} elseif ($period == 2) {
// 半年
$ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
} elseif ($period == 3) {
// 三个月
$ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
} elseif ($period == 4) {
// 一个月
$ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
} else {
$ext = '';
}
/* 查询该商品销量 */
$sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '{$goods_id}'" . $ext;
$sales_count = $GLOBALS['db']->getOne($sql);
return intval($sales_count);
}