Skip to content

Commit b50eadd

Browse files
committed
细节更新完善
1 parent 7e40305 commit b50eadd

File tree

9 files changed

+102
-76
lines changed

9 files changed

+102
-76
lines changed

server/apps/classes/FrontPage.php

Lines changed: 68 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,67 @@
44

55
class FrontPage extends Swoole\Controller
66
{
7-
/**
8-
* 展示用户信息
9-
* @param $uid
10-
* @return unknown_type
11-
*/
7+
/**
8+
* 展示用户信息
9+
* @param $uid
10+
* @throws Swoole\Exception\NotFound
11+
* @throws \Exception
12+
*/
1213
protected function userinfo($uid)
1314
{
14-
$_user = createModel('UserInfo');
15-
$_cate = createModel('UserLogCat');
16-
$_pic = createModel('UserPhoto');
17-
$user = $_user->getInfo($uid);
18-
if(empty($user)) return false;
15+
$_user = createModel('UserInfo');
16+
$_cate = createModel('UserLogCat');
17+
$_pic = createModel('UserPhoto');
18+
$user = $_user->getInfo($uid);
19+
if (empty($user))
20+
{
21+
throw new Swoole\Exception\NotFound("user[$uid] not found.");
22+
}
1923

20-
if(!empty($user['skill']))
24+
if (!empty($user['skill']))
2125
{
2226
$user['skill_info'] = implode('', $user['skill']);
2327
}
24-
$gets2['select'] = 'name,id,num';
25-
$gets2['uid'] = $uid;
26-
$gets2['order'] = 'id';
27-
$gets2['limit'] = 15;
28-
$blog_cates = $_cate->gets($gets2);
29-
if($user['sex']=='') $ta = '';
30-
else if($user['sex']=='') $ta = '';
31-
else $ta = "TA";
32-
33-
$this->swoole->tpl->assign('user',$user);
34-
$this->swoole->tpl->assign('ta',$ta);
35-
$this->swoole->tpl->assign('blog_cates',$blog_cates);
28+
$gets2['select'] = 'name,id,num';
29+
$gets2['uid'] = $uid;
30+
$gets2['order'] = 'id';
31+
$gets2['limit'] = 15;
32+
$blog_cates = $_cate->gets($gets2);
33+
if ($user['sex'] == '')
34+
{
35+
$ta = '';
36+
}
37+
else
38+
{
39+
if ($user['sex'] == '')
40+
{
41+
$ta = '';
42+
}
43+
else
44+
{
45+
$ta = "TA";
46+
}
47+
}
3648

37-
$gets3['uid'] = $uid;
38-
$c = $_pic->count($gets3);
39-
$this->swoole->tpl->assign('myphoto_count',$c);
40-
if($c>0)
41-
{
42-
$gets3['limit'] = 1;
43-
$gets3['select'] = 'imagep';
44-
$pic = $_pic->gets($gets3);
45-
$this->swoole->tpl->assign('myphoto',$pic[0]);
46-
}
49+
$this->swoole->tpl->assign('user', $user);
50+
$this->swoole->tpl->assign('ta', $ta);
51+
$this->swoole->tpl->assign('blog_cates', $blog_cates);
52+
53+
$gets3['uid'] = $uid;
54+
$c = $_pic->count($gets3);
55+
$this->swoole->tpl->assign('myphoto_count', $c);
56+
if ($c > 0)
57+
{
58+
$gets3['limit'] = 1;
59+
$gets3['select'] = 'imagep';
60+
$pic = $_pic->gets($gets3);
61+
$this->swoole->tpl->assign('myphoto', $pic[0]);
62+
}
4763
}
64+
4865
/**
4966
* 获取微博客内容列表
5067
* @param $pagesize
51-
* @return unknown_type
5268
*/
5369
protected function getMblogs($pagesize=10,$uid=0)
5470
{
@@ -90,19 +106,25 @@ protected function getMblogs($pagesize=10,$uid=0)
90106
$mblogs_atta['pic'][] = $m['pic_id'];
91107
}
92108
}
93-
if(!empty($mblogs_atta['pic']))
94-
{
95-
$pics = $_photo->getMap(array('select'=>'id,imagep,picture','in'=>array('id',implode(',',$mblogs_atta['pic']))));
96-
$this->swoole->tpl->assign('pics',$pics);
97-
}
98-
if(!empty($mblogs_atta['url']))
99-
{
109+
if (!empty($mblogs_atta['pic']))
110+
{
111+
$pics = $_photo->getMap(array(
112+
'select' => 'id,imagep,picture',
113+
'in' => array('id', implode(',', $mblogs_atta['pic']))
114+
));
115+
$this->swoole->tpl->assign('pics', $pics);
116+
}
117+
if (!empty($mblogs_atta['url']))
118+
{
100119

101-
$urls = $_link->getMap(array('select'=>'id,title,url','in'=>array('id',implode(',',$mblogs_atta['url']))));
102-
$this->swoole->tpl->assign('urls',$urls);
103-
}
104-
$this->swoole->tpl->assign('mblogs',$mblogs);
105-
$this->swoole->tpl->assign('pager',$pager);
120+
$urls = $_link->getMap(array(
121+
'select' => 'id,title,url',
122+
'in' => array('id', implode(',', $mblogs_atta['url']))
123+
));
124+
$this->swoole->tpl->assign('urls', $urls);
125+
}
126+
$this->swoole->tpl->assign('mblogs', $mblogs);
127+
$this->swoole->tpl->assign('pager', $pager);
106128
}
107129

