Esempio n. 1
0
 public function verify()
 {
     $res = array();
     $res['Success'] = false;
     $str = '';
     $project = new Project();
     $project->setValue($this->ProjectId);
     if ($this->Action > 0) {
         $keys = array();
         //邮件设置
         $verifyUrl = URL_WEBSITE . "/basic/project_detail.php?id=" . $project->Id . "&selected=2";
         switch ($project->Status) {
             case 1:
                 if ($this->Action == 1) {
                     $project->Status = 2;
                     $str = '需求审核通过;';
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'];
                         $keys['cc'] = "*****@*****.**";
                         $keys['from'] = "*****@*****.**";
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "您的技术开发需求已通过事业部审核:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,您提交的技术开发需求,已经通过事业部审核。接下来的环节是技术部的审核。详情请点击:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 } else {
                     $project->Status = 18;
                     $str = '需求驳回;';
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'];
                         $keys['from'] = "*****@*****.**";
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,您提交的技术开发需求,事业部审核不通过,已被驳回。详情请点击:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 }
                 break;
             case 2:
                 if ($this->Action == 1) {
                     $project->Status = 3;
                     $str = '开发审核通过;';
                     $project->Developer = $this->Developer;
                     $developer = new Developer();
                     //单独设置开发人员
                     //$this->DeveloperIds;
                     //删除原来的。
                     $developer->deleteByProjectId($project->Id);
                     //分割插入
                     $arrIds = explode(' ', $this->DeveloperIds);
                     for ($i = 0; $i < count($arrIds); $i++) {
                         $developer->ProjectId = $project->Id;
                         $developer->UserId = $arrIds[$i];
                         if (empty($developer->UserId)) {
                             continue;
                         }
                         $developer->add();
                     }
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'];
                         $keys['from'] = "*****@*****.**";
                         if ($project->Department == 101) {
                             //大客户事业部需要抄送
                             $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com';
                         }
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "您的技术开发需求已通过技术部审核:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,您提交的技术开发需求,已经通过技术部审核。本次开发对接人为:" . $this->Developer . ",如有疑问,可与其联系。接下来是设计环节,客户确认好设计稿之后,请及时到以下链接更新项目状态:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 } else {
                     $project->Status = 19;
                     $str = '开发需求驳回;';
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'];
                         $keys['from'] = "*****@*****.**";
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,您提交的技术开发需求,技术部审核不通过,已被驳回。详情请点击:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 }
                 break;
             case 3:
                 if ($this->Action == 1) {
                     $project->Status = 4;
                     $str = '客户已确认设计稿;';
                     //设置发送邮件
                     //发送邮件操作
                     $keys['to'] = '*****@*****.**';
                     $keys['from'] = "*****@*****.**";
                     $keys['smtp_port'] = "25";
                     $keys['smtp_username'] = "******";
                     $keys['smtp_password'] = "******";
                     $mailsubject = "设计稿客户已经确认:" . $project->Subject;
                     $mailbody = "Dear " . $userMode['Name'];
                     $mailbody .= "<br />";
                     $mailbody .= "<br />";
                     $mailbody .= "您好,设计已经完成,可进入开发阶段。详情请点击:";
                     $mailbody .= "<br />";
                     $mailbody .= "<br />";
                     $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                     $mailbody .= "<br />";
                     $mailbody .= "<br />";
                     $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                     $mailbody .= "<br />";
                     $mailbody .= "<br />";
                     $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                     $keys['subject'] = $mailsubject;
                     $keys['content'] = $mailbody;
                     $keys['content_type'] = 'HTML';
                     $keys['smtp_host'] = "smtp.qq.com";
                 }
                 break;
             case 4:
                 if ($this->Action == 1) {
                     $project->Status = 5;
                     $str = '开发已完成;';
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'];
                         $keys['from'] = "*****@*****.**";
                         if ($project->Department == 101) {
                             //大客户事业部需要抄送
                             $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com';
                         }
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "您提交的技术开发需求,已经开发完成:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,您提交的技术开发需求,技术已开发完成,可以进入测试阶段。请安排人协助测试验收。如有问题请及时反馈给相关开发人员。测试完毕,请到以下链接及时更改为上线状态:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 }
                 break;
             case 5:
                 if ($this->Action == 1) {
                     $project->Status = 6;
                     $str = '测试已完成;';
                     //设置发送邮件
                     $user = new User();
                     $userMode = $user->getModel($project->UserId);
                     if (!empty($userMode['Email'])) {
                         //发送邮件操作
                         $keys['to'] = $userMode['Email'] . ';sauweweng@thindov.com';
                         if ($project->Department == 101) {
                             //大客户事业部需要抄送
                             $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com';
                         }
                         $keys['from'] = "*****@*****.**";
                         $keys['smtp_port'] = "25";
                         $keys['smtp_username'] = "******";
                         $keys['smtp_password'] = "******";
                         $mailsubject = "测试已经完成,活动已上线:" . $project->Subject;
                         $mailbody = "Dear " . $userMode['Name'];
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "您好,测试已经完成,活动已经上线。请在活动结束时及时到以下链接更新状态,并做效果的总结登记:";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "——深圳尚道微营销有限公司  技术中心";
                         $mailbody .= "<br />";
                         $mailbody .= "<br />";
                         $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
                         $keys['subject'] = $mailsubject;
                         $keys['content'] = $mailbody;
                         $keys['content_type'] = 'HTML';
                         $keys['smtp_host'] = "smtp.qq.com";
                     }
                 }
                 break;
             case 6:
                 if ($this->Action == 1) {
                     $project->Status = 7;
                     $str = '项目已经结束;';
                 }
                 break;
         }
         $project->update();
     } else {
         $project->Developer = $this->Developer;
         $developer = new Developer();
         //单独设置开发人员
         //$this->DeveloperIds;
         //删除原来的。
         $developer->deleteByProjectId($project->Id);
         //分割插入
         $arrIds = explode(' ', $this->DeveloperIds);
         for ($i = 0; $i < count($arrIds); $i++) {
             $developer->ProjectId = $project->Id;
             $developer->UserId = $arrIds[$i];
             if (empty($developer->UserId)) {
                 continue;
             }
             $developer->add();
         }
         $project->update();
     }
     $memo = new Memo();
     $memo->ProjectId = $this->ProjectId;
     $memo->CreateTime = date('Y-m-d H:i:s');
     $memo->Memo = $str . $this->Memo;
     $memo->UserId = $_SESSION['userid'];
     $result = $memo->add();
     if ($result > 0) {
         $res['Success'] = true;
         $res['Message'] = "保存成功";
         $res['Memo'] = $memo->Memo;
         $res['Name'] = $_SESSION['username'];
         $res['CreateTime'] = $memo->CreateTime;
         $res['NewId'] = $result;
         $res['Status'] = $project->Status;
         //发送邮件
         $mail = new SaeMail();
         $mail->setOpt($keys);
         $ret = $mail->send();
         //if ($ret === false)
         //var_dump($mail->errno(), $mail->errmsg());
         $mail->clean();
     } else {
         $res['Success'] = false;
         $res['Message'] = "操作失败,请联系技术部";
     }
     echo json_encode($res);
     exit;
 }