php红包
‘壹’ 如何用php实现模拟微信抢红包
小伙子你很有想法啊,可惜不行,因为php是服务端的,而微信是客户段的。除非微信红包开放接口
‘贰’ 求 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_list&bonus_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_mp($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
‘叁’ php每轮控制发送多少红包,如何控制高并发
郭霞决定帮忙付款,凑00元找“王经理通下,先交部分”。随后,郭向“王理”提供的账号转入00元,承诺次日再00元。当晚8时许,郭霞收到真正的好友薇薇从微信上发来信,称没有代付机票款一事。此时,郭霞才意识到被骗了,赶忙到派出所报案。在微博上与郭霞联系的“薇薇”再也没有回,“王理”的电话再也打不
多人被骗
受骗金额达到约76万
成都商报记者了到,郭霞的遭遇并非案。她告诉记者,被后,另一位微博博主讲述了与她相同的遭遇,还组建了一个微。“当时只有七八个人,后来人越来越多,我们才知道受骗的人那么。”郭说,截至目前,仅微信群里统计到的受骗人数有20人,截至19日统计到的受骗金额为64元。其中,今年、6月,受骗人数共50余
成都商报记者从郭霞提供的一份微信群内统计数据表上看到,大部分受骗者系在新浪微博上骗,少数为其他网络台;被骗过程均为骗子仿制在国外亲友的微博或其他网络平台通讯账号,大部分被要求代付机票款、少数被要求代付托运费;受骗金额多在1万元左右,最少00元,最多的9万元。大部分受骗者都已向警方报案
‘肆’ jquery代码 点击哪个红包,显示出来哪个红包里面的金额
具体如下:
jquery+php实现的随机生成红包金额数量特效是一段实现了可以将一定金额的钱生成多个不同金额的红包的效果代码,红包数量与金钱可以自己设定。
‘伍’ 1364 Driver.class.php LINE: 350大神谁知道,红包!!红包
其实thinkphp已经提示得很明显了,在数据表中sex这个字段你没有设置默认值,同时你的sql语句在执行的时候也没有给sex这个字段存值,所以就报错了,你可以根据我说的检查一遍,希望对你有帮助
配个php的环境啊
‘柒’ 求一份 php+mysql 首字母查询案例详解,财富值没了,加QQ(526557820)红包酬谢。
Version:0.9
StartHTML:-1
EndHTML:-1
StartFragment:0000000111
EndFragment:0000006562
if($_POST)
{
$letter = $_POST['letter'];
$link = mysql_connect("127.0.0.1","root","root");
mysql_query("set names utf8");
mysql_select_db("xxx",$link);
$result = mysql_query("select * from `table` where letter = '{$letter}'");
$arr = array();
while ($row = mysql_fetch_assoc($result))
{
$arr[] = $row;
}
print_r($arr);
}
?>
<html>
<meta content="text/html; charset=gbk" http-equiv="Content-Type" />
<body>
<form method="post">
首字母:<input type="text" name="letter"><br>
<input type="submit" value="查询">
</form>
</body>
</html>
‘捌’ 求大神!公众号后台如何自动回复红包如何将微信红包接入php网站
你这个是某猪的源码吧,他这个源码估计是没有发红包的开发,所以不能直接发红包的,而且这种免费源码还有泄漏的风险,不建议使用。一般来说做了这个红包支付的接口,直接调用关注时回复发送红包就可以了。
‘玖’ 怎样用php实现模拟微信抢红包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$money = 100; // 总金额
$copies = 10; // 份数
$result = []; // 结果
$min = 1; // 单包最少
$max = 20; // 单包最多
while($copies--){
$take = mt_rand(max(1, $min), min($max, $money));
$money -= $take;
if($money <= 0){
$take -= 0 - $money;
$money += 1;
}
$result[] = $take;
}
var_mp($result);
// array(10) { [0]=> int(9) [1]=> int(9) [2]=> int(15) [3]=> int(9) [4]=> int(13) [5]=> int(3) [6]=> int(8) [7]=> int(17) [8]=> int(12) [9]=> int(2) }