108130
function getActiveUsers($num = 10)

server/apps/controllers/Myphoto.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class Myphoto extends App\UserBase
77
{
88
/**
99
* 相片的呈现
10-
* @return unknown_type
1110
*/
1211
function index()
1312
{
@@ -23,6 +22,7 @@ function index()
2322
if(isset($_GET['from'])) $this->swoole->tpl->display('myphoto_insert.html');
2423
else $this->swoole->tpl->display('myphoto_index.html');
2524
}
25+
2626
/**
2727
* 用flash添加照片
2828
*/
@@ -33,9 +33,9 @@ function add_photo()
3333
global $php;
3434
$php->upload->thumb_width = 136;
3535
$php->upload->thumb_height = 136;
36-
$php->upload->max_width = 500;
37-
$php->upload->max_height = 500;
38-
$php->upload->thumb_qulitity = 100;
36+
$php->upload->max_width = 1280;
37+
$php->upload->max_height = 1280;
38+
$php->upload->thumb_qulitity = 90;
3939
$php->upload->sub_dir = 'user_images';
4040
$up_pic = Swoole::$php->upload->save('Filedata');
4141
if (empty($up_pic))

server/apps/controllers/Page.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function callback_qq()
120120
$u['sex'] = $userinfo['gender'] == '' ? 1 : 2;
121121
//插入到表中
122122
$u['id'] = $model->put($u);
123+
$uid = $u['id'];
123124
}
124125
else
125126
{
@@ -128,10 +129,11 @@ function callback_qq()
128129
$u->province = $userinfo['province'];
129130
$u->city = $userinfo['city'];
130131
$u->save();
132+
$uid = $u->get()['id'];
131133
}
132134
//写入SESSION
133135
$_SESSION['isLogin'] = 1;
134-
$_SESSION['user_id'] = $u->_current_id;
136+
$_SESSION['user_id'] = $uid;
135137
$_SESSION['user'] = $u;
136138
$this->setLoginStat();
137139
$this->http->redirect(WEBROOT."/person/index/");
@@ -514,14 +516,18 @@ function guestbook()
514516
$php->tpl->display('guestbook.html');
515517
}
516518
}
517-
function user()
518-
{
519-
if(empty($_GET['uid'])) exit('Uid is empty');
520-
$uid = (int)$_GET['uid'];
521-
$this->userinfo($uid);
522-
$this->getMblogs(10,$uid);
523-
$this->swoole->tpl->display();
524-
}
519+
520+
function user()
521+
{
522+
if (empty($_GET['uid']))
523+
{
524+
exit('Uid is empty');
525+
}
526+
$uid = (int)$_GET['uid'];
527+
$this->userinfo($uid);
528+
$this->getMblogs(10, $uid);
529+
$this->swoole->tpl->display();
530+
}
525531

