当前位置: 首页>>代码示例>>PHP>>正文


PHP Registration::updateSMSMessageId方法代码示例

本文整理汇总了PHP中Registration::updateSMSMessageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::updateSMSMessageId方法的具体用法?PHP Registration::updateSMSMessageId怎么用?PHP Registration::updateSMSMessageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registration的用法示例。


在下文中一共展示了Registration::updateSMSMessageId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRegoSubmission

function processRegoSubmission()
{
    // $out = new OUTPUTj(0,"","Registration currently not available");
    // echo $out->toJSON();
    // return false;
    $json = $_POST["json"];
    if ($json || $_POST["reference"]) {
        if ($json != "") {
            //create new object with json data
            $rego = new Registration($json);
            //check if json data exists
            if ($rego->exists()) {
                $out = new OUTPUTj(0, "", "This registration information already exists!");
                echo $out->toJSON();
                return false;
            }
            //json to objects
            $rego->parseJSON();
            //make sure the json converted is valid
            if ($rego->isValid() == false) {
                $out = new OUTPUTj(0, "", $rego->errMsg);
                echo $out->toJSON();
                return false;
            }
            //$out = new OUTPUTj(0,"","Registration is temporarily unavailable!");
            //echo $out->toJSON();
            //return false;
            //$rego->toString();
            if ($rego->commitDB()) {
                $ref = $rego->Reference;
                //send sms
                try {
                    //we try this as we dont want to show error if sms fails
                    //we still want to show the registration information
                    //check for aussie mobile prefix
                    if (substr($rego->Phone, 0, 5) == "+6104" || substr($rego->Phone, 0, 4) == "+614") {
                        $sms = new SMS();
                        if ($sms->access_token) {
                            $messageId = $sms->send($rego->Phone, 'Hi ' . $rego->Firstname . ', your ref: ' . $ref . '. View your rego @ http://tinyurl.com/h4glqrk?ref=' . $ref . '\\n\\nDaiHoi Melbourne2016 Team.');
                            if ($messageId) {
                                $rego->updateSMSMessageId($rego->Reference, $messageId);
                            }
                        }
                    }
                } catch (Exception $e) {
                    //should log error in db
                }
                //we send email
                try {
                    //we try this as we dont want to show error if email fails
                    //we still want to show the registration information
                    $show_viet_section = 0;
                    if (startsWith($rego->Phone, "+84") || startsWith($rego->Phone, "84") || endsWith($rego->Church, "Vietnam")) {
                        $show_viet_section = 1;
                    }
                    $message = $rego->getRego($ref);
                    $email = new Mailer();
                    $email->sendMail($rego->Email, 'DaiHoi 2016 Registration [' . $ref . '] for: ' . $rego->FullName(), $message, $show_viet_section);
                } catch (Exception $e) {
                    //should log error in db
                }
                $out = new OUTPUTj(1, $ref, $rego->errMsg);
                echo $out->toJSON();
            } else {
                $out = new OUTPUTj(0, "", $rego->errMsg);
                echo $out->toJSON();
            }
        }
    }
}
开发者ID:sonchau,项目名称:melbourne2016,代码行数:70,代码来源:_cRegistration.php


注:本文中的Registration::updateSMSMessageId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。