Skip to content

Commit

Permalink
Merge branch 'plus-2.0' into plus
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Sep 25, 2018
2 parents fb48bfe + 9e7398b commit 8f84e48
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 220 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@
"slimkit/plus-socialite": "2.0.3",
"symfony/finder": "^4.0",
"symfony/yaml": "^4.0",
"zhiyicx/plus-group": "2.0.0",
"zhiyicx/plus-pc": "2.0.0",
"zhiyicx/plus-question": "2.0.0",
"zhiyicx/plus-group": "2.0.3",
"zhiyicx/plus-pc": "2.0.3",
"zhiyicx/plus-question": "2.0.3",
"tymon/jwt-auth": "1.0.0-rc.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion packages/zhiyicx-plus-group/assets/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/zhiyicx-plus-group/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
]
}
},
"version": "2.0.0"
"version": "2.0.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<!-- panle-content -->
<div class="row">
<div class="col-lg-4">
<img v-show="group.avatar" :src="group.avatar.url" class="img-circle" style="max-width:100px;">
<template v-if="group.avatar">
<img :src="group.avatar.url" class="img-circle" style="max-width:100px;">
</template>
<p>#ID: {{ group.id }}</p>
<p>名称: {{ group.name }}</p>
<p>分类: {{ group.hasOwnProperty('category') ? group.category.name : '' }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,19 @@ public function store(CreateGroupRequest $request, StorageInterface $storage, Ca
public function update(UpdateGroupRequest $request, StorageInterface $storage, GroupModel $group)
{
$user = $request->user();
$member = $group->members()->where('user_id', $user->id)->where('audit', 1)->where('disabled', 0)->first();

// 审核未通过或被禁用
if (in_array($group->audit, [0, 2, 3])) {
return response()->json(['message' => '圈子审核未通过或已被禁用,不能进行修改'], 403);
}

$member = $group
->members()
->where('user_id', $user->id)
->where('audit', 1)
->where('disabled', 0)
->first();
// 是否为普通成员
if ($member->role === 'member') {
if (! $member || $member->role === 'member') {
return response()->json(['message' => '无权限操作'], 403);
}

Expand Down Expand Up @@ -597,7 +601,7 @@ public function userGroups(Request $request, GroupModel $group)
})->orWhere(function ($query) use ($user) {
return $query->whereHas('members', function ($query) use ($user) {
return $query->where('user_id', $user->id)->where('audit', 0);
});
})->where('audit', 1);
});
break;
case 'allow_post':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function index(Request $request, Group $group, PostRepository $repository
'created_at',
])
->with(['user', 'images'])
->orderBy($type === 'last_reply' ? 'comment_updated_at' : 'id', 'desc')
->orderBy($type === 'latest_reply' ? 'comment_updated_at' : 'id', 'desc')
->offset($offset)
->limit($limit)
->get();
Expand Down
2 changes: 1 addition & 1 deletion packages/zhiyicx-plus-pc/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"overtrue/socialite": "^2.0",
"gregwar/captcha": "1.*"
},
"version": "2.0.0"
"version": "2.0.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ to {-webkit-transform:rotate(360deg);transform:rotate(360deg);}
.repostable-topic {cursor: pointer;}
.repostable-mention {cursor: pointer;}
.feed_repostable {display: block;padding: 20px;margin-bottom: 20px;background-color: #f7f7f7;font-size: 14px;color: #666;letter-spacing: 1px;cursor: pointer;word-wrap: break-word;word-break: break-all;}
.feed_repostable .post_cover {margin-top: 10px;}
.feed_repostable strong {font-weight: bold;}
.feed_repostable .title {font-weight: bold;margin: 0;}
.feed_repostable .description {margin: 0;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.chat_left ul li:hover {cursor:pointer;background:#DBDEDF;}
.chat_left .chat_svg {font-size:40px;width:40px;height:40px;border-radius:50%;}
.chat_left .chat_item {float:left;width:127px;margin-left:12px;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:#999;line-height:20px;}
.chat_left .chat_item .chat_ms_span {font-size:14px;color:#333;line-height:30px;}
.chat_left .chat_item .chat_span {font-size:14px;color:#333;line-height:50px;}
.chat_left .chat_item .last_content {overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.chat_right .body_title {width:100%;font-size:16px;height:50px;padding-left:20px;text-align:left;border-bottom:1px solid #DEDEDE;line-height:50px;}
Expand Down
6 changes: 3 additions & 3 deletions packages/zhiyicx-plus-pc/resources/assets/web/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ var repostable = {
},

jumpToReference(url, node) {
if (node.paid) return location.href = url;
if (!node || node.paid) return location.href = url;

var html = formatConfirm('购买支付', '<div class="confirm_money">' + node.amount + '</div>您只需要支付' + node.amount + '积分即可查看完整内容,是否确认支付?');
ly.confirm(html, '', '', function(){
Expand All @@ -1792,12 +1792,12 @@ var repostable = {
$(function() {

// 获取我的好友 用于全局at弹框显示默认内容
axios.get('/api/v2/user/follow-mutual').then(function (res) {
if (TS.USER) axios.get('/api/v2/user/follow-mutual').then(function (res) {
TS.USER_FOLLOW_MUTUAL = res.data.slice(0, 8)
})

// 获取热门话题 用于全局转发动态选择话题显示默认内容
axios.get('/api/v2/feed/topics', { params: {only: 'hot'} }) .then(function(res) {
if (TS.USER) axios.get('/api/v2/feed/topics', { params: {only: 'hot'} }) .then(function(res) {
TS.HOT_TOPICS = res.data.slice(0, 8)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ easemob = {
+ '<img src="' + avatar + '" class="chat_svg">'
+ '</div>'
+ '<div class="chat_item">'
+ '<span class="chat_span">' + title + '</span>'
+ '<span class="chat_ms_span">' + title + '</span>'
+ '<div>' + last_message_txt + '</div>'
+ '</div>'
+ '</li>';
Expand Down Expand Up @@ -833,4 +833,4 @@ easemob = {
cancelGroup: function() {
$('li[type="message"]').click();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<ul>
<li>
<a href="javascript:;" onclick="repostable.show('posts', '{{$post['id']}}');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-share"></use></svg>转发
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-share"></use></svg> <span>转发</span>
</a>
</li>
@if (in_array($post['group']['joined']['role'], ['administrator', 'founder']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@
href="{{ route('pc:grouppost', ['group_id' => $repostable['group']['id'], 'post_id' => $feed['repostable_id']]) }}"
@endif
>
<p class="description"><strong>{{$repostable['user']['name']}}: {{$repostable['title']}}</strong></p>
@php
$summary = preg_replace('/@!\[image\]\(\d+\)/', '[图片]', $repostable['summary']); // 替换图片
$summary = preg_replace('/<{0,1}((http|ftp|https):\/\/)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(\/[#a-zA-Z0-9\&%_\.\/-~-]*)?>{0,1}/', '<span style="color: #59b6d7;">网页链接</span>', $summary); // 超级厉害的正则(来自android端)匹配网址
@endphp
<p class="description"><strong>{{$repostable['title']}}</strong></p>
<p class="description">{!! $summary !!}</p>
@if ($repostable['image'] ?? false)
<img class="post_cover" src="{{ url('/api/v2/files/' . $repostable['image']) }}" alt="">
@endif
</a>
@else
<span class="feed_repostable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,176 +5,6 @@
use function Zhiyi\Component\ZhiyiPlus\PlusComponentPc\getAvatar;
@endphp

@if(!empty($pinneds))
@foreach($pinneds as $k => $post)
@php
$post['liked'] = $post['liked'] ?? false;
$post['group'] = $post['group'] ?? false;
$post['collected'] = $post['collected'] ?? false;
@endphp
<div class="feed_item" id="feed{{$post['id']}}">
<div class="feed_title">
<a class="avatar_box" href="{{ route('pc:mine', $post['user']['id']) }}">
<img class="avatar" src="{{ getAvatar($post['user'], 50) }}" />
@if($post['user']['verified'])
<img class="role-icon" src="{{ $post['user']['verified']['icon'] ?? asset('assets/pc/images/vip_icon.svg') }}">
@endif
</a>
<span class="feed_uname font14">{{ $post['user']['name'] }}</span>
<a href="{{ route('pc:grouppost', [$post['group_id'], $post['id']]) }}" class="date">
<span class="feed_time font12">{{ getTime($post['created_at']) }}</span>
<span class="feed_time font12 hide">查看详情</span>
</a>
<a class="pinned" href="javascript:;">置顶</a>
@if($post['excellent_at'])
<a class="excellent" href="javascript:;">精华</a>
@endif
</div>
<div class="feed_body">
<p class="s-fc">{!! formatContent($post['title']) !!}</p>
<p class="f-fs2">{!! formatContent($post['summary']) !!}</p>
@include('pcview::templates.feed_images', ['target_url' => route('pc:grouppost', [$post['group_id'], $post['id']])])
</div>
<div class="feed_bottom">
<div class="feed_datas">
<span class="digg" id="J-likes{{$post['id']}}" rel="{{$post['likes_count']}}" status="{{(int) $post['liked']}}">
@if($post['liked'] ?? false)
<a href="javascript:void(0)" onclick="liked.init({{$post['id']}}, 'group', 1)">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-likered"></use></svg>
<font>{{$post['likes_count']}}</font>
</a>
@else
<a href="javascript:;" onclick="liked.init({{$post['id']}}, 'group', 1)">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-like"></use></svg>
<font>{{$post['likes_count']}}</font>
</a>
@endif
</span>
<span class="comment J-comment-show">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-comment"></use></svg>
<font class="cs{{$post['id']}}">{{$post['comments_count']}}</font>
</span>
<span class="view">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-chakan"></use></svg>
<font>{{$post['views_count']}}</font>
</span>
@if ($post['group']['joined'])
@if ($post['user_id'] != $TS['id'] && $post['group']['joined']['disabled']) @else
<span class="options" onclick="options(this)">
<svg class="icon icon-more" aria-hidden="true"><use xlink:href="#icon-more"></use></svg>
</span>
@endif
<div class="options_div">
<div class="triangle"></div>
<ul>
<li>
<a href="javascript:;" onclick="repostable.show('posts', '{{$post['id']}}');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-share"></use></svg>转发
</a>
</li>
@if(in_array($post['group']['joined']['role'], ['administrator', 'founder']))
<li>
@if(!$post['excellent_at'])
<a href="javascript:;" onclick="post.setExcellent('{{ $post['id'] }}', true)">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-text"></use></svg><span>设为精华</span>
</a>
@else
<a href="javascript:;" onclick="post.setExcellent('{{ $post['id'] }}', false)">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-text"></use></svg><span>取消精华</span>
</a>
@endif
</li>
<li id="J-collect{{$post['id']}}" rel="0" status="{{(int) $post['collected']}}">
@if($post['collected'])
<a class="act" href="javascript:;" onclick="collected.init({{$post['id']}}, 'group', 1);" class="act">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-collect"></use></svg><span>已收藏</span>
</a>
@else
<a href="javascript:;" onclick="collected.init({{$post['id']}}, 'group', 1);">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-collect"></use></svg><span>收藏</span>
</a>
@endif
</li>
<li>
<a href="javascript:;" onclick="post.cancelPinned('{{$post['id']}}');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-pinned"></use></svg><span>撤销置顶</span>
</a>
</li>
<li>
<a href="javascript:;" onclick="post.delPost('{{$post['group_id']}}', '{{$post['id']}}');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-delete"></use></svg><span>删除</span>
</a>
</li>
@else
@if($post['user_id'] == $TS['id'])
<li>
<a href="javascript:;" onclick="post.delPost('{{$post['group_id']}}', '{{$post['id']}}');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-delete"></use></svg>删除
</a>
</li>
@else
<li id="J-collect{{$post['id']}}" rel="0" status="{{(int) $post['collected']}}">
@if($post['collected'])
<a class="act" href="javascript:;" onclick="collected.init({{$post['id']}}, 'group', 1);" class="act">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-collect"></use></svg><span>已收藏</span>
</a>
@else
<a href="javascript:;" onclick="collected.init({{$post['id']}}, 'group', 1);">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-collect"></use></svg><span>收藏</span>
</a>
@endif
</li>
<li>
<a href="javascript:;" onclick="reported.init('{{$post['id']}}', 'posts');">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-report"></use></svg>
<span>举报</span>
</a>
</li>
@endif
@endif
</ul>
</div>
@endif
</div>
{{-- 评论 --}}
@include('pcview::widgets.comments', [
'id' => $post['id'],
'group_id' => $post['group_id'],
'comments_count' => $post['comments_count'],
'comments_type' => 'group',
'url' => Route('pc:grouppost', [$post['group_id'], $post['id']]),
'position' => 1,
'top' => 1,
'comments_data' => $post['comments'],
])

<div class="feed_line"></div>
</div>
</div>
<script type="text/javascript">
var images = {!! json_encode($post['images']) !!}, data = new Array();
if(images){
for (var i in images) {
var size = images[i].size.split('x');
var img = {
id: 'img' + i,
img: TS.SITE_URL + '/api/v2/files/' + images[i].id + '?token=' + TS.TOKEN,
tinyimg: TS.SITE_URL + '/api/v2/files/' + images[i].id + '?w=58&h=58&token=' + TS.TOKEN,
width: size[0],
height: size[1]
};
data.push(img);
}
}
$('#feed_photos_{{$post['id']}}').PicShow({
data: data,
bigWidth: {{ $conw ?? 635}},
bigHeight: {{ $conh ?? 400}}
});
</script>
@endforeach
@endif

@if(!empty($posts))
@foreach($posts as $key => $post)
@php
Expand All @@ -198,7 +28,7 @@
<span class="feed_time font12">{{ getTime($post['created_at']) }}</span>
<span class="feed_time font12 hide">查看详情</span>
</a>
@if(!empty($post['pinned']) && $post['pinned']['status'] == 1 && (strtotime($post['pinned']['expires_at']) > time()))
@if(!empty($post['pinned']) && $post['pinned'] == true)
<a class="pinned" href="javascript:;">置顶</a>
@endif
@if($post['excellent_at'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
</div>
@endif

@elseif($type == 3 && isset($ads[$page-1]['data']) && $_GET['type'] == 'hot')

{{-- 热门动态列表广告 --}}
@elseif($type == 3 && isset($ads[$page-1]['data']) && isset($_GET['type']) && $_GET['type'] == 'hot')
<div class="ads_item">
<a target="_blank" href="{{ $ads[$page-1]['data']['link'] ?? ''}}">
<dl class="user-box mt30 clearfix">
Expand All @@ -56,8 +56,8 @@
<div class="feed_line"></div>
</div>

@elseif($type == 4 && isset($ads[$page-1]['data']) && isset($_GET['recommend']))

{{-- 推荐资讯列表广告 --}}
@elseif($type == 4 && isset($ads[$page-1]['data']) && isset($_GET['type']) && $_GET['type'] == 'recommend')
<div class="news_item">
<a target="_blank" href="{{ $ads[$page-1]['data']['link'] ?? ''}}">
<div class="news_img">
Expand Down
Loading

0 comments on commit 8f84e48

Please sign in to comment.