public function send_sms() { if (app_conf("SMS_ON") == 1 && app_conf("SMS_SEND_COUPON") == 1) { $id = intval($_REQUEST['id']); $sms_count = $GLOBALS['db']->getOne("select sms_count from " . DB_PREFIX . "deal_coupon where id = " . $id); if ($GLOBALS['db']->getOne("select d.forbid_sms from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_coupon as dc on d.id = dc.deal_id where dc.id = " . $id) == 1) { showErr($GLOBALS['lang']['SMS_NOT_ALLOW']); } if (app_conf("SMS_COUPON_LIMIT") > $sms_count) { $s_user_info = es_session::get("user_info"); if ($s_user_info['mobile'] == '') { showErr($GLOBALS['lang']['COUPON_MOBILE_EMPTY']); } else { send_deal_coupon_sms($id); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set sms_count = sms_count + 1 where id = " . $id); showSuccess($GLOBALS['lang']['SEND_SUCCESS']); } } else { showErr($GLOBALS['lang']['SEND_EXCEED_LIMIT']); } } else { showErr($GLOBALS['lang']['SMS_NOT_ALLOW']); } }
public function sms() { if (app_conf("SMS_ON") == 1 && app_conf("SMS_SEND_COUPON") == 1) { $id = intval($_REQUEST['id']); send_deal_coupon_sms($id); save_log("ID:" . $id . L("SEND_COUPON_SMS_SUCCESS"), 1); $this->success(L("SEND_COUPON_SMS_SUCCESS")); } else { $this->error(L("SEND_COUPON_SMS_FAILED")); } }
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']); $coupon = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id'] . " and is_valid = 1"); $deal_info = load_auto_cache("deal", array("id" => $coupon['deal_id'])); if ($coupon) { if ($coupon['refund_status'] == 1) { $data['status'] = 0; $data['info'] = "团购券退款审核中"; ajax_return($data); } elseif ($coupon['refund_status'] == 2) { $data['status'] = 0; $data['info'] = "团购券已退款"; ajax_return($data); } elseif ($coupon['confirm_time'] > 0) { $data['status'] = 0; $data['info'] = "团购券已使用"; ajax_return($data); } elseif ($coupon['end_time'] > 0 && $coupon['end_time'] < NOW_TIME) { $data['status'] = 0; $data['info'] = "团购券已过期"; ajax_return($data); } else { if ($t == "sms") { if ($deal_info['forbid_sms'] == 1 || app_conf("SMS_ON") == 0 || app_conf("SMS_SEND_COUPON") == 0) { $data['status'] = 0; $data['info'] = "不支持短信发送"; ajax_return($data); } elseif ($coupon['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_deal_coupon_sms($id); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon 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 || app_conf("MAIL_SEND_COUPON") == 0) { $data['status'] = 0; $data['info'] = "不支持邮件发送"; ajax_return($data); } elseif ($coupon['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_deal_coupon_mail($id); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon 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); } } }