威尼斯娱乐

ecshop二次开发

ecshop二次开发

威尼斯娱乐 资讯中心 ecshop二次开发 ECSHOP会员注册自动发送红包插件

ECSHOP会员注册自动发送红包插件

时间:2020-12-16
一、大家在ecshop后台增加一种红包类型请把新增加的红包类型的名称设置为注册送红包二、修改includes/lib_common.php,在其文件最后?前加一个函数functionsend_register_bonus($user_id,$bid=0){if($bid==0){$bid=$G..

一、大家在ecshop后台增加一种红包类型
请把新增加的红包类型的名称设置为注册送红包

二、修改includes/lib_common.php,在其文件最后?>前加一个函数
function send_register_bonus($user_id,$bid=0)
{
        if($bid ==0)
        {
           $bid = $GLOBALS['db']->getOne("select 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("select 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']);
是新增加的


QQ在线客服在线客服
用手机扫描二维码 关闭
二维码
XML 地图 | Sitemap 地图