41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* 成绩证书
|
|
* @Author:Soar
|
|
* @Time:2023/12/27 11:17
|
|
*/
|
|
|
|
namespace app\index\controller;
|
|
|
|
use app\admin\model\cms\Archives;
|
|
use app\common\controller\Frontend;
|
|
use app\index\service\CertificateService;
|
|
|
|
class Certificate extends Frontend
|
|
{
|
|
protected $noNeedLogin = ['checkCertificate'];
|
|
public function checkCertificate()
|
|
{
|
|
// 解决跨域请求接口问题
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies
|
|
header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问
|
|
header('Access-Control-Allow-Headers: *');
|
|
|
|
$certificate_number = $this->request->param("certificate_number");
|
|
|
|
$certificateService = new CertificateService();
|
|
|
|
if ($certificateService->checkCertificate($certificate_number)) {
|
|
$certificate_info = $certificateService->getCertificateToNumber($certificate_number);
|
|
|
|
$result['code'] = 200;
|
|
$result['data'] = $certificate_info;
|
|
$result['msg'] = "验证成功";
|
|
|
|
return json($result);
|
|
}
|
|
|
|
$this->error("验证失败");
|
|
}
|
|
} |