feat : check

This commit is contained in:
2025-04-01 15:11:04 +08:00
parent 33cbf5baa2
commit d1f3c33a02
4 changed files with 65 additions and 3 deletions

View File

@@ -10,10 +10,36 @@ declare(strict_types=1);
namespace App\Service\Api\Salesman;
use App\Exception\ErrException;
use App\Model\SalesmanTakePhoto;
use App\Service\ServiceTrait\Common\OssTrait;
use Hyperf\DbConnection\Db;
class ForceTakePhotoService extends BaseSalesmanService
{
public function handle()
use OssTrait;
/**
* @return array
* @throws ErrException
*/
public function handle(): array
{
//todo Write logic
$imageId = (int)$this->request->input('image_id');
Db::transaction(function () use ($imageId) {
$insertModel = new SalesmanTakePhoto();
$insertModel->user_id = $this->userId;
$insertModel->cycle_id = $this->cycleId;
$insertModel->date = date('Y-m-d');
$insertModel->image_id = $imageId;
$this->updateOssObjects([$imageId]);
if (!$insertModel->save()) throw new ErrException('拍照失败');
});
return $this->return->success();
}
}