dever há 7 anos atrás
pai
commit
41580ccd0c
1 ficheiros alterados com 0 adições e 177 exclusões
  1. 0 177
      src/Data.php

+ 0 - 177
src/Data.php

@@ -1,177 +0,0 @@
-<?php
-
-namespace Message\Src;
-
-use Dever;
-
-class Data
-{
-	public function __construct()
-	{
-		$this->uid = intval(Dever::input('uid', 0));
-
-		if (!$this->uid || $this->uid < 0) {
-			Dever::alert('错误的用户信息');
-		}
-        parent::__construct();
-	}
-
-	/**
-     * 获取我的消息
-     * 
-     * @return mixed
-     */
-	public function read()
-	{
-		$uid = $this->uid;
-
-		$prefix = defined('DEVER_PROJECT') && DEVER_PROJECT != 'default' ? DEVER_PROJECT . '_' : '';
-		$outbox = $prefix . 'message_outbox';
-		$inbox = $prefix . 'message_inbox';
-
-		$where = ' and a.state = 1';
-		# 读取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 . ' ';
-
-        $state = Dever::db('message/inbox')->query($sql);
-		$outbox = $state->fetchAll();
-
-		if ($outbox) {
-			foreach ($outbox as $k => $v) {
-                $insert['add_uid'] = $uid;
-                $insert['add_oid'] = $v['id'];
-                $insert['add_status'] = 1;
-                $insert['add_type'] = $v['type'];
-				//$insert['add_site'] = $v['site'];
-				$insert['add_from_uid'] = $v['uid'];
-				$insert['add_name'] = $v['name'];
-				$insert['add_content'] = $v['content'];
-                Dever::load('message/inbox-insert', $insert);
-            }
-		}
-
-        $status = Dever::input('status', false);
-
-        $param['option_uid'] = $uid;
-        if ($status > 0) {
-            $param['option_status'] = $status;
-            return Dever::load('message/inbox-total', $param);
-        }
-		$data = Dever::load('message/inbox-getAll', $param);
-
-		return $data;
-	}
-
-    /**
-     * 查看我的新消息
-     * 
-     * @return mixed
-     */
-    public function num()
-    {
-        Dever::setInput('status', 1);
-        return $this->read();
-    }
-
-	/**
-     * 查看我的消息
-     * 
-     * @return mixed
-     */
-	public function view()
-	{
-		$id = Dever::input('message_id');
-
-		if ($id > 0) {
-			$info = Dever::load('message/inbox-one', array('option_uid' => $this->uid, 'option_id' => $id));
-			if ($info) {
-				Dever::load('message/inbox-update', array('where_id' => $id, 'set_status' => 2));
-
-				$data = Dever::load('message/inbox-check', $id);
-
-				return $data;
-			}
-		}
-
-		Dever::alert('错误的消息信息');
-	}
-
-	/**
-     * 推送消息
-     * 
-     * @return mixed
-     */
-	public function push()
-	{
-		$uid 		= $this->uid;
-        $name 		= Dever::input('name');
-        $content 	= Dever::input('content');
-        $type 	    = intval(Dever::input('type'));
-        # 暂时都是系统消息
-        $type 		= 1;
-        //$site 	    = intval(Dever::input('site', -1));
-        $to_uid 	= Dever::input('to_uid');
-
-        if (!is_numeric($type)) {
-            Dever::alert('错误的消息类型');
-        }
-        /*
-        if(!is_numeric($site))
-        {
-            Dever::alert('错误的站点ID');
-        }
-        */
-        if ($type > 10 && !is_numeric($uid)) {
-            Dever::alert('错误的发件人id');
-        }
-        if ($type > 10 && !$to_uid) {
-           	Dever::alert('错误的收件人id');
-        }
-        if (!$content) {
-            Dever::alert('错误的消息内容');
-        }
-
-        if (is_numeric($uid) && $content && is_numeric($type)) {
-        	if ($type < 10) {
-                $uid = -1;
-            }
-
-            $data['add_uid'] = $uid;
-            $data['add_name'] = $name;
-            $data['add_content'] = $content;
-            $data['add_type'] = $type;
-            //$data['add_site'] = $site;
-            $id = Dever::load('message/outbox-insert', $data);
-
-            if ($id > 0) {
-            	if ($to_uid) {
-                    $to_uid = explode(',', $to_uid);
-                    foreach ($to_uid as $k => $v) {
-                    	$info = Dever::load('message/outbox-one', array('option_uid' => $v, 'option_oid' => $id));
-                    	if ($info) {
-                    		$update['where_id'] = $info['id'];
-	                        $update['set_from_uid'] = $data['add_uid'];
-	                        $update['set_name'] = $data['add_name'];
-	                        $update['set_content'] = $data['add_content'];
-	                        //$update['origin'] = $origin;
-                    		Dever::load('message/inbox-update', $update);
-                    	} else {
-                    		$insert['add_uid'] = $v;
-	                        $insert['add_oid'] = $id;
-	                        $insert['add_status'] = 1;
-	                        $insert['add_type'] = $data['add_type'];
-	                        //$insert['add_site'] = $site;
-	                        $insert['add_from_uid'] = $data['add_uid'];
-	                        $insert['add_name'] = $data['add_name'];
-	                        $insert['add_content'] = $data['add_content'];
-	                        //$insert['add_origin'] = $origin;
-                    		Dever::load('message/inbox-insert', $insert);
-                    	}
-
-                    	//这里可以设置发送push
-                    }
-                }
-            }
-        }
-	}
-}