main
Jing Li 2024-04-16 17:14:06 +08:00
parent 06b694f6bf
commit 0a9fe3dc4a
1 changed files with 13 additions and 0 deletions

View File

@ -2,11 +2,13 @@
namespace App\Http\Controllers\Api;
use App\Enums\TaskStatus;
use App\Exceptions\RuntimeException;
use App\Http\Controllers\Api\Controller;
use App\Models\Keyword;
use App\Models\Ledger;
use App\Models\LedgerItem;
use App\Models\TaskLedger;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
@ -132,6 +134,17 @@ class LedgerController extends Controller
])->all()
);
// 自动完成总账录入任务
$taskLedger = TaskLedger::where('store_id', $user->store_id)
->where('date', $ledger->date)
->first();
if ($taskLedger) {
$taskLedger->task()->update([
'task_status' => TaskStatus::Success,
'completed_at' => $ledger->created_at,
]);
}
DB::commit();
} catch (Throwable $e) {
DB::rollBack();