Compare commits

..

No commits in common. "30c217a6d2dc32547c3399402e2fe8995a4b515b" and "336ff28c163ef14ade6a1a9493947ea39baf14bb" have entirely different histories.

5 changed files with 8 additions and 35 deletions

View File

@ -50,11 +50,9 @@ class StoreService extends BaseService
]);
}
// 修改店长的所属门店
// 绑定店长
Employee::where('id', $data['master_id'])->update(['store_id' => $model->id]);
$this->currentModel = $model;
return true;
}
@ -73,11 +71,6 @@ class StoreService extends BaseService
$model->update($data);
// 修改店长的所属门店
if (isset($data['master_id'])) {
Employee::where('id', $data['master_id'])->update(['store_id' => $model->id]);
}
$afterProfitRatio = $model->profit_ratio;
if (bccomp($beforeProfitRatio, $afterProfitRatio, 2) !== 0) {
@ -95,9 +88,7 @@ class StoreService extends BaseService
]);
}
$this->currentModel = $model;
return true;
return $model->update($data);
}
public function resloveData($data, $model = null)

View File

@ -14,7 +14,6 @@ class Kernel extends ConsoleKernel
{
$schedule->command(Commands\TaskUpdateCommand::class)->hourly()->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();
}

View File

@ -11,7 +11,6 @@ use App\Admin\Services\EmployeeSignService;
use App\Enums\{SignTime, SignType, SignStatus};
use Carbon\Carbon;
use Slowlyo\OwlAdmin\Services\AdminSettingService;
use Illuminate\Validation\Rule;
/**
* 考勤打卡
@ -53,19 +52,17 @@ class SignController extends Controller
// 根据定位的距离判断, 是否外勤
$maxDistance = AdminSettingService::make()->arrayGet('sign', 'distance');
$type = SignType::Outside;
$distance = null;
$distance = '';
$description = '当前位置不在考勤范围内,请选择外勤打卡';
if ($request->filled(['lon', 'lat']) && $store && $maxDistance) {
$distance = $service->haversineDistance($request->input('lat'), $request->input('lon'), $store->lat, $store->lon);
if ($distance <= $maxDistance) {
$description = '已进入考勤范围: ' . $store->title;
$description = '已进入考勤范围' . $store->title;
$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)
@ -76,12 +73,6 @@ class SignController extends Controller
]);
$user = $this->guard()->user();
$time = SignTime::from($request->input('time'));
$type = SignType::from($request->input('type'));
// 没有定位坐标, 必须是外勤打卡
if (!$request->filled('position') && $type == SignType::Normal) {
}
try {
DB::beginTransaction();
if (!$service->signDay($user, $time, now(), $request->only(['remarks', 'position', 'type']))) {

View File

@ -24,22 +24,14 @@ class MessageController extends Controller
'readingLogs' => fn ($query) => $query->where('employee_id', $user->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(
MessageResource::make($message)->resolve(),
['is_read' => $message->reading_logs_count],
);
});
// 分页
return [
'data' => $list,
'meta' => [
'total' => $paginator->total()
]
];
}
public function show($id, Request $request): MessageResource

View File

@ -36,7 +36,7 @@ class ReimbursementController extends Controller
$validated = $request->validate(
rules: [
'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'],
'photos' => ['bail', 'required', 'array'],
],