begin of thinksaas 3.68

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2023-06-22 13:33:25 +08:00
commit 963ec1b2ea
2746 changed files with 331806 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
defined('IN_TS') or die('Access Denied.');
return array (
'name' => '消息盒子',
'version' => '1.2',
'desc' => 'ImBox消息盒子',
'url' => 'http://www.thinksaas.cn',
'email' => 'thinksaas@qq.com',
'author' => '邱君',
'author_url' => 'http://www.thinksaas.cn',
'isoption' => '1',
'isinstall' => '1',
'issql' => '0',
'issystem' => '1',
'isappnav' => '0',
'ismy'=>'0',
);
+10
View File
@@ -0,0 +1,10 @@
<?php
defined('IN_TS') or die('Access Denied.');
//管理入口
if(is_file('app/'.$app.'/action/admin/'.$mg.'.php')){
include_once 'app/'.$app.'/action/admin/'.$mg.'.php';
}else{
qiMsg('sorry:no index!');
}
+34
View File
@@ -0,0 +1,34 @@
<?php
defined('IN_TS') or die('Access Denied.');
switch($ts){
case "list":
$page = tsIntval($_GET['page'],1);
$url = SITE_URL.'index.php?app=message&ac=admin&mg=msg&ts=list&page=';
$lstart = $page*20-20;
$arrMsg = $new['message']->findAll('message',null,'addtime desc',null,$lstart.',20');
$msgNum = $new['message']->findCount('message');
$pageUrl = pagination($msgNum, 20, $page, $url);
include template('admin/msg_list');
break;
//删除
case "delete":
$messageid = tsIntval($_GET['messageid']);
$page = tsIntval($_GET['page']);
$new['message']->delete('message',array(
'messageid'=>$messageid,
));
header('Location: '.SITE_URL.'index.php?app=message&ac=admin&mg=msg&ts=list&page='.$page);
break;
}
+11
View File
@@ -0,0 +1,11 @@
<?php
defined('IN_TS') or die('Access Denied.');
switch($ts){
//基本配置
case "":
include template("admin/options");
break;
}
+9
View File
@@ -0,0 +1,9 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
// api入口
if (is_file ( 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php' )) {
include_once 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php';
} else {
qiMsg ( 'sorry:no api!' );
}
+21
View File
@@ -0,0 +1,21 @@
<?php
defined('IN_TS') or die('Access Denied.');
echo '<pre>
-----------------------------------------------
Message Http Api List
URL:https://demo.thinksaas.cn
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
</pre>';
+7
View File
@@ -0,0 +1,7 @@
<?php
defined('IN_TS') or die('Access Denied.');
if($ac!='api'){
$userid = aac('user')->isLogin();
$strUser = aac('user')->getOneUser($userid);
}
+31
View File
@@ -0,0 +1,31 @@
<?php
defined('IN_TS') or die('Access Denied.');
//用户是否登录
$userid = aac('user')->isLogin();
$page = tsIntval($_GET['page'],1);
$url = tsUrl('message','friend',array('page'=>''));
$lstart = $page*40-40;
$arrToUsers = $db->fetch_all_assoc("select `userid` from ".dbprefix."message where `userid` > '0' and `touserid`='$userid' group by userid order by addtime desc limit $lstart,40");
$userNum = $db->once_num_rows("select `userid` from ".dbprefix."message where `userid` > '0' and `touserid`='$userid' group by userid");
$pageUrl = pagination($userNum, 40, $page, $url);
if(is_array($arrToUsers)){
foreach($arrToUsers as $key=>$item){
$arrToUser[] = $item;
$arrToUser[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
$arrToUser[$key]['count'] = $new['message']->findCount('message',array(
'touserid'=>$userid,
'userid'=>$item['userid'],
'isread'=>0,
));
}
}
$title = '好友消息';
include template('friend');
+2
View File
@@ -0,0 +1,2 @@
<?php
defined('IN_TS') or die('Access Denied.');
+41
View File
@@ -0,0 +1,41 @@
<?php
defined('IN_TS') or die('Access Denied.');
//消息盒子
$userid = aac('user')->isLogin();
$touserid= tsIntval($_GET['userid']);
if($userid == 0 || $touserid == 0) {
exit;
};
$msgCount = $new['message']->findCount('message',"(userid='$userid' and touserid='$touserid') or (userid='$touserid' and touserid='$userid')");
if($msgCount ==0) {
exit;
};
$arrMessage = $new['message']->findAll('message',"(userid='$userid' and touserid='$touserid') or (userid='$touserid' and touserid='$userid')",'addtime desc',null,10);
foreach($arrMessage as $key=>$item){
$arrMessage[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
$arrMessage[$key]['content'] = tsTitle($item['content']);
}
$arrMessage = array_reverse($arrMessage);
//isread设为已读
$new['message']->update('message',array(
'userid'=>$touserid,
'touserid'=>$userid,
'isread'=>0,
),array(
'isread'=>1,
));
$title = '消息盒子';
include template("msgbox");
+19
View File
@@ -0,0 +1,19 @@
<?php
defined('IN_TS') or die('Access Denied.');
$arrMessage = $new['message']->findAll('message',array(
'touserid'=>$strUser['userid'],
'isread'=>'0',
));
foreach($arrMessage as $key=>$item){
$arrMessage[$key]['content'] = tsTitle($item['content']);
if($item['userid']){
$arrMessage[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
}
}
$title = '我的消息盒子';
include template("my");
+19
View File
@@ -0,0 +1,19 @@
<?php
defined('IN_TS') or die('Access Denied.');
$userid = tsIntval($GLOBALS['TS_USER']['userid']);
if(!$userid) {
echo '0';
}
$newMsgNum = $new['message']->findCount('message',array(
'touserid'=>$userid,
'isread'=>0,
));
if($newMsgNum == '0'){
echo '0';
}else{
echo $newMsgNum;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/4/8
* Time: 9:42
*/
defined('IN_TS') or die('Access Denied.');
$touserid= aac('user')->isLogin();
//isread设为已读
$new['message']->update('message',array(
'touserid'=>$touserid,
'isread'=>0,
),array(
'isread'=>1,
));
tsNotice('操作成功!');
+13
View File
@@ -0,0 +1,13 @@
<?php
defined('IN_TS') or die('Access Denied.');
/*
* 发送盒子
*/
$userid= tsIntval($_GET['userid']);
$strTouser = aac('user')->getSimpleUser($userid);
$title = '发送盒子';
include template("sendbox");
+10
View File
@@ -0,0 +1,10 @@
<?php
defined('IN_TS') or die('Access Denied.');
$userid = aac('user')->isLogin();
$touserid = tsIntval($_POST['touserid']);
$content = tsTrim($_POST['content']);
$new['message']->sendmsg($userid,$touserid,$content);
echo '1';
+32
View File
@@ -0,0 +1,32 @@
<?php
defined('IN_TS') or die('Access Denied.');
/*
* 系统消息盒子
*/
$userid = '0';
$touserid= aac('user')->isLogin();
$arrMessage = $new['message']->findAll('message',array(
//'userid'=>0,
'touserid'=>$touserid,
),'addtime desc',null,10);
foreach($arrMessage as $key=>$item){
$arrMessage[$key]['content'] = tsTitle($item['content']);
if($item['userid']){
$arrMessage[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
}
}
//isread设为已读
$new['message']->update('message',array(
'userid'=>0,
'touserid'=>$touserid,
'isread'=>0,
),array(
'isread'=>1,
));
$title = '系统消息';
include template("system");
+37
View File
@@ -0,0 +1,37 @@
<?php
defined('IN_TS') or die('Access Denied.');
//消息盒子
$userid = aac('user')->isLogin();
$touserid= tsIntval($_GET['touserid']);
$strTouser = aac('user')->getSimpleUser($touserid);
$where = "(userid='$userid' and touserid='$touserid' and `tourl`='') or (userid='$touserid' and touserid='$userid' and `tourl`='')";
$msgCount = $new['message']->findCount('message',$where);
$arrMessage = $new['message']->findAll('message',$where,'addtime desc',null,10);
foreach($arrMessage as $key=>$item){
$arrMessage[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
$arrMessage[$key]['content'] = tsTitle($item['content']);
}
$arrMessage = array_reverse($arrMessage);
//isread设为已读
$new['message']->update('message',array(
'userid'=>$touserid,
'touserid'=>$userid,
'isread'=>0,
),array(
'isread'=>1,
));
$title = '消息盒子';
include template("user");
+48
View File
@@ -0,0 +1,48 @@
<?php
defined('IN_TS') or die('Access Denied.');
class message extends tsApp{
//构造函数
public function __construct($db){
$tsAppDb = array();
include 'app/message/config.php';
//判断APP是否采用独立数据库
if($tsAppDb){
$db = new MySql($tsAppDb);
}
parent::__construct($db);
}
/**
* 发送消息
* @param $userid 发送者用户ID,0为系统消息
* @param $touserid 接收消息的用户ID
* @param $content 消息内容
* @param string $tourl 消息对应的内容网址
* @param string $extend 消息扩展
*/
public function sendmsg($userid,$touserid,$content,$tourl='',$extend=''){
$userid = tsIntval($userid);
$touserid = tsIntval($touserid);
$content = addslashes(tsTrim($content));
if($touserid && $content){
$messageid = $this->create('message',array(
'userid' => $userid,
'touserid' => $touserid,
'content' => $content,
'tourl'=>$tourl,
'extend'=>$extend,
'addtime' => time(),
));
}
}
}
+6
View File
@@ -0,0 +1,6 @@
<?php
defined('IN_TS') or die('Access Denied.');
$skin = 'default';
$TS_APP['appname'] = '消息';
+12
View File
@@ -0,0 +1,12 @@
<div class="tabnav">
<h6>消息管理</h6>
<ul>
<li {if $mg=='options'}class="select"{/if}><a href="{SITE_URL}index.php?app=message&ac=admin&mg=options">配置</a></li>
<li {if $mg=='msg' && $ts=='list'}class="select"{/if}><a href="{SITE_URL}index.php?app=message&ac=admin&mg=msg&ts=list">消息列表</a></li>
</ul>
</div>
<div style="height: 100px;"></div>
+41
View File
@@ -0,0 +1,41 @@
{php include pubTemplate("header_admin")}
<div class="midder">
{php include template("admin/menu");}
<div class="page">{$pageUrl}</div>
<table class="table table-hover">
<thead class="thead-light">
<tr>
<th>messageid</th><th>userid</th><th>touserid</th><th>content</th><th>addtime</th> <th>操作</th>
</tr>
</thead>
<tbody>
{loop $arrMsg $key $item}
<tr><td>{$item['messageid']}</td><td>{$item['userid']}</td><td>{$item['touserid']}</td><td>{$item['content']}</td>
<td>{php echo date('Y-m-d H:i:s',$item['addtime'])}</td>
<td>
<a onclick="return confirm('确定删除吗?')" href="{SITE_URL}index.php?app=message&ac=admin&mg=msg&ts=delete&page={$page}&messageid={$item['messageid']}">删除</a>
</td></tr>
{/loop}
</tbody>
</table>
</div>
{php include pubTemplate("footer_admin")}
+11
View File
@@ -0,0 +1,11 @@
{php include pubTemplate("header_admin")}
<div class="midder">
{php include template("admin/menu");}
暂无配置
</div>
{php include pubTemplate("footer_admin")}
+52
View File
@@ -0,0 +1,52 @@
{php include pubTemplate("header")}
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="my_left">
{php include pubTemplate("my")}
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body">
{template menu}
<div class="msgbox">
<ul>
{loop $arrToUser $key $item}
<li>
<a href="{tsUrl('message','user',array('touserid'=>$item['userid']))}"><img alt="{$item[user][username]}" class="m_sub_img" width="16" src="{$item[user][face]}" align="absmiddle" /> {$item[user][username]} </a>{if $item[count] > 0}({$item[count]}){/if}
</li>
{/loop}
</ul>
</div>
<div class="page">{$pageUrl}</div>
</div>
</div>
</div>
</div>
</div>
{php include pubTemplate("footer")}
+7
View File
@@ -0,0 +1,7 @@
<div class="mb-3">
<a class="btn btn-sm {if $ac=='my'}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('message','my')}">最新消息</a>
<a class="btn btn-sm {if $ac=='system'}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('message','system')}">系统消息</a>
<a class="btn btn-sm {if $ac=='friend' || $ac=='user'}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('message','friend')}">好友消息</a>
</div>
<hr />
+11
View File
@@ -0,0 +1,11 @@
<div class="msgbox">
<ul>
{loop $arrMessage $key $item}
<li {if $item[userid] == $TS_USER[userid]}class="mysend"{/if}>
{if $item[userid]==$TS_USER[userid]}<span style="color:#006efe;">{$item[user][username]} {php echo date('Y-m-d H:i:s',$item[addtime])}</span>{else}<span style="color:#42b475;">{$item[user][username]} {php echo date('Y-m-d H:i:s',$item[addtime])}</span>{/if}
<br />
{$item[content]}
</li>
{/loop}
</ul>
</div>
+98
View File
@@ -0,0 +1,98 @@
{php include pubTemplate("header")}
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="my_left">
{php include pubTemplate("my")}
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body position-relative">
{template menu}
<div class="position-absolute" style="top:20px;right:20px;"><a class="btn btn-sm btn-outline-info" href="{SITE_URL}index.php?app=message&ac=read">设为全部已读</a></div>
{if $arrMessage}
<table class="table">
<thead class="thead-light">
<tr>
<th>消息</th>
<th>状态</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
{loop $arrMessage $key $item}
<tr>
<td>
<p class="c9">{php echo date('Y-m-d H:i:s',$item[addtime])}</p>
{if $item['userid']}{$item['user']['username']}{/if} {$item[content]}
</td>
<td>
{if $item['isread']==1}
已读
{else}
未读
{/if}
</td>
<td class="text-right">
{if $item['tourl']}
<a class="btn btn-sm btn-outline-secondary" target="_blank" href="{$item['tourl']}">查看</a>
{/if}
{if $item['userid'] && $item['tourl']==''}
<a class="btn btn-sm btn-outline-secondary" href="{tsUrl('message','user',array('touserid'=>$item['userid']))}">聊天</a>
{/if}
</td>
</tr>
{/loop}
</tbody>
</table>
<!--
<div class="newmsg fs13 mt-2">
<ul>
{loop $arrMsg $key $item}
<li>{if $item['userid']}<img src="{$item['user']['face']}" width="16" align="absmiddle" /> {$item['user']['username']}{$item['content']} <a href="{tsUrl('message','user',array('touserid'=>$item['userid']))}">[回复]</a>{else}系统消息:<a href="{tsUrl('message','system')}">[查看]</a>{/if}</li>
{/loop}
</ul>
</div>
-->
{else}
<div class="text-black-50">暂无消息</div>
{/if}
</div>
</div>
</div>
</div>
</div>
{php include pubTemplate("footer")}
+8
View File
@@ -0,0 +1,8 @@
<div class="sendbox">
<p><span style="color:#0066cc;">{$strTouser[username]}</span>进行及时消息通话中</p>
<p><textarea id="boxcontent"></textarea> </p>
<p>
<span id="sendbutton" style="display:block;"><a class="btn" href="javascript:void('0');" onclick="sendmsg('{$TS_USER[userid]}','{$strTouser[userid]}');">发送</a></span>
<span id="loading" style="display:none;">消息送达中<img src="{SITE_URL}public/images/loading.gif" alt="Loading..." /></span>
</p>
</div>
+85
View File
@@ -0,0 +1,85 @@
{php include pubTemplate("header")}
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="my_left">
{php include pubTemplate("my")}
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body">
{template menu}
<div class="system fs13">
<table class="table">
<thead class="thead-light">
<tr>
<th>消息</th>
<th>状态</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
{loop $arrMessage $key $item}
<tr>
<td>
<p class="c9">{php echo date('Y-m-d H:i:s',$item[addtime])}</p>
{if $item['userid']}{$item['user']['username']}{/if} {$item[content]}
</td>
<td>
{if $item['isread']==1}
已读
{else}
未读
{/if}
</td>
<td class="text-right">
{if $item['tourl']}
<a class="btn btn-sm btn-outline-secondary" target="_blank" href="{$item['tourl']}">查看</a>
{/if}
{if $item['userid'] && $item['tourl']==''}
<a class="btn btn-sm btn-outline-secondary" href="{tsUrl('message','user',array('touserid'=>$item['userid']))}">聊天</a>
{/if}
</td>
</tr>
{/loop}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{php include pubTemplate("footer")}
+56
View File
@@ -0,0 +1,56 @@
{php include pubTemplate("header")}
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="my_left">
{php include pubTemplate("my")}
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body">
{template menu}
<div class="usermsg">
<ul>
{loop $arrMessage $key $item}
<li {if $item[userid] == $TS_USER[userid]}class="mysend"{/if}>
{if $item[userid]==$TS_USER[userid]}<span style="color:#006efe;">{$item[user][username]} {php echo date('Y-m-d H:i:s',$item[addtime])}</span>{else}<span style="color:#42b475;">{$item[user][username]} {php echo date('Y-m-d H:i:s',$item[addtime])}</span>{/if}
<br />
{$item[content]}
</li>
{/loop}
</ul>
</div>
<hr>
<div class="sendbox">
<p><span style="color:#0066cc;">{$strTouser[username]}</span>进行及时消息通话中</p>
<p><textarea class="form-control" id="boxcontent"></textarea> </p>
<p class="mt-1">
<span id="sendbutton" style="display:block;"><a class="btn btn-sm btn-info" href="javascript:void('0');" onclick="window.parent.sendmsg('{$TS_USER[userid]}','{$strTouser[userid]}');">发送</a></span>
<span id="loading" style="display:none;">消息送达中<img src="{SITE_URL}public/images/loading.gif" alt="Loading..." /></span>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
{php include pubTemplate("footer")}
+72
View File
@@ -0,0 +1,72 @@
//发送盒子
function sendbox(userid){
$("#msgbox").html("加载消息中......")
$("#sendbox").html("加载输入框中......")
$.ajax({
type: "GET",
url: siteUrl+"index.php?app=message&ac=msgbox&userid="+userid,
success: function(msg){
$('#msgbox').html(msg);
var msgbox=document.getElementById('msgbox');
if(msgbox.scrollHeight>msgbox.offsetHeight) msgbox.scrollTop=msgbox.scrollHeight-msgbox.offsetHeight+20;
}
});
$.ajax({
type: "GET",
url: siteUrl+"index.php?app=message&ac=sendbox&userid="+userid,
success: function(msg){
$('#sendbox').html(msg);
}
});
}
//发送消息
function sendmsg(userid,touserid){
var content = $("#boxcontent").val();
if(content == ''){
alert("请输入你要发送的内容!");return false;
}
//清空内容
$("#boxcontent").attr("value",'');
$("#sendbutton").css('display','none');
$("#loading").css('display','block');
$.ajax({
type: "POST",
url: siteUrl+"index.php?app=message&ac=sendmsg",
data: "userid="+userid+"&touserid="+touserid+"&content="+content,
beforeSend: function(){},
success: function(result){
if(result == '1'){
$("#loading").css('display','none');
$("#sendbutton").css('display','block');
window.location.reload();
}
}
});
}
//系统消息盒子
function systembox(userid){
$("#sendbox").html("");
$("#msgbox").html("加载系统消息中......")
$.ajax({
type: "GET",
url: siteUrl+"index.php?app=message&ac=systembox&userid="+userid,
success: function(msg){
$('#msgbox').html(msg);
var msgbox=document.getElementById('msgbox');
if(msgbox.scrollHeight>msgbox.offsetHeight) msgbox.scrollTop=msgbox.scrollHeight-msgbox.offsetHeight+20;
}
});
}
+35
View File
@@ -0,0 +1,35 @@
/*imbox*/
.imbox{}
.leftbar{}
.leftbar .bartitle{background:#dae9ef;padding:5px;}
.leftbar ul{}
.leftbar ul, .leftbar ul li{list-style: none;margin:0;padding:0;}
.leftbar ul li{line-height:23px;padding-left:10px;}
.msgbox{overflow:hidden;}
.msgbox ul, .msgbox ul li{list-style: none;margin:0;padding:0;}
.msgbox ul{}
.msgbox ul li{width:175px;float:left;line-height:23px;padding-left:10px;}
.mysend{background:#f5f8fa}
.system{overflow:hidden;}
.system ul, .system ul li{list-style: none;margin:0;padding:0;}
.system ul{}
.system ul li{line-height:23px;padding-left:10px;}
.sendbox{padding:0px 20px 20px 0px;overflow:hidden;}
.sendbox p{}
.sendbox textarea{width:100%;height:50px;}
.boxabout{line-height:23px;padding:0 10px;}
.usermsg{overflow:hidden;}
.usermsg ul, .usermsg ul li{list-style: none;margin:0;padding:0;}
.usermsg ul{}
.usermsg ul li{line-height:23px;padding:0 10px;}
.newmsg{}
.newmsg ul, .newmsg ul li{list-style: none;margin:0;padding:0;}
.newmsg ul{}
.newmsg ul li{padding:5px 10px;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+35
View File
@@ -0,0 +1,35 @@
/*imbox*/
.imbox{}
.leftbar{}
.leftbar .bartitle{background:#dae9ef;padding:5px;}
.leftbar ul{}
.leftbar ul, .leftbar ul li{list-style: none;margin:0;padding:0;}
.leftbar ul li{line-height:23px;padding-left:10px;}
.msgbox{overflow:hidden;}
.msgbox ul, .msgbox ul li{list-style: none;margin:0;padding:0;}
.msgbox ul{}
.msgbox ul li{width:175px;float:left;line-height:23px;padding-left:10px;}
.mysend{background:#f5f8fa}
.system{overflow:hidden;}
.system ul, .system ul li{list-style: none;margin:0;padding:0;}
.system ul{}
.system ul li{line-height:23px;padding-left:10px;}
.sendbox{padding:0 20px 20px 20px;overflow:hidden;}
.sendbox p{}
.sendbox textarea{width:350px;height:50px;}
.boxabout{line-height:23px;padding:0 10px;}
.usermsg{overflow:hidden;}
.usermsg ul, .usermsg ul li{list-style: none;margin:0;padding:0;}
.usermsg ul{}
.usermsg ul li{line-height:23px;padding:0 10px;}
.newmsg{}
.newmsg ul, .newmsg ul li{list-style: none;margin:0;padding:0;}
.newmsg ul{}
.newmsg ul li{padding:5px 10px;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B