$time1 = strtotime("+1 day", $time1) - 1; $time2 = strtotime("+1 day", $time2) - 1; $daytime = 24 * 3600; $days = ($time2 - $time1) / $daytime + 1; $pos = count($items); $sum = 0; $names = array(); //得到奖品总数 while (--$pos >= 0 && ($name = $items[$pos]) && ($num = $nums[$pos])) { $sum += intval($num); //产生新的数组,用md5值来产生中奖key $names[md5($name)] = array("name" => $name, "count" => $num); } //计算活动天数及每天中奖数量 $avg = floor($sum / $days); if (s_bad_post('confirm', $confirm, 'int')) { $params['key'] = $akey; $params['name'] = $name; $params['start'] = $start; $params['stop'] = $stop; $params['odds'] = $odds; $params['items'] = $items; $params['nums'] = $nums; $params['confirm'] = 1; $params['avg'] = $avg; //未确认 return s_action_json($params); } //将配置信息存储起来 $data = array('name' => $name, 'key' => $akey, 'start' => $start, 'stop' => $stop, 'odds' => $odds, 'uid' => $user['id'], 'uname' => $user['screen_name'], 'sum' => $sum, 'fdate' => date('Y-m-d'), 'ftime' => date('Y-m-d H:i:s')); //$sql = sprintf("insert into `%s_bingo_config (`name`, `key`, `start`, `stop`, `odds`, `uid`, `uname`, `sum`, `fdate`, `ftime`) values('%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s')`;",
if (s_bad_post('token', $token)) { return s_action_error('require params: name or uid.'); } if (!s_bad_id($token)) { //是数字,当UID $data = s_user_by_uid($token); } else { if (!s_bad_string($token)) { echo 'null'; //是字符,当username $data = s_user_by_nickname($token); } } } else { if ($type === 'getWeiboDetail') { if (s_bad_post('token', $token)) { return s_action_error('require params: wid.'); } if (!s_bad_id($token)) { //是数字,当WID $data = s_weibo_by_wid($token); } else { if (!s_bad_string($token)) { //是BASE64,当mid $data = s_weibo_by_mid($token); } } } } for ($i = 0; $i < 10; ++$i) { $weibo = "测试p/s, from ab, at:" . time() . " " . rand(1, 100000);