ECSHOP会员登录赠送等级积分和消费积分插件

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

本功能实现ECSHOP会员每天第一次登录赠送等级积分和消费积分,长时间停留赠送积分,可后台设置参数1.每天第一次登录赠送积分的打开includes\lib_main.php查找,(把下边这段一定要放在之前的}前)添加:$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'] = '会员每天第一次登录赠送积分';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');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'] = '一天只赠送一次。';在商店设置-基本设置-最下面设置 设置相关的参数