关于让ecshop会员注册送红包的方法
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
一、我们在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没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop二次开发商品购买增
图片1香...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
ecshop热门问答
ecshop热门资料
ecmall订单明细
ecshop开发商
ecshop申通
ecshop整站多城市切换
ecshop李强
javaecshop
ecshop外联
ecshop龙信网络科技
ecshop批量购物
ecshop问题搜索
ecshop添加分类
ecshop仿造
ecshop紫林商城
ecshop短信发送
beego缓存
ecshop重庆
ecshopworldpay
ecshop部署
ecshop外链
ecshop维修中心
ecshop注册码
ecshop协议
ecshopserial
qq登录ecshop
输出ecshop数据
ecshop个人账户
ecshop调高
ecshop不对称
ecshop跟随
ecshop在线编辑器