ECSHOP会员每天登陆和长时间停留送积分
ECSHOP会员每天第一次登录赠送积分的
includes\lib_main.php,
查找/* 更新登录时间,登录次数及登录ip */,添加:
/*每天第一次登录送100分*/
$sql = 'SELECT last_login FROM ' . $GLOBALS['ecs']->table('users') . " WHERE user_id = '" . $_SESSION['user_id'] . "'";
$last_login = $GLOBALS['db']->getOne($sql);
if($last_login < (strtotime(date("y-m-d"))-8*3600))
{
log_account_change($_SESSION['user_id'], 0, 0, $GLOBALS['_CFG']['login_points'], $GLOBALS['_CFG']['login_points'],"会员每天第一次登录赠送".$GLOBALS['_CFG']['login_points']."积分");
}
sql语句:
INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ( '2', 'login_points', 'text', '', '', '100', '1');
languages\zh_cn\admin\shop_config.php,
查找$_LANG['cfg_name']['integral_percent'] = '积分支付比例';下面添加:
$_LANG['cfg_name']['login_points'] = '会员每天第一次登录赠送积分';
长时间停留赠送积分的
includes\init.php,
查找if ((DEBUG_MODE & 1) == 1) 前面添加:
/*长停留时间赠送积分*/
if($_SESSION['user_id'])
{
$now_time = gmtime();
$sql = "select last_login from ".$ecs->table('users')." where user_id = ".$_SESSION['user_id'];
$last_login = $db->getOne($sql);
if(($last_login + $_CFG['tingliu_time']) < $now_time)
{
$today = strtotime(date("y-m-d"))-8*3600;//当天时间
$sql = "select count(log_id) as log_num from ".$ecs->table('account_log')." where user_id = ".$_SESSION['user_id'].
" and change_type = 98 and change_time > ".$today;
$log_num = $db->getOne($sql);
if($log_num == 0)
{
log_account_change($_SESSION['user_id'], 0, 0, $_CFG['tingliu_points'], $_CFG['tingliu_points'],"停留时间超过".$_CFG['tingliu_time']."秒赠送".$_CFG['tingliu_points']."积分",98);
}
}
}
sql语句:
INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ( '2', 'tingliu_points', 'text', '', '', '100', '1');
INSERT INTO `ecs_shop_config` (`parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order` ) VALUES ( '2', 'tingliu_time', 'text', '', '', '100', '1');
languages\zh_cn\admin\shop_config.php,
查找$_LANG['cfg_name']['integral_percent'] = '积分支付比例';下面添加:
$_LANG['cfg_name']['tingliu_points'] = '长时间停留赠送积分';
$_LANG['cfg_name']['tingliu_time'] = '停留时间(单位:秒)';
$_LANG['cfg_desc']['tingliu_points'] = '一天只赠送一次。';
参数在商店设置-基本设置-最下面设置