<?php
// +----------------------------------------------------------------------
// | onezan-admin 快速开发的管理平台
// +----------------------------------------------------------------------
// | 官方网址：https://www.onezan.cn
// +----------------------------------------------------------------------
// | onezan团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: 543885307@qq.com
// +----------------------------------------------------------------------
namespace app\service\admin\user;

use app\service\admin\BaseAdminService;
use app\service\domain\user\CoreUserVerifyService;
use think\Request;


/**
 * User Verify Service
 * @package app\service\admin\user
 */
class UserVerifyService extends BaseAdminService
{

    /**
     * 审核用户认证
     * @param Request $request 请求对象
     * @return array
     */
    public function review(Request $request): array
    {
        $id = $request->post('verify_id');
        $action = trim((string)$request->post('action', ''));
        $remark = trim((string)$request->post('remark', ''));

        if (!is_numeric($id)) {
            return ['code' => 1, 'msg' => ''];
        }

        return $this->core()->review((int)$id, $action, $remark);
    }

    /**
     * 获取用户认证核心服务实例
     * @return CoreUserVerifyService
     */
    private function core(): CoreUserVerifyService
    {
        return $this->app->make(CoreUserVerifyService::class);
    }
}