修复日历事件共享bug
This commit is contained in:
@@ -36,12 +36,12 @@ class InfoService
|
||||
'year2' => '前年',
|
||||
];
|
||||
|
||||
$user_info = UserWidget::where('user_id', $auth['id'])
|
||||
->where('id', $gets['id'])->first();
|
||||
|
||||
$info = Widget::where('id', $user_info['node_id'])
|
||||
$info = Widget::where('id', $gets['id'])
|
||||
->first();
|
||||
|
||||
$user_info = UserWidget::where('user_id', $auth['id'])
|
||||
->where('node_id', $gets['id'])->first();
|
||||
|
||||
if (not_empty($user_info)) {
|
||||
$info['id'] = $user_info['id'];
|
||||
if ($user_info['name']) {
|
||||
@@ -59,6 +59,9 @@ class InfoService
|
||||
|
||||
$permission = empty($params['permission']) ? 'department' : $params['permission'];
|
||||
$date = empty($params['date']) ? 'month' : $params['date'];
|
||||
$params['permission'] = $permission;
|
||||
$params['date'] = $date;
|
||||
$info['params'] = $params;
|
||||
|
||||
switch ($date) {
|
||||
case 'day':
|
||||
@@ -104,8 +107,8 @@ class InfoService
|
||||
$sql = $sql2 = '';
|
||||
switch ($date) {
|
||||
case 'day':
|
||||
$sql = sql_year_month_day($table.'created_at','ts')."='$day'";
|
||||
$sql2 = sql_year_month_day($table.'created_at','ts')."='$day2'";
|
||||
$sql = sql_year_month_day($table.'.created_at','ts')."='$day'";
|
||||
$sql2 = sql_year_month_day($table.'.created_at','ts')."='$day2'";
|
||||
break;
|
||||
case 'day2':
|
||||
$sql = sql_year_month_day($table.'.created_at','ts')."='$day2'";
|
||||
|
||||
@@ -8,13 +8,24 @@ class ShareService
|
||||
/**
|
||||
* 获取分享数据
|
||||
*/
|
||||
public static function getItemsSourceBy(array $source_type, $user_id)
|
||||
public static function getItemsSourceBy(array $source_type, $user_id, $start_at = null, $end_at = null)
|
||||
{
|
||||
$user = User::find($user_id);
|
||||
return Share::leftJoin('user', 'share.created_id', '=', 'user.id')
|
||||
|
||||
$model = Share::leftJoin('user', 'share.created_id', '=', 'user.id')
|
||||
->permission('share.receive_id', $user)
|
||||
->whereIn('share.source_type', $source_type)
|
||||
->get(['share.*', 'user.name', 'user.username']);
|
||||
->whereIn('share.source_type', $source_type);
|
||||
|
||||
$start_at = strtotime($start_at);
|
||||
$end_at = strtotime($end_at) + 86400;
|
||||
if ($start_at > 0 && $end_at > 0) {
|
||||
$model->whereRaw('
|
||||
(share.start_at between '.$start_at.' and '.$end_at.' or share.end_at between '.$start_at.' and '.$end_at.')
|
||||
or (share.is_repeat = 1 and share.start_at <= '.$end_at.')
|
||||
');
|
||||
}
|
||||
|
||||
return $model->get(['share.*', 'user.name', 'user.username']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user