* finish task #5158.

This commit is contained in:
wangyidong
2018-12-05 14:49:13 +08:00
parent efdce81b19
commit 0c8f891767
5 changed files with 38 additions and 0 deletions
@@ -0,0 +1,3 @@
<?php
$config->message->available['xuanxuan'] = $config->message->objectTypes;
$config->message->setting['xuanxuan']['setting'] = $config->message->available['xuanxuan'];
@@ -0,0 +1,2 @@
<?php
$lang->message->typeList['xuanxuan'] = 'Xuanxuan';
@@ -0,0 +1,2 @@
<?php
$lang->message->typeList['xuanxuan'] = '喧喧';
@@ -0,0 +1,29 @@
<?php
class xuanxuanMessage extends messageModel
{
public function send($objectType, $objectID, $actionType, $actionID)
{
$messageSetting = $this->config->message->setting;
if(is_string($messageSetting)) $messageSetting = json_decode($messageSetting, true);
if(isset($messageSetting['xuanxuan']))
{
$actions = $messageSetting['xuanxuan']['setting'];
if(isset($actions[$objectType]) and in_array($actionType, $actions[$objectType]))
{
$this->loadModel('action');
$object = $this->dao->select('*')->from($this->config->objectTables[$objectType])->where('id')->eq($objectID)->fetch();
$field = $this->config->action->objectNameFields[$objectType];
$title = $this->app->user->realname . $this->lang->action->label->$actionType . $this->lang->action->objectTypes[$objectType];
$text = $title . ' ' . "[#{$objectID}::{$object->$field}]";
$url = common::getSysURL() . helper::createLink($objectType, 'view', "id=$objectID");
$target = '';
if(!empty($object->assignedTo)) $target .= $object->assignedTo;
if(!empty($object->mailto)) $target .= ",{$object->mailto}";
$target = trim($target, ',');
if($target) $this->loadModel('chat')->createNotify($target, $text, '', $text, 'text', $url);
}
}
}
}
@@ -0,0 +1,2 @@
<?php
$this->loadExtension('xuanxuan')->send($objectType, $objectID, $actionType, $actionID);