526532
private function setLoginStat()
527533
{

server/apps/templates/block/photo_show.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@
3636
//-->
3737
</script>
3838
<div class="ml75">
39-
<div><img class="photo" src="{{$photo.picture}}" id="photoshow" onclick="changephoto(event,this)" onmousemove="changestyle(event)" /></div>
39+
<div><img class="photo" style="max-width: 750px;" src="{{$photo.picture}}" id="photoshow" onclick="changephoto(event,this)" onmousemove="changestyle(event)" /></div>
4040
</div>

server/apps/templates/blog_detail.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
<!--欢迎页面-->
2828
<div class="microblog" id='mblog_list' style="border-bottom:1px dotted #CCC; margin-top:12px;">
2929
<div class="welcome">{{$blog.title}} <span class="date" style="float:right">
30-
发表时间:{{$blog.addtime}}</span></div>
30+
发表时间:{{$blog.addtime|howLongAgo}}</span></div>
3131
<div class="content">{{$blog.content}}</div>
3232
<div class="clear"></div>
33-
<div class="pages">{{$pager.render}}</div>
3433
</div>
3534
<div id='comment' style="margin-top:12px;">
3635
<table width="620" border="0" align="left" cellpadding="0" cellspacing="0" style="margin-top:12px;">

server/apps/templates/header.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
<div id='header' class="bg1">
33
<table width="100%" border="0">
44
<tr>
5-
<td width="60" height="80" align="center">
6-
<a href="http://www.swoole.com/page/index/">
7-
<img src="/static/images/logo.png" align="absmiddle" width="64" height="64" />
8-
</a>
9-
</td>
10-
<td width="80" height="80" align="left">
11-
<img src="/static/images/logow.jpg" height="64" />
12-
</td>
13-
<td width="918" height="80">
5+
<td width="180" height="80" align="center">
6+
<a href="http://www.swoole.com/page/index/">
7+
<img src="/static/images/swoole.png" align="absmiddle" width="128"/>
8+
</a>
9+
</td>
10+
<td height="80">
1411
<table height="80" border="0" cellspacing="0" align="left">
1512
<tr height="24"><td>
1613
<ul id='checklogin'>

server/apps/templates/mblog_detail.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@
4141
<a href="/page/user/uid-{{$user.id}}">
4242
<strong class="blu_12b" style="font-size:14px">{{$user.nickname}}</strong>
4343
</a>
44-
(<span class="date">{{$mblog.addtime}}</span>):<br />
44+
(<span class="date">{{$mblog.addtime|howLongAgo}}</span>):<br />
4545
<div style="text-indent:2em">{{$mblog.content|nl2br}}</div>
4646
<div class="clear"></div>
47-
<div class="pages">{{$pager.render}}</div>
4847
</div>
4948
<div id='comment' style="margin-top:12px;">
5049
<table width="720" border="0" align="left" cellpadding="0" cellspacing="0" style="margin-top:12px;">

server/apps/templates/person_myfriends.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
<div class="welcome">您还没有好友,赶快去添加好友吧</div>{{/if}}
2323
{{foreach item=v from=$list}}
2424
<div class="friend">
25-
<div class="userPic" style="max-width:150px"> <a href="/page/user/uid-{{$v.uid}}"><img class="avatar photo" src="{{$v.avatar|default:'/static/images/default.png'}}"></a>
25+
<div class="userPic" style="max-width:150px">
26+
<a href="/page/user/uid-{{$v.uid}}">
27+
<img style="max-width:100px" class="avatar photo" src="{{$v.avatar|default:'/static/images/default.png'}}"></a>
2628
</div>
2729
<a href="/page/user/uid-{{$v.uid}}">{{$v.nickname}}</a><br />
2830
最近登录:<span>{{$v.addtime|howLongAgo}} <br />

web/static/css/facebox.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
}
5959

6060
#facebox img {
61-
border: 0;
62-
margin: 0;
61+
border: 0;
62+
margin: 0;
63+
max-width: 900px;
6364
}
6465

6566
#facebox_overlay {

0 commit comments

Comments
 (0)