找到
if ($row = $GLOBALS['db']->getRow($sql))
{
另起一行,加入 /*by xiaotaitai*/
if((date('Y-m-d',$row['last_login'])!==date('Y-m-d',gmtime()))&&((gmtime()>$row['last_login']))){
$sql = "UPDATE " .$GLOBALS['ecs']->table('users'). " SET".
" pay_points = pay_points + 10 ".
", rank_points = rank_points + 10 ".
" WHERE user_id = '" . $_SESSION['user_id'] . "'";
$GLOBALS['db']->query($sql);
}
/*by xiaotaitai*/
去后台找一个 ,今天未登录过的账号 测试 看看积分是否有增加2.如果要实现长时间停留赠送积分的
打开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');
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'] = '一天只赠送一次。';
在商店设置-基本设置-最下面设置 设置相关的参数 最佳答案
