|
@@ -20,7 +20,7 @@ class Data
|
|
|
*
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function read($uid, $type = false, $update = false, $status = false)
|
|
|
+ public function read($uid, $type = false, $update = false, $status = false, $project = 1)
|
|
|
{
|
|
|
if (!$uid) {
|
|
|
Dever::alert('错误的用户信息');
|
|
@@ -29,10 +29,10 @@ class Data
|
|
|
$outbox = $prefix . 'message_outbox';
|
|
|
$inbox = $prefix . 'message_inbox';
|
|
|
|
|
|
- $where = ' and a.state = 1';
|
|
|
+ $where = ' and a.state = 1 and a.project_id = ' . $project;
|
|
|
$where .= ' and a.type <= 10';
|
|
|
# 读取outbox里的数据
|
|
|
- $sql = 'select a.name,a.content,a.id,a.type,a.uid from '.$outbox.' as a where not exists(select oid from '.$inbox.' where a.id = oid and uid = '.$uid.')' . $where . ' ';
|
|
|
+ $sql = 'select a.name,a.content,a.id,a.type,a.uid,a.project_id from '.$outbox.' as a where not exists(select oid from '.$inbox.' where a.id = oid and uid = '.$uid.')' . $where . ' ';
|
|
|
|
|
|
$state = Dever::db('message/inbox')->query($sql);
|
|
|
$outbox = $state->fetchAll();
|
|
@@ -42,6 +42,7 @@ class Data
|
|
|
$insert['add_uid'] = $uid;
|
|
|
$insert['add_oid'] = $v['id'];
|
|
|
$insert['add_status'] = 1;
|
|
|
+ $insert['add_project_id'] = $v['project_id'];
|
|
|
$insert['add_type'] = $v['type'];
|
|
|
//$insert['add_site'] = $v['site'];
|
|
|
$insert['add_from_uid'] = $v['uid'];
|
|
@@ -50,6 +51,9 @@ class Data
|
|
|
Dever::load('message/inbox-insert', $insert);
|
|
|
}
|
|
|
}
|
|
|
+ if ($project) {
|
|
|
+ $param['option_project_id'] = $project;
|
|
|
+ }
|
|
|
if ($type) {
|
|
|
$param['option_type'] = $type;
|
|
|
}
|
|
@@ -74,9 +78,9 @@ class Data
|
|
|
*
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function num($uid)
|
|
|
+ public function num($uid, $project = 1)
|
|
|
{
|
|
|
- return $this->read($uid, false, false, 1);
|
|
|
+ return $this->read($uid, false, false, 1, $project);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -105,19 +109,11 @@ class Data
|
|
|
*
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function push($uid, $to_uid, $name, $content, $type = 11)
|
|
|
+ public function push($uid, $to_uid, $name, $content, $type = 11, $project = 1)
|
|
|
{
|
|
|
- //$site = intval(Dever::input('site', -1));
|
|
|
-
|
|
|
if (!is_numeric($type)) {
|
|
|
Dever::alert('错误的消息类型');
|
|
|
}
|
|
|
- /*
|
|
|
- if(!is_numeric($site))
|
|
|
- {
|
|
|
- Dever::alert('错误的站点ID');
|
|
|
- }
|
|
|
- */
|
|
|
if ($type > 10 && !$uid) {
|
|
|
Dever::alert('错误的发件人id');
|
|
|
}
|
|
@@ -137,7 +133,7 @@ class Data
|
|
|
$data['add_name'] = $name;
|
|
|
$data['add_content'] = $content;
|
|
|
$data['add_type'] = $type;
|
|
|
- //$data['add_site'] = $site;
|
|
|
+ $data['add_project_id'] = $project;
|
|
|
$id = Dever::load('message/outbox-insert', $data);
|
|
|
|
|
|
if ($id > 0) {
|
|
@@ -148,7 +144,7 @@ class Data
|
|
|
$insert['add_oid'] = $id;
|
|
|
$insert['add_status'] = 1;
|
|
|
$insert['add_type'] = $data['add_type'];
|
|
|
- //$insert['add_site'] = $site;
|
|
|
+ $insert['add_project_id'] = $project;
|
|
|
$insert['add_from_uid'] = $data['add_uid'];
|
|
|
$insert['add_name'] = $data['add_name'];
|
|
|
$insert['add_content'] = $data['add_content'];
|