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


PHP Crawler::sendMailOutWithPin方法代码示例

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


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

示例1: postOffice

    public function postOffice()
    {
        set_time_limit(600);
        //check if available
        if (!Yii::app()->db->createCommand("SELECT * FROM crawler WHERE action='takingMail'")->queryRow()) {
            Yii::app()->db->createCommand("INSERT INTO crawler (action,active) VALUES('takingMail',1)")->execute();
            //blocking function
            //read emails to send
            if ($emails = Yii::app()->db->createCommand("SELECT * FROM mailToSent WHERE indexmail IS NULL LIMIT 4000")->queryAll()) {
                Yii::app()->db->createCommand("INSERT INTO mailToSent (indexmail) VALUES(1)")->execute();
                //print_r($emails);
                foreach ($emails as $row) {
                    if ($row['outside'] == 1) {
                        //send email third server
                        if ($row['pass'] == '') {
                            if (Crawler::sendMailOutWithPin($row)) {
                                $meta = substr(hex2bin($row['meta']), 0, 16) . substr(hex2bin($row['meta']), 16);
                                $body = substr(hex2bin($row['body']), 0, 16) . substr(hex2bin($row['body']), 16);
                                $person[] = array("oldId" => $row['messageId'], "meta" => new MongoBinData($meta, MongoBinData::GENERIC), "body" => new MongoBinData($body, MongoBinData::GENERIC), "modKey" => $row['modKey'], "file" => $row['file'], "pinHash" => $row['pinHash'], "tryCounter" => 0, "expireAfter" => new MongoDate(strtotime('now' . '+ 4 weeks')));
                                if (Yii::app()->mongo->insert('mailQueue', $person)) {
                                    Yii::app()->db->createCommand("DELETE FROM mailToSent WHERE id=" . $row['id'])->execute();
                                }
                                unset($person);
                            }
                        } else {
                            if (Crawler::sendMailOutWithoutPin($row)) {
                                if (isset($row['file']) && $row['file'] != '') {
                                    $person[] = array("oldId" => $row['messageId'], "modKey" => $row['modKey'], "file" => $row['file'], "expireAfter" => new MongoDate(strtotime('now' . '+ 4 weeks')));
                                    Yii::app()->mongo->insert('mailQueue', $person);
                                    unset($person);
                                }
                                Yii::app()->db->createCommand("DELETE FROM mailToSent WHERE id=" . $row['id'])->execute();
                            }
                        }
                    }
                    //end send email third server
                    if ($row['fromOut'] == 1 || $row['outside'] == 0 && $row['fromOut'] == 0) {
                        $fileSize = 0;
                        if (isset($row['file'])) {
                            //calculate space occupied by files
                            $files = json_decode($row['file']);
                            foreach ($files as $file) {
                                $fileSize += FileWorks::getFileSize($file);
                            }
                        }
                        $trans = Yii::app()->db->beginTransaction();
                        $par[':id'] = $row['id'];
                        $par[':meta'] = $row['seedMeta'];
                        $par[':modKey'] = $row['modKeySeed'];
                        $par[':password'] = $row['seedPass'];
                        $par[':rcpnt'] = $row['rcpnt'];
                        $par[':v1'] = 1;
                        if (Yii::app()->db->createCommand("INSERT INTO seedTable (id,meta,modKey,password,rcpnt,v1) VALUES (:id,:meta,:modKey,:password,:rcpnt,:v1)")->execute($par)) {
                            unset($par);
                            $meta = substr(hex2bin($row['meta']), 0, 16) . substr(hex2bin($row['meta']), 16);
                            $body = substr(hex2bin($row['body']), 0, 16) . substr(hex2bin($row['body']), 16);
                            $person[] = array("oldId" => $row['messageId'], "meta" => new MongoBinData($meta, MongoBinData::GENERIC), "body" => new MongoBinData($body, MongoBinData::GENERIC), "pass" => $row['pass'], "modKey" => $row['modKey'], "file" => $row['file'], "emailSize" => strlen($meta) + strlen($body) + $fileSize);
                            if (Yii::app()->mongo->insert('mailQueue', $person)) {
                                unset($fileSize, $person);
                                if (Yii::app()->db->createCommand("DELETE FROM mailToSent WHERE id=" . $row['id'])->execute()) {
                                    $trans->commit();
                                } else {
                                    $trans->rollback();
                                }
                            } else {
                                $trans->rollback();
                            }
                        }
                    }
                }
            }
            Yii::app()->db->createCommand("DELETE FROM crawler WHERE action ='takingMail'")->execute();
        }
        echo 'success
		';
    }
开发者ID:blackdragon199154,项目名称:scryptmail,代码行数:76,代码来源:Crawler.php


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