/** * This is notice action */ public function actionNotice() { if (!isset($_GET['authkey']) || '12315454364625223345467' != $_GET['authkey']) { echo 'notice authkey wrong!'; return; } $activeProductIdStr = $this->getActiveProductId(); $assignToUserArr = $this->getNoticeUser($activeProductIdStr); foreach ($assignToUserArr as $assignUser) { $assignedBugArr = Yii::app()->db->createCommand()->select('id,severity,priority,title,bug_status,created_by_name,assign_to_name,resolved_by_name,solution,updated_at')->from('{{bugview}}')->where('assign_to=' . $assignUser['id'] . ' and product_id in(' . $activeProductIdStr . ') and bug_status<>"Closed"')->order('id desc')->queryAll(); $subject = Yii::t('BugInfo', 'Bugs assigned to you by now:') . ' ' . count($assignedBugArr); $messageContent = $this->render('notice', array('bugArr' => $assignedBugArr, 'assignedUser' => $assignUser), true); MailService::sysMail($assignUser['email'], '', $subject, $messageContent); } }
/** * send mail message after action * * @author youzhao.zxw<*****@*****.**> * @param int $infoId info id * @param string $infoType bug,case or result * @param int $actionId action id * @param string $repeatStep repeat step * @param string $replyNote reply note * @return */ private static function sendMessage($infoId, $infoType, $actionId, $repeatStep = '', $replyNote = '') { $className = ucfirst(strtolower($infoType)) . 'Info'; $targetModel = new $className(); $basicInfo = $targetModel->model()->findByPk($infoId); list($mailMsg, $wangwangMsg) = self::getMessageContent($basicInfo, $infoType, $actionId, $repeatStep, $replyNote); $assignToEmail = ''; $wangwang = ''; if (!empty($basicInfo->assign_to)) { if (Yii::app()->user->id != $basicInfo->assign_to) { $assignUserInfo = TestUser::model()->findByPk($basicInfo->assign_to); $assignToEmail = self::getUserEmail($assignUserInfo); $wangwang = self::getWangwang($assignUserInfo); } } $ccArr = self::getCCList($basicInfo, $assignToEmail); MailService::sysMail($assignToEmail, $ccArr, ucfirst(strtolower($infoType)) . ' #' . $infoId . ' ' . CommonService::sysSubStr($basicInfo['title'], 150, true), $mailMsg); }