Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0b4429a

Browse files
committedFeb 6, 2017
调整细节
1 parent 0110da3 commit 0b4429a

File tree

8 files changed

+37
-36
lines changed

8 files changed

+37
-36
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/log/
66
/client/uploads/
77
/framework
8+
/webroot/uploads/

‎README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ WebIM
66
* 全异步非阻塞Server,可以同时支持数百万TCP连接在线
77
* 基于websocket+flash_websocket支持所有浏览器/客户端/移动端
88
* 支持单聊/群聊/组聊等功能
9-
* 支持永久保存聊天记录
9+
* 支持永久保存聊天记录,使用MySQL存储
1010
* 基于Server PUSH的即时内容更新,登录/登出/状态变更/消息等会内容即时更新
11+
* 用户列表和在线信息使用Redis存储
1112
* 支持发送连接/图片/语音/视频/文件(开发中)
1213
* 支持Web端直接管理所有在线用户和群组(开发中)
1314

@@ -98,7 +99,8 @@ $config['server'] = array(
9899
);
99100
```
100101
101-
配置`webroot/apps/configs/db.php`中数据库信息,将聊天记录存储到mysql中
102+
* 配置`webroot/apps/configs/db.php`中数据库信息,将聊天记录存储到MySQL中
103+
* 配置`webroot/apps/configs/redis.php`中的Redis服务器信息,将用户列表和信息存到Redis中
102104
103105
表结构
104106
```sql

‎webroot/apps/configs/cache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22
$cache['master'] = array(
3-
'type' => 'Memcache',
3+
'type' => 'Redis',
44
);
55
return $cache;

‎webroot/apps/configs/redis.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$redis['master'] = array(
3+
'host' => '127.0.0.1',
4+
);
5+
return $redis;

‎webroot/apps/configs/upload.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22
return array(
3-
'base_dir' => WEBPATH . '/client/uploads/',
3+
'base_dir' => WEBPATH . '/uploads/',
44
'base_url' => '/uploads/',
55
);

‎webroot/apps/controllers/Page.php

+24
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,28 @@ function chatroom()
5151
$this->assign('debug', 'true');
5252
$this->display('page/chatroom.php');
5353
}
54+
55+
/**
56+
* 用flash添加照片
57+
*/
58+
function upload()
59+
{
60+
if ($_FILES)
61+
{
62+
global $php;
63+
$php->upload->thumb_width = 136;
64+
$php->upload->thumb_height = 136;
65+
$php->upload->thumb_qulitity = 100;
66+
$up_pic = $php->upload->save('Filedata');
67+
if (empty($up_pic))
68+
{
69+
echo '上传失败,请重新上传! Error:' . $php->upload->error_msg;
70+
}
71+
echo json_encode($up_pic);
72+
}
73+
else
74+
{
75+
echo "Bad Request\n";
76+
}
77+
}
5478
}

‎webroot/apps/templates/page/chatroom.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
{
3535
var settings = {
3636
flash_url: "/static/swf/swfupload.swf",
37-
//upload_script: '/myphoto/add_photo/',
38-
upload_url: "/apps/upload.php",
37+
upload_url: "/page/upload/",
3938
post_params: {"uid": '0', 'post': 1, 'PHPSESSID': "0"},
4039
file_size_limit: "2MB",
4140
file_types: "*.jpg;*.png;*.gif",

‎webroot/apps/upload.php

-30
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.