diff --git a/Makefile b/Makefile index da2dd1e5e4..233cfaf1fd 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,7 @@ zentaoxx: sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/module/im/control.php sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/module/im/model/conference.php sed -i 's/xxb_/zt_/g' zentaoxx/db/*.sql + echo "ALTER TABLE \`zt_user\` ADD \`pinyin\` varchar(255) NOT NULL DEFAULT '' AFTER \`realname\`;" >> zentaoxx/db/xuanxuan.sql mkdir zentaoxx/tools; cp tools/cn2tw.php zentaoxx/tools; cd zentaoxx/tools; php cn2tw.php cp tools/en2de.php zentaoxx/tools; cd zentaoxx/tools; php en2de.php ../ rm -rf zentaoxx/tools diff --git a/xuanxuan/module/im/ext/model/class/xuanxuan.class.php b/xuanxuan/module/im/ext/model/class/xuanxuan.class.php index 8e5b5a0955..ee6d75ad98 100644 --- a/xuanxuan/module/im/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/im/ext/model/class/xuanxuan.class.php @@ -113,4 +113,36 @@ class xuanxuanIm extends imModel return $fileID; } + + public function chatAddAction($chatId = '', $action = '', $actorId = '', $result = '', $comment = '') + { + if(!$this->loadModel('action')->checkLogLevel('chat', $action)) return; + + $account = $this->dao->select('account')->from(TABLE_USER)->where('id')->eq($actorId)->fetch('account'); + $actor = !empty($account) ? $account : ''; + $extra = json_encode(array('actorId' => $actorId)); + $this->loadModel('action')->create('chat', $chatId, $action, $comment, $extra, $actor); + } + + public function userAddAction($user, $actionType, $result, $comment = '', $common = false) + { + if(!zget($this->config->xuanxuan, 'logLevel', 1) && !$common) return; + + $account = ''; + $userID = 0; + if(is_int($user)) + { + $account = $this->dao->select('account')->from(TABLE_USER)->where('id')->eq($user)->fetch('account'); + $userID = $user; + } + if(is_string($user)) + { + $userID = $this->dao->select('id')->from(TABLE_USER)->where('account')->eq($user)->fetch('id'); + $account = $user; + } + + $actor = !empty($account) ? $account : ''; + $extra = json_encode(array('actorId' => $userID)); + $this->loadModel('action')->create('user', $userID, $actionType, $comment, $extra, $actor); + } } diff --git a/xuanxuan/module/im/ext/model/xuanxuan.php b/xuanxuan/module/im/ext/model/xuanxuan.php index a4db385d55..d4bb906dc3 100644 --- a/xuanxuan/module/im/ext/model/xuanxuan.php +++ b/xuanxuan/module/im/ext/model/xuanxuan.php @@ -21,10 +21,10 @@ public function uploadFile($fileName, $path, $size, $time, $userID, $users, $cha public function chatAddAction($chatId = '', $action = '', $actorId = '', $result = '', $comment = '') { - return; + return $this->loadExtension('xuanxuan')->chatAddAction($chatId, $action, $actorId, $result, $comment); } -public function userAddAction($chatId = '', $action = '', $actorId = '', $result = '', $comment = '') +public function userAddAction($user, $actionType, $result, $comment = '', $common = false) { - return; + return $this->loadExtension('xuanxuan')->userAddAction($user, $actionType, $result, $comment, $common); }