/** * 审核活动报名:发序列号,以及相关短信邮件 * @param unknown_type $submit_id */ function verify_event_submit($submit_id) { $submit_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where id = " . $submit_id); if ($submit_data['is_verify'] == 0) { do { $sn = rand(100, 999) . $submit_data['event_id'] . rand(10, 99); $GLOBALS['db']->query("update " . DB_PREFIX . "event_submit set sn = '" . $sn . "',is_verify = 1 where id = " . $submit_id); } while ($GLOBALS['db']->affected_rows() == 0); send_event_sn_mail($submit_id); send_event_sn_sms($submit_id); } else { $sn = $submit_data['sn']; } return $sn; }
public function send() { global_run(); if (check_save_login() != LOGIN_STATUS_LOGINED) { $data['status'] = 1000; ajax_return($data); } else { $t = strim($_REQUEST['t']); $id = intval($_REQUEST['id']); $event_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']); $event_info = load_auto_cache("event", array("id" => $event_submit['event_id'])); if ($event_submit) { if ($event_submit['is_verify'] == 0) { $data['status'] = 0; $data['info'] = "报名未审核"; ajax_return($data); } if ($event_submit['is_verify'] == 2) { $data['status'] = 0; $data['info'] = "报名审核不通过"; ajax_return($data); } elseif ($event_submit['confirm_time'] > 0) { $data['status'] = 0; $data['info'] = "活动已参加"; ajax_return($data); } elseif ($event_submit['event_end_time'] > 0 && $event_submit['event_end_time'] < NOW_TIME) { $data['status'] = 0; $data['info'] = "活动已过期"; ajax_return($data); } else { if ($t == "sms") { if (app_conf("SMS_ON") == 0) { $data['status'] = 0; $data['info'] = "不支持短信发送"; ajax_return($data); } elseif ($event_submit['sms_count'] >= app_conf("SMS_COUPON_LIMIT")) { $data['status'] = 0; $data['info'] = "短信发送已超过" . app_conf("SMS_COUPON_LIMIT") . "次"; ajax_return($data); } elseif ($GLOBALS['user_info']['mobile'] == "") { $data['status'] = 0; $data['info'] = "请先设置手机号"; $data['jump'] = url("index", "uc_account"); ajax_return($data); } else { send_event_sn_sms($id); $GLOBALS['db']->query("update " . DB_PREFIX . "event_submit set sms_count = sms_count + 1 where id = " . $id); $data['status'] = 1; $data['info'] = "短信成功发送到" . $GLOBALS['user_info']['mobile'] . ",请注意查收。"; ajax_return($data); } } elseif ($t == "mail") { if (app_conf("MAIL_ON") == 0) { $data['status'] = 0; $data['info'] = "不支持邮件发送"; ajax_return($data); } elseif ($event_submit['mail_count'] >= app_conf("MAIL_COUPON_LIMIT")) { $data['status'] = 0; $data['info'] = "邮件发送已超过" . app_conf("MAIL_COUPON_LIMIT") . "次"; ajax_return($data); } elseif ($GLOBALS['user_info']['email'] == "") { $data['status'] = 0; $data['info'] = "请先设置邮箱"; $data['jump'] = url("index", "uc_account"); ajax_return($data); } else { send_event_sn_mail($id); $GLOBALS['db']->query("update " . DB_PREFIX . "event_submit set mail_count = mail_count + 1 where id = " . $id); $data['status'] = 1; $data['info'] = "邮件成功发送到" . $GLOBALS['user_info']['email'] . ",请注意查收。"; ajax_return($data); } } else { $data['status'] = 0; $data['info'] = "非法操作"; ajax_return($data); } } } else { $data['status'] = 0; $data['info'] = "报名数据不存在"; ajax_return($data); } } }