Exemplo n.º 1
0
 /**
  * 发送图度
  *
  * @param string $tuduId
  * @param array $recipients
  * @return boolean
  */
 public function sendTudu($tuduId, array $recipients, $params = null)
 {
     foreach ($recipients as $uniqueId => $recipient) {
         $ret = $this->addRecipient($tuduId, $uniqueId, $params);
         if (false !== $ret) {
             if (empty($recipient['isforeign'])) {
                 // 投递到图度箱
                 $this->addLabel($tuduId, $uniqueId, '^all');
                 if (!$ret || !in_array('^g', explode(',', $ret))) {
                     $this->addLabel($tuduId, $uniqueId, '^i');
                 }
                 // 分配相关标签
                 // 公告
                 if (isset($params['notice']) && $params['notice']) {
                     $this->addLabel($tuduId, $uniqueId, '^n');
                     // 讨论
                 } elseif (isset($params['discuss']) && $params['discuss']) {
                     $this->addLabel($tuduId, $uniqueId, '^d');
                     // 会议
                 } elseif (isset($params['meeting']) && $params['meeting']) {
                     $this->addLabel($tuduId, $uniqueId, '^m');
                     // 我执行
                 } elseif (isset($recipient['role']) && $recipient['role'] == Dao_Td_Tudu_Tudu::ROLE_ACCEPTER && empty($params['meeting'])) {
                     $this->addLabel($tuduId, $uniqueId, '^a');
                 }
             }
             if (is_array($recipient)) {
                 $this->_tuduDao->updateTuduUser($tuduId, $uniqueId, $recipient);
             }
         }
     }
     // 发送图度 - 取消草稿标识,更新版块统计等
     $this->_tuduDao->sendTudu($tuduId);
     return true;
 }