|
|
|
|
@ -57,12 +57,12 @@ class VisitController extends CommonController
|
|
|
|
|
if (isset($all['type'])) {
|
|
|
|
|
$query->where('type', $all['type']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['start_date'])) {
|
|
|
|
|
$query->where('date', '>=', $all['start_date']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['end_date'])) {
|
|
|
|
|
$query->where('date', '<=', $all['end_date']);
|
|
|
|
|
if (isset($all['start_date']) && isset($all['end_date'])) {
|
|
|
|
|
// 查询日期范围与数据库日期范围有交集
|
|
|
|
|
$query->where('start_date', '<=', $all['end_date'])
|
|
|
|
|
->where('end_date', '>=', $all['start_date']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($all['my_self']) && !empty($all['my_self'])) {
|
|
|
|
|
$query->where('admin_id', $this->getUserId());
|
|
|
|
|
}
|
|
|
|
|
@ -209,7 +209,7 @@ class VisitController extends CommonController
|
|
|
|
|
$model->save();
|
|
|
|
|
VisitLog::add($this->getUser(), '', $model->id, isset($all['id']) ? '更新拜访记录' : '新增拜访记录');
|
|
|
|
|
DB::commit();
|
|
|
|
|
return $this->success('更新成功');
|
|
|
|
|
return $this->success($model);
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
return $this->fail([$exception->getCode(), $exception->getMessage()]);
|
|
|
|
|
|