<?php

namespace app\controller\common;

use app\extra\basic\Base;
use app\model\system\SystemConfig;
use LinFly\Annotation\Route\Controller;
use LinFly\Annotation\Route\Route;
use support\Response;
use Tinywan\Captcha\Captcha;

/**
 *
 */
#[Controller(prefix: "/api/service")]
class Common extends Base
{

    /**
     *
     */
    #[Route(path: "data",methods: "get")]
    public function getServiceData(): Response
    {
        try {
            $captcha = Captcha::base64();
            $service = (new SystemConfig)->where("type","service")->column("value","name");
            return successTrans("success.data",compact('captcha','service'));
        } catch (\Throwable $throwable) {
            return error($throwable->getMessage());
        }
    }

}