/** * 保存会议数据 * * @param $data */ public function onSave(Tudu_Model_Tudu_Entity_Tudu $tudu, Tudu_Model_Tudu_Entity_Extension_Abstract $data) { /* @var $daoCycle Dao_Td_Tudu_Cycle */ $daoCycle = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Cycle', Tudu_Dao_Manager::DB_TS); $cycle = $data->getAttributes(); if (null !== $daoCycle->getCycle(array('cycleid' => $tudu->cycleId))) { $daoCycle->updateCycle($tudu->cycleId, $cycle); } else { $daoCycle->createCycle($cycle); } }
/** * * @param Model_Tudu_Tudu $tudu */ public function saveTuduCycle(Model_Tudu_Tudu &$tudu) { $cycle = $tudu->getExtension('Model_Tudu_Extension_Cycle'); /* @var $daoCycle Dao_Td_Tudu_Cycle */ $daoCycle = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Cycle', Tudu_Dao_Manager::DB_TS); $params = $cycle->getAttributes(); if (null !== $daoCycle->getCycle(array('cycleid' => $cycle->cycleId))) { $daoCycle->updateCycle($cycle->cycleId, $params); } else { $daoCycle->createCycle($params); } }
/** * */ public function classesAction() { $boardId = $this->_request->getQuery('boardid'); /* @var $daoClass Dao_Td_Tudu_Class */ $daoClass = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Class', Tudu_Dao_Manager::DB_TS); $conditions = array('orgid' => $this->_user->orgId); if (!empty($boardId)) { $conditions['boardid'] = $boardId; } $classes = $daoClass->getClasses($conditions)->toArray(); $this->view->code = TuduX_OpenApi_ResponseCode::SUCCESS; $this->view->classes = $classes; }
/** * 保存会议数据 * * @param $data */ public function onSave(Tudu_Model_Tudu_Entity_Tudu $tudu, Tudu_Model_Tudu_Entity_Extension_Abstract $data) { /* @var $daoMeeting Dao_Td_Tudu_Meeting */ $daoMeeting = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Meeting', Tudu_Dao_Manager::DB_TS); $attrs = $data->getAttributes(); if ($daoMeeting->existsMeeting($tudu->tuduId)) { if (empty($attrs)) { return true; } $ret = $daoMeeting->updateMeeting($tudu->tuduId, $attrs); } else { $attrs['tuduid'] = $tudu->tuduId; $attrs['orgid'] = $tudu->orgId; $ret = $daoMeeting->createMeeting($attrs); } }
/** * 删除图度 */ public function deleteAction() { $tuduIds = explode(',', $this->_request->getParam('tuduid')); $isDetail = (bool) $this->_request->getParam('detail', 0); if (empty($tuduIds)) { throw new TuduX_OpenApi_Exception('Missing or invalid value of parameter "tuduid"', TuduX_OpenApi_ResponseCode::MISSING_PARAMETER); } $modelManage = Tudu_Model::factory('Model_Tudu_Manage'); /* @var $daoTudu Dao_Td_Tudu_Tudu */ $daoTudu = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Tudu', Tudu_Dao_Manager::DB_TS); $tudus = $daoTudu->getTudus(array('tuduids' => $tuduIds)); $result = array(); $success = 0; foreach ($tudus as $tudu) { try { $modelManage->execute('delete', array(&$tudu)); } catch (Model_Tudu_Exception $e) { $code = TuduX_OpenApi_ResponseCode::SUCCESS; switch ($e->getCode()) { case Model_Tudu_Manage::CODE_PERMISSION_DENY: $code = TuduX_OpenApi_ResponseCode::ACCESS_DENIED; break; case Model_Tudu_Manage::TUDU_DELETE_GROUP: $code = TuduX_OpenApi_ResponseCode::TUDU_DELETE_GROUP; break; default: $code = TuduX_OpenApi_ResponseCode::TUDU_DELETE_FAILED; break; } $result[$tudu->tuduId] = $code; continue; } $result[$tudu->tuduId] = TuduX_OpenApi_ResponseCode::SUCCESS; $success++; } // 不存在的 $diff = array_diff($tuduIds, array_keys($result)); foreach ($diff as $id) { $result[$id] = TuduX_OpenApi_ResponseCode::SUCCESS; $success++; } $this->view->code = $success > 0 ? TuduX_OpenApi_ResponseCode::SUCCESS : TuduX_OpenApi_ResponseCode::TUDU_DELETE_FAILED; if ($isDetail) { $this->view->detail = $result; } }
/** * 过滤转发条件 * 1.当前用户具有图度转发权限 * 2.图度必须存在且已被发送 * 3.当前操作用户必须为图度执行人 * 4.当前图度不能是图度组 * * @see Model_Tudu_Compose_Abstract::filter() */ public function filter(Model_Tudu_Tudu &$tudu) { /* @var $daoTudu Dao_Td_Tudu_Tudu */ $daoTudu = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Tudu', Tudu_Dao_Manager::DB_TS); // 权限 if (!$this->_user->getAccess()->isAllowed(Tudu_Access::PERM_FORWARD_TUDU)) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Not allow to divide tudu', Model_Tudu_Exception::PERMISSION_DENIED); } // 无效的图度 if (!$tudu->tuduId) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Tudu not exists', Model_Tudu_Exception::TUDU_NOTEXISTS); } $this->_fromTudu = $daoTudu->getTuduById($this->_user->uniqueId, $tudu->tuduId); // 图度不存在或已被删除 if (null === $this->_fromTudu) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Tudu not exists', Model_Tudu_Exception::TUDU_NOTEXISTS); } // 草稿 if ($this->_fromTudu->isDraft) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Could not divide a draft tudu', Model_Tudu_Exception::TUDU_IS_DRAFT); } // 不是执行人 if (!in_array($this->_user->userName, $this->_fromTudu->accepter)) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Not allow to divide tudu', Model_Tudu_Exception::PERMISSION_DENIED); } // 工作流任务不能分工 if ($this->_fromTudu->flowId) { require_once 'Model/Tudu/Exception.php'; throw new Model_Tudu_Exception('Could not divide Tudu have flow', Model_Tudu_Exception::TUDU_IS_TUDUFLOW); } // 是否允许修改 $boards = $this->_getBoards(); $board = $boards[$this->_fromTudu->boardId]; $isSender = $this->_fromTudu->sender == $this->_user->userName; $isModerator = array_key_exists($this->_user->userId, $board['moderators']); $isSuperModerator = !empty($board['parentid']) && array_key_exists($this->_user->userId, $boards[$board['parentid']]['moderators']); if (!$this->_user->getAccess()->isAllowed(Tudu_Access::PERM_UPDATE_TUDU) || !$isSender && !$isModerator && !$isSuperModerator) { $this->_isModified = false; } $tudu->fromTudu = $this->_fromTudu; }
/** * * @param Model_Tudu_Tudu $tudu */ public function action(Model_Tudu_Tudu &$tudu) { $meeting = $tudu->getExtension('Model_Tudu_Extension_Meeting'); /* @var $daoMeeting Dao_Td_Tudu_Meeting */ $daoMeeting = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Meeting', Tudu_Dao_Manager::DB_TS); $params = $meeting->getAttributes(); if ($params['notifytype']) { $params['notifytime'] = Dao_Td_Tudu_Meeting::calNotifyTime(strtotime($tudu->starttime), $params['notifytype']); } else { $params['notifytime'] = null; } if ($daoMeeting->existsMeeting($tudu->tuduId)) { $daoMeeting->updateMeeting($tudu->tuduId, $params); } else { $params['tuduid'] = $tudu->tuduId; $daoMeeting->createMeeting($params); } }
/** * (non-PHPdoc) * @see Model_Tudu_Compose_Abstract::send() */ public function send(Model_Tudu_Tudu &$tudu) { /* @var $daoTudu Dao_Td_Tudu_Tudu */ $daoTudu = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Tudu', Tudu_Dao_Manager::DB_TS); // 添加到发起人草稿箱 $labels = $daoTudu->addUser($tudu->tuduId, $this->_user->uniqueId, array()); if (false !== $labels) { if (is_string($labels)) { $labels = explode(',', $labels); } else { $labels = array(); } // 添加到草稿箱 if (!in_array('^r', $labels)) { $daoTudu->addLabel($tudu->tuduId, $this->_user->uniqueId, '^r'); } } }
/** * * @param Model_Tudu_Tudu $tudu */ public function action(Model_Tudu_Tudu &$tudu) { $remind = $tudu->getExtension('Model_Tudu_Extension_Remind'); $params = $remind->getAttributes(); /* @var $daoRemind Dao_Td_Tudu_Remind */ $daoRemind = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Remind', Tudu_Dao_Manager::DB_TS); if ($params['action'] == 'update') { if (empty($params)) { $params['isvalid'] = 0; } $daoRemind->updateRemind($tudu->tuduId, $params); } else { if ($params['isvalid']) { $params['tuduid'] = $tudu->tuduId; $daoRemind->createRemind($params); } } }
/** * 过期任务自动确认 */ public function markDone($db) { $labelId = '^o'; $sql = "SELECT tudu_id, org_id FROM td_tudu WHERE type='task' AND status > 1 AND is_done = 0 AND last_post_time < (UNIX_TIMESTAMP() - 86400 * 7 - UNIX_TIMESTAMP() % 86400) ORDER BY last_post_time ASC"; $records = $db->fetchAll($sql, array(), Zend_Db::FETCH_NUM); Tudu_Dao_Manager::setDb(Tudu_Dao_Manager::DB_TS, $db, true); $manager = Tudu_Tudu_Manager::getInstance(); $daoLog = Tudu_Dao_Manager::getDao('Dao_Td_Log_Log', Tudu_Dao_Manager::DB_TS); foreach ($records as $record) { $tuduId = $record[0]; $orgId = $record[1]; $rows = $db->fetchAll("SELECT tudu_id, unique_id FROM td_tudu_user WHERE tudu_id = '{$tuduId}' AND labels LIKE '%^all%' AND labels NOT LIKE '%{$labelId}%'"); $flag = true; foreach ($rows as $row) { // 移除“图度箱”标签 $ret = $manager->deleteLabel($row['tudu_id'], $row['unique_id'], '^i'); // 移除“我执行”标签 $ret = $manager->deleteLabel($row['tudu_id'], $row['unique_id'], '^a'); if ($ret) { // 添加“已完成”标签 $ret = $manager->addLabel($row['tudu_id'], $row['unique_id'], $labelId); } if (false === $ret) { $flag = false; $this->getLogger()->warn("Move Label:[{$row['tudu_id']}][{$row['unique_id']}] Failured"); continue; } } if ($flag) { // 标记图度完结 $flag = $manager->updateTudu($tuduId, array('isdone' => true)); if (!$flag) { $this->getLogger()->warn("Done tudu:[{$tuduId}] Failured"); continue; } else { // 成功记录操作日志 $daoLog->createLog(array('orgid' => $orgId, 'targettype' => Dao_Td_Log_Log::TYPE_TUDU, 'targetid' => $tuduId, 'uniqueid' => '^system', 'action' => Dao_Td_Log_Log::ACTION_TUDU_DONE, 'detail' => serialize(array('isdone' => true)), 'logtime' => time())); } } $this->getLogger()->info("Done tudu:[{$tuduId}] success"); } }
/** * * @param Model_Tudu_Tudu $tudu */ public function filter(Model_Tudu_Tudu &$tudu) { $cycle = $tudu->getExtension('Model_Tudu_Extension_Cycle'); if (null !== $cycle) { $tudu->cycleId = $cycle->cycleId; $tudu->special = 1; } /* @var $daoCycle Dao_Td_Tudu_Cycle */ $daoCycle = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Cycle', Tudu_Dao_Manager::DB_TS); $params = $cycle->getAttributes(); if (null !== $daoCycle->getCycle(array('cycleid' => $cycle->cycleId))) { $ret = $daoCycle->updateCycle($cycle->cycleId, $params); } else { $ret = $daoCycle->createCycle($params); } if (!$ret) { $tudu->cycleId = null; $tudu->special = 0; } }
/** * 获取图度工作流列表 */ public function listAction() { $boardId = $this->_request->getQuery('boardid'); /* @var $daoFlow Dao_Td_Board_Board */ $daoFlow = Tudu_Dao_Manager::getDao('Dao_Td_Flow_Flow', Tudu_Dao_Manager::DB_TS); $conditions = array('orgid' => $this->_user->orgId); if (!empty($boardId)) { $conditions['boardid'] = $boardId; } $flows = $daoFlow->getFlows(array('orgid' => $this->_user->orgId, 'uniqueid' => $this->_user->uniqueId))->toArray(); $ret = array(); foreach ($flows as $item) { if (!$item['avaliable']) { continue; } $ret[] = array('orgid' => $item['orgid'], 'boardid' => $item['boardid'], 'flowid' => $item['flowid'], 'subject' => $item['subject'], 'createtime' => $item['createtime']); } $this->view->code = TuduX_OpenApi_ResponseCode::SUCCESS; $this->view->flows = $ret; }
/** * 执行讨论数据处理 */ public function run() { foreach ($this->_dbs as $key => $db) { // 清理过期讨论 $sql = 'SELECT tudu_id, org_id FROM td_tudu WHERE type = \'discuss\' AND end_time IS NOT NULL ' . 'AND is_draft = 0 AND is_done = 0 AND end_time < ' . strtotime('today'); Tudu_Dao_Manager::setDb(Tudu_Dao_Manager::DB_TS, $db, true); $manager = Tudu_Tudu_Manager::getInstance(); $daoLog = Tudu_Dao_Manager::getDao('Dao_Td_Log_Log', Tudu_Dao_Manager::DB_TS); $array = $db->fetchAll($sql); foreach ($array as $item) { if ($manager->closeTudu($item['tudu_id'], true)) { $this->getLogger()->info("Discuss id:({$item['tudu_id']}) close success"); // 成功记录操作日志 $daoLog->createLog(array('orgid' => $item['org_id'], 'targettype' => Dao_Td_Log_Log::TYPE_TUDU, 'targetid' => $item['tudu_id'], 'uniqueid' => '^system', 'action' => Dao_Td_Log_Log::ACTION_CLOSE, 'detail' => serialize(array('isdone' => true)), 'logtime' => time())); continue; } $this->getLogger()->warn("Discuss id:{$item['tudu_id']} close failure"); } $this->getLogger()->info("Ts db:({$key}) process complete"); } }
/** * 获取当前应用信息 */ protected final function _getAppInfo() { if (!is_string($this->_appId)) { return null; } $key = 'TUDU-APP-' . $this->_user->orgId . '@' . $this->_appId; $info = $this->cache->get($key); if (!$info) { /* @var $daoApp Dao_Md_App_App */ $daoApp = Tudu_Dao_Manager::getDao('Dao_Md_App_App'); $info = $daoApp->getApp($this->_appId, $this->_user->orgId); if (null == $info) { return null; } if ($info->orgId != $this->_user->orgId) { return null; } $this->cache->set($key, $info, null, 86400); } return $info; }
/** * */ public function saveSettingAction() { $setting = $this->_request->getParam('setting'); $setting = json_decode($setting, true); if (!$setting) { $this->view->code = TuduX_OpenApi_ResponseCode::MISSING_PARAMETER; $this->view->message = 'Parameter "setting" is not a valided JSON string'; return; } /* @var $daoUser Dao_Md_User_User */ $daoOption = Tudu_Dao_Manager::getDao('Dao_Md_User_Option', Tudu_Dao_Manager::DB_MD); $data = $daoOption->getOption(array('orgid' => $this->_user->orgId, 'userid' => $this->_user->userId)); if (null == $data) { $this->view->code = TuduX_OpenApi_ResponseCode::RESOURCE_NOT_EXISTS; $this->view->message = 'User had been delete'; return; } $settings = $data->settings; $settings['ios'] = $setting; $daoOption->updateOption($this->_user->orgId, $this->_user->userId, array('settings' => json_encode($settings))); $this->view->code = 0; }
/** * 验证操作 */ public function authorizeAction() { $grantType = $this->_request->getParam('grant_type'); $memcache = $this->_bootstrap->getResource('memcache'); try { $storage = new TuduX_OAuth_Storage_Session(); $storage->setMemcache($memcache); $oauth = new OpenApi_OAuth_OAuth(array(OpenApi_OAuth_OAuth::STORAGE => $storage)); $oauth->setGrantClass(OpenApi_OAuth_OAuth::GRANT_TYPE_USER_CREDENTIALS, 'TuduX_OAuth_Grant_User'); $params = array(OpenApi_OAuth_OAuth::PARAM_GRANT_TYPE => $grantType, OpenApi_OAuth_OAuth::PARAM_CLIENT_ID => $this->_request->getParam(OpenApi_OAuth_OAuth::PARAM_CLIENT_ID), OpenApi_OAuth_OAuth::PARAM_CLIENT_SECRET => $this->_request->getParam(OpenApi_OAuth_OAuth::PARAM_CLIENT_SECRET), OpenApi_OAuth_OAuth::PARAM_SCOPE => $this->_request->getParam(OpenApi_OAuth_OAuth::PARAM_SCOPE)); switch ($grantType) { case OpenApi_OAuth_OAuth::GRANT_TYPE_USER_CREDENTIALS: $params[OpenApi_OAuth_OAuth::PARAM_USERNAME] = $this->_request->getParam('username'); $params[OpenApi_OAuth_OAuth::PARAM_PASSWORD] = $this->_request->getParam('password'); break; case OpenApi_OAuth_OAuth::GRANT_TYPE_REFRESH_TOKEN: $params[OpenApi_OAuth_OAuth::PARAM_REFRESH_TOKEN] = $this->_request->getParam('refresh_token'); break; } $assign = $oauth->grantAccessToken($params); $token = $oauth->getStorage()->getAccessToken($assign['access_token']); // 获取用户设置 /* @var $daoUser Dao_Md_User_User */ $daoOption = Tudu_Dao_Manager::getDao('Dao_Md_User_Option', Tudu_Dao_Manager::DB_MD); $data = $daoOption->getOption(array('orgid' => $token['auth']['orgid'], 'userid' => $token['auth']['userid'])); if (!empty($data->settings['ios'])) { $assign['setting'] = $data->settings['ios']; } else { $assign['setting'] = array('push' => array('task' => 1, 'discuss' => 1, 'notice' => 1, 'meeting' => 1)); } $this->view->assign($assign); } catch (OpenApi_OAuth_Exception $e) { //$this->getResponse()->setHttpResponseCode(401); $this->view->code = TuduX_OpenApi_ResponseCode::AUTHORIZE_FAILED; $this->view->error = $e->getError(); $this->view->error_description = $e->getDescription(); } }
/** * 保存会议数据 * * @param $data */ public function onSave(Tudu_Model_Tudu_Entity_Tudu $tudu, Tudu_Model_Tudu_Entity_Extension_Abstract $data) { /* @var $daoMeeting Dao_Td_Tudu_Meeting */ $daoVote = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Vote', Tudu_Dao_Manager::DB_TS); $attrs = $data->getAttributes(); $options = $data->getOptions(); $vote = array(); if (isset($attrs['maxchoices']) && is_int($attrs['maxchoices'])) { $vote['maxchoices'] = $attrs['maxchoices']; } if (isset($attrs['privacy'])) { $vote['privacy'] = $attrs['privacy'] ? 1 : 0; } if (isset($attrs['visible'])) { $vote['visible'] = $attrs['visible'] ? 1 : 0; } if (isset($attrs['expiretime']) && is_int($attrs['expiretime'])) { $vote['expiretime'] = $attrs['expiretime']; } if (isset($attrs['votecount'])) { $vote['votecount'] = (int) $attrs['votecount']; } $vote['tuduid'] = $tudu->tuduId; if ($daoVote->existsVote($tudu->tuduId)) { $ret = $daoVote->updateVote($tudu->tuduId, $vote); } else { $ret = $daoVote->createVote($vote); } foreach ($options as $option) { if (!empty($option['isnew'])) { $option['tuduid'] = $tudu->tuduId; $daoVote->createOption($option); } else { $daoVote->updateOption($tudu->tuduId, $option['optionid'], $option); } } }
/** * 外发会议 * * @param array $params */ public function sendMeeting($params) { if (empty($params['tuduid']) || empty($params['tsid']) || empty($params['uniqueid']) || empty($params['from']) || empty($params['content']) || empty($params['location'])) { return; } $tuduId = $params['tuduid']; $uniqueId = $params['uniqueid']; $tsId = $params['tsid']; $to = !empty($params['to']) ? explode(',', $params['to']) : null; $sender = $params['from']; $content = $params['content']; $location = $params['location']; /* @var $manager Tudu_Tudu_Manager */ $manager = Tudu_Tudu_Manager::getInstance(Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_TS)); $tudu = $manager->getTuduById($tuduId, $uniqueId); if (null == $tudu) { $this->getLogger()->warn("Tudu id:{$tuduId} is not exists"); return; } // 获取接收人 $receivers = $manager->getTuduUsers($tudu->tuduId); $emails = array(); /* @var $daoContact Dao_Td_Contact_Contact */ $daoContact = Tudu_Dao_Manager::getDao('Dao_Td_Contact_Contact', Tudu_Dao_Manager::DB_TS); // 处理接收人数据 foreach ($receivers as $receiver) { $info = explode(' ', $receiver['accepterinfo'], 3); $email = $info[0]; $name = !empty($info[1]) ? $info[1] : null; $contactId = isset($info[2]) ? $info[2] : null; if ($name == null && $email) { $arr = explode('@', $email); $name = array_shift($arr); } if (!$email && !$name) { continue; } if (!empty($to) && !in_array($email, $to)) { continue; } if ($receiver['isforeign']) { $auth = $receiver['authcode']; if (Oray_Function::isEmail($email) && $uniqueId != $receiver['uniqueid']) { $array = array('address' => $email, 'name' => $name, 'authinfo' => '', 'url' => 'http://' . $tudu->orgId . '.com/foreign/tudu?ts=' . $tsId . '&tid=' . $tudu->tuduId . '&fid=' . $receiver['uniqueid']); if ($auth) { $array['authinfo'] = '<p style="margin:10px 0">打开任务链接后需要输入以下验证码:<strong style="color:#f00">' . $auth . '</strong></p>'; } $emails[] = $array; } } } // 执行外发 $tpl = $this->_options['data']['path'] . '/templates/tudu/mail_meeting_notify.tpl'; if (!file_exists($tpl) || !is_readable($tpl)) { $this->getLogger()->warn("Tpl file:\"mail_meeting_notify.tpl\" is not exists"); return; } // 公用信息 $common = array('subject' => $tudu->subject, 'sender' => $sender, 'lastupdate' => date('Y-m-d H:i:s', $tudu->lastPostTime), 'content' => mb_substr(strip_tags($content), 0, 20, 'utf-8'), 'type' => $this->_typeNames[$tudu->type]); $mailTransport = $this->getMailTransport($this->_balancer->select()); $template = $this->_assignTpl(file_get_contents($tpl), $common); foreach ($emails as $email) { try { $mail = new Zend_Mail('utf-8'); $mail->setFrom($this->_options['smtp']['from']['alert'], urldecode($this->_options['smtp']['fromname'])); $mail->addTo($email['address'], $email['name']); $mail->addHeader('tid', $tudu->tuduId); $mail->setSubject("图度{$this->_typeNames[$tudu->type]}——" . $tudu->subject . '[会议提醒]'); $mail->setBodyHtml($this->_assignTpl($template, $email)); $mail->send($mailTransport); } catch (Zend_Mail_Exception $ex) { $this->getLogger()->warn("[Failed] Email send type:{$this->_typeNames[$tudu->type]} TuduId:{$tuduId} retry\n{$ex}"); continue; } } $this->getLogger()->debug("Send Meeting id:{$tuduId} done"); }
/** * 获取部门列表 * * @param string $orgId */ protected function _getDepartments($orgId) { if (null === $this->_depts) { /* @var Dao_Md_Department_Department */ $daoDepts = Tudu_Dao_Manager::getDao('Dao_Md_Department_Department', Tudu_Dao_Manager::DB_MD); $this->_depts = $daoDepts->getDepartments(array('orgid' => $orgId))->toArray('deptid'); } return $this->_depts; }
/** * 获取版块列表 * 不进行格式化 * * @param string $orgId */ protected function _getBoards($orgId) { if (null === $this->_boards) { /* @var $daoBoard Dao_Td_Board_Board */ $daoBoard = Tudu_Dao_Manager::getDao('Dao_Td_Board_Board', Tudu_Dao_Manager::DB_TS); $boards = array(); $this->_boards = $daoBoard->getBoards(array('orgid' => $orgId)); } return $this->_boards; }
/** * 生成组织ID * * @param unknown_type $from */ protected function _getOrgId($from) { // 查找应用组织关联表 $daoAssociate = Tudu_Dao_Manager::getDao('Dao_Md_Org_Associate', Tudu_Dao_Manager::DB_MD); $count = $daoAssociate->getOrgCount(array('from' => $from)); $pfx = $base = ord($from); $base = $base * $base * 10; return $pfx . $base . ($count + 1); }
/** * 记录图度日志 * @param Model_Tudu_Tudu $tudu */ protected function _tuduLog($action, Model_Tudu_Tudu $tudu) { $detail = $this->_getLogDetail($tudu); $detail = serialize($detail); $daoLog = Tudu_Dao_Manager::getDao('Dao_Td_Log_Log', Tudu_Dao_Manager::DB_TS); return $daoLog->createLog(array('orgid' => $this->_user->orgId, 'uniqueid' => $this->_user->uniqueId, 'operator' => $this->_user->userName . ' ' . $this->_user->trueName, 'logtime' => time(), 'targettype' => 'tudu', 'targetid' => $tudu->tuduId, 'action' => $action, 'detail' => $detail, 'privacy' => 0)); }
/** * 创建图度步骤 * * @param Model_Tudu_Tudu $tudu */ public function createTuduSteps(Model_Tudu_Tudu &$tudu) { /* @var $daoStep Dao_Td_Tudu_Step */ $daoStep = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Step', Tudu_Dao_Manager::DB_TS); $steps = array(); $currentStepId = null; $orderNum = 1; if ($tudu->reviewer) { $reviewers = $tudu->reviewer; $users = array(); $processIndex = 1; foreach ($reviewers as $item) { foreach ($item as $reviewer) { $users[] = array('email' => $reviewer['email'], 'truename' => $reviewer['truename'], 'processindex' => $processIndex, 'stepstatus' => $processIndex == 1 ? 1 : 0); } $processIndex++; } $stepId = Dao_Td_Tudu_Step::getStepId(); $steps[$stepId] = array('orgid' => $tudu->orgId, 'tuduid' => $tudu->tuduId, 'uniqueid' => $tudu->uniqueId, 'stepid' => $stepId, 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE, 'prevstepid' => self::NODE_HEAD, 'nextstepid' => self::NODE_END, 'users' => $users, 'ordernum' => $orderNum++, 'createtime' => time()); $currentStepId = $stepId; } if ($tudu->to) { $stepId = Dao_Td_Tudu_Step::getStepId(); $prevId = self::NODE_HEAD; if ($currentStepId) { $steps[$currentStepId]['nextstepid'] = $stepId; $prevId = $currentStepId; } else { $currentStepId = $stepId; } $steps[$stepId] = array('orgid' => $tudu->orgId, 'tuduid' => $tudu->tuduId, 'uniqueid' => $tudu->uniqueId, 'stepid' => $stepId, 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE, 'prevstepid' => $prevId, 'nextstepid' => self::NODE_END, 'users' => $tudu->to, 'ordernum' => $orderNum++, 'createtime' => time()); } foreach ($steps as $step) { if ($this->createStep($step)) { $recipients = $this->_prepareRecipients($tudu->orgId, $tudu->uniqueId, $step['users']); $processIndex = $step['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE ? 0 : null; $this->_addStepUsers($tudu->tuduId, $step['stepid'], $recipients, $processIndex); } } $tudu->stepId = $currentStepId; $tudu->stepNum = count($steps); }
/** * * @param $className * @return Oray_Dao_Abstract */ private function getDao($className) { return Tudu_Dao_Manager::getDao($className, Tudu_Dao_Manager::DB_TS); }
/** * 保存权限设置 */ public function saveAction() { /* @var $daoAppUser Dao_App_App_User */ $daoAppUser = Tudu_Dao_Manager::getDao('Dao_App_App_User', Tudu_Dao_Manager::DB_APP); $daoApp = Tudu_Dao_Manager::getDao('Dao_App_App_App', Tudu_Dao_Manager::DB_APP); $app = $daoApp->getApp(array('orgid' => $this->_user->orgId, 'appid' => $this->_appId)); if (!$app || $app->orgId != $this->_user->orgId) { return $this->json(false, '未安装该应用程序'); } $status = (int) $this->getRequest()->getPost('status'); $checkoutRemind = $this->_request->getPost('checkoutremind'); $settings = array('checkoutremind' => $checkoutRemind); $params = array('status' => $status, 'settings' => json_encode($settings)); if ($status == Dao_App_App_App::STATUS_NORMAL && $app->status != $status) { $params['activetime'] = strtotime('tomorrow'); } $ret = $daoApp->updateApp($this->_user->orgId, $this->_appId, $params); if (!$ret) { return $this->json(false, '更新应用状态失败'); } $daoAppUser->deleteUsers($this->_user->orgId, $this->_appId); $roles = array(Dao_App_App_User::ROLE_ADMIN, Dao_App_App_User::ROLE_DEF, Dao_App_App_User::ROLE_SUM, Dao_App_App_User::ROLE_SC); $more = (bool) $this->_request->getPost('more'); foreach ($roles as $role) { if (!$more && in_array($role, array(Dao_App_App_User::ROLE_DEF, Dao_App_App_User::ROLE_SUM, Dao_App_App_User::ROLE_SC))) { continue; } $val = $this->getRequest()->getPost($role); $val = explode("\n", $val); foreach ($val as $item) { $daoAppUser->addUserRole(array('orgid' => $this->_user->orgId, 'appid' => $this->_appId, 'itemid' => $item, 'role' => $role)); } } return $this->json(true, '保存应用设置成功'); }
/** * 更新权限组权限 */ public function updateAccess(array $params) { // 组织ID必须有 if (empty($params['orgid'])) { require_once 'Model/User/Exception.php'; throw new Model_User_Exception('Missing or invalid value of parameter "orgid"', self::CODE_INVALID_ORGID); } // 权限组ID,必须有 if (empty($params['roleid'])) { require_once 'Model/User/Exception.php'; throw new Model_User_Exception('Missing or invalid value of parameter "groupname"', self::CODE_INVALID_ROLEID); } $orgId = $params['orgid']; $roleId = $params['roleid']; $accesses = $params['access']; // 是否已验证权限组是否存在 $isVerify = !empty($params['isverify']) ? true : false; /* @var $daoRole Dao_Md_User_Role */ $daoRole = Tudu_Dao_Manager::getDao('Dao_Md_User_Role', Tudu_Dao_Manager::DB_MD); if (!$isVerify) { $existRole = $daoRole->existsRole($orgId, $roleId); if (!$existRole) { require_once 'Model/User/Exception.php'; throw new Model_User_Exception('Role "' . $roleId . '" not exists', self::CODE_ROLE_NOTEXISTS); } } if ($daoRole->removeAccess($orgId, $roleId)) { foreach ($accesses as $access) { $daoRole->addAccess($orgId, $roleId, array('accessid' => $access['accessid'], 'value' => $access['value'])); } return; } require_once 'Model/User/Exception.php'; throw new Model_User_Exception('Update role access failed', self::CODE_SAVE_FAILED); }
/** * 写入操作日志 * * @param string $targetType * @param string $targetId * @param string $action * @param array $detail * @param array $params * @param boolean $privacy * @param boolean $isSystem */ protected function _writeLog($targetType, $targetId, $action, array $params, $detail = null, $privacy = false, $isSystem = false) { if (null !== $detail) { $detail = serialize($detail); } /* @var $daoLabel Dao_Td_Log_Log */ $daoLog = Tudu_Dao_Manager::getDao('Dao_Td_Log_Log', Tudu_Dao_Manager::DB_TS); $daoLog->createLog(array('orgid' => $params['orgid'], 'uniqueid' => $params['uniqueid'], 'operator' => $isSystem ? '^system 图度系统' : $params['userinfo'], 'logtime' => time(), 'targettype' => $targetType, 'targetid' => $targetId, 'action' => $action, 'detail' => $detail, 'privacy' => $privacy ? 1 : 0)); }
/** * 获取用户排班计划 * 没有设置则返回默认班信息 */ public function getPlan($orgId, $uniqueId, $date) { /* @var $daoAdjust Dao_App_Attend_Schedule_Adjust */ $daoAdjust = Tudu_Dao_Manager::getDao('Dao_App_Attend_Schedule_Adjust', Tudu_Dao_Manager::DB_APP); // 若调整为非工作日,返回null $adjust = $daoAdjust->getUserAdjust(array('uniqueid' => $uniqueId, 'datetime' => $date)); if (null !== $adjust && $adjust->type == 0) { return null; } /* @var $daoSchedule Dao_App_Attend_Schedule */ $daoSchedule = Tudu_Dao_Manager::getDao('Dao_App_Attend_Schedule', Tudu_Dao_Manager::DB_APP); /* @var $daoPlan Dao_App_Attend_Schedule_Plan */ $daoPlan = Tudu_Dao_Manager::getDao('Dao_App_Attend_Schedule_Plan', Tudu_Dao_Manager::DB_APP); // 读取当前月排班计划 $condition = array('date' => date('Ym', $date), 'uniqueid' => $uniqueId); $plan = $daoPlan->getMonthPlan($condition); $day = date('j', $date); if ($plan !== null) { $plan = $plan->toArray(); $plan = $plan['plan']; if (!empty($plan) && isset($plan[$day])) { $scheduleId = $plan[$day]; } } else { $weekPlan = $daoPlan->getWeekPlan(array('uniqueid' => $uniqueId)); if ($weekPlan !== null) { $weekPlan = $weekPlan->toArray(); $scheduleId = $this->getPlanByWeekPlan($weekPlan, $date); } } $schedule = null; if (!empty($scheduleId)) { if ($scheduleId != '^off') { if ($scheduleId == '^default') { $query = array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date), 'status' => 1); if (!empty($adjust) && $adjust->type == 1) { $query = array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date)); } $schedule = $daoSchedule->getSchedule($query); $schedule = null !== $schedule ? $schedule->toArray() : null; } else { $schedule = $daoSchedule->getSchedule(array('orgid' => $orgId, 'scheduleid' => $scheduleId), array('isvalid' => true)); if (null === $schedule) { $query = array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date), 'status' => 1); if (!empty($adjust) && $adjust->type == 1) { $query = array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date)); } $schedule = $daoSchedule->getSchedule($query); } $schedule = null !== $schedule ? $schedule->toArray() : null; } } else { // 非工作日的调整成工作日的,默认班填充 if (!empty($adjust) && $adjust->type == 1) { $schedule = $daoSchedule->getSchedule(array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date))); $schedule = null !== $schedule ? $schedule->toArray() : null; } } } else { $schedule = $daoSchedule->getSchedule(array('orgid' => $orgId, 'scheduleid' => '^default', 'week' => date('w', $date))); $schedule = null !== $schedule ? $schedule->toArray() : null; if (empty($adjust) && !empty($schedule) && !$schedule['status']) { $schedule = null; } } return $schedule; }
/** * (non-PHPdoc) * @see Model_Tudu_Compose_Abstract::send() */ public function send(Model_Tudu_Tudu &$tudu) { /* @var $daoTudu Dao_Td_Tudu_Tudu */ $daoTudu = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Tudu', Tudu_Dao_Manager::DB_TS); $user = Tudu_User::getInstance(); // 发送图度 if ($this->_fromTudu->type == 'task' && !$tudu->reviewer && !$tudu->isDraft) { // 移除当前执行人 $daoTudu->removeAccepter($tudu->tuduId, $this->_user->uniqueId); $daoTudu->deleteLabel($tudu->tuduId, $this->_user->uniqueId, '^a'); } $daoTudu->addLabel($tudu->tuduId, $this->_user->uniqueId, '^w'); }
/** * /compose/reply * * 回覆 */ public function replyAction() { $tuduId = $this->_request->getPost('tid'); $action = $this->_request->getPost('action'); $type = $this->_request->getPost('type'); $post = $this->_request->getPost(); $uniqueId = $this->_user->uniqueId; $fromPost = null; $fromPostId = trim($this->_request->getPost('fpid')); $isDoneTudu = false; /* @var $manager Tudu_Tudu_Manager */ $manager = Tudu_Tudu_Manager::getInstance(); /* @var $storage Tudu_Tudu_Storage */ $storage = Tudu_Tudu_Storage::getInstance(); $tudu = $manager->getTuduById($tuduId, $uniqueId); if (null === $tudu) { return $this->json(false, $this->lang['tudu_not_exists']); } // 编辑回复的权限判断 if ($this->_user->orgId != $tudu->orgId) { return $this->json(false, $this->lang['tudu_not_exists']); } // 已确认图度 if ($tudu->isDone) { return $this->json(false, $this->lang['tudu_is_done']); } if ($fromPostId) { $fromPost = $manager->getPostById($tuduId, $fromPostId); } $isReceiver = $this->_user->uniqueId == $tudu->uniqueId && count($tudu->labels); $isAccepter = in_array($this->_user->userName, $tudu->accepter, true); $isSender = in_array($tudu->sender, array($this->_user->address, $this->_user->account)); $sendParam = array(); if ('modify' == $action) { if (null == $fromPost) { return $this->json(false, $this->lang['post_not_exists']); } // 编辑回复的权限判断 if (!$this->_user->getAccess()->isAllowed(Tudu_Access::PERM_UPDATE_POST) && $fromPost->isSend) { return $this->json(false, $this->lang['perm_deny_update_post']); } // 非回复者时,需要判断版主的权限 if ($fromPost->uniqueId != $this->_user->uniqueId) { $boards = $this->getBoards(false); $board = $boards[$tudu->boardId]; $isModerators = array_key_exists($this->_user->userId, $board['moderators']); if (!$isModerators) { return $this->json(false, $this->lang['perm_deny_update_post']); } } if (!$fromPost->isSend) { $sendParam['remind'] = true; } } else { // 发表回复的权限判断 - 参与人员或回复权限 if (!$isReceiver && !$this->_user->getAccess()->isAllowed(Tudu_Access::PERM_CREATE_POST)) { return $this->json(false, $this->lang['perm_deny_create_post']); } // 需要发送提醒 $sendParam['remind'] = true; } // 空内容 if ($type != 'save' && empty($post['content'])) { return $this->json(false, $this->lang['missing_content']); } // 构造参数 $params = array('orgid' => $tudu->orgId, 'boardid' => $tudu->boardId, 'tuduid' => $tudu->tuduId, 'uniqueid' => $uniqueId, 'email' => $this->_user->userName, 'poster' => $this->_user->trueName, 'posterinfo' => $this->_user->position, 'content' => $post['content'], 'attachment' => !empty($post['attach']) ? array_unique((array) $post['attach']) : array(), 'file' => !empty($post['file']) ? array_unique((array) $post['file']) : array()); $elapsedtime = round((double) $this->_request->getPost('elapsedtime'), 2) * 3600; $percent = min(100, (int) $this->_request->getPost('percent')); if ($fromPost && $fromPost->isSend) { $isLog = $fromPost->isLog; $params['elapsedtime'] = $fromPost->elapsedtime; $params['percent'] = $fromPost->percent; } else { if (isset($post['percent'])) { $isLog = $percent != $tudu->selfPercent || $elapsedtime > 0; } else { $isLog = $elapsedtime > 0; } } $params['islog'] = $isLog; if ($isLog && $tudu->selfPercent < 100) { $params['elapsedtime'] = $elapsedtime; $params['percent'] = $percent; } // 处理网盘附件 if (!empty($post['nd-attach'])) { $params['attachment'] = array_diff($params['attachment'], $post['nd-attach']); $daoNdFile = $this->getDao('Dao_Td_Netdisk_File'); $daoAttachment = $this->getDao('Dao_Td_Attachment_File'); foreach ($post['nd-attach'] as $ndfileId) { $fileId = $ndfileId; $attach = $daoAttachment->getFile(array('fileid' => $fileId)); if (null !== $attach) { $params['attachment'][] = $fileId; continue; } $file = $daoNdFile->getFile(array('uniqueid' => $this->_user->uniqueId, 'fileid' => $ndfileId)); if ($file->fromFileId) { $fileId = $file->fromFileId; } if ($file->attachFileId) { $fileId = $file->attachFileId; } $ret = $daoAttachment->createFile(array('uniqueid' => $this->_user->uniqueId, 'fileid' => $fileId, 'orgid' => $this->_user->orgId, 'filename' => $file->fileName, 'path' => $file->path, 'type' => $file->type, 'size' => $file->size, 'createtime' => time())); if ($ret) { $params['attachment'][] = $fileId; } } } if (!$fromPost) { $postId = $storage->createPost($params); if (!$postId) { return $this->json(false, $this->lang['post_send_failure']); } // 添加操作日志 $this->_writeLog(Dao_Td_Log_Log::TYPE_POST, $postId, Dao_Td_Log_Log::ACTION_CREATE, $params); } else { $postId = $fromPost->postId; // 增加最后编辑信息 if ($fromPost->isSend) { $params['lastmodify'] = implode(chr(9), array($uniqueId, $this->_timestamp, $this->_user->trueName)); } else { $params['createtime'] = time(); } $storage->updatePost($tuduId, $postId, $params); // 记录更新内容 $arrFromPost = $fromPost->toArray(); $updates = array(); foreach ($params as $key => $val) { if (in_array($key, array('file', 'attachment'))) { continue; } if ($val != $arrFromPost[$key]) { $updates[$key] = $val; } } // 添加操作日志 $this->_writeLog(Dao_Td_Log_Log::TYPE_POST, $postId, Dao_Td_Log_Log::ACTION_CREATE, $updates); } if ($type != 'save') { // 未读 if (!$fromPost || !$fromPost->isSend) { $manager->markAllUnread($tudu->tuduId); } // 标记已经读 // 加入了批量更新和回复,所以在更新时就需要标示已读 if ($tudu->isRead) { $manager->markRead($tudu->tuduId, $this->_user->uniqueId, true); } $config = $this->bootstrap->getOption('httpsqs'); // 插入消息队列 $httpsqs = new Oray_Httpsqs($config['host'], $config['port'], $config['chartset'], $config['name']); $tuduPercent = $tudu->percent; $flowPercent = null; if ($isLog && $tudu->selfPercent < 100) { if ($tudu->flowId) { $tuduPercent = $manager->updateFlowProgress($tudu->tuduId, $tudu->uniqueId, $tudu->stepId, (int) $params['percent'], $flowPercent); } else { $tuduPercent = $manager->updateProgress($tudu->tuduId, $tudu->uniqueId, (int) $params['percent']); } if (!$fromPost || !$fromPost->isSend) { // 添加操作日志 $this->_writeLog(Dao_Td_Log_Log::TYPE_TUDU, $tudu->tuduId, Dao_Td_Log_Log::ACTION_TUDU_PROGRESS, array('percent' => $params['percent'], 'elapsedtime' => $tudu->elapsedTime + (int) $post['elapsedtime'])); } } // 自动确认 if ($isLog && $tuduPercent == 100 && null === $flowPercent || $isLog && $flowPercent == 100) { if ($isSender && $isAccepter || !$tudu->needConfirm) { $isDoneTudu = true; $doneParams = array('tuduid' => $tudu->tuduId, 'percent' => $params['percent'], 'elapsedtime' => $tudu->elapsedTime + (int) $post['elapsedtime']); // 添加到发起人图度箱 -- 待确认中 } else { /* @var $addressBook Tudu_AddressBook */ $addressBook = Tudu_AddressBook::getInstance(); $sender = $addressBook->searchUser($this->_user->orgId, $tudu->sender); $manager->addLabel($tudu->tuduId, $sender['uniqueid'], '^i'); } } // 计算父级图度进度 及 图度组达到100%时,确认 if ($tudu->parentId) { $parentPercent = $manager->calParentsProgress($tudu->parentId); if ($parentPercent >= 100) { $sendParam['confirm'] = true; } } // 发送回复 $manager->sendPost($tuduId, $postId); // 统计时间 if ($isLog) { $manager->calcElapsedTime($tuduId); } // 周期任务 if ($isLog && $tudu->cycleId && $tuduPercent >= 100) { $daoCycle = $this->getDao('Dao_Td_Tudu_Cycle'); $cycle = $daoCycle->getCycle(array('cycleid' => $tudu->cycleId)); if ($cycle->count == $tudu->cycleNum) { $sendParam['cycle'] = true; } } $sendParam['tuduid'] = $tudu->tuduId; $sendParam['from'] = $this->_user->userName; $sendParam['sender'] = $this->_user->trueName; $sendParam['uniqueid'] = $this->_user->uniqueId; $sendParam['postid'] = $postId; $sendParam['tsid'] = $this->_user->tsId; $sendParam['server'] = $this->_request->getServer('HTTP_HOST'); // 处理工作流 // 处理流程发送过程 if ($tudu->type == 'task' && $percent >= 100) { /* @var $daoFlow Dao_Td_Tudu_Flow */ $daoFlow = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Flow', Tudu_Dao_Manager::DB_TS); $flowData = $daoFlow->getFlow(array('tuduid' => $tudu->tuduId)); if (null !== $flowData) { /* @var $flow Model_Tudu_Extension_Flow */ $flow = new Model_Tudu_Extension_Flow($flowData->toArray()); $isCurrentUser = $flow->isCurrentUser($this->_user->uniqueId); $isComplete = false; if ($isCurrentUser) { $flow->complete($this->_user->uniqueId); if ($flow->isStepComplete()) { $isComplete = true; $flow->flowTo(); } } $modelFlow = $flow->getHandler($flow->getHandlerClass()); $modelFlow->updateFlow($flow); if ($flow->currentStepId != '^end') { $isDoneTudu = false; } // 发送下一步 if (false === strpos($flow->currentStepId, '^') && $isComplete) { $section = $flow->getStepSection($flow->currentStepId); $tuduParams = array('tuduid' => $tudu->tuduId, 'type' => $tudu->type, 'fromtudu' => $tudu); $users = array(); foreach ($section as $sec) { $users[$sec['username']] = array('uniqueid' => $sec['uniqueid'], 'truename' => $sec['truename'], 'username' => $sec['username'], 'email' => $sec['username']); } $step = $flow->getStep($flow->currentStepId); if ($step['type'] == 1) { $tuduParams['reviewer'] = $users; } else { $tuduParams['to'] = $users; if ($step['type'] == 2) { $tuduParams['acceptmode'] = 1; } } $sendTudu = new Model_Tudu_Tudu($tuduParams); $daoTudu = Tudu_Dao_Manager::getDao('Dao_Td_Tudu_Tudu', Tudu_Dao_Manager::DB_TS); $params = $sendTudu->getStorageParams(); if (!empty($params['to'])) { $accepters = $daoTudu->getAccepters($tudu->tuduId); foreach ($accepters as $item) { $daoTudu->removeAccepter($tudu->tuduId, $item['uniqueid']); } } $daoTudu->updateTudu($tudu->tuduId, $params); $modelTudu = new Model_Tudu_Send_Common(); $modelTudu->send($sendTudu); // 更新进度 $manager->updateProgress($tudu->tuduId, $this->_user->uniqueId); if ($tudu->parentId) { $manager->calParentsProgress($tudu->parentId); } } } } // 自动确认 if ($isDoneTudu && isset($doneParams)) { $manager->doneTudu($doneParams['tuduid'], true, 0); // 添加操作日志 $this->_writeLog(Dao_Td_Log_Log::TYPE_TUDU, $doneParams['tuduid'], Dao_Td_Log_Log::ACTION_TUDU_DONE, array('percent' => $doneParams['percent'], 'elapsedtime' => $doneParams['elapsedtime']), false, true); } // 回复消息 $data = implode(' ', array('tudu', 'reply', '', http_build_query($sendParam))); $httpsqs->put($data, 'tudu'); } return $this->json(true, $this->lang['post_send_success'], array('postid' => $postId)); }