Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[疑难] 有奖活动--给今天生日会员发送生日祝福(问题)

[复制链接]
ytb0412 发表于 2008-9-8 16:53:51 | 显示全部楼层 |阅读模式
有奖活动--给今天生日会员发送生日祝福(本活动可重复执行)
有没有人用过啊,为什么发了祝福却不能完成任务啊???



<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.

*/

if(!defined('IN_UCHOME')) {
exit('Access Denied');
}

//要求发送的祝福数
$maxbless = 10;
$currTime = $_SGLOBAL['timestamp'];
$currMonth = intval(date("m",$currTime));
$currDay = intval(date("d",$currTime));
$currYear = intval(date("Y",$currTime));
$today = mktime(0,0,0,$currMonth,$currDay,$currYear);

//今天过生日的会员数
$birthdaysql = "SELECT count(sf.uid) FROM ".tname('spacefield')." sf
WHERE sf.birthmonth = $currMonth AND sf.birthday = $currDay
LIMIT 0,1";
$birthdayquery = $_SGLOBAL['db']->query($birthdaysql);
$birthdaycount = $_SGLOBAL['db']->result($birthdayquery);

//发过短信的生日会员数
$pmsql = "SELECT count(sf.uid) FROM ".tname('spacefield')." sf
WHERE sf.birthmonth = $currMonth AND sf.birthday = $currDay
AND sf.uid IN (SELECT p.msgtoid FROM ucenter.uc_pms p WHERE p.msgfromid = ".$_SGLOBAL['supe_uid']." AND (p.dateline BETWEEN $today AND $today+86400))
LIMIT 0,1";
$pmquery = $_SGLOBAL['db']->query($pmsql);
$pmcount = $_SGLOBAL['db']->result($pmquery);


if($birthdaycount && ($pmcount==$birthdaycount || $pmcount>=$maxbless)) {

$task['done'] = 1;//活动完成
if($space['birthmonth']==0 || $space['birthday']==0) {
$task['result'] ='
→将个人资料补充完整,以便其他会员能够给我发送生日祝福!
';
}

} else {

if($birthdaycount==0) {
//今天没有会员过生日
$task['guide'] = '今天没有会员过生日。
';

} else {

$birthdaylist = array();
$query = $_SGLOBAL['db']->query("SELECT s.uid,s.username,s.name,s.namestatus FROM ".tname('spacefield')." sf
LEFT JOIN ".tname('space')." s ON s.uid=sf.uid
WHERE sf.birthmonth = $currMonth AND sf.birthday = $currDay
ORDER BY rand()
LIMIT 0,$maxbless");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
$birthdaylist[] = $value;
}


if($birthdaylist) {
$task['guide'] .= '以下会员今天过生日,请为他们送上生日祝福吧:
';
$task['guide'] .= '';
}
}

$birthdaylist = array();
$query = $_SGLOBAL['db']->query("SELECT s.uid,s.username,s.name,s.namestatus,sf.birthmonth,sf.birthday FROM ".tname('spacefield')." sf
LEFT JOIN ".tname('space')." s ON s.uid=sf.uid
WHERE sf.birthmonth = $currMonth AND sf.birthday >= $currDay+1
ORDER BY sf.birthday ASC
LIMIT 0,100");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
$birthdaylist[] = $value;
}

if($birthdaylist) {
$task['guide'] .= '本月还有以下会员过生日,欢迎届时为他们送上生日祝福:
';
$task['guide'] .= '';
} else {
$task['guide'] .= '明天起至月底前,没有会员过生日。欢迎下月继续参加本活动。
';
}
if($space['birthmonth']==0 || $space['birthday']==0) {
$task['guide'] .='→将个人资料补充完整,以便其他会员能够给我发送生日祝福!
';
}

}

?>
 楼主| ytb0412 发表于 2008-9-8 17:25:49 | 显示全部楼层
回复

使用道具 举报

 楼主| ytb0412 发表于 2008-9-17 17:08:09 | 显示全部楼层
有没有高人知道啊
回复

使用道具 举报

 楼主| ytb0412 发表于 2008-9-17 17:08:33 | 显示全部楼层
只要提交一次就OK的那种
回复

使用道具 举报

mdjgyb 发表于 2009-7-4 10:31:25 | 显示全部楼层
现在 这里的协助气氛越来越不浓了
回复

使用道具 举报

weny83 发表于 2009-9-28 15:09:42 | 显示全部楼层
我也关注此特“给今天生日会员发送生日祝福”
回复

使用道具 举报

debialu 发表于 2012-5-29 20:45:23 | 显示全部楼层
什么都是浮云,送上生日祝福就最实际
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-24 01:21 , Processed in 0.027449 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表