generated from liutk/owl-admin-base
Compare commits
No commits in common. "30c217a6d2dc32547c3399402e2fe8995a4b515b" and "336ff28c163ef14ade6a1a9493947ea39baf14bb" have entirely different histories.
30c217a6d2
...
336ff28c16
|
|
@ -50,11 +50,9 @@ class StoreService extends BaseService
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改店长的所属门店
|
// 绑定店长
|
||||||
Employee::where('id', $data['master_id'])->update(['store_id' => $model->id]);
|
Employee::where('id', $data['master_id'])->update(['store_id' => $model->id]);
|
||||||
|
|
||||||
$this->currentModel = $model;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,11 +71,6 @@ class StoreService extends BaseService
|
||||||
|
|
||||||
$model->update($data);
|
$model->update($data);
|
||||||
|
|
||||||
// 修改店长的所属门店
|
|
||||||
if (isset($data['master_id'])) {
|
|
||||||
Employee::where('id', $data['master_id'])->update(['store_id' => $model->id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$afterProfitRatio = $model->profit_ratio;
|
$afterProfitRatio = $model->profit_ratio;
|
||||||
|
|
||||||
if (bccomp($beforeProfitRatio, $afterProfitRatio, 2) !== 0) {
|
if (bccomp($beforeProfitRatio, $afterProfitRatio, 2) !== 0) {
|
||||||
|
|
@ -95,9 +88,7 @@ class StoreService extends BaseService
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentModel = $model;
|
return $model->update($data);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resloveData($data, $model = null)
|
public function resloveData($data, $model = null)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
$schedule->command(Commands\TaskUpdateCommand::class)->hourly()->runInBackground();
|
$schedule->command(Commands\TaskUpdateCommand::class)->hourly()->runInBackground();
|
||||||
$schedule->command(Commands\TaskLedgerGenerateCommand::class)->dailyAt('01:00')->runInBackground();
|
$schedule->command(Commands\TaskLedgerGenerateCommand::class)->dailyAt('01:00')->runInBackground();
|
||||||
$schedule->command(Commands\EmployeeSign::class)->dailyAt('02:00')->runInBackground();
|
|
||||||
// $schedule->call(fn() => logger('schedule running'))->everyMinute();
|
// $schedule->call(fn() => logger('schedule running'))->everyMinute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ use App\Admin\Services\EmployeeSignService;
|
||||||
use App\Enums\{SignTime, SignType, SignStatus};
|
use App\Enums\{SignTime, SignType, SignStatus};
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Slowlyo\OwlAdmin\Services\AdminSettingService;
|
use Slowlyo\OwlAdmin\Services\AdminSettingService;
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤打卡
|
* 考勤打卡
|
||||||
|
|
@ -53,19 +52,17 @@ class SignController extends Controller
|
||||||
// 根据定位的距离判断, 是否外勤
|
// 根据定位的距离判断, 是否外勤
|
||||||
$maxDistance = AdminSettingService::make()->arrayGet('sign', 'distance');
|
$maxDistance = AdminSettingService::make()->arrayGet('sign', 'distance');
|
||||||
$type = SignType::Outside;
|
$type = SignType::Outside;
|
||||||
$distance = null;
|
$distance = '';
|
||||||
$description = '当前位置不在考勤范围内,请选择外勤打卡';
|
$description = '当前位置不在考勤范围内,请选择外勤打卡';
|
||||||
if ($request->filled(['lon', 'lat']) && $store && $maxDistance) {
|
if ($request->filled(['lon', 'lat']) && $store && $maxDistance) {
|
||||||
$distance = $service->haversineDistance($request->input('lat'), $request->input('lon'), $store->lat, $store->lon);
|
$distance = $service->haversineDistance($request->input('lat'), $request->input('lon'), $store->lat, $store->lon);
|
||||||
if ($distance <= $maxDistance) {
|
if ($distance <= $maxDistance) {
|
||||||
$description = '已进入考勤范围: ' . $store->title;
|
$description = '已进入考勤范围' . $store->title;
|
||||||
$type = SignType::Normal;
|
$type = SignType::Normal;
|
||||||
} else {
|
|
||||||
$enable = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return compact('enable', 'time', 'type', 'description', 'distance', 'maxDistance');
|
return compact('enable', 'time', 'type', 'description', 'distance');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request, EmployeeSignService $service)
|
public function store(Request $request, EmployeeSignService $service)
|
||||||
|
|
@ -76,12 +73,6 @@ class SignController extends Controller
|
||||||
]);
|
]);
|
||||||
$user = $this->guard()->user();
|
$user = $this->guard()->user();
|
||||||
$time = SignTime::from($request->input('time'));
|
$time = SignTime::from($request->input('time'));
|
||||||
$type = SignType::from($request->input('type'));
|
|
||||||
|
|
||||||
// 没有定位坐标, 必须是外勤打卡
|
|
||||||
if (!$request->filled('position') && $type == SignType::Normal) {
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
if (!$service->signDay($user, $time, now(), $request->only(['remarks', 'position', 'type']))) {
|
if (!$service->signDay($user, $time, now(), $request->only(['remarks', 'position', 'type']))) {
|
||||||
|
|
|
||||||
|
|
@ -24,22 +24,14 @@ class MessageController extends Controller
|
||||||
'readingLogs' => fn ($query) => $query->where('employee_id', $user->id),
|
'readingLogs' => fn ($query) => $query->where('employee_id', $user->id),
|
||||||
])
|
])
|
||||||
->latest('id')
|
->latest('id')
|
||||||
->paginate($request->query('per_page', 20));
|
->simplePaginate($request->query('per_page', 20));
|
||||||
|
|
||||||
$list = collect($paginator->items())->map(function (Message $message) {
|
return collect($paginator->items())->map(function (Message $message) {
|
||||||
return array_merge(
|
return array_merge(
|
||||||
MessageResource::make($message)->resolve(),
|
MessageResource::make($message)->resolve(),
|
||||||
['is_read' => $message->reading_logs_count],
|
['is_read' => $message->reading_logs_count],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 分页
|
|
||||||
return [
|
|
||||||
'data' => $list,
|
|
||||||
'meta' => [
|
|
||||||
'total' => $paginator->total()
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id, Request $request): MessageResource
|
public function show($id, Request $request): MessageResource
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class ReimbursementController extends Controller
|
||||||
$validated = $request->validate(
|
$validated = $request->validate(
|
||||||
rules: [
|
rules: [
|
||||||
'reimbursement_type_id' => ['bail', 'required', Rule::exists(Keyword::class, 'key')],
|
'reimbursement_type_id' => ['bail', 'required', Rule::exists(Keyword::class, 'key')],
|
||||||
'expense' => ['bail', 'required', 'min:0', 'max:99999999', 'decimal:0,2'],
|
'expense' => ['bail', 'required', 'min:0', 'decimal:0,2'],
|
||||||
'reason' => ['bail', 'required', 'max:255'],
|
'reason' => ['bail', 'required', 'max:255'],
|
||||||
'photos' => ['bail', 'required', 'array'],
|
'photos' => ['bail', 'required', 'array'],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue