功能介绍:新用户成功注册之后,系统自动赠送红包,用户在会员中心就可以查看到红包,而管理员不用手动的在后台按会员发放。
支持最新ECSHOP版本及以往各个版本
首先,预览下效果:
1.首先在后台添加红包类型, 如图:
2.成功添加红包类型, 如图:
红包安装,步骤:
打开\ecshop\languages\zh_cn\admin\bonus.php
查找:
$_LANG
[
'send_by'
][SEND_BY_PRINT] =
'线下发放的红包'
;
在下面添加:
$_LANG
[
'send_by'
][SEND_BY_REGISTER] =
'注册用户送红包'
;
打开打开\ecshop\includes\inc _con stant.php
查找:
define(
'SEND_BY_PRINT'
, 3);
// 线下发放
在下面添加一行代码:
define(
'SEND_BY_REGISTER'
, 4);
// 注册用户送红包
打开\ecshop\admin/templates/bonus_type_info.htm
查找:
'radio'
name=
'send_type'
value=
'3'
{
if
$bonus_arr
.send_type eq 3} checked=
'true'
{/
if
} onClick=
'showunit(3)'
/>{
$lang
.send_by[3]}
在下面添加:
'radio'
name=
'send_type'
value=
'4'
{
if
$bonus_arr
.send_type eq 4} checked=
'true'
{/
if
} onClick=
'showunit(4)'
/>{
$lang
.send_by[4]}
打开\ecshop\user.php
查找:
/* 判断是否需要自动发送注册邮件 */
if
(
$GLOBALS
[
'_CFG'
][
'member_email_validate'
] &&
$GLOBALS
[
'_CFG'
][
'send_verify_email'
])
在上面新增一行添加以下代码:
/*
* 用户注册就发红包
* send_type=4 对应define('SEND_BY_REGISTER', 4);
* type_id=5 对应(图2)后台添加‘注册用户送红包’的id;
*/
$sql
=
'SELECT type_id, type_money FROM '
.
$ecs
->table(
'bonus_type'
).
' WHERE send_type=4 And type_id =5 AND send_start_date<>
.time().
' AND send_end_date>='
.time();
$bonus
=
$db
->getRow(
$sql
, true);
if
(
$bonus
){
$sql
=
'INSERT INTO '
.
$ecs
->table(
'user_bonus'
).
'(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed)'
.
'VALUES(''
.
$bonus
['type_id
'].''
, 0,
''.$_SESSION[user_id].''
, 0, 0, 0)';
$db
->query(
$sql
);
}
联系客服