Ecshop模板网
首页 > ecshop教程 > ecshop经验分享 > 让ecshop会员注册送红包的方法
文章详情

让ecshop会员注册送红包的方法

ecshop模板网 / 2014-01-19

一、我们在ecshop后台增加一种红包类型
请把新增加的红包类型的名称设置为注册送红包
 
二、修改includes/lib_common.php,在其文件最后?>前加一个函数
function send_register_bonus($user_id,$bid=0)
{
if($bid ==0)
   {
  $bid = $GLOBALS['db']->getOne("sel ect type_id from " . $GLOBALS['ecs']->table('bonus_type') . "where type_name ='注册送红包' order by type_id desc limit 1 " );
}
if(! $bid)
   {
 return  false;
}
$user_info = $GLOBALS['db']->getRow("sel ect user_name, email from " . $GLOBALS['ecs']->table('users') . "where user_id ='$user_id' " );
$bonus_type = $GLOBALS['db']->getRow("SELECT * FROM " . $GLOBALS['ecs']->table('bonus_type') .
            " WHERE type_id = '$bid'");
if(! $bonus_type) return false;
 
/* 向会员红包表录入数据 */
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('user_bonus') .
"(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed) " .
"VALUES ('$bid', 0, '$user_id', 0, 0, " .BONUS_MAIL_SUCCEED. ")";
$GLOBALS['db']->query($sql);
 
$tpl = get_mail_template('send_bonus');
if(! $tpl) return false;
$today = local_date($_CFG['date_format']);
/* 发送邮件通知 */
        $GLOBALS['smarty']->assign('user_name',    $user_info['user_name']);
        $GLOBALS['smarty']->assign('shop_name',    $GLOBALS['_CFG']['shop_name']);
        $GLOBALS['smarty']->assign('send_date',    $today);
        $GLOBALS['smarty']->assign('sent_date',    $today);
        $GLOBALS['smarty']->assign('count',        1);
        $GLOBALS['smarty']->assign('money',        price_format($bonus_type['type_money']));
 
        $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']);
 
send_mail($user_info['user_name'], $user_info['email'], '注册送红包', $content, $tpl['is_html']);
}
 
?>
 
三、修改lib_passport.php的register函数
 
/* 注册送积分 */
if (!empty($GLOBALS['_CFG']['register_points']))
{
    log_account_change($_SESSION['user_id'], 0, 0, $GLOBALS['_CFG']['register_points'], $GLOBALS['_CFG']['register_points'], $GLOBALS['_LANG']['register_points']);
}
 
 
/***注册送红包**/
send_register_bonus($_SESSION['user_id']);
 
/*推荐处理*/
$affiliate  = unserialize($GLOBALS['_CFG']['affiliate']);
 
 
其中
/***注册送红包**/
send_register_bonus($_SESSION['user_id']);
是新增加的
下一篇: 让ecshop用户名、手机号、email登陆方法 上一篇: 让ecshop会员每天登录送积分
 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页
 
QQ在线咨询
售前电话热线
#
售前QQ客服