public function send_mail()
 {
     if (app_conf("MAIL_ON") == 1 && app_conf("MAIL_SEND_COUPON") == 1) {
         $id = intval($_REQUEST['id']);
         $mail_count = $GLOBALS['db']->getOne("select mail_count from " . DB_PREFIX . "deal_coupon where id = " . $id);
         if (app_conf("MAIL_COUPON_LIMIT") > $mail_count) {
             send_deal_coupon_mail($id);
             $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set mail_count = mail_count + 1 where id = " . $id);
             showSuccess($GLOBALS['lang']['SEND_SUCCESS']);
         } else {
             showErr($GLOBALS['lang']['SEND_EXCEED_LIMIT']);
         }
     } else {
         showErr($GLOBALS['lang']['MAIL_NOT_ALLOW']);
     }
 }
Пример #2
0
 public function mail()
 {
     if (app_conf("MAIL_ON") == 1 && app_conf("MAIL_SEND_COUPON") == 1) {
         $id = intval($_REQUEST['id']);
         send_deal_coupon_mail($id);
         save_log("ID:" . $id . L("SEND_COUPON_MAIL_SUCCESS"), 1);
         $this->success(L("SEND_COUPON_MAIL_SUCCESS"));
     } else {
         $this->error(L("SEND_COUPON_MAIL_FAILED"));
     }
 }
Пример #3
0
 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);
         }
     }
 }