ecshop领红包代码的简单介绍
admin 发布:2022-12-19 21:50 178
本篇文章给大家谈谈ecshop领红包代码,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、ecshop 如何实现领取红包功能
- 2、求 ecshop 一次使用多个红包的功能的代码!!!!
- 3、ecshop充值满100送10元红包的代码怎么写啊?具体点的,ecshop新手求助
- 4、ecshop获得红包类型
ecshop 如何实现领取红包功能
后台添加一个“注册就送红包”的红包类型,前台注册检测是否有这个类型,有就根据红包类型设置,插入信息到ecs_user_bonus表里面。
求 ecshop 一次使用多个红包的功能的代码!!!!
步骤
1) 添加一种新的红包类型4 ,
文件 admin/templates/bonus_type_info.htm
找到 input type="radio" name="send_type" value="0" {if $bonus_arr.send_type eq 0} checked="true" {/if} onClick="showunit(0)" /{$lang.send_by[0]}
input type="radio" name="send_type" value="1" {if $bonus_arr.send_type eq 1} checked="true" {/if} onClick="showunit(1)" /{$lang.send_by[1]}
input type="radio" name="send_type" value="2" {if $bonus_arr.send_type eq 2} checked="true" {/if} onClick="showunit(2)" /{$lang.send_by[2]}
input type="radio" name="send_type" value="3" {if $bonus_arr.send_type eq 3} checked="true" {/if} onClick="showunit(3)" /{$lang.send_by[3]}
再其后面添加
input type="radio" name="send_type" value="4" {if $bonus_arr.send_type eq 4} checked="true" {/if} onClick="showunit(4)" /通用红包 多次使用
2) 生成这类红包字符串
增加文件 admin/templates/bonus_by_print_phpsir.htm
修改文件 admin/bonus.php 找到
elseif ($_REQUEST['send_by'] == SEND_BY_PRINT)
{
$smarty-assign('type_list', get_bonus_type());
$smarty-display('bonus_by_print.htm');
}
再其后添加
elseif ($_REQUEST['send_by'] == 4)
{
$smarty-assign('type_list', get_bonus_type_phpsir());
$smarty-display('bonus_by_print_phpsir.htm');
}
3) 增加 get_bonus_type_phpsir 函数
文件 admin/includes/lib_main.php
function get_bonus_type_phpsir()
{
$bonus = array();
$sql = 'SELECT type_id, type_name, type_money FROM ' . $GLOBALS['ecs']-table('bonus_type') .
' WHERE send_type = 4';
$res = $GLOBALS['db']-query($sql);
while ($row = $GLOBALS['db']-fetchRow($res))
{
$bonus[$row['type_id']] = $row['type_name'].' [' .sprintf($GLOBALS['_CFG']['currency_format'], $row['type_money']).']';
}
return $bonus;
}
4) 在 bonus.php 里面 找到
if ($_REQUEST['act'] == 'send_by_print')
{
...........................
}
再其后面添加,处理增加这类红包时候生成方法
if ($_REQUEST['act'] == 'send_by_print_phpsir')
{
@set_time_limit(0);
/* 红下红包的类型ID和生成的数量的处理 */
$bonus_typeid = !empty($_POST['bonus_type_id']) ? $_POST['bonus_type_id'] : 0;
$bonus_sum = !empty($_POST['bonus_sum']) ? $_POST['bonus_sum'] : 1;
/* 生成红包序列号 */
for ($i = 0, $j = 0; $i $bonus_sum; $i++)
{
$bonus_sn = $_POST['bonus_txt'];
$db-query("INSERT INTO ".$ecs-table('user_bonus')." (bonus_type_id, bonus_sn) VALUES('$bonus_typeid', '$bonus_sn')");
$j++;
}
/* 记录管理员操作 */
admin_log($bonus_sn, 'add', 'userbonus');
/* 清除缓存 */
clear_cache_files();
/* 提示信息 */
$link[0]['text'] = $_LANG['back_bonus_list'];
$link[0]['href'] = 'bonus.php?act=bonus_listbonus_type=' . $bonus_typeid;
sys_msg($_LANG['creat_bonus'] . $j . $_LANG['creat_bonus_num'], 0, $link);
}
5) 修改 bonus.php 让后台显示红包内容
if ($_REQUEST['act'] == 'bonus_list')
{
...........................
}
和
if ($_REQUEST['act'] == 'query_bonus')
{
...........................
}
里面增加
if ($bonus_type['send_type'] == 4)
{
$smarty-assign('show_bonus_sn', 1);
}
至此 后台部分完成
前台部分 修改
includes/lib_order.php
function bonus_info($bonus_id, $bonus_sn = '')
{
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']-table('bonus_type') . " AS t," .
$GLOBALS['ecs']-table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id ";
if ($bonus_id 0)
{
$sql .= " AND b.bonus_id = '$bonus_id'";
$row = $GLOBALS['db']-getRow($sql);
return $row;
}
else
{
$sql .= " AND b.bonus_sn = '$bonus_sn'";
$row = $GLOBALS['db']-getRow($sql);
}
if($row['send_type'] == 4) // phpsir 如果是第4类型红包,那么就找一个未使用的红包,这种红包可被多次使用,不限制每人使用次数
{
$sess_userid = $_SESSION["user_id"];
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']-table('bonus_type') . " AS t," .
$GLOBALS['ecs']-table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.used_time = 0 ";
if ($bonus_id 0)
{
$sql .= "AND b.bonus_id = '$bonus_id'";
}
else
{
$sql .= "AND b.bonus_sn = '$bonus_sn'";
}
//print $sql;
$row = $GLOBALS['db']-getRow($sql);
//var_dump($row);
return $row;
}
// 如果想每人只使用N次,请用下面的部分
/*
if($row['send_type'] == 4) // phpsir 如果是第4类型红包,那么就找一个未使用的红包,这种红包可被多次使用,不限制每人使用次数
{
$sess_userid = $_SESSION["user_id"];
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']-table('bonus_type') . " AS t," .
$GLOBALS['ecs']-table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.user_id = '$sess_userid' and b.bonus_sn = '$bonus_sn' ";
$rows = $GLOBALS['db']-getAll($sql);
$allow_used_bonus_num = 2; // 最大允许使用次数
if(count($rows) = $allow_used_bonus_num )
{
return false;
}else{
$sql = "SELECT t.*, b.* " .
"FROM " . $GLOBALS['ecs']-table('bonus_type') . " AS t," .
$GLOBALS['ecs']-table('user_bonus') . " AS b " .
"WHERE t.type_id = b.bonus_type_id and b.used_time = 0 and b.bonus_sn = '$bonus_sn' ";
$row = $GLOBALS['db']-getRow($sql);
return $row;
}
}
*/
return $row;
}
注意不要用记事本修改php文件,建议下载dreamweaver
ecshop充值满100送10元红包的代码怎么写啊?具体点的,ecshop新手求助
在user.php 的注册成功信息显示前面,大概是 show_message(sprintf($_LANG['register_success'].............前面加入
注意下下面的 $bonus_type_id = 1; 需要先在后台加入对应的红包的id
//phpsir 1111
$bonus_type_id=1;
$bonus = $db-getRow('SELECT * FROM ' . $ecs-table("bonus_type") . " WHERE send_type = 0 And type_id = $bonus_type_id", true);
if($bonus){ if(time()($bonus['send_end_date']+28800)){
$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); } }
//phpsir 1111_end
ecshop获得红包类型
ecshop红包有两类型:
一种是直接发送到个人帐户上去的,这个一旦发送到客户的帐户上去。那么意味着别人拿到了这个编码,也不能使用这个编码进行抵扣。
2.另外一种ecshop红包就是线下发送的。当你得到这个编码,在红包的有效期内,可以使用该红包。
关于ecshop领红包代码和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-17做公司网页,做公司网页有什么简单的方法
- 05-12深圳seo公司的简单介绍
- 05-11设计一个简单的网页,独立站建站平台有哪些
- 05-09网页代码,网页代码快捷键
- 05-09hao123网址之家官网的简单介绍
- 05-07孝感seo的简单介绍
- 05-07简历源代码可以上传照片的简单介绍[20240507更新]
- 05-06单页网站的代码(完整的网页代码)[20240506更新]
- 05-06个人主页图片代码(个人主页图片代码怎么弄)[20240506更新]
- 05-06提取微信名片代码(微信名片信息提取)[20240506更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接