添加拉卡拉SDK

This commit is contained in:
qinzexin 2025-08-01 11:39:06 +08:00
parent 0590c2c26a
commit 60ad5db1db
6797 changed files with 1086012 additions and 9 deletions

8
.gitignore vendored
View File

@ -1,15 +1,7 @@
/nbproject/
/thinkphp/
/vendor/
/addons/*
/public/assets/libs/
/public/assets/addons/*
.idea
composer.lock
*.css.map
!.gitkeep
.env
.svn
.vscode
node_modules
.user.ini

1
addons/.htaccess Normal file
View File

@ -0,0 +1 @@
deny from all

1
addons/address/.addonrc Normal file
View File

@ -0,0 +1 @@
{"files":["public\/assets\/addons\/address\/js\/jquery.autocomplete.js","public\/assets\/addons\/address\/js\/gcoord.min.js"],"license":"regular","licenseto":"16018","licensekey":"1ZdGecY32upUIAJt m8dBv1leI2bbX3bJtAGUrA==","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"]}

View File

@ -0,0 +1,32 @@
<?php
namespace addons\address;
use think\Addons;
/**
* 地址选择
* @author [MiniLing] <[laozheyouxiang@163.com]>
*/
class Address extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
}

34
addons/address/bootstrap.js vendored Normal file
View File

@ -0,0 +1,34 @@
require([], function () {
//绑定data-toggle=addresspicker属性点击事件
$(document).on('click', "[data-toggle='addresspicker']", function () {
var that = this;
var callback = $(that).data('callback');
var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : "";
var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : "";
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
var lat = lat_id ? $("#" + lat_id).val() : '';
var lng = lng_id ? $("#" + lng_id).val() : '';
var zoom = zoom_id ? $("#" + zoom_id).val() : '';
var url = "/addons/address/index/select";
url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");
lat_id && $("#" + lat_id).val(res.lat).trigger("change");
lng_id && $("#" + lng_id).val(res.lng).trigger("change");
zoom_id && $("#" + zoom_id).val(res.zoom).trigger("change");
try {
//执行回调函数
if (typeof callback === 'function') {
callback.call(that, res);
}
} catch (e) {
}
}
});
});
});

132
addons/address/config.php Normal file
View File

@ -0,0 +1,132 @@
<?php
return [
[
'name' => 'maptype',
'title' => '默认地图类型',
'type' => 'radio',
'content' => [
'baidu' => '百度地图',
'amap' => '高德地图',
'tencent' => '腾讯地图',
],
'value' => 'tencent',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'zoom',
'title' => '默认缩放级别',
'type' => 'string',
'content' => [],
'value' => '11',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lat',
'title' => '默认Lat',
'type' => 'string',
'content' => [],
'value' => '39.919990',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lng',
'title' => '默认Lng',
'type' => 'string',
'content' => [],
'value' => '116.456270',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'baidukey',
'title' => '百度地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapkey',
'title' => '高德地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapsecurityjscode',
'title' => '高德地图安全密钥',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'tencentkey',
'title' => '腾讯地图KEY',
'type' => 'string',
'content' => [],
'value' => '2ZCBZ-3B2KU-C24VQ-2S2WG-24TZV-NSBHZ',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'coordtype',
'title' => '坐标系类型',
'type' => 'select',
'content' => [
'DEFAULT' => '默认(使用所选地图默认坐标系)',
'GCJ02' => 'GCJ-02',
'BD09' => 'BD-09',
],
'value' => 'DEFAULT',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => '',
'content' => [],
'value' => '请先申请对应地图的Key配置后再使用',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => 'alert-danger-light',
],
];

View File

@ -0,0 +1,64 @@
<?php
namespace addons\address\controller;
use think\addons\Controller;
use think\Config;
use think\Hook;
class Index extends Controller
{
// 首页
public function index()
{
// 语言检测
$lang = $this->request->langset();
$lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
$site = Config::get("site");
// 配置信息
$config = [
'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
'upload' => null,
'modulename' => 'addons',
'controllername' => 'index',
'actionname' => 'index',
'jsname' => 'addons/address',
'moduleurl' => '',
'language' => $lang
];
$config = array_merge($config, Config::get("view_replace_str"));
// 配置信息后
Hook::listen("config_init", $config);
// 加载当前控制器语言包
$this->view->assign('site', $site);
$this->view->assign('config', $config);
return $this->view->fetch();
}
// 选择地址
public function select()
{
$config = get_addon_config('address');
$zoom = (int)$this->request->get('zoom', $config['zoom']);
$lng = (float)$this->request->get('lng');
$lat = (float)$this->request->get('lat');
$address = $this->request->get('address');
$lng = $lng ?: $config['lng'];
$lat = $lat ?: $config['lat'];
$this->view->assign('zoom', $zoom);
$this->view->assign('lng', $lng);
$this->view->assign('lat', $lat);
$this->view->assign('address', $address);
$maptype = $config['maptype'];
if (!isset($config[$maptype . 'key']) || !$config[$maptype . 'key']) {
$this->error("请在配置中配置对应类型地图的密钥");
}
return $this->view->fetch('index/' . $maptype);
}
}

10
addons/address/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = address
title = 地址位置选择插件
intro = 地图位置选择插件,可返回地址和经纬度
author = FastAdmin
website = https://www.fastadmin.net
version = 1.1.8
state = 1
url = /addons/address
license = regular
licenseto = 16018

View File

@ -0,0 +1,258 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>地址选择器</title>
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
#container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.confirm {
position: absolute;
bottom: 30px;
right: 4%;
z-index: 99;
height: 50px;
width: 50px;
line-height: 50px;
font-size: 15px;
text-align: center;
background-color: white;
background: #1ABC9C;
color: white;
border: none;
cursor: pointer;
border-radius: 50%;
}
.search {
position: absolute;
width: 400px;
top: 0;
left: 50%;
padding: 5px;
margin-left: -200px;
}
.amap-marker-label {
border: 0;
background-color: transparent;
}
.info {
padding: .75rem 1.25rem;
margin-bottom: 1rem;
border-radius: .25rem;
position: fixed;
top: 2rem;
background-color: white;
width: auto;
min-width: 22rem;
border-width: 0;
left: 1.8rem;
box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
}
</style>
</head>
<body>
<div class="search">
<div class="input-group">
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-success">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
<div class="confirm">确定</div>
<div id="container"></div>
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode: "{$config.amapsecurityjscode|default=''}",
}
</script>
<script type="text/javascript" src="//webapi.amap.com/maps?v=1.4.11&key={$config.amapkey|default=''}&plugin=AMap.ToolBar,AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocoder"></script>
<!-- UI组件库 1.0 -->
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
<script type="text/javascript">
$(function () {
var as, map, geocoder, address, fromtype, totype;
address = "{$address|htmlentities}";
var lng = Number("{$lng}");
var lat = Number("{$lat}");
fromtype = "GCJ02";
totype = "{$config.coordtype|default='DEFAULT'}"
totype = totype === 'DEFAULT' ? "GCJ02" : totype;
if (lng && lat && fromtype !== totype) {
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
lng = result[0] || lng;
lat = result[1] || lat;
}
var init = function () {
AMapUI.loadUI(['misc/PositionPicker', 'misc/PoiPicker'], function (PositionPicker, PoiPicker) {
//加载PositionPickerloadUI的路径参数为模块名中 'ui/' 之后的部分
map = new AMap.Map('container', {
zoom: parseInt('{$zoom}'),
center: [lng, lat]
});
geocoder = new AMap.Geocoder({
radius: 1000 //范围默认500
});
var positionPicker = new PositionPicker({
mode: 'dragMarker',//设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
map: map//依赖地图对象
});
//输入提示
var autoOptions = {
input: "place"
};
var relocation = function (lnglat, addr) {
lng = lnglat.lng;
lat = lnglat.lat;
map.panTo([lng, lat]);
positionPicker.start(lnglat);
if (addr) {
// var label = '<div class="info">地址:' + addr + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
var label = '<div class="info">地址:' + addr + '</div>';
positionPicker.marker.setLabel({
content: label //显示内容
});
} else {
geocoder.getAddress(lng + ',' + lat, function (status, result) {
if (status === 'complete' && result.regeocode) {
var address = result.regeocode.formattedAddress;
// var label = '<div class="info">地址:' + address + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
var label = '<div class="info">地址:' + address + '</div>';
positionPicker.marker.setLabel({
content: label //显示内容
});
} else {
console.log(JSON.stringify(result));
}
});
}
};
var auto = new AMap.Autocomplete(autoOptions);
//构造地点查询类
var placeSearch = new AMap.PlaceSearch({
map: map
});
//注册监听,当选中某条记录时会触发
AMap.event.addListener(auto, "select", function (e) {
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name, function (status, result) {
$(map.getAllOverlays("marker")).each(function (i, j) {
j.on("click", function () {
relocation(j.De.position);
});
});
}); //关键字查询查询
});
AMap.event.addListener(map, 'click', function (e) {
relocation(e.lnglat);
});
//加载工具条
var tool = new AMap.ToolBar();
map.addControl(tool);
var poiPicker = new PoiPicker({
input: 'place',
placeSearchOptions: {
map: map,
pageSize: 6 //关联搜索分页
}
});
poiPicker.on('poiPicked', function (poiResult) {
poiPicker.hideSearchResults();
$('.poi .nearpoi').text(poiResult.item.name);
$('.address .info').text(poiResult.item.address);
$('#address').val(poiResult.item.address);
$("#place").val(poiResult.item.name);
relocation(poiResult.item.location);
});
positionPicker.on('success', function (positionResult) {
console.log(positionResult);
as = positionResult.position;
address = positionResult.address;
lat = as.lat;
lng = as.lng;
});
positionPicker.on('fail', function (positionResult) {
address = '';
});
positionPicker.start();
if (address) {
// 添加label
var label = '<div class="info">地址:' + address + '</div>';
positionPicker.marker.setLabel({
content: label //显示内容
});
}
//点击搜索按钮
$(document).on('click', '#search-btn', function () {
if ($("#place").val() == '')
return;
placeSearch.search($("#place").val(), function (status, result) {
$(map.getAllOverlays("marker")).each(function (i, j) {
j.on("click", function () {
relocation(j.De.position);
});
});
});
});
});
};
//点击确定后执行回调赋值
var close = function (data) {
var index = parent.Layer.getFrameIndex(window.name);
var callback = parent.$("#layui-layer" + index).data("callback");
//再执行关闭
parent.Layer.close(index);
//再调用回传函数
if (typeof callback === 'function') {
callback.call(undefined, data);
}
};
//点击搜索按钮
$(document).on('click', '.confirm', function () {
var zoom = map.getZoom();
var data = {lat: lat, lng: lng, zoom: zoom, address: address};
if (fromtype !== totype) {
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
data.lng = (result[0] || data.lng).toFixed(5);
data.lat = (result[1] || data.lat).toFixed(5);
console.log(data, result, fromtype, totype);
}
close(data);
});
init();
});
</script>
</body>
</html>

View File

@ -0,0 +1,243 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>地址选择器</title>
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
#container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.confirm {
position: absolute;
bottom: 30px;
right: 4%;
z-index: 99;
height: 50px;
width: 50px;
line-height: 50px;
font-size: 15px;
text-align: center;
background-color: white;
background: #1ABC9C;
color: white;
border: none;
cursor: pointer;
border-radius: 50%;
}
.search {
position: absolute;
width: 400px;
top: 0;
left: 50%;
padding: 5px;
margin-left: -200px;
}
label.BMapLabel {
max-width: inherit;
padding: .75rem 1.25rem;
margin-bottom: 1rem;
background-color: white;
width: auto;
min-width: 22rem;
border: none;
box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
}
</style>
</head>
<body>
<div class="search">
<div class="input-group">
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
<span class="input-group-btn">
<button type="button" name="search" id="search-btn" class="btn btn-success">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
<div class="confirm">确定</div>
<div id="container"></div>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak={$config.baidukey|default=''}"></script>
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
<script type="text/javascript">
$(function () {
var map, marker, point, fromtype, totype;
var zoom = parseInt("{$zoom}");
var address = "{$address|htmlentities}";
var lng = Number("{$lng}");
var lat = Number("{$lat}");
fromtype = "BD09";
totype = "{$config.coordtype|default='DEFAULT'}"
totype = totype === 'DEFAULT' ? "BD09" : totype;
if (lng && lat && fromtype !== totype) {
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
lng = result[0] || lng;
lat = result[1] || lat;
}
var geocoder = new BMap.Geocoder();
var addPointMarker = function (point, addr) {
deletePoint();
addPoint(point);
if (addr) {
addMarker(point, addr);
} else {
geocoder.getLocation(point, function (rs) {
addMarker(point, rs.address);
});
}
};
var addPoint = function (point) {
lng = point.lng;
lat = point.lat;
marker = new BMap.Marker(point);
map.addOverlay(marker);
map.panTo(point);
};
var addMarker = function (point, addr) {
address = addr;
// var labelhtml = '<div class="info">地址:' + address + '<br>经度:' + point.lng + '<br>纬度:' + point.lat + '</div>';
var labelhtml = '<div class="info">地址:' + address + '</div>';
var label = new BMap.Label(labelhtml, {offset: new BMap.Size(16, 20)});
label.setStyle({
border: 'none',
padding: '.75rem 1.25rem'
});
marker.setLabel(label);
};
var deletePoint = function () {
var allOverlay = map.getOverlays();
for (var i = 0; i < allOverlay.length; i++) {
map.removeOverlay(allOverlay[i]);
}
};
var init = function () {
map = new BMap.Map("container"); // 创建地图实例
var point = new BMap.Point(lng, lat); // 创建点坐标
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
map.centerAndZoom(point, zoom); // 初始化地图,设置中心点坐标和地图级别
var size = new BMap.Size(10, 20);
map.addControl(new BMap.CityListControl({
anchor: BMAP_ANCHOR_TOP_LEFT,
offset: size,
}));
if ("{$lng}" != '' && "{$lat}" != '') {
addPointMarker(point, address);
}
ac = new BMap.Autocomplete({"input": "place", "location": map}); //建立一个自动完成的对象
ac.addEventListener("onhighlight", function (e) { //鼠标放在下拉列表上的事件
var str = "";
var _value = e.fromitem.value;
var value = "";
if (e.fromitem.index > -1) {
value = _value.province + _value.city + _value.district + _value.street + _value.business;
}
str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
value = "";
if (e.toitem.index > -1) {
_value = e.toitem.value;
value = _value.province + _value.city + _value.district + _value.street + _value.business;
}
str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
$("#searchResultPanel").html(str);
});
ac.addEventListener("onconfirm", function (e) { //鼠标点击下拉列表后的事件
var _value = e.item.value;
myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
$("#searchResultPanel").html("onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue);
setPlace();
});
function setPlace(text) {
map.clearOverlays(); //清除地图上所有覆盖物
function myFun() {
var results = local.getResults();
var result = local.getResults().getPoi(0);
var point = result.point; //获取第一个智能搜索的结果
map.centerAndZoom(point, 18);
// map.addOverlay(new BMap.Marker(point)); //添加标注
if (result.type != 0) {
address = results.province + results.city + result.address;
} else {
address = result.address;
}
addPointMarker(point, address);
}
var local = new BMap.LocalSearch(map, { //智能搜索
onSearchComplete: myFun
});
local.search(text || myValue);
}
map.addEventListener("click", function (e) {
//通过点击百度地图可以获取到对应的point, 由point的lng、lat属性就可以获取对应的经度纬度
addPointMarker(e.point);
});
//点击搜索按钮
$(document).on('click', '#search-btn', function () {
if ($("#place").val() == '')
return;
setPlace($("#place").val());
});
};
var close = function (data) {
var index = parent.Layer.getFrameIndex(window.name);
var callback = parent.$("#layui-layer" + index).data("callback");
//再执行关闭
parent.Layer.close(index);
//再调用回传函数
if (typeof callback === 'function') {
callback.call(undefined, data);
}
};
//点击确定后执行回调赋值
$(document).on('click', '.confirm', function () {
var zoom = map.getZoom();
var data = {lat: lat, lng: lng, zoom: zoom, address: address};
if (fromtype !== totype) {
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
data.lng = (result[0] || data.lng).toFixed(5);
data.lat = (result[1] || data.lat).toFixed(5);
console.log(data, result, fromtype, totype);
}
close(data);
});
init();
});
</script>
</body>
</html>

View File

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>地图位置(经纬度)选择插件</title>
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
</head>
<body>
<div class="container">
<div class="bs-docs-section clearfix">
<div class="row">
<div class="col-lg-12">
<div class="page-header">
<h2>地图位置(经纬度)选择示例</h2>
</div>
<div class="bs-component">
<form action="" method="post" role="form">
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="address" placeholder="地址">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="lng" placeholder="经度">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="lat" placeholder="纬度">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
</div>
<button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
</form>
</div>
<div class="page-header">
<h2 id="code">调用代码</h2>
</div>
<div class="bs-component">
<textarea class="form-control" rows="17">
<form action="" method="post" role="form">
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="address" placeholder="地址">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="lng" placeholder="经度">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="lat" placeholder="纬度">
</div>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
</div>
<button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
</form>
</textarea>
</div>
<div class="page-header">
<h2>参数说明</h2>
</div>
<div class="bs-component" style="background:#fff;">
<table class="table table-bordered">
<thead>
<tr>
<th>参数</th>
<th>释义</th>
</tr>
</thead>
<tbody>
<tr>
<td>data-input-id</td>
<td>填充地址的文本框ID</td>
</tr>
<tr>
<td>data-lng-id</td>
<td>填充经度的文本框ID</td>
</tr>
<tr>
<td>data-lat-id</td>
<td>填充纬度的文本框ID</td>
</tr>
<tr>
<td>data-zoom-id</td>
<td>填充缩放的文本框ID</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--@formatter:off-->
<script type="text/javascript">
var require = {
config: {$config|json_encode}
};
</script>
<!--@formatter:on-->
<script>
require.callback = function () {
define('addons/address', ['jquery', 'bootstrap', 'frontend', 'template'], function ($, undefined, Frontend, Template) {
var Controller = {
index: function () {
}
};
return Controller;
});
define('lang', function () {
return [];
});
}
</script>
<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-frontend.min.js?v={$site.version}"></script>
</body>
</html>

View File

@ -0,0 +1,291 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>地址选择器</title>
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
#container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.confirm {
position: absolute;
bottom: 30px;
right: 4%;
z-index: 99;
height: 50px;
width: 50px;
line-height: 50px;
font-size: 15px;
text-align: center;
background-color: white;
background: #1ABC9C;
color: white;
border: none;
cursor: pointer;
border-radius: 50%;
}
.search {
position: absolute;
width: 400px;
top: 0;
left: 50%;
padding: 5px;
margin-left: -200px;
}
.autocomplete-search {
text-align: left;
cursor: default;
background: #fff;
border-radius: 2px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
position: absolute;
display: none;
z-index: 1036;
max-height: 254px;
overflow: hidden;
overflow-y: auto;
box-sizing: border-box;
}
.autocomplete-search .autocomplete-suggestion {
padding: 5px;
}
.autocomplete-search .autocomplete-suggestion:hover {
background: #f0f0f0;
}
</style>
</head>
<body>
<div class="search">
<div class="input-group">
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
<span class="input-group-btn">
<button type="button" name="search" id="search-btn" class="btn btn-success">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
<div class="confirm">确定</div>
<div id="container"></div>
<script charset="utf-8" src="//map.qq.com/api/js?v=2.exp&libraries=place&key={$config.tencentkey|default=''}"></script>
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
<script src="__CDN__/assets/addons/address/js/jquery.autocomplete.js"></script>
<script type="text/javascript">
$(function () {
var map, marker, geocoder, infoWin, searchService, keyword, address, fromtype, totype;
address = "{$address|htmlentities}";
var lng = Number("{$lng}");
var lat = Number("{$lat}");
fromtype = "GCJ02";
totype = "{$config.coordtype|default='DEFAULT'}"
totype = totype === 'DEFAULT' ? "GCJ02" : totype;
if (lng && lat && fromtype !== totype) {
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
lng = result[0] || lng;
lat = result[1] || lat;
}
var init = function () {
var center = new qq.maps.LatLng(lat, lng);
map = new qq.maps.Map(document.getElementById('container'), {
center: center,
zoom: parseInt("{$config.zoom}")
});
//实例化信息窗口
infoWin = new qq.maps.InfoWindow({
map: map
});
geocoder = {
getAddress: function (latLng) {
$.ajax({
url: "https://apis.map.qq.com/ws/geocoder/v1/?location=" + latLng.lat + "," + latLng.lng + "&key={$config.tencentkey|default=''}&output=jsonp",
dataType: "jsonp",
type: 'GET',
cache: true,
crossDomain: true,
success: function (ret) {
console.log("getAddress:", ret)
if (ret.status === 0) {
var component = ret.result.address_component;
if (ret.result.formatted_addresses && ret.result.formatted_addresses.recommend) {
var recommend = ret.result.formatted_addresses.recommend;
var standard_address = ret.result.formatted_addresses.standard_address;
var address = component.province !== component.city ? component.province + component.city : component.province;
address = address + (recommend.indexOf(component.district) === 0 ? '' : component.district) + recommend;
} else {
address = ret.result.address;
}
showMarker(ret.result.location, address);
showInfoWin(ret.result.location, address);
}
},
error: function (e) {
console.log(e, 'error')
}
});
}
};
//初始化marker
showMarker(center);
if (address) {
showInfoWin(center, address);
} else {
geocoder.getAddress(center);
}
var place = $("#place");
place.autoComplete({
minChars: 1,
cache: 0,
menuClass: 'autocomplete-search',
source: function (term, response) {
try {
xhr.abort();
} catch (e) {
}
xhr = $.ajax({
url: "https://apis.map.qq.com/ws/place/v1/suggestion?keyword=" + term + "&key={$config.tencentkey|default=''}&output=jsonp",
dataType: "jsonp",
type: 'GET',
cache: true,
success: function (ret) {
if (ret.status === 0) {
if(ret.data.length === 0){
$(".autocomplete-suggestions.autocomplete-search").html('');
}
response(ret.data);
} else {
console.log(ret);
}
}
});
},
renderItem: function (item, search) {
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var regexp = new RegExp("(" + search.replace(/[\,|\u3000|\uff0c]/, ' ').split(' ').join('|') + ")", "gi");
return "<div class='autocomplete-suggestion' data-item='" + JSON.stringify(item) + "' data-title='" + item.title + "' data-val='" + item.title + "'>" + item.title.replace(regexp, "<b>$1</b>") + "</div>";
},
onSelect: function (e, term, sel) {
e.preventDefault();
var item = $(sel).data("item");
//调用获取位置方法
geocoder.getAddress(item.location);
var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
map.setCenter(position);
}
});
//地图点击
qq.maps.event.addListener(map, 'click', function (event) {
try {
//调用获取位置方法
geocoder.getAddress(event.latLng);
} catch (e) {
console.log(e);
}
}
);
};
//显示info窗口
var showInfoWin = function (latLng, title) {
var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
infoWin.open();
infoWin.setContent(title);
infoWin.setPosition(position);
};
//实例化marker和监听拖拽结束事件
var showMarker = function (latLng, title) {
console.log("showMarker", latLng, title)
var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
marker && marker.setMap(null);
marker = new qq.maps.Marker({
map: map,
position: position,
draggable: true,
title: title || '拖动图标选择位置'
});
//监听拖拽结束
qq.maps.event.addListener(marker, 'dragend', function (event) {
//调用获取位置方法
geocoder.getAddress(event.latLng);
});
};
var close = function (data) {
var index = parent.Layer.getFrameIndex(window.name);
var callback = parent.$("#layui-layer" + index).data("callback");
//再执行关闭
parent.Layer.close(index);
//再调用回传函数
if (typeof callback === 'function') {
callback.call(undefined, data);
}
};
//点击确定后执行回调赋值
$(document).on('click', '.confirm', function () {
var zoom = map.getZoom();
var data = {lat: infoWin.position.lat.toFixed(5), lng: infoWin.position.lng.toFixed(5), zoom: zoom, address: infoWin.content};
if (fromtype !== totype) {
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
data.lng = (result[0] || data.lng).toFixed(5);
data.lat = (result[1] || data.lat).toFixed(5);
console.log(data, result, fromtype, totype);
}
close(data);
});
//点击搜索按钮
$(document).on('click', '#search-btn', function () {
if ($("#place").val() === '')
return;
var first = $(".autocomplete-search > .autocomplete-suggestion:first");
if (!first.length) {
return;
}
var item = first.data("item");
//调用获取位置方法
geocoder.getAddress(item.location);
var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
map.setCenter(position);
});
init();
});
</script>
</body>
</html>

1
addons/alisms/.addonrc Normal file
View File

@ -0,0 +1 @@
{"files":[],"license":"basic","licenseto":"16018","licensekey":"b6VN0kuQzEgTpwC3 jrSrNHXh4ygwHO32cz6+BQ==","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"]}

86
addons/alisms/Alisms.php Normal file
View File

@ -0,0 +1,86 @@
<?php
namespace addons\alisms;
use think\Addons;
/**
* Alisms
*/
class Alisms extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
/**
* 短信发送行为
* @param array $params 必须包含mobile,event,code
* @return boolean
*/
public function smsSend(&$params)
{
$config = get_addon_config('alisms');
if (!isset($config['template'][$params['event']])) {
return false;
}
$alisms = new \addons\alisms\library\Alisms();
$result = $alisms->mobile($params['mobile'])
->template($config['template'][$params['event']])
->param(['code' => $params['code']])
->send();
return $result;
}
/**
* 短信发送通知
* @param array $params 必须包含 mobile,event,msg
* @return boolean
*/
public function smsNotice(&$params)
{
$config = get_addon_config('alisms');
$alisms = \addons\alisms\library\Alisms::instance();
if (isset($params['msg'])) {
if (is_array($params['msg'])) {
$param = $params['msg'];
} else {
parse_str($params['msg'], $param);
}
} else {
$param = [];
}
$param = $param ? $param : [];
$params['template'] = $params['template'] ?? (isset($params['event']) && isset($config['template'][$params['event']]) ? $config['template'][$params['event']] : '');
$result = $alisms->mobile($params['mobile'])
->template($params['template'])
->param($param)
->send();
return $result;
}
/**
* 检测验证是否正确
* @param $params
* @return boolean
*/
public function smsCheck(&$params)
{
return true;
}
}

73
addons/alisms/config.php Normal file
View File

@ -0,0 +1,73 @@
<?php
return [
[
'name' => 'key',
'title' => '应用key',
'type' => 'string',
'content' => [],
'value' => 'your key',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'secret',
'title' => '密钥secret',
'type' => 'string',
'content' => [],
'value' => 'your secret',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'sign',
'title' => '签名',
'type' => 'string',
'content' => [],
'value' => 'your sign',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'template',
'title' => '短信模板',
'type' => 'array',
'content' => [],
'value' => [
'register' => 'SMS_114000000',
'resetpwd' => 'SMS_114000000',
'changepwd' => 'SMS_114000000',
'changemobile' => 'SMS_114000000',
'profile' => 'SMS_114000000',
'notice' => 'SMS_114000000',
'mobilelogin' => 'SMS_114000000',
'bind' => 'SMS_114000000',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => 'string',
'content' => [],
'value' => '应用key和密钥你可以通过 https://ram.console.aliyun.com/manage/ak 获取',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
];

View File

@ -0,0 +1,73 @@
<?php
namespace addons\alisms\controller;
use think\addons\Controller;
/**
* 阿里云短信
*/
class Index extends Controller
{
protected $model = null;
protected $templateList = [
'register' => '注册',
'resetpwd' => '重置密码',
'changepwd' => '修改密码',
'changemobile' => '修改手机号',
'profile' => '修改个人信息',
'notice' => '通知',
'mobilelogin' => '移动端登录',
'bind' => '绑定账号',
];
public function _initialize()
{
if (!\app\admin\library\Auth::instance()->id) {
$this->error('暂无权限浏览');
}
parent::_initialize();
}
//首页
public function index()
{
$this->view->assign('templateList', $this->templateList);
return $this->view->fetch();
}
//发送测试短信
public function send()
{
$config = get_addon_config('alisms');
$mobile = $this->request->post('mobile');
$template = $this->request->post('template');
$sign = $this->request->post('sign', '');
if (!$mobile) {
$this->error('手机号不能为空');
}
$templateArr = $config['template'] ?? [];
if (!isset($templateArr[$template]) || !$templateArr[$template]) {
$this->error('后台未配置对应的模板CODE');
}
$template = $templateArr[$template];
$sign = $sign ?: $config['sign'];
$param = (array)json_decode($this->request->post('param', '', 'trim'));
$param = ['code' => mt_rand(1000, 9999)];
$alisms = new \addons\alisms\library\Alisms();
$ret = $alisms->mobile($mobile)
->template($template)
->sign($sign)
->param($param)
->send();
if ($ret) {
$this->success("发送成功");
} else {
$this->error("发送失败!失败原因:" . $alisms->getError());
}
}
}

10
addons/alisms/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = alisms
title = 阿里云短信发送
intro = 阿里云短信发送插件
author = FastAdmin
website = https://www.fastadmin.net
version = 1.0.11
state = 1
url = /addons/alisms
license = basic
licenseto = 16018

View File

@ -0,0 +1,170 @@
<?php
namespace addons\alisms\library;
/**
* 阿里云SMS短信发送
*/
class Alisms
{
private $_params = [];
public $error = '';
protected $config = [];
protected static $instance;
public function __construct($options = [])
{
if ($config = get_addon_config('alisms')) {
$this->config = array_merge($this->config, $config);
}
$this->config = array_merge($this->config, is_array($options) ? $options : []);
}
/**
* 单例
* @param array $options 参数
* @return Alisms
*/
public static function instance($options = [])
{
if (is_null(self::$instance)) {
self::$instance = new static($options);
}
return self::$instance;
}
/**
* 设置签名
* @param string $sign
* @return Alisms
*/
public function sign($sign = '')
{
$this->_params['SignName'] = $sign;
return $this;
}
/**
* 设置参数
* @param array $param
* @return Alisms
*/
public function param(array $param = [])
{
foreach ($param as $k => &$v) {
$v = (string)$v;
}
unset($v);
$param = array_filter($param);
$this->_params['TemplateParam'] = $param ? json_encode($param) : '{}';
return $this;
}
/**
* 设置模板
* @param string $code 短信模板
* @return Alisms
*/
public function template($code = '')
{
$this->_params['TemplateCode'] = $code;
return $this;
}
/**
* 接收手机
* @param string $mobile 手机号码
* @return Alisms
*/
public function mobile($mobile = '')
{
$this->_params['PhoneNumbers'] = $mobile;
return $this;
}
/**
* 立即发送
* @return boolean
*/
public function send()
{
$this->error = '';
$params = $this->_params();
$params['Signature'] = $this->_signed($params);
$response = $this->_curl($params);
if ($response !== false) {
$res = (array)json_decode($response, true);
if (isset($res['Code']) && $res['Code'] == 'OK') {
return true;
}
$this->error = $res['Message'] ?? 'InvalidResult';
} else {
$this->error = 'InvalidResult';
}
return false;
}
/**
* 获取错误信息
* @return string
*/
public function getError()
{
return $this->error;
}
private function _params()
{
return array_merge([
'AccessKeyId' => $this->config['key'],
'SignName' => $this->config['sign'] ?? '',
'Action' => 'SendSms',
'Format' => 'JSON',
'Version' => '2017-05-25',
'SignatureVersion' => '1.0',
'SignatureMethod' => 'HMAC-SHA1',
'SignatureNonce' => uniqid(),
'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'),
], $this->_params);
}
private function percentEncode($string)
{
$string = urlencode($string);
$string = preg_replace('/\+/', '%20', $string);
$string = preg_replace('/\*/', '%2A', $string);
$string = preg_replace('/%7E/', '~', $string);
return $string;
}
private function _signed($params)
{
$sign = $this->config['secret'];
ksort($params);
$canonicalizedQueryString = '';
foreach ($params as $key => $value) {
$canonicalizedQueryString .= '&' . $this->percentEncode($key) . '=' . $this->percentEncode($value);
}
$stringToSign = 'GET&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1));
$signature = base64_encode(hash_hmac('sha1', $stringToSign, $sign . '&', true));
return $signature;
}
private function _curl($params)
{
$uri = 'http://dysmsapi.aliyuncs.com/?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.98 Safari/537.36");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$reponse = curl_exec($ch);
curl_close($ch);
return $reponse;
}
}

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>阿里云短信发送示例 - {$site.name}</title>
<link href="__CDN__/assets/libs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="/assets/js/html5shiv.js"></script>
<script src="/assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="well" style="margin-top:30px;">
<div class="alert alert-danger">温馨提示:仅用于测试插件是否能正常发送短信</div>
<form class="form-horizontal" action="{:addon_url('alisms/index/send')}" method="POST">
<fieldset>
<legend style="padding-bottom:15px;">阿里云短信发送测试</legend>
<div class="form-group">
<label class="col-lg-2 control-label">手机号</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="mobile" placeholder="手机号">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">消息模板</label>
<div class="col-lg-10">
<select name="template" class="form-control">
{foreach name="templateList" id="item"}
<option value="{$key}">{$item} ({$key})</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="submit" class="btn btn-primary">发送</button>
<button type="reset" class="btn btn-default">重置</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function () {
});
</script>
</body>
</html>

1
addons/barcode/.addonrc Normal file
View File

@ -0,0 +1 @@
{"files":[],"license":"regular","licenseto":"16018","licensekey":"W2bPHUwMcyO6Fjkg pTI8DspkQ7HSNZ5g4bCmSA==","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"]}

View File

@ -0,0 +1,53 @@
<?php
namespace addons\barcode;
use think\Addons;
/**
* 条码生成
*/
class Barcode extends Addons {
/**
* 插件安装方法
* @return bool
*/
public function install() {
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall() {
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable() {
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable() {
return true;
}
/**
* 应用初始化
*/
public function appInit()
{
if(!class_exists("\Picqer\Barcode")){
\think\Loader::addNamespace('Picqer\Barcode', ADDON_PATH . 'barcode' . DS . 'library' . DS . 'Barcode' . DS);
}
}
}

22
addons/barcode/config.php Normal file
View File

@ -0,0 +1,22 @@
<?php
return [
[
'name' => 'rewrite',
'title' => '伪静态',
'type' => 'array',
'content' =>
[
],
'value' =>
[
'index/index' => '/barcode$',
'index/build' => '/barcode/build$',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
];

View File

@ -0,0 +1,43 @@
<?php
namespace addons\barcode\controller;
use think\addons\Controller;
use think\Response;
/**
* 条码生成
* @package addons\barcode\controller
*/
class Index extends Controller {
public function index() {
return $this->view->fetch();
}
// 生成条码
public function build() {
$text = $this->request->get('text', '1234567890');
$type = $this->request->get('type', 'C128');
$foreground = $this->request->get('foreground', "#000000");
$width = $this->request->get('width', 2);
$height = $this->request->get('height', 30);
$params = [
'text' => $text,
'type' => $type,
'foreground' => $foreground,
'width' => $width,
'height' => $height,
];
$barcode = \addons\barcode\library\Service::barcode($params);
// 直接显示条码
$response = Response::create()->header("Content-Type", "image/png");
header('Content-Type: image/png');
$response->content($barcode);
return $response;
}
}

10
addons/barcode/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = barcode
title = 条码生成
intro = 生成条码示例插件
author = aa820t
website = https://ask.fastadmin.net/u/26861
version = 1.0.0
state = 1
license = regular
licenseto = 16018
url = /addons/barcode

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
<?php
namespace Picqer\Barcode;
class BarcodeGeneratorHTML extends BarcodeGenerator
{
/**
* Return an HTML representation of barcode.
*
* @param string $code code to print
* @param string $type type of barcode
* @param int $widthFactor Width of a single bar element in pixels.
* @param int $totalHeight Height of a single bar element in pixels.
* @param int|string $color Foreground color for bar elements (background is transparent).
* @return string HTML code.
* @public
*/
public function getBarcode($code, $type, $widthFactor = 2, $totalHeight = 30, $color = 'black')
{
$barcodeData = $this->getBarcodeData($code, $type);
$html = '<div style="font-size:0;position:relative;width:' . ($barcodeData['maxWidth'] * $widthFactor) . 'px;height:' . ($totalHeight) . 'px;">' . "\n";
$positionHorizontal = 0;
foreach ($barcodeData['bars'] as $bar) {
$barWidth = round(($bar['width'] * $widthFactor), 3);
$barHeight = round(($bar['height'] * $totalHeight / $barcodeData['maxHeight']), 3);
if ($bar['drawBar']) {
$positionVertical = round(($bar['positionVertical'] * $totalHeight / $barcodeData['maxHeight']), 3);
// draw a vertical bar
$html .= '<div style="background-color:' . $color . ';width:' . $barWidth . 'px;height:' . $barHeight . 'px;position:absolute;left:' . $positionHorizontal . 'px;top:' . $positionVertical . 'px;">&nbsp;</div>' . "\n";
}
$positionHorizontal += $barWidth;
}
$html .= '</div>' . "\n";
return $html;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Picqer\Barcode;
use Picqer\Barcode\Exceptions\BarcodeException;
class BarcodeGeneratorJPG extends BarcodeGenerator
{
/**
* Return a JPG image representation of barcode (requires GD or Imagick library).
*
* @param string $code code to print
* @param string $type type of barcode:
* @param int $widthFactor Width of a single bar element in pixels.
* @param int $totalHeight Height of a single bar element in pixels.
* @param array $color RGB (0-255) foreground color for bar elements (background is transparent).
* @return string image data or false in case of error.
* @public
* @throws BarcodeException
*/
public function getBarcode($code, $type, $widthFactor = 2, $totalHeight = 30, $color = array(0, 0, 0))
{
$barcodeData = $this->getBarcodeData($code, $type);
// calculate image size
$width = ($barcodeData['maxWidth'] * $widthFactor);
$height = $totalHeight;
if (function_exists('imagecreate')) {
// GD library
$imagick = false;
$jpg = imagecreate($width, $height);
$colorBackground = imagecolorallocate($jpg, 255, 255, 255);
imagecolortransparent($jpg, $colorBackground);
$colorForeground = imagecolorallocate($jpg, $color[0], $color[1], $color[2]);
} elseif (extension_loaded('imagick')) {
$imagick = true;
$colorForeground = new \imagickpixel('rgb(' . $color[0] . ',' . $color[1] . ',' . $color[2] . ')');
$jpg = new \Imagick();
$jpg->newImage($width, $height, 'white', 'jpg');
$imageMagickObject = new \imagickdraw();
$imageMagickObject->setFillColor($colorForeground);
} else {
throw new BarcodeException('Neither gd-lib or imagick are installed!');
}
// print bars
$positionHorizontal = 0;
foreach ($barcodeData['bars'] as $bar) {
$bw = round(($bar['width'] * $widthFactor), 3);
$bh = round(($bar['height'] * $totalHeight / $barcodeData['maxHeight']), 3);
if ($bar['drawBar']) {
$y = round(($bar['positionVertical'] * $totalHeight / $barcodeData['maxHeight']), 3);
// draw a vertical bar
if ($imagick && isset($imageMagickObject)) {
$imageMagickObject->rectangle($positionHorizontal, $y, ($positionHorizontal + $bw), ($y + $bh));
} else {
imagefilledrectangle($jpg, $positionHorizontal, $y, ($positionHorizontal + $bw) - 1, ($y + $bh),
$colorForeground);
}
}
$positionHorizontal += $bw;
}
ob_start();
if ($imagick && isset($imageMagickObject)) {
$jpg->drawImage($imageMagickObject);
echo $jpg;
} else {
imagejpeg($jpg);
imagedestroy($jpg);
}
$image = ob_get_clean();
return $image;
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace Picqer\Barcode;
use Picqer\Barcode\Exceptions\BarcodeException;
class BarcodeGeneratorPNG extends BarcodeGenerator
{
/**
* Return a PNG image representation of barcode (requires GD or Imagick library).
*
* @param string $code code to print
* @param string $type type of barcode:
* @param int $widthFactor Width of a single bar element in pixels.
* @param int $totalHeight Height of a single bar element in pixels.
* @param array $color RGB (0-255) foreground color for bar elements (background is transparent).
* @return string image data or false in case of error.
* @public
*/
public function getBarcode($code, $type, $widthFactor = 2, $totalHeight = 30, $color = array(0, 0, 0))
{
$barcodeData = $this->getBarcodeData($code, $type);
// calculate image size
$width = ($barcodeData['maxWidth'] * $widthFactor);
$height = $totalHeight;
if (function_exists('imagecreate')) {
// GD library
$imagick = false;
$png = imagecreate($width, $height);
$colorBackground = imagecolorallocate($png, 255, 255, 255);
imagecolortransparent($png, $colorBackground);
$colorForeground = imagecolorallocate($png, $color[0], $color[1], $color[2]);
} elseif (extension_loaded('imagick')) {
$imagick = true;
$colorForeground = new \imagickpixel('rgb(' . $color[0] . ',' . $color[1] . ',' . $color[2] . ')');
$png = new \Imagick();
$png->newImage($width, $height, 'none', 'png');
$imageMagickObject = new \imagickdraw();
$imageMagickObject->setFillColor($colorForeground);
} else {
throw new BarcodeException('Neither gd-lib or imagick are installed!');
}
// print bars
$positionHorizontal = 0;
foreach ($barcodeData['bars'] as $bar) {
$bw = round(($bar['width'] * $widthFactor), 3);
$bh = round(($bar['height'] * $totalHeight / $barcodeData['maxHeight']), 3);
if ($bar['drawBar']) {
$y = round(($bar['positionVertical'] * $totalHeight / $barcodeData['maxHeight']), 3);
// draw a vertical bar
if ($imagick && isset($imageMagickObject)) {
$imageMagickObject->rectangle($positionHorizontal, $y, ($positionHorizontal + $bw), ($y + $bh));
} else {
imagefilledrectangle($png, $positionHorizontal, $y, ($positionHorizontal + $bw) - 1, ($y + $bh),
$colorForeground);
}
}
$positionHorizontal += $bw;
}
ob_start();
if ($imagick && isset($imageMagickObject)) {
$png->drawImage($imageMagickObject);
echo $png;
} else {
imagepng($png);
imagedestroy($png);
}
$image = ob_get_clean();
return $image;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Picqer\Barcode;
class BarcodeGeneratorSVG extends BarcodeGenerator
{
/**
* Return a SVG string representation of barcode.
*
* @param $code (string) code to print
* @param $type (const) type of barcode
* @param $widthFactor (int) Minimum width of a single bar in user units.
* @param $totalHeight (int) Height of barcode in user units.
* @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
* @return string SVG code.
* @public
*/
public function getBarcode($code, $type, $widthFactor = 2, $totalHeight = 30, $color = 'black')
{
$barcodeData = $this->getBarcodeData($code, $type);
// replace table for special characters
$repstr = array("\0" => '', '&' => '&amp;', '<' => '&lt;', '>' => '&gt;');
$width = round(($barcodeData['maxWidth'] * $widthFactor), 3);
$svg = '<?xml version="1.0" standalone="no" ?>' . "\n";
$svg .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' . "\n";
$svg .= '<svg width="' . $width . '" height="' . $totalHeight . '" viewBox="0 0 ' . $width . ' ' . $totalHeight . '" version="1.1" xmlns="http://www.w3.org/2000/svg">' . "\n";
$svg .= "\t" . '<desc>' . strtr($barcodeData['code'], $repstr) . '</desc>' . "\n";
$svg .= "\t" . '<g id="bars" fill="' . $color . '" stroke="none">' . "\n";
// print bars
$positionHorizontal = 0;
foreach ($barcodeData['bars'] as $bar) {
$barWidth = round(($bar['width'] * $widthFactor), 3);
$barHeight = round(($bar['height'] * $totalHeight / $barcodeData['maxHeight']), 3);
if ($bar['drawBar']) {
$positionVertical = round(($bar['positionVertical'] * $totalHeight / $barcodeData['maxHeight']), 3);
// draw a vertical bar
$svg .= "\t\t" . '<rect x="' . $positionHorizontal . '" y="' . $positionVertical . '" width="' . $barWidth . '" height="' . $barHeight . '" />' . "\n";
}
$positionHorizontal += $barWidth;
}
$svg .= "\t" . '</g>' . "\n";
$svg .= '</svg>' . "\n";
return $svg;
}
}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class BarcodeException extends \Exception {}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class InvalidCharacterException extends BarcodeException {}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class InvalidCheckDigitException extends BarcodeException {}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class InvalidFormatException extends BarcodeException {}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class InvalidLengthException extends BarcodeException {}

View File

@ -0,0 +1,5 @@
<?php
namespace Picqer\Barcode\Exceptions;
class UnknownTypeException extends BarcodeException {}

View File

@ -0,0 +1,27 @@
<?php
namespace addons\barcode\library;
class Service
{
public static function barcode($params)
{
$params = is_array($params) ? $params : [$params];
$params['text'] = isset($params['text']) ? $params['text'] : 'Hello world!';
$params['type'] = isset($params['type']) ? $params['type'] : 'C128';
$params['width'] = isset($params['width']) ? $params['width'] : 2;
$params['height'] = isset($params['height']) ? $params['height'] : 30;
$params['foreground'] = isset($params['foreground']) ? $params['foreground'] : "#000000";
// 前景色
list($r, $g, $b) = sscanf($params['foreground'], "#%02x%02x%02x");
$foregroundcolor = [$r, $g, $b];
// 创建实例
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$barcode = $generator->getBarcode($params['text'], $params['type'], $params['width'], $params['height'], $foregroundcolor);
return $barcode;
}
}

View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>条码生成 - {$site.name}</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<h2>条码生成</h2>
<hr>
<div class="well">
<form action="" method="post">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="control-label">文本内容</label>
<input type="text" name="text" class="form-control" placeholder="" value="1234567890">
</div>
<div class="form-group">
<label class="control-label">条码类型</label>
<select name="type" class="form-control">
<option value="C128">C128</option>
<option value="C128A">C128A</option>
<option value="C128B">C128B</option>
<option value="C128C">C128C</option>
<option value="C39">C39</option>
<option value="C39+">C39+</option>
<option value="C39E">C39E</option>
<option value="C39E+">C39E+</option>
<option value="S25">S25</option>
<option value="I25">I25</option>
<option value="I25+">I25+</option>
<option value="EAN2">EAN2</option>
<option value="EAN5">EAN5</option>
<option value="EAN8">EAN8</option>
<option value="EAN13">EAN13</option>
<option value="UPCA">UPCA</option>
<option value="UPCE">UPCE</option>
<option value="MSI">MSI</option>
<option value="POSTNET">POSTNET</option>
<option value="PLANET">PLANET</option>
<option value="RMS4CC">RMS4CC</option>
<option value="KIX">KIX</option>
<option value="IMB">IMB</option>
<option value="CODABAR">CODABAR</option>
<option value="CODE11">CODE11</option>
<option value="PHARMA">PHARMA</option>
<option value="PHARMA2T">PHARMA2T</option>
</select>
</div>
<div class="form-group">
<input type="submit" class="btn btn-info" />
<input type="reset" class="btn btn-default" />
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<label class="control-label">前景色</label>
<input type="text" name="foreground" placeholder="" class="form-control" value="#000000">
</div>
<div class="form-group">
<label class="control-label">间距</label>
<input type="number" name="width" placeholder="" class="form-control" value="2">
</div>
<div class="form-group">
<label class="control-label">高度</label>
<input type="number" name="height" placeholder="" class="form-control" value="30">
</div>
</div>
</div>
</div>
</form>
</div>
<input type="text" class="form-control" id='barcodeurl' />
<img src="" alt="" id='barcodeimg' style="margin-top:15px;"/>
</div>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("form").submit(function () {
$("#barcodeimg").prop("src", "{:addon_url('barcode/index/build',[],false)}?" + $(this).serialize());
$("#barcodeurl").val("{:addon_url('barcode/index/build',[],false,true)}?" + $(this).serialize());
return false;
});
$("form").trigger('submit');
});
</script>
</body>
</html>

View File

@ -0,0 +1 @@
{"files":["public\/assets\/addons\/betterform\/css\/common.css"],"license":"regular","licenseto":"16018","licensekey":"9o7X8uHAZwJTMkUe YyQ4Yx\/HgpJiX4YDt1usLxh45EwlUVtH6ztSssVMDSQ=","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"]}

View File

@ -0,0 +1,113 @@
<?php
namespace addons\betterform;
use app\common\library\Menu;
use think\Addons;
use think\Loader;
/**
* 插件
*/
class Betterform extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
return true;
}
public function viewFilter(&$content)
{
$request = \think\Request::instance();
$dispatch = $request->dispatch();
if (!$dispatch) {
return;
}
if (!$request->module() || $request->module() !== 'admin') {
return;
}
$config = get_addon_config('betterform');
//在head前引入CSS
$content = preg_replace("/<\/head>/i", "<link href='/assets/addons/betterform/css/common.css' rel='stylesheet' />" . "\n\$0", $content);
//如果不存在表单
if (!preg_match('/<form (.*?)data-toggle="validator"/i', $content)) {
return;
}
// 避免栈空间不足
ini_set('pcre.jit', false);
// 匹配<div class="form-group">标签
$regex = '/<div[^>]*class\s*=\s*"[^"]*\bform-group\b[^"]*"[^>]*>(?:(?!<div[^>]*class\s*=\s*"[^"]*\bform-group\b[^"]*").)*?data-rule="[^"]*?(required|checked)[^"]*?"[^>]*>/si';
$result = preg_replace_callback($regex, function ($matches) use ($config) {
return str_replace("form-group", "form-group required-{$config['asteriskposition']}", $matches[0]);
}, $content);
$content = is_null($result) ? $content : $result;
// 匹配<tr>
$pattern = '/(<tr[^>]*>)\s*<td[^>]*>(.*?)<\/td>\s*<td[^>]*>.*?<input[^>]*data-rule="[^"]*required[^"]*"[^>]*>.*?<\/td>\s*<\/tr>/si';
$result = preg_replace_callback($pattern, function ($matches) use ($config) {
if (preg_match('/(<tr[^>]*)class\s*=\s*"[^"]*"/i', $matches[1])) {
return preg_replace('/(<tr[^>]*)class\s*=\s*"([^"]*)"/i', '$1class="$2 required-' . $config['asteriskposition'] . '"', $matches[0]);
} else {
return str_replace("<tr", "<tr class=\"required-{$config['asteriskposition']}\"", $matches[0]);
}
}, $content);
$content = is_null($result) ? $content : $result;
}
/**
* @param $params
*/
public function configInit(&$params)
{
$config = $this->getConfig();
$config['area'] = preg_match("/\[(.*?)\]/i", $config['area']) ? array_slice(array_values((array)json_decode($config['area'], true)), 0, 2) : $config['area'];
$config['shade'] = floatval($config['shade']);
$config['shadeClose'] = boolval($config['shadeClose']);
$params['betterform'] = $config;
}
}

27
addons/betterform/bootstrap.js vendored Normal file
View File

@ -0,0 +1,27 @@
require(['fast', 'layer'], function (Fast, Layer) {
var _fastOpen = Fast.api.open;
Fast.api.open = function (url, title, options) {
options = options || {};
options.area = Config.betterform.area;
options.offset = Config.betterform.offset;
options.anim = Config.betterform.anim;
options.shadeClose = Config.betterform.shadeClose;
options.shade = Config.betterform.shade;
return _fastOpen(url, title, options);
};
if (isNaN(Config.betterform.dialoganim)) {
var _layerOpen = Layer.open;
Layer.open = function (options) {
var classNameArr = {slideDown: "layer-anim-slide-down", slideLeft: "layer-anim-slide-left", slideUp: "layer-anim-slide-up", slideRight: "layer-anim-slide-right"};
var animClass = "layer-anim " + classNameArr[options.anim] || "layer-anim-fadein";
var index = _layerOpen(options);
var layero = $('#layui-layer' + index);
layero.addClass(classNameArr[options.anim] + "-custom");
layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass(animClass);
});
return index;
}
}
});

View File

@ -0,0 +1,102 @@
<?php
return [
[
'name' => 'asteriskposition',
'title' => '*号位置',
'type' => 'radio',
'group' => '',
'visible' => '',
'content' => [
'before' => '位于文本前',
'after' => '位于文本后',
],
'value' => 'before',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'offset',
'title' => '弹窗位置',
'type' => 'radio',
'content' => [
'auto' => '居中',
't' => '顶部',
'b' => '底部',
'l' => '左部',
'r' => '右部',
],
'value' => 'r',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'anim',
'title' => '打开动画',
'type' => 'select',
'content' => [
'0' => '平滑放大',
'1' => '从上掉落',
'2' => '从最底部往上滑入',
'3' => '从左滑入',
'4' => '从左翻滚',
'5' => '渐显',
'6' => '抖动',
'slideDown' => '从上边缘往下',
'slideLeft' => '从右边缘往左',
'slideUp' => '从下边缘往上',
'slideRight' => '从左边缘往右',
],
'value' => 'slideLeft',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'area',
'title' => '弹窗宽高',
'type' => 'string',
'content' => [],
'value' => '["60%", "100%"]',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'shade',
'title' => '阴影透明度',
'type' => 'number',
'content' => [],
'value' => '0.3',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'shadeClose',
'title' => '点击阴影关闭弹窗',
'type' => 'bool',
'content' => [
'1' => '开启',
'0' => '关闭',
],
'value' => '0',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
];

View File

@ -0,0 +1,15 @@
<?php
namespace addons\betterform\controller;
use think\addons\Controller;
class Index extends Controller
{
public function index()
{
$this->error("当前插件暂无前台页面");
}
}

View File

@ -0,0 +1,10 @@
name = betterform
title = FastAdmin表单弹窗优化插件
intro = 优化FastAdmin表单弹窗
author = FastAdmin
website = https://www.fastadmin.net
version = 1.0.2
state = 1
url = /addons/betterform
license = regular
licenseto = 16018

View File

@ -0,0 +1 @@
{"files":["application\/admin\/library\/buiattach\/Imgcompress.php","application\/admin\/lang\/zh-cn\/buiattach.php","application\/admin\/controller\/Buiattach.php","application\/admin\/view\/buiattach\/index.html","application\/admin\/view\/buiattach\/category.html","application\/index\/lang\/zh-cn\/buiattach.php","application\/index\/controller\/Buiattach.php","application\/index\/view\/buiattach\/index.html","public\/assets\/img\/attach_select.png","public\/assets\/img\/attach_delete.png","public\/assets\/img\/attach_upload.png","public\/assets\/js\/backend\/buiattach.js","public\/assets\/js\/frontend\/buiattach.js"],"license":"extended","licenseto":"16018","licensekey":"haCX5jkprT7oeFzH vxVzdzcBsA9LaYhcXhZswNAfrNJANcli8RH1PPJR89A=","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"]}

View File

@ -0,0 +1,80 @@
<?php
namespace addons\buiattach;
use think\Addons;
use think\Request;
use think\Config;
use app\common\library\Menu;
use app\admin\library\buiattach\Imgcompress;
/**
* 插件
*/
class Buiattach extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
return true;
}
public function configInit(&$params){
$config = $this->getConfig();
$params['buiattach'] = ['is_default' => $config['is_default']];
}
/**
* 添加附件后
*/
public function uploadAfter($attachment){
$host = Request::instance()->domain();
$config = $this->getConfig();
if(!empty($config['is_compress']) && !empty($config['compress_scale'])){
$attachment = json_decode($attachment,true);
$image_full = sprintf("%s%s",$host,$attachment['url']);
$image_path = sprintf("%s%s",$_SERVER['DOCUMENT_ROOT'],$attachment['url']);
$pathinfo = (pathinfo($image_full));
if(array_key_exists('extension',$pathinfo)){
$percent = trim($config['compress_scale']);
$imgcompress = new Imgcompress($image_full, $percent, $image_path);
$imgcompress->compressImg($image_path);
}
}
}
}

376
addons/buiattach/bootstrap.js vendored Normal file
View File

@ -0,0 +1,376 @@
/**
* 图片选择器 - CODE
*/
require(['form', 'upload'], function (Form, Upload) {
Form.events.bindevent = function (form) {
if(typeof(Config.buiattach.is_default) !== "undefined" && Config.buiattach.is_default=="2"){
Form.events.faselect = function(form){
if ($(".faselect,.fachoose", form).length > 0) {
$(".faselect,.fachoose", form).off('click').on('click', function () {
var that = this;
var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
mimetype = mimetype.replace(/\/\*/ig, '');
if(mimetype=='image'){
//初始配置
var cdnurl = Config.upload.cdnurl;
let domain = window.location.protocol + '//'+ document.location.host + Config.moduleurl;
var button = $("#" + $(that).attr("id"));
var imgcount = $(button).data("maxcount");
var inputval = $(button).data("input-id") ? $(button).data("input-id") : "";
var multiple = (multiple == true) ? 1 : 0;
var content = domain+'/buiattach/index?multiple=' + multiple;
var preview = Upload.config.previewtpl;
//图片选择最大数处理
if(typeof(imgcount) == "undefined"){
imgcount = 0; //不限制
}else{
imgcount = parseInt(imgcount);
}
//控制窗体大小
var area = ['65%', '80%']; //大屏幕
//越小屏幕占用空间越大
if(screen() == 2){
area = ['80%', '90%'];
}else if(screen() == 1){
area = ['100%', '100%'];
}else if(screen() == 0){
area = ['100%', '100%'];
}
top.Layer.open({
type:2,
title: __('图片选择器'),
content: content,
area: area,
maxmin:false,
shade: 0.5,
btn: ['确定','取消'],
btnAlign: "r",
yes: function (index, layero) {
var html = '';
var arrs = [];
var full = [];
var defs = [];
var body = top.layer.getChildFrame('body',index);
var getvalue = $("#"+inputval).val(); //取值
if(typeof(getvalue) == "undefined"){
getvalue = "";
}
if(multiple == 1 && getvalue.length > 1){
defs = getvalue.split(',');
}
body.find("input[type='checkbox']:checked").each(function(){
var src = $(this).parent().find(".picture").attr("data-src");
if(multiple == 1 && defs.length > 0){
var indexs = $.inArray(src,defs);
if(indexs == "-1"){
full.push($(this).parent().find(".picture").attr("src"));
arrs.push($(this).parent().find(".picture").attr("data-src"));
}
}else{
full.push($(this).parent().find(".picture").attr("src"));
arrs.push($(this).parent().find(".picture").attr("data-src"));
}
});
//多图 设置图片数量大于0
if(multiple == 1 && imgcount > 0){
var curr_count = arrs.concat(defs);
if(curr_count.length > imgcount){
top.layer.msg("图片不能大于"+imgcount+"张", {icon: 0});
return false;
}
}
arrs.forEach((imgstr, index) => {
var preview_html = preview;
preview_html = preview_html.replace("<%=url%>",imgstr);
preview_html = preview_html.replace(/<%=fullurl%>/g,full[index]);
preview_html = preview_html.replace("<%=suffix%>","FAIL");
html += preview_html;
});
if(multiple == 0){
$("#"+inputval).parent().parent().find("ul").html(html);
$("#"+inputval).val(arrs.join(",")).trigger("change").trigger("validate");
top.layer.close(index);
return false;
}
if(multiple == 1 && defs.length > 0){
arrs = arrs.concat(defs);
}
$("#"+inputval).parent().parent().find("ul").append(html);
$("#"+inputval).val(arrs.join(",")).trigger("change").trigger("validate");
top.layer.close(index);
}
});
}else{
var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
callback: function (data) {
var button = $("#" + $(that).attr("id"));
var maxcount = $(button).data("maxcount");
var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
if (input_id && data.multiple) {
var urlArr = [];
var inputObj = $("#" + input_id);
var value = $.trim(inputObj.val());
if (value !== "") {
urlArr.push(inputObj.val());
}
var nums = value === '' ? 0 : value.split(/\,/).length;
var files = data.url !== "" ? data.url.split(/\,/) : [];
$.each(files, function (i, j) {
var url = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
urlArr.push(url);
});
if (maxcount > 0) {
var remains = maxcount - nums;
if (files.length > remains) {
Toastr.error(__('You can choose up to %d file%s', remains));
return false;
}
}
var result = urlArr.join(",");
inputObj.val(result).trigger("change").trigger("validate");
} else {
var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
$("#" + input_id).val(url).trigger("change").trigger("validate");
}
}
});
}
return false;
});
}
}
}
//判断浏览器大小
function screen() {
var width = top.document.documentElement.clientWidth;
if (width > 1200) {
return 3; //大屏幕
} else if (width > 992) {
return 2; //中屏幕
} else if (width > 768) {
return 1; //小屏幕
} else {
return 0; //超小屏幕
}
}
//图片选择器 - 添加
$(document).on("click",".select-upload",function(){
//初始配置
var Config = requirejs.s.contexts._.config.config;
let domain = window.location.protocol + '//'+ document.location.host + Config.moduleurl;
var _this = this;
var shape = $(_this).attr("data-shape"); //图片形状
var inputval = $(_this).attr("data-input"); //输入值
var imgcount = $(_this).attr("data-maxcount"); //图片最大选择数
var cdnurl = Config.upload.cdnurl;
var multiple = ($(_this).attr("data-multiple") == "true") ? 1 : 0;
var content = domain+'/buiattach/index?multiple=' + multiple;
var width = '100';
var pleft = '91px';
if(typeof(shape) !== "undefined" && shape == "oblong"){
width = '150';
pleft = '141px'
}
if(typeof(inputval) == "undefined"){
Toastr.error("属性data-input配置错误");
return false;
}
if($(_this).parent().find("input[name='"+inputval+"']").length < 1){
Toastr.error("属性data-input配置错误");
return false;
}
//图片选择最大数处理
if(typeof(imgcount) == "undefined"){
imgcount = 0; //不限制
}else{
imgcount = parseInt(imgcount);
}
//控制窗体大小
var area = ['65%', '80%']; //大屏幕
//越小屏幕占用空间越大
if(screen() == 2){
area = ['80%', '90%'];
}else if(screen() == 1){
area = ['100%', '100%'];
}else if(screen() == 0){
area = ['100%', '100%'];
}
top.Layer.open({
type:2,
title: __('图片选择器'),
content: content,
area: area,
maxmin:false,
shade: 0.5,
btn: ['确定','取消'],
btnAlign: "r",
yes: function (index, layero) {
var html = '';
var arrs = [];
var full = [];
var defs = [];
var body = top.layer.getChildFrame('body',index);
var getvalue = $(_this).parent().find("input[name='"+inputval+"']").val(); //取值
if(typeof(getvalue) == "undefined"){
getvalue = "";
}
if(multiple == 1 && getvalue.length > 1){
defs = getvalue.split(',');
}
body.find("input[type='checkbox']:checked").each(function(){
var src = $(this).parent().find(".picture").attr("data-src");
if(multiple == 1 && defs.length > 0){
var indexs = $.inArray(src,defs);
if(indexs == "-1"){
full.push($(this).parent().find(".picture").attr("src"));
arrs.push($(this).parent().find(".picture").attr("data-src"));
}
}else{
full.push($(this).parent().find(".picture").attr("src"));
arrs.push($(this).parent().find(".picture").attr("data-src"));
}
});
//多图 设置图片数量大于0
if(multiple == 1 && imgcount > 0){
var curr_count = arrs.concat(defs);
if(curr_count.length > imgcount){
top.layer.msg("图片不能大于"+imgcount+"张", {icon: 0});
return false;
}
if(curr_count.length == imgcount){
$(_this).hide();
}
}
arrs.forEach((imgstr, index) => {
html += '<div class="select-images" style="float:left;margin-right:4%;">';
html += '<img src="'+full[index]+'" data-src="'+imgstr+'" onerror="this.src=\''+domain+'/ajax/icon?suffix=FAIL\';this.onerror=null;" height="100" width="'+width+'" style="border:1px dashed #E6E6E6;max-width:100%;object-fit: cover;">';
html += '<div class="images-delete" data-maxcount="'+imgcount+'" data-multiple="'+multiple+'" data-src="'+imgstr+'" style="position:relative;top:-111px;left:'+pleft+';cursor:pointer;">';
html += '<img src="/assets/img/attach_delete.png" style="height:16px;width:16px;"></div></div>';
});
if(multiple == 0){
$(_this).hide();
}
if(multiple == 1 && defs.length > 0){
arrs = arrs.concat(defs);
}
$(_this).before(html);
$("input[name='"+inputval+"']").attr("value",arrs.join(","));
top.layer.close(index);
}
});
});
//图片选择器 - 删除
$(document).on("click",".images-delete",function(){
var imgcount = $(this).data('maxcount');
var multiple = $(this).data('multiple');
//多图片处理
if(multiple == "1"){
var imagesrc = $(this).data("src");
var inputval = $(this).parent().parent().find("input[type='hidden']").val();
inputval = inputval.replace(","+imagesrc,"");
inputval = inputval.replace(imagesrc+",","");
inputval = inputval.replace(imagesrc,"");
inputval = inputval.replace(",,","");
$(this).parent().parent().find("input[type='hidden']").attr("value",inputval);
var inputcount = inputval.split(",").length;
if(typeof(imgcount) == "undefined"){
imgcount = 0;
}else{
imgcount = parseInt(imgcount);
}
if(imgcount > inputcount){
$(this).parent().parent().find(".select-upload").show();
}
$(this).parent().remove();
}
//单图片处理
if(multiple == "0"){
$(this).parent().parent().find("input[type='hidden']").attr("value","");
$(this).parent().parent().find(".select-upload").show();
$(this).parent().remove();
}
});
//回显图片 - 轮询
$(".select-upload").each(function(){
var _this = this;
var state = false;
var shape = $(_this).attr("data-shape"); //图片形状
var inputval = $(_this).attr("data-input"); //输入值
var imgcount = $(_this).attr("data-maxcount"); //图片最大选择数
var multiple = ($(_this).attr("data-multiple") == "true") ? 1 : 0;
let domain = window.location.protocol + '//'+ document.location.host + Config.moduleurl;
var cdnurl = Config.upload.cdnurl;
var getvalue = "";
var width = '100';
var pleft = '91px';
if(typeof(shape) !== "undefined" && shape == "oblong"){
width = '150';
pleft = '141px'
}
if(typeof(inputval) !== "undefined"){
state = true;
}
//图片选择最大数处理
if(typeof(imgcount) == "undefined"){
imgcount = 0; //不限制
}else{
imgcount = parseInt(imgcount);
}
if(state){
getvalue = $(_this).parent().find("input[name='"+inputval+"']").val(); //取值
if(typeof(getvalue) == "undefined"){
state = false;
}
}
if(state && getvalue.length > 1){
var html = '';
var arrs = getvalue.split(",");
for (let imgstr in arrs) {
html += '<div class="select-images" style="float:left;margin-right:4%;">';
html += '<img src="'+cdnurl+arrs[imgstr]+'" data-src="'+arrs[imgstr]+'" onerror="this.src=\''+domain+'/ajax/icon?suffix=FAIL\';this.onerror=null;" height="100" width="'+width+'" style="border:1px dashed #E6E6E6;max-width:100%;object-fit: cover;">';
html += '<div class="images-delete" data-maxcount="'+imgcount+'" data-multiple="'+multiple+'" data-src="'+arrs[imgstr]+'" style="position:relative;top:-111px;left:'+pleft+';cursor:pointer;">';
html += '<img src="/assets/img/attach_delete.png" style="height:16px;width:16px;"></div></div>';
}
if(multiple == 0){
$(_this).hide();
}
if(multiple == 1 && imgcount == arrs.length){
$(_this).hide();
}
$(_this).before(html);
}
});
}
});

View File

@ -0,0 +1,64 @@
<?php
return [
[
'name' => 'is_default',
'title' => '接管弹窗',
'type' => 'radio',
'content' => [
1 => '官方弹窗',
2 => '插件弹窗',
],
'value' => '2',
'rule' => 'required',
'msg' => '',
'tip' => '图片选择时,官方默认弹窗,插件弹窗方式,这两种方式。',
'ok' => '',
'extend' => '',
],
[
'name' => 'is_compress',
'title' => '开启压缩',
'type' => 'radio',
'content' => [
1 => '开启',
0 => '关闭',
],
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'compress_scale',
'title' => '压缩比例',
'type' => 'select',
'content' => [
'1' => '1.0',
'0.9' => '0.9',
'0.8' => '0.8',
'0.7' => '0.7',
'0.6' => '0.6',
],
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => '',
'content' => [],
'value' => '压缩比例建议使用1.0,原比例无损压缩。<br/>第三方云存储插件,上传模式设置<span style="color:red">【服务器中转】</span>压缩才有效。',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => 'alert-info-light',
],
];

View File

@ -0,0 +1,14 @@
<?php
namespace addons\buiattach\controller;
use think\addons\Controller;
class Index extends Controller{
protected $layout = 'default';
public function index(){
return $this->view->fetch();
}
}

10
addons/buiattach/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = buiattach
title = 图片选择器
intro = 强大的图片管理插件
author = 东07
website = https://www.fastadmin.net
version = 1.0.1
state = 1
license = extended
licenseto = 16018
url = /addons/buiattach

View File

@ -0,0 +1,140 @@
<div id="content-container" class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<h2 class="page-header">{:__('图片选择器代码')}</h2>
<form class="form-horizontal" >
<div>使用参数说明</div>
<table class="table table-bordered">
<thead>
<tr>
<th>参数</th>
<th>示例</th>
<th>说明</th>
<th>默认</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">dataMultiple</th>
<td>data-multiple="false”</td>
<td>false 单选图片true 多选图片</td>
<td>默认为单选图片</td>
</tr>
<tr>
<th scope="row">dataMaxCount</th>
<td>data-maxcount="0"</td>
<td>0 不限制选择图片数量 5 最大五张图片</td>
<td>默认不限制</td>
</tr>
<tr>
<th scope="row">dataInput</th>
<td>data-input="row[image]"</td>
<td>回显到input数据对应input文本name属性</td>
<td>必须填写(接管官方弹窗不需要)</td>
</tr>
<tr>
<th scope="row">dataShape</th>
<td>data-shape="oblong" </td>
<td>oblong 长方形 square 正方形</td>
<td>为空默认正方形(接管官方弹窗不需要)</td>
</tr>
</tbody>
</table>
<div>图片添加代码</div>
<pre><xmp><div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片单选')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-image" class="form-control" size="50" name="row[image]" type="hidden" value="">
<div class="select-upload" style="cursor:pointer;float:left;" data-shape="oblongs" data-input="row[image]" data-multiple="false">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片多选')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-images" class="form-control" size="50" name="row[images]" type="hidden" value="">
<div class="select-upload" style="cursor:pointer;float:left;" data-shape="oblongs" data-maxcount="0" data-input="row[images]" data-multiple="true">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div></xmp></pre>
<div>图片修改代码</div>
<pre><xmp><div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片单选')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-image" class="form-control" size="50" name="row[image]" type="hidden" value="{\$row.image|htmlentities}" >
<div class="select-upload" style="cursor:pointer;float:left;" data-shape="oblongs" data-input="row[image]" data-multiple="false">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片多选')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-images" class="form-control" size="50" name="row[images]" type="hidden" value="{\$row.images|htmlentities}" >
<div class="select-upload" style="cursor:pointer;float:left;" data-shape="oblongs" data-maxcount="0" data-input="row[images]" data-multiple="true">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div></xmp></pre>
<hr/>
<div style="margin-bottom:30px;">图片示例效果:</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-1">图片单选:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-image" class="form-control" size="50" name="image" type="hidden" value="">
<div class="select-images" style="float:left;margin-right:4%;">
<img src="" data-src="" onerror="this.src='/index/ajax/icon?suffix=FAIL';this.onerror=null;" height="100" width="100" style="border:1px dashed #E6E6E6;max-width:100%;object-fit: cover;">
<div class="images-delete" data-max="0" data-multiple="0" data-src="" style="position:relative;top:-111px;left:91px;cursor:pointer;">
<img src="/assets/img/attach_delete.png" style="height:16px;width:16px;">
</div>
</div>
<div class="select-upload" style="cursor: pointer; float: left; display: none;" data-shape="oblongs" data-input="image" data-multiple="false">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-1">图片多选:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-images" class="form-control" size="50" name="images" type="hidden" value="">
<div class="select-images" style="float:left;margin-right:4%;">
<img src="" data-src="" onerror="this.src='/index/ajax/icon?suffix=FAIL';this.onerror=null;" height="100" width="100" style="border:1px dashed #E6E6E6;max-width:100%;object-fit: cover;">
<div class="images-delete" data-max="3" data-multiple="1" data-src="" style="position:relative;top:-111px;left:91px;cursor:pointer;">
<img src="/assets/img/attach_delete.png" style="height:16px;width:16px;">
</div>
</div>
<div class="select-images" style="float:left;margin-right:4%;">
<img src="" data-src="" onerror="this.src='/index/ajax/icon?suffix=FAIL';this.onerror=null;" height="100" width="100" style="border:1px dashed #E6E6E6;max-width:100%;object-fit: cover;">
<div class="images-delete" data-max="3" data-multiple="1" data-src="" style="position:relative;top:-111px;left:91px;cursor:pointer;">
<img src="/assets/img/attach_delete.png" style="height:16px;width:16px;">
</div>
</div>
<div class="select-upload" style="cursor: pointer; float: left; display: block;" data-shape="oblongs" data-max="3" data-input="images" data-multiple="true">
<img src="/assets/img/attach_upload.png" height="100" width="100" style="border:1px dashed #E6E6E6;">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{$site.name|htmlentities}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
{if isset($keywords)}
<meta name="keywords" content="{$keywords|htmlentities}">
{/if}
{if isset($description)}
<meta name="description" content="{$description|htmlentities}">
{/if}
<link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />
<link href="__CDN__/assets/css/frontend{$Think.config.app_debug?'':'.min'}.css?v={$Think.config.site.version|htmlentities}" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
<script src="__CDN__/assets/js/html5shiv.js"></script>
<script src="__CDN__/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var require = {
config: {$config|json_encode}
};
</script>
<link href="__CDN__/assets/css/user.css?v={$Think.config.site.version|htmlentities}" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-white navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#header-navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{:url('/')}">{$site.name|htmlentities}</a>
</div>
</div>
</nav>
<main class="content">
{__CONTENT__}
</main>
<footer class="footer" style="clear:both">
<p class="copyright">Copyright&nbsp;©&nbsp;{:date("Y")} {$site.name|htmlentities} All Rights Reserved <a href="https://beian.miit.gov.cn" target="_blank">{$site.beian|htmlentities}</a></p>
</footer>
<script src="__CDN__/assets/js/require{$Think.config.app_debug?'':'.min'}.js" data-main="__CDN__/assets/js/require-frontend{$Think.config.app_debug?'':'.min'}.js?v={$site.version|htmlentities}"></script>
</body>
</html>

1
addons/cardocr/.addonrc Normal file
View File

@ -0,0 +1 @@
{"files":["application\/admin\/model\/cardocr\/Card.php","application\/admin\/lang\/zh-cn\/cardocr\/card.php","application\/admin\/validate\/cardocr\/Card.php","application\/admin\/controller\/cardocr\/Card.php","application\/admin\/view\/cardocr\/card\/add.html","application\/admin\/view\/cardocr\/card\/index.html","application\/admin\/view\/cardocr\/card\/edit.html","application\/index\/lang\/zh-cn\/cardocr.php","application\/index\/controller\/Cardocr.php","application\/index\/view\/cardocr\/docard.html","public\/assets\/js\/backend\/cardocr\/card.js","public\/assets\/js\/frontend\/cardocr.js"],"license":"regular","licenseto":"16018","licensekey":"5AtWnVDxh7UbHXBu SoMlh2sBitl\/9ioS7+SXFg==","domains":["hschool.com.cn"],"licensecodes":[],"validations":["917fd160f10e900c10e2777c626cb280"],"menus":["cardocr","cardocr\/card","cardocr\/card\/index","cardocr\/card\/add","cardocr\/card\/edit","cardocr\/card\/del","cardocr\/card\/multi"]}

164
addons/cardocr/Cardocr.php Normal file
View File

@ -0,0 +1,164 @@
<?php
namespace addons\cardocr;
use addons\cardocr\library\Card;
use app\common\library\Menu;
use think\Addons;
use think\Exception;
use think\Loader;
use think\Request;
use think\response\Json;
/**
* 身份证联网认证插件
*/
class Cardocr extends Addons
{
private $menu;
private $name = "cardocr";
public function __construct()
{
parent::__construct();
$menu = [
[
'name' => 'cardocr',
'title' => '身份证验证管理',
'icon' => 'fa fa-address-book',
'sublist' => [
[
'name' => 'cardocr/card',
'title' => '身份证验证',
'icon' => 'fa fa-id-card',
'sublist' => [
['name' => 'cardocr/card/index', 'title' => '查看'],
['name' => 'cardocr/card/add', 'title' => '添加'],
['name' => 'cardocr/card/edit', 'title' => '修改'],
['name' => 'cardocr/card/del', 'title' => '删除'],
['name' => 'cardocr/card/multi', 'title' => '批量更新'],
]
],
]
]
];
$this->menu = $menu;
}
/**
* 插件安装方法
* @return bool
*/
public function install()
{
Menu::create($this->menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete($this->name);
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
Menu::enable($this->name);
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
Menu::disable($this->name);
return true;
}
/** 检查身份证号码与姓名是一致钩子
* @param array $checkdata ['name'];$checkdata["idnum"]
* @return json
*/
public function checkIdname($checkdata)
{
$arr['time'] = time();
if(!isset($checkdata["name"])) {
return json(['code'=>400,'msg'=>'姓名不能缺少'],400);
}
if(!isset($checkdata["idnum"])) {
return json(['code'=>400,'msg'=>'身份证号码不能缺少'],400);
}
$data = Card::checkidcard($checkdata["idnum"],$checkdata["name"]);
return json(array_filter($data));
}
/** 身份证识别钩子
* @param array $array $data['ImageBase64'] = $ImageBase64;$data['CardSide'] = 'FRONT';
* 传入例子 checkOcr($data, $data['CardSide'])
* @param array $array ['CardSide'] |'FRONT','BACK' 识别身份证正反
* @return json
*/
public function checkOcr($arrjson)
{
$arr['time'] = time();
if(!isset($arrjson["ImageBase64"])) {
return json(['code'=>400,'msg'=>'身份证缺少ImageBase64'],400);
}
if(!preg_match('/^data:image\/(png|jpeg|gif);base64,/', $arrjson['ImageBase64'])){
return json(['code'=>400,'msg'=>'ImageBase64参数不是ImageBase64 格式'],400);
}
if(!isset($arrjson["CardSide"]) ){
return json(['code'=>400,'msg'=>'身份证缺少正反面参数'],400);
}
if($arrjson["CardSide"]!='FRONT' && $arrjson["CardSide"]!='BACK' ){
return json(['code'=>400,'msg'=>'身份证正反面参数不符合'],400);
}
$data = Card::checkcardocr(json_encode($arrjson), $arrjson['CardSide']);
return json(array_filter($data));
}
/**
* 添加命名空间
*/
public function appInit()
{
//添加支付包的命名空间
Loader::addNamespace('TencentCloud', ADDON_PATH . 'cardocr' . DS . 'library' . DS . 'TencentCloud' . DS);
}
/**
* 会员中心边栏后
* @return mixed
* @throws \Exception
*/
public function userSidenavAfter()
{
$request = Request::instance();
$controllername = strtolower($request->controller());
$actionname = strtolower($request->action());
$data = [
'actionname' => $actionname,
'controllername' => $controllername
];
return $this->fetch('view/hook/user_sidenav_after', $data);
}
}

103
addons/cardocr/config.php Normal file
View File

@ -0,0 +1,103 @@
<?php
return [
1 => [
'name' => 'secretid',
'title' => 'SecretId',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => 'required',
'msg' => '',
'tip' => '请前往腾讯控制台 > 访问管理 > API密钥',
'ok' => '',
'extend' => '',
],
[
'name' => 'secretkey',
'title' => 'SecretKey',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => 'required',
'msg' => '',
'tip' => '请前往腾讯控制台 > 访问管理 > API密钥',
'ok' => '',
'extend' => '',
],
[
'name' => 'endpoint',
'title' => '身份验证接口',
'type' => 'string',
'content' => [],
'value' => 'faceid.tencentcloudapi.com',
'rule' => 'required',
'msg' => '',
'tip' => '身份验证接口',
'ok' => '',
'extend' => '',
],
[
'name' => 'endpoint_ocr',
'title' => 'ocr识别接口',
'type' => 'string',
'content' => [],
'value' => 'ocr.tencentcloudapi.com',
'rule' => 'required',
'msg' => '',
'tip' => '身份验证接口',
'ok' => '',
'extend' => '',
],
[
'name' => 'region',
'title' => '地域名称',
'type' => 'string',
'content' => [],
'value' => 'ap-guangzhou',
'rule' => 'required',
'msg' => '',
'tip' => '请输入地域简称,请注意使用英文',
'ok' => '',
'extend' => '',
],
[
'name' => 'isapi',
'title' => '前台是否通过API审核',
'type' => 'radio',
'content' => [
1 => '是',
0 => '否',
],
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '前台是否通过API审核',
'ok' => '',
'extend' => '',
],
[
'name' => 'replay',
'title' => '限制单日api审核次数',
'type' => 'string',
'content' => [],
'value' => '10',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => 'array',
'content' => [],
'value' => '请在腾讯云管理中心获取SecretId与SecretKey,其他选项默认即可',
'rule' => '',
'msg' => '',
'tip' => '身份证验证参数配置',
'ok' => '',
'extend' => '',
],
];

View File

@ -0,0 +1,146 @@
<?php
namespace addons\cardocr\controller;
use addons\cardocr\model\CardocrLog;
use app\common\model\User;
use think\Config;
use think\addons\Controller;
use addons\cardocr\library\Card;
use addons\cardocr\model\Cardocr;
use think\Exception;
class Index extends Controller
{
protected $noNeedRight = ['index'];
/**
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
if (!$this->auth->isLogin()) {
$this->error(__('Please login first'));
}
if (!$this->request->isPost()) {
$this->error("无效请求");
}
$card_config = get_addon_config('cardocr');
$row = $this->request->post();
//人工审核,不请求api
if (!$card_config['isapi']) {
try {
$inster_data = array();
$inster_data["user_id"] = (int)$this->auth->id;
$inster_data["name"] = $row['username'];
$inster_data["idnum"] = $row['idnum'];
$inster_data["sex"] = !empty($row['sex']) ? $row['sex'] : "未知";
$inster_data['nation'] = "";
$inster_data['birth'] = date("Ymd");
$inster_data['address'] = "";
$inster_data['authority'] = "";
$inster_data['validdatestart'] = date("Ymd");
$inster_data['validdateend'] = date("Ymd");
$inster_data['positive_img'] = $row['positive_img'];
$inster_data['back_img'] = $row['back_img'];
$inster_data['status'] = "2";
Cardocr::create($inster_data);
$arr["code"] = 1;
$arr["result"] = 0;
$arr["time"] = time();
$arr["msg"] = "提交成功";
$arr["data"] = "";
echo json_encode($arr);
die();
} catch (Exception $e) {
$this->error($e->getMessage());
}
}
//限制api访问次数
$userid = $this->auth->id;
$replay = CardocrLog::where(array("user_id" => $userid))->whereTime('createtime', 'today')->count();
if (intval($card_config['replay']) <= $replay) {
$this->error("单日审核次数已满");
}
$url = Config::get('upload.cdnurl');
$name = $row['username'];
$idnum = $row['idnum'];
$positive_img = cdnurl($row['positive_img'], true);
$back_img = cdnurl($row['back_img'], true);
$data = \addons\cardocr\model\Cardocr::whereOr('user_id', '=', $this->auth->id)->whereOr(
'idnum',
'=',
$idnum
)->find();
if (!isset($data) || $data->status != 1) {
} else {
$this->error("身份证已经验证通过");
}
//记录api记录
CardocrLog::record("身份证核验");
$cardocr = new \app\index\controller\Cardocr();
//ocr识别身份证正面
$orc_frontdata = $cardocr->checkfront($positive_img);
if ($orc_frontdata['Name'] != $name && $orc_frontdata['IdNum'] != $idnum) {
$this->error("身份证图片与你输入的姓名与身份证号码不一致");
}
//ocr识别身份证反面
$orc_backdata = $cardocr->checkback($back_img);
//获取腾讯云身份验证api
$params_data = Card::checkidcard($idnum, $name);
try {
if ($params_data['Result'] == 0) {
$inster_data = array();
$inster_data["user_id"] = (int)$this->auth->id;
$inster_data["name"] = $name;
$inster_data["idnum"] = $idnum;
$inster_data["sex"] = !empty($orc_frontdata['Sex']) ? $orc_frontdata['Sex'] : "未知";
$inster_data['nation'] = !empty($orc_frontdata['Nation']) ? $orc_frontdata['Nation'] : "";
$inster_data['birth'] = !empty($orc_frontdata['Birth']) ? $orc_frontdata['Birth'] : null;
$inster_data['address'] = !empty($orc_frontdata['Address']) ? $orc_frontdata['Address'] : "";
$inster_data['authority'] = !empty($orc_backdata['backdata']['Authority']) ? $orc_backdata['backdata']['Authority'] : "";
$inster_data['validdatestart'] = $orc_backdata['validdatestart'];
$inster_data['validdateend'] = $orc_backdata['validdateend'];
$inster_data['positive_img'] = $row['positive_img'];
$inster_data['back_img'] = $row['back_img'];
$inster_data['status'] = "1";
Cardocr::create($inster_data);
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
$arr["code"] = 1;
$arr["result"] = $params_data['Result'];
$arr["time"] = time();
$arr["msg"] = $params_data['Description'];
$arr["data"] = $params_data;
echo json_encode($arr);
die();
}
}

10
addons/cardocr/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = cardocr
title = 腾讯身份证联网认证
intro = 腾讯身份证联网公安系统认证与ORC识别身份证
author = 镜面王子
website = https://www.fastadmin.net
version = 1.0.4
state = 1
url = /addons/cardocr
license = regular
licenseto = 16018

View File

@ -0,0 +1,37 @@
CREATE TABLE IF NOT EXISTS `__PREFIX__cardocr` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '会员ID',
`name` varchar(10) DEFAULT '' COMMENT '姓名',
`sex` enum('','','未知') NOT NULL DEFAULT '未知' COMMENT '性别',
`nation` char(6) DEFAULT '' COMMENT '民族',
`birth` datetime DEFAULT NULL COMMENT '生日(datetime)',
`address` char(60) DEFAULT NULL COMMENT '身份证地址',
`idnum` char(25) NOT NULL DEFAULT '' COMMENT '身份证id',
`authority` char(25) DEFAULT NULL COMMENT '发证机关',
`validdatestart` datetime DEFAULT NULL COMMENT '有效期开始',
`validdateend` datetime DEFAULT NULL COMMENT '有效期结束',
`status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态,0=拒绝,1=通过,2=等待审核',
`positive_img` varchar(150) DEFAULT NULL COMMENT '身份证正面',
`back_img` varchar(150) DEFAULT NULL COMMENT '身份证反面',
`memo` varchar(10) DEFAULT '' COMMENT '备注',
`createtime` int(10) DEFAULT NULL COMMENT '创建时间',
`updatetime` int(10) DEFAULT NULL COMMENT '更新时间',
`publishtime` int(10) DEFAULT NULL COMMENT '审核时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idnum` (`idnum`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='身份证';
CREATE TABLE IF NOT EXISTS `__PREFIX__cardocr_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
`username` varchar(30) NOT NULL DEFAULT '' COMMENT '用户名',
`url` varchar(1500) DEFAULT NULL COMMENT '操作页面',
`title` varchar(100) DEFAULT NULL COMMENT '日志标题',
`type` varchar(30) DEFAULT NULL COMMENT '状态,0="集合",1=身份证核验,2=ocr识别',
`content` text NOT NULL COMMENT '内容',
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'IP',
`useragent` varchar(255) NOT NULL DEFAULT '' COMMENT 'User-Agent',
`createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '请求时间',
PRIMARY KEY (`id`),
KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='身份证api日志';

View File

@ -0,0 +1,245 @@
<?php
namespace addons\cardocr\library;
use fast\Http;
use think\Config;
use think\addons\Controller;
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Ocr\V20181119\OcrClient;
use TencentCloud\Ocr\V20181119\Models\IDCardOCRRequest;
use TencentCloud\Faceid\V20180301\FaceidClient;
use TencentCloud\Faceid\V20180301\Models\IdCardOCRVerificationRequest;
use think\Session;
use app\common\model\User;
use think\Exception;
class Card
{
/**
* @param string $idnum 身份证id
* @param string $name 姓名
* @param string $ImageBase64 身份证正面base64
* @param string $ImageUrl 身份证正面绝对url,必须公网可访问的
* @return array|mixed
*/
public static function checkidcard($idnum="", $name="", $ImageBase64 = "", $ImageUrl = "")
{
$card_config = get_addon_config('cardocr');
$secretId = $card_config['secretid'];
$secretKey = $card_config['secretkey'];
$endpoint = $card_config['endpoint'];
$region = $card_config['region'];
try {
$data = array();
$data["IdCard"] = $idnum;
$data['Name'] = $name;
$data['ImageBase64'] = $ImageBase64;
$data['ImageUrl'] = $ImageUrl;
$cred = new Credential($secretId, $secretKey);
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint($endpoint);
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
$client = new FaceidClient($cred, $region, $clientProfile);
$req = new IdCardOCRVerificationRequest();
$params = json_encode($data);
$req->fromJsonString($params);
$resp = $client->IdCardOCRVerification($req);
$params_data = json_decode($resp->toJsonString(), true);
return $params_data;
// var_dump( json_decode($resp->toJsonString(), true));
// print_r($resp->toJsonString());
} catch (TencentCloudSDKException $e) {
return array("code" => $e->getErrorCode(), "msg" => $e->getMessage(), "data" => "");
}
}
/**
* @param json $params ImageBase64格式
* @param string $status|'FRONT','BACK' 识别身份证正反
* @return array|mixed
*/
public static function checkcardocr($params, $status = 'FRONT')
{
$card_config = get_addon_config('cardocr');
$secretId = $card_config['secretid'];
$secretKey = $card_config['secretkey'];
$endpoint = $card_config['endpoint_ocr'];
$region = $card_config['region'];
$cardside['FRONT'] = "身份证正面";
$cardside['BACK'] = "身份证反面";
try {
$cred = new Credential($secretId, $secretKey);
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint($endpoint);
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
$client = new OcrClient($cred, $region, $clientProfile);
$req = new IDCardOCRRequest();
$req->fromJsonString($params);
$resp = $client->IDCardOCR($req);
$params_data = json_decode($resp->toJsonString(), true);
// var_dump($params_data);
return $params_data;
} catch (TencentCloudSDKException $e) {
return array("code" => $e->getErrorCode(), "msg" => $cardside[$status] . $e->getMessage(), "data" => "");
}
}
/**
* @param $image_file 图片url绝对地址
* @return array|string
*/
public static function base64EncodeImage($image_file)
{
try {
$base64_image=self::geturlbase64($image_file, 2);
return !empty($base64_image['data']) ?$base64_image['data']:"";
} catch (Exception $exception) {
return array("code" => 0, "msg" => $exception->getMessage());
}
}
/**
* 将一个字符串部分字符用$re替代隐藏
* @param string $string 待处理的字符串
* @param int $start 规定在字符串的何处开始,
* 正数 - 在字符串的指定位置开始
* 负数 - 在从字符串结尾的指定位置开始
* 0 - 在字符串中的第一个字符处开始
* @param int $length 可选。规定要隐藏的字符串长度。默认是直到字符串的结尾。
* 正数 - start 参数所在的位置隐藏
* 负数 - 从字符串末端隐藏
* @param string $re 替代符
* @return string 处理后的字符串
*/
public static function hidestr($string, $start = 0, $length = 0, $re = '*')
{
if (empty($string)) {
return false;
}
$strarr = array();
$mb_strlen = mb_strlen($string);
while ($mb_strlen) {//循环把字符串变为数组
$strarr[] = mb_substr($string, 0, 1, 'utf8');
$string = mb_substr($string, 1, $mb_strlen, 'utf8');
$mb_strlen = mb_strlen($string);
}
$strlen = count($strarr);
$begin = $start >= 0 ? $start : ($strlen - abs($start));
$end = $last = $strlen - 1;
;
if ($length > 0) {
$end = $begin + $length - 1;
} elseif ($length < 0) {
$end -= abs($length);
}
for ($i = $begin; $i <= $end; $i++) {
$strarr[$i] = $re;
}
// if ($begin >= $end || $begin >= $last || $end > $last) return false;
return implode('', $strarr);
}
/**
* @param $url
* @param int $type 0普通数据 2获取base64
* @param int $timeout
* @return array
*/
public static function geturlbase64($url, $type=0, $timeout=30)
{
$msg = ['code'=>2100,'status'=>'error','msg'=>'未知错误!'];
$imgs= ['image/jpeg'=>'jpeg',
'image/jpg'=>'jpg',
'image/gif'=>'gif',
'image/png'=>'png',
'text/html'=>'html',
'text/plain'=>'txt',
'image/pjpeg'=>'jpg',
'image/x-png'=>'png',
'image/x-icon'=>'ico'
];
if (!stristr($url, 'http')) {
$msg['code']= 2101;
$msg['msg'] = 'url地址不正确!';
return $msg;
}
$dir= pathinfo($url);
//var_dump($dir);
$host = $dir['dirname'];
$refer= $host.'/';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_REFERER, $refer); //伪造来源地址
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//返回变量内容还是直接输出字符串,0输出,1返回内容
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);//在启用CURLOPT_RETURNTRANSFER的时候返回原生的Raw输出
curl_setopt($ch, CURLOPT_HEADER, 0); //是否输出HEADER头信息 0否1是
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); //超时时间
$data = curl_exec($ch);
//$httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
//$httpContentType = curl_getinfo($ch,CURLINFO_CONTENT_TYPE);
$info = curl_getinfo($ch);
curl_close($ch);
$httpCode = intval($info['http_code']);
$httpContentType = $info['content_type'];
$httpSizeDownload= intval($info['size_download']);
if ($httpCode!='200') {
$msg['code']= 2102;
$msg['msg'] = 'url返回内容不正确';
return $msg;
}
if ($type>0 && !isset($imgs[$httpContentType])) {
$msg['code']= 2103;
$msg['msg'] = 'url资源类型未知';
return $msg;
}
if ($httpSizeDownload<1) {
$msg['code']= 2104;
$msg['msg'] = '内容大小不正确!';
return $msg;
}
$msg['code'] = 200;
$msg['status']='success';
$msg['msg'] = '资源获取成功';
if ($type==0 or $httpContentType=='text/html') {
$msg['data'] = $data;
}
$base_64 = base64_encode($data);
if ($type==1) {
$msg['data'] = $base_64;
} elseif ($type==2) {
$msg['data'] = "data:{$httpContentType};base64,{$base_64}";
} elseif ($type==3) {
$msg['data'] = "<img src='data:{$httpContentType};base64,{$base_64}' />";
} else {
$msg['msg'] = '未知返回需求!';
}
unset($info,$data,$base_64);
return $msg;
}
}

View File

@ -0,0 +1,417 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common;
use \ReflectionClass;
use TencentCloud\Common\Http\HttpConnection;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
/**
* 抽象api类禁止client引用
* @package TencentCloud\Common
*/
abstract class AbstractClient
{
/**
* @var string SDK版本
*/
public static $SDK_VERSION = "SDK_PHP_3.0.90";
/**
* @var integer http响应码200
*/
public static $HTTP_RSP_OK = 200;
/**
* @var Credential 认证类实例,保存认证相关字段
*/
private $credential;
/**
* @var ClientProfile 会话配置信息类
*/
private $profile;
/**
* @var string 产品地域
*/
private $region;
/**
* @var string 请求路径
*/
private $path;
/**
* @var string sdk版本号
*/
private $sdkVersion;
/**
* @var string api版本号
*/
private $apiVersion;
/**
* 基础client类
* @param string $endpoint 请求域名
* @param string $version api版本
* @param Credential $credential 认证信息实例
* @param string $region 产品地域
* @param ClientProfile $profile
*/
public function __construct($endpoint, $version, $credential, $region, $profile = null)
{
$this->path = "/";
$this->credential = $credential;
$this->region = $region;
if ($profile) {
$this->profile = $profile;
} else {
$this->profile = new ClientProfile();
}
if ($this->profile->getHttpProfile()->getEndpoint() === null) {
$this->profile->getHttpProfile()->setEndpoint($endpoint);
}
$this->sdkVersion = AbstractClient::$SDK_VERSION;
$this->apiVersion = $version;
}
/**
* 设置产品地域
* @param string $region 地域
*/
public function setRegion($region)
{
$this->region = $region;
}
/**
* 获取产品地域
* @return string
*/
public function getRegion()
{
return $this->region;
}
/**
* 设置认证信息实例
* @param Credential $credential 认证信息实例
*/
public function setCredential($credential)
{
$this->credential = $credential;
}
/**
* 返回认证信息实例
* @return Credential
*/
public function getCredential()
{
return $this->credential;
}
/**
* 设置配置实例
* @param ClientProfile $profile 配置实例
*/
public function setClientProfile($profile)
{
$this->profile = $profile;
}
/**
* 返回配置实例
* @return ClientProfile
*/
public function getClientProfile()
{
return $this->profile;
}
/**
* @param string $action 方法名
* @param array $request 参数列表
* @return mixed
* @throws TencentCloudSDKException
*/
public function __call($action, $request)
{
return $this->doRequestWithOptions($action, $request[0], array());
}
protected function doRequestWithOptions($action, $request, $options)
{
try {
$responseData = null;
$serializeRequest = $request->serialize();
$method = $this->getPrivateMethod($request, "arrayMerge");
$serializeRequest = $method->invoke($request, $serializeRequest);
switch ($this->profile->getSignMethod()) {
case ClientProfile::$SIGN_HMAC_SHA1:
case ClientProfile::$SIGN_HMAC_SHA256:
$responseData = $this->doRequest($action, $serializeRequest);
break;
case ClientProfile::$SIGN_TC3_SHA256:
$responseData = $this->doRequestWithTC3($action, $request, $options);
break;
default:
throw new TencentCloudSDKException("ClientError", "Invalid sign method");
break;
}
if ($responseData->getStatusCode() !== AbstractClient::$HTTP_RSP_OK) {
throw new TencentCloudSDKException($responseData->getReasonPhrase(), $responseData->getBody());
}
$tmpResp = json_decode($responseData->getBody(), true)["Response"];
if (array_key_exists("Error", $tmpResp)) {
throw new TencentCloudSDKException(
$tmpResp["Error"]["Code"],
$tmpResp["Error"]["Message"],
$tmpResp["RequestId"]
);
}
return $this->returnResponse($action, $tmpResp);
} catch (\Exception $e) {
if (!($e instanceof TencentCloudSDKException)) {
throw new TencentCloudSDKException("", $e->getMessage());
} else {
throw $e;
}
}
}
private function doRequest($action, $request)
{
switch ($this->profile->getHttpProfile()->getReqMethod()) {
case HttpProfile::$REQ_GET:
return $this->getRequest($action, $request);
break;
case HttpProfile::$REQ_POST:
return $this->postRequest($action, $request);
break;
default:
throw new TencentCloudSDKException("", "Method only support (GET, POST)");
break;
}
}
private function doRequestWithTC3($action, $request, $options)
{
$headers = array();
$endpoint = $this->profile->getHttpProfile()->getEndpoint();
$headers["Host"] = $endpoint;
$headers["X-TC-Action"] = ucfirst($action);
$headers["X-TC-RequestClient"] = $this->sdkVersion;
$headers["X-TC-Timestamp"] = time();
$headers["X-TC-Version"] = $this->apiVersion;
if ($this->region) {
$headers["X-TC-Region"] = $this->region;
}
if ($this->credential->getToken()) {
$headers["X-TC-Token"] = $this->credential->getToken();
}
$canonicalUri = $this->path;
$reqmethod = $this->profile->getHttpProfile()->getReqMethod();
if (HttpProfile::$REQ_GET == $reqmethod) {
$headers["Content-Type"] = "application/x-www-form-urlencoded";
$rs = $request->serialize();
$am = $this->getPrivateMethod($request, "arrayMerge");
$rsam = $am->invoke($request, $rs);
$canonicalQueryString = http_build_query($rsam);
$payload = "";
} else {
if (isset($options["IsMultipart"]) && $options["IsMultipart"] === true) {
$boundary = uniqid();
$headers["Content-Type"] = "multipart/form-data; boundary=" . $boundary;
$canonicalQueryString = "";
$payload = $this->getMultipartPayload($request, $boundary, $options);
} else {
$headers["Content-Type"] = "application/json";
$canonicalQueryString = "";
$payload = $request->toJsonString();
}
}
if ($this->profile->getUnsignedPayload() == true) {
$headers["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD";
$payloadHash = hash("SHA256", "UNSIGNED-PAYLOAD");
} else {
$payloadHash = hash("SHA256", $payload);
}
$canonicalHeaders = "content-type:" . $headers["Content-Type"] . "\n" .
"host:" . $headers["Host"] . "\n";
$signedHeaders = "content-type;host";
$canonicalRequest = $reqmethod . "\n" .
$canonicalUri . "\n" .
$canonicalQueryString . "\n" .
$canonicalHeaders . "\n" .
$signedHeaders . "\n" .
$payloadHash;
$algo = "TC3-HMAC-SHA256";
// date_default_timezone_set('UTC');
// $date = date("Y-m-d", $headers["X-TC-Timestamp"]);
$date = gmdate("Y-m-d", $headers["X-TC-Timestamp"]);
$service = explode(".", $endpoint)[0];
$credentialScope = $date . "/" . $service . "/tc3_request";
$hashedCanonicalRequest = hash("SHA256", $canonicalRequest);
$str2sign = $algo . "\n" .
$headers["X-TC-Timestamp"] . "\n" .
$credentialScope . "\n" .
$hashedCanonicalRequest;
$skey = $this->credential->getSecretKey();
$signature = Sign::signTC3($skey, $date, $service, $str2sign);
$sid = $this->credential->getSecretId();
$auth = $algo .
" Credential=" . $sid . "/" . $credentialScope .
", SignedHeaders=content-type;host, Signature=" . $signature;
$headers["Authorization"] = $auth;
if (HttpProfile::$REQ_GET == $reqmethod) {
$connect = $this->createConnect();
return $connect->getRequest($this->path, $canonicalQueryString, $headers);
} else {
$connect = $this->createConnect();
return $connect->postRequestRaw($this->path, $headers, $payload);
}
}
private function getMultipartPayload($request, $boundary, $options)
{
$body = "";
$params = $request->serialize();
foreach ($params as $key => $value) {
$body .= "--" . $boundary . "\r\n";
$body .= "Content-Disposition: form-data; name=\"" . $key;
if (in_array($key, $options["BinaryParams"])) {
$body .= "\"; filename=\"" . $key;
}
$body .= "\"\r\n";
if (is_array($value)) {
$value = json_encode($value);
$body .= "Content-Type: application/json\r\n";
}
$body .= "\r\n" . $value . "\r\n";
}
if ($body != "") {
$body .= "--" . $boundary . "--\r\n";
}
return $body;
}
/**
* @throws TencentCloudSDKException
*/
private function getRequest($action, $request)
{
$query = $this->formatRequestData($action, $request, httpProfile::$REQ_GET);
$connect = $this->createConnect();
return $connect->getRequest($this->path, $query, []);
}
/**
* @throws TencentCloudSDKException
*/
private function postRequest($action, $request)
{
$body = $this->formatRequestData($action, $request, httpProfile::$REQ_POST);
$connect = $this->createConnect();
return $connect->postRequest($this->path, [], $body);
}
/**
* @throws TencentCloudSDKException
*/
private function formatRequestData($action, $request, $reqMethod)
{
$param = $request;
$param["Action"] = ucfirst($action);
$param["RequestClient"] = $this->sdkVersion;
$param["Nonce"] = rand();
$param["Timestamp"] = time();
$param["Version"] = $this->apiVersion;
if ($this->credential->getSecretId()) {
$param["SecretId"] = $this->credential->getSecretId();
}
if ($this->region) {
$param["Region"] = $this->region;
}
if ($this->credential->getToken()) {
$param["Token"] = $this->credential->getToken();
}
if ($this->profile->getSignMethod()) {
$param["SignatureMethod"] = $this->profile->getSignMethod();
}
$signStr = $this->formatSignString(
$this->profile->getHttpProfile()->getEndpoint(),
$this->path,
$param,
$reqMethod
);
$param["Signature"] = Sign::sign($this->credential->getSecretKey(), $signStr, $this->profile->getSignMethod());
return $param;
}
private function createConnect()
{
return new HttpConnection($this->profile->getHttpProfile()->getProtocol() .
$this->profile->getHttpProfile()->getEndpoint(), $this->profile);
}
private function formatSignString($host, $uri, $param, $requestMethod)
{
$tmpParam = [];
ksort($param);
foreach ($param as $key => $value) {
array_push($tmpParam, $key . "=" . $value);
}
$strParam = join("&", $tmpParam);
$signStr = strtoupper($requestMethod) . $host . $uri . "?" . $strParam;
return $signStr;
}
private function getPrivateMethod($obj, $methodName)
{
$objReflectClass = new ReflectionClass(get_class($obj));
$method = $objReflectClass->getMethod($methodName);
$method->setAccessible(true);
return $method;
}
}

View File

@ -0,0 +1,131 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common;
use \ReflectionClass;
/**
* 抽象model类禁止client引用
* @package TencentCloud\Common
*/
abstract class AbstractModel
{
/**
* 内部实现,用户禁止调用
*/
public function serialize()
{
$ret = $this->objSerialize($this);
return $ret;
}
private function objSerialize($obj)
{
$memberRet = [];
$ref = new ReflectionClass(get_class($obj));
$memberList = $ref->getProperties();
foreach ($memberList as $x => $member) {
$name = ucfirst($member->getName());
$member->setAccessible(true);
$value = $member->getValue($obj);
if ($value === null) {
continue;
}
if ($value instanceof AbstractModel) {
$memberRet[$name] = $this->objSerialize($value);
} else {
if (is_array($value)) {
$memberRet[$name] = $this->arraySerialize($value);
} else {
$memberRet[$name] = $value;
}
}
}
return $memberRet;
}
private function arraySerialize($memberList)
{
$memberRet = [];
foreach ($memberList as $name => $value) {
if ($value === null) {
continue;
}
if ($value instanceof AbstractModel) {
$memberRet[$name] = $this->objSerialize($value);
} elseif (is_array($value)) {
$memberRet[$name] = $this->arraySerialize($value);
} else {
$memberRet[$name] = $value;
}
}
return $memberRet;
}
private function arrayMerge($array, $prepend = null)
{
$results = array();
foreach ($array as $key => $value) {
if (is_array($value)) {
$results = array_merge($results, static::arrayMerge($value, $prepend . $key . '.'));
} else {
if (is_bool($value)) {
$results[$prepend . $key] = json_encode($value);
} else {
$results[$prepend . $key] = $value;
}
}
}
return $results;
}
abstract public function deserialize($param);
/**
* @param string $jsonString json格式的字符串
*/
public function fromJsonString($jsonString)
{
$arr = json_decode($jsonString, true);
$this->deserialize($arr);
}
public function toJsonString()
{
$r = $this->serialize();
// it is an object rather than an array
if (empty($r)) {
return "{}";
}
return json_encode($r, JSON_UNESCAPED_UNICODE);
}
public function __call($member, $param)
{
$act = substr($member, 0, 3);
$attr = substr($member, 3);
if ($act === "get") {
return $this->$attr;
} else {
if ($act === "set") {
$this->$attr = $param[0];
}
}
}
}

View File

@ -0,0 +1,107 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common;
/**
* 证书类,保存认证相关参数
* @package TencentCloud\Common
*/
class Credential
{
/**
* @var string secretId
*/
private $secretId;
/**
* @var string secretKey
*/
private $secretKey;
/**
* @var string token
*/
private $token;
/**
* Credential constructor.
* @param string $secretId secretId
* @param string $secretKey secretKey
* @param string $token token
*/
public function __construct($secretId, $secretKey, $token = null)
{
$this->secretId = $secretId;
$this->secretKey = $secretKey;
$this->token = $token;
}
/**
* 设置secretId
* @param string $secretId secretId
*/
public function setSecretId($secretId)
{
$this->secretId = $secretId;
}
/**
* 设置secretKey
* @param string $secretKey secretKey
*/
public function setSecretKey($secretKey)
{
$this->secretKey = $secretKey;
}
/**
* @param string $token 要设置的token
*/
public function setToken($token)
{
$this->token = $token;
}
/**
* 获取secretId
* @return string secretId
*/
public function getSecretId()
{
return $this->secretId;
}
/**
* 获取secretKey
* @return string secretKey
*/
public function getSecretKey()
{
return $this->secretKey;
}
/**
* 获取token
* @return null|string token
*/
public function getToken()
{
return $this->token;
}
}

View File

@ -0,0 +1,76 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common\Exception;
/**
* sdk异常类
* @package TencentCloud\Common\Exception
*/
class TencentCloudSDKException extends \Exception
{
/**
* @var string 请求id
*/
private $requestId;
private $errorCode;
/**
* TencentCloudSDKException constructor.
* @param string $code 异常错误码
* @param string $message 异常信息
* @param string $requestId 请求ID
*/
public function __construct($code = "", $message = "", $requestId = "")
{
parent::__construct($message, 0);
$this->errorCode = $code;
$this->requestId = $requestId;
}
/**
* 返回请求id
* @return string
*/
public function getRequestId()
{
return $this->requestId;
}
/**
* 返回错误码
* @return string
*/
public function getErrorCode()
{
return $this->errorCode;
}
/**
* 格式化输出异常码异常信息请求id
* @return string
*/
public function __toString()
{
return "[" . __CLASS__ . "]" . " code:" . $this->errorCode .
" message:" . $this->getMessage() .
" requestId:" . $this->requestId;
}
}

View File

@ -0,0 +1,84 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common\Http;
use GuzzleHttp\Client;
/**
* http连接类
* @package TencentCloud\Common\http
*/
class HttpConnection
{
private $client;
private $profile;
public function __construct($url, $profile)
{
$this->client = new Client(["base_uri" => $url]);
$this->profile = $profile;
}
private function getOptions()
{
$options = ["allow_redirects" => false];
$options["timeout"] = $this->profile->getHttpProfile()->getReqTimeout();
return $options;
}
public function getRequest($uri = '', $query = [], $headers = [])
{
$options = $this->getOptions();
if ($query) {
$options["query"] = $query;
}
if ($headers) {
$options["headers"] = $headers;
}
return $this->client->get($uri, $options);
}
public function postRequest($uri = '', $headers = [], $body = '')
{
$options = $this->getOptions();
if ($headers) {
$options["headers"] = $headers;
}
if ($body) {
$options["form_params"] = $body;
}
return $this->client->post($uri, $options);
}
public function postRequestRaw($uri = '', $headers = [], $body = '')
{
$options = $this->getOptions();
if ($headers) {
$options["headers"] = $headers;
}
if ($body) {
$options["body"] = $body;
}
return $this->client->post($uri, $options);
}
}

View File

@ -0,0 +1,126 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common\Profile;
/**
* client可选参数类
* Class ClientProfile
* @package TencentCloud\Common\Profile
*/
class ClientProfile
{
/**
* @var string hmacsha1算法
*/
public static $SIGN_HMAC_SHA1 = "HmacSHA1";
/**
* @var string hmacsha256算法
*/
public static $SIGN_HMAC_SHA256 = "HmacSHA256";
/**
* @var string 签名V3
*/
public static $SIGN_TC3_SHA256 = "TC3-HMAC-SHA256";
/**
* @var HttpProfile http相关参数
*/
private $httpProfile;
/**
* @var string 签名方法
*/
private $signMethod;
/**
* @var string 忽略内容签名
*/
private $unsignedPayload;
/**
* ClientProfile constructor.
* @param string $signMethod 签名算法目前支持SHA256SHA1
* @param HttpProfile $httpProfile http参数类
*/
public function __construct($signMethod = null, $httpProfile = null)
{
$this->signMethod = $signMethod ? $signMethod : ClientProfile::$SIGN_TC3_SHA256;
$this->httpProfile = $httpProfile ? $httpProfile : new HttpProfile();
$this->unsignedPayload = false;
}
/**
* 设置签名算法
* @param string $signMethod 签名方法目前支持SHA256SHA1, TC3
*/
public function setSignMethod($signMethod)
{
$this->signMethod = $signMethod;
}
/**
* 设置http相关参数
* @param HttpProfile $httpProfile http相关参数
*/
public function setHttpProfile($httpProfile)
{
$this->httpProfile = $httpProfile;
}
/**
* 获取签名方法
* @return null|string 签名方法
*/
public function getSignMethod()
{
return $this->signMethod;
}
/**
* 设置是否忽略内容签名
* @param bool $flag true表示忽略签名
*/
public function setUnsignedPayload($flag)
{
$this->unsignedPayload = $flag;
}
/**
* 获取是否忽略内容签名标志位
* @return bool
*/
public function getUnsignedPayload()
{
return $this->unsignedPayload;
}
/**
* 获取http选项实例
* @return null|HttpProfile http选项实例
*/
public function getHttpProfile()
{
return $this->httpProfile;
}
}

View File

@ -0,0 +1,160 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common\Profile;
/**
* http相关参数类
* Class HttpProfile
* @package TencentCloud\Common\Profile
*/
class HttpProfile
{
/**
* @var string https访问
*/
public static $REQ_HTTPS = "https://";
/**
* @var string http访问
*/
public static $REQ_HTTP = "http://";
/**
* @var string post请求
*/
public static $REQ_POST = "POST";
/**
* @var string get请求
*/
public static $REQ_GET = "GET";
/**
* @var int 时间一分钟
*/
public static $TM_MINUTE = 60;
/**
* @var string http请求方法
*/
private $reqMethod;
/**
* @var string 请求接入点域名
*/
private $endpoint;
/**
* @var integer 请求超时时长,单位为秒
*/
private $reqTimeout;
/**
* @var string 请求协议
*/
private $protocol;
/**
* HttpProfile constructor.
* @param string $protocol 请求协议
* @param string $endpoint 请求接入点域名(xx.[region.]tencentcloudapi.com)
* @param string $reqMethod http请求方法目前支持POST GET
* @param integer $reqTimeout 请求超时时间,单位:s
*/
public function __construct($protocol = null, $endpoint = null, $reqMethod = null, $reqTimeout = null)
{
$this->reqMethod = $reqMethod ? $reqMethod : HttpProfile::$REQ_POST;
$this->endpoint = $endpoint;
$this->reqTimeout = $reqTimeout ? $reqTimeout : HttpProfile::$TM_MINUTE;
$this->protocol = $protocol ? $protocol : HttpProfile::$REQ_HTTPS;
}
/**
* 设置http请求方法
* @param string $reqMethod http请求方法目前支持POST GET
*/
public function setReqMethod($reqMethod)
{
$this->reqMethod = $reqMethod;
}
/**
* 设置请求协议
* @param string $protocol 请求协议https:// http://
*/
public function setProtocol($protocol)
{
$this->protocol = $protocol;
}
/**
* 设置请求接入点域名
* @param string $endpoint 请求接入点域名(xx.[region.]tencentcloudapi.com)
*/
public function setEndpoint($endpoint)
{
$this->endpoint = $endpoint;
}
/**
* 设置请求超时时间
* @param integer $reqTimeout 请求超时时间,单位:s
*/
public function setReqTimeout($reqTimeout)
{
$this->reqTimeout = $reqTimeout;
}
/**
* 获取请求方法
* @return null|string 请求方法
*/
public function getReqMethod()
{
return $this->reqMethod;
}
/**
* 获取请求协议
* @return null|string 请求协议
*/
public function getProtocol()
{
return $this->protocol;
}
/**
* 获取请求超时时间
* @return int 请求超时时间
*/
public function getReqTimeout()
{
return $this->reqTimeout;
}
/**
* 获取请求接入点域名
* @return null|string 接入点域名
*/
public function getEndpoint()
{
return $this->endpoint;
}
}

View File

@ -0,0 +1,50 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud\Common;
use TencentCloud\Common\Exception\TencentCloudSDKException;
/**
* 签名类禁止client引用
* @package TencentCloud\Common
* @throws TencentCloudSDKException
*/
class Sign
{
/**
* @throws TencentCloudSDKException
*/
public static function sign($secretKey, $signStr, $signMethod)
{
$signMethodMap = ["HmacSHA1" => "SHA1", "HmacSHA256" => "SHA256"];
if (!array_key_exists($signMethod, $signMethodMap)) {
throw new TencentCloudSDKException("signMethod invalid", "signMethod only support (HmacSHA1, HmacSHA256)");
}
$signature = base64_encode(hash_hmac($signMethodMap[$signMethod], $signStr, $secretKey, true));
return $signature;
}
public static function signTC3($skey, $date, $service, $str2sign)
{
$dateKey = hash_hmac("SHA256", $date, "TC3" . $skey, true);
$serviceKey = hash_hmac("SHA256", $service, $dateKey, true);
$reqKey = hash_hmac("SHA256", "tc3_request", $serviceKey, true);
return hash_hmac("SHA256", $str2sign, $reqKey);
}
}

View File

@ -0,0 +1,70 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301;
use TencentCloud\Common\AbstractClient;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Credential;
use TencentCloud\Faceid\V20180301\Models as Models;
/**
* @method Models\BankCard2EVerificationResponse BankCard2EVerification(Models\BankCard2EVerificationRequest $req) 输入银行卡号、姓名,校验信息的真实性和一致性。
* @method Models\BankCard4EVerificationResponse BankCard4EVerification(Models\BankCard4EVerificationRequest $req) 输入银行卡号、姓名、开户证件号、开户手机号,校验信息的真实性和一致性。
* @method Models\BankCardVerificationResponse BankCardVerification(Models\BankCardVerificationRequest $req) 银行卡三要素核验,输入银行卡号、姓名、开户证件号,校验信息的真实性和一致性。
* @method Models\DetectAuthResponse DetectAuth(Models\DetectAuthRequest $req) 每次调用人脸核身SaaS化服务前需先调用本接口获取BizToken用来串联核身流程在验证完成后用于获取验证结果信息。
* @method Models\GetActionSequenceResponse GetActionSequence(Models\GetActionSequenceRequest $req) 使用动作活体检测模式前,需调用本接口获取动作顺序。
* @method Models\GetDetectInfoResponse GetDetectInfo(Models\GetDetectInfoRequest $req) 完成验证后用BizToken调用本接口获取结果信息BizToken生成后三天内3\*24\*3, 600秒)可多次拉取。
* @method Models\GetLiveCodeResponse GetLiveCode(Models\GetLiveCodeRequest $req) 使用数字活体检测模式前,需调用本接口获取数字验证码。
* @method Models\IdCardOCRVerificationResponse IdCardOCRVerification(Models\IdCardOCRVerificationRequest $req) 本接口用于校验姓名和身份证号的真实性和一致性,您可以通过输入姓名和身份证号或传入身份证人像面照片提供所需验证信息。
* @method Models\IdCardVerificationResponse IdCardVerification(Models\IdCardVerificationRequest $req) 传入姓名和身份证号,校验两者的真实性和一致性。
* @method Models\ImageRecognitionResponse ImageRecognition(Models\ImageRecognitionRequest $req) 传入照片和身份信息,判断该照片与公安权威库的证件照是否属于同一个人。
* @method Models\LivenessResponse Liveness(Models\LivenessRequest $req) 活体检测
* @method Models\LivenessCompareResponse LivenessCompare(Models\LivenessCompareRequest $req) 传入视频和照片,先判断视频中是否为真人,判断为真人后,再判断该视频中的人与上传照片是否属于同一个人。
* @method Models\LivenessRecognitionResponse LivenessRecognition(Models\LivenessRecognitionRequest $req) 传入视频和身份信息,先判断视频中是否为真人,判断为真人后,再判断该视频中的人与公安权威库的证件照是否属于同一个人。
*/
class FaceidClient extends AbstractClient
{
/**
* @var string 产品默认域名
*/
protected $endpoint = "faceid.tencentcloudapi.com";
/**
* @var string api版本号
*/
protected $version = "2018-03-01";
/**
* CvmClient constructor.
* @param Credential $credential 认证类实例
* @param string $region 地域
* @param ClientProfile $profile client配置
*/
public function __construct($credential, $region, $profile = null)
{
parent::__construct($this->endpoint, $this->version, $credential, $region, $profile);
}
public function returnResponse($action, $response)
{
$respClass = "TencentCloud" . "\\" . ucfirst("faceid") . "\\" . "V20180301\\Models" . "\\" . ucfirst($action) . "Response";
$obj = new $respClass();
$obj->deserialize($response);
return $obj;
}
}

View File

@ -0,0 +1,68 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getName() 获取姓名
* @method void setName(string $Name) 设置姓名
* @method string getBankCard() 获取银行卡
* @method void setBankCard(string $BankCard) 设置银行卡
*/
/**
*BankCard2EVerification请求参数结构体
*/
class BankCard2EVerificationRequest extends AbstractModel
{
/**
* @var string 姓名
*/
public $Name;
/**
* @var string 银行卡
*/
public $BankCard;
/**
* @param string $Name 姓名
* @param string $BankCard 银行卡
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("BankCard", $param) and $param["BankCard"] !== null) {
$this->BankCard = $param["BankCard"];
}
}
}

View File

@ -0,0 +1,148 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getResult() 获取认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '银行卡号码有误'
* '-4': '持卡人信息有误'
* '-5': '未开通无卡支付'
* '-6': '此卡被没收'
* '-7': '无效卡号'
* '-8': '此卡无对应发卡行'
* '-9': '该卡未初始化或睡眠卡'
* '-10': '作弊卡、吞卡'
* '-11': '此卡已挂失'
* '-12': '该卡已过期'
* '-13': '受限制的卡'
* '-14': '密码错误次数超限'
* '-15': '发卡行不支持此交易'
* '-16': '服务繁忙'
* @method void setResult(string $Result) 设置认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '银行卡号码有误'
* '-4': '持卡人信息有误'
* '-5': '未开通无卡支付'
* '-6': '此卡被没收'
* '-7': '无效卡号'
* '-8': '此卡无对应发卡行'
* '-9': '该卡未初始化或睡眠卡'
* '-10': '作弊卡、吞卡'
* '-11': '此卡已挂失'
* '-12': '该卡已过期'
* '-13': '受限制的卡'
* '-14': '密码错误次数超限'
* '-15': '发卡行不支持此交易'
* '-16': '服务繁忙'
* @method string getDescription() 获取认证结果信息。
* @method void setDescription(string $Description) 设置认证结果信息。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*BankCard2EVerification返回参数结构体
*/
class BankCard2EVerificationResponse extends AbstractModel
{
/**
* @var string 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '银行卡号码有误'
* '-4': '持卡人信息有误'
* '-5': '未开通无卡支付'
* '-6': '此卡被没收'
* '-7': '无效卡号'
* '-8': '此卡无对应发卡行'
* '-9': '该卡未初始化或睡眠卡'
* '-10': '作弊卡、吞卡'
* '-11': '此卡已挂失'
* '-12': '该卡已过期'
* '-13': '受限制的卡'
* '-14': '密码错误次数超限'
* '-15': '发卡行不支持此交易'
* '-16': '服务繁忙'
*/
public $Result;
/**
* @var string 认证结果信息。
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Result 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '银行卡号码有误'
* '-4': '持卡人信息有误'
* '-5': '未开通无卡支付'
* '-6': '此卡被没收'
* '-7': '无效卡号'
* '-8': '此卡无对应发卡行'
* '-9': '该卡未初始化或睡眠卡'
* '-10': '作弊卡、吞卡'
* '-11': '此卡已挂失'
* '-12': '该卡已过期'
* '-13': '受限制的卡'
* '-14': '密码错误次数超限'
* '-15': '发卡行不支持此交易'
* '-16': '服务繁忙'
* @param string $Description 认证结果信息。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,136 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getName() 获取姓名
* @method void setName(string $Name) 设置姓名
* @method string getBankCard() 获取银行卡
* @method void setBankCard(string $BankCard) 设置银行卡
* @method string getPhone() 获取手机号码
* @method void setPhone(string $Phone) 设置手机号码
* @method string getIdCard() 获取开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @method void setIdCard(string $IdCard) 设置开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @method integer getCertType() 获取证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
* @method void setCertType(integer $CertType) 设置证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
/**
*BankCard4EVerification请求参数结构体
*/
class BankCard4EVerificationRequest extends AbstractModel
{
/**
* @var string 姓名
*/
public $Name;
/**
* @var string 银行卡
*/
public $BankCard;
/**
* @var string 手机号码
*/
public $Phone;
/**
* @var string 开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
*/
public $IdCard;
/**
* @var integer 证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
public $CertType;
/**
* @param string $Name 姓名
* @param string $BankCard 银行卡
* @param string $Phone 手机号码
* @param string $IdCard 开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @param integer $CertType 证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("BankCard", $param) and $param["BankCard"] !== null) {
$this->BankCard = $param["BankCard"];
}
if (array_key_exists("Phone", $param) and $param["Phone"] !== null) {
$this->Phone = $param["Phone"];
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("CertType", $param) and $param["CertType"] !== null) {
$this->CertType = $param["CertType"];
}
}
}

View File

@ -0,0 +1,156 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getResult() 获取认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '手机号码不合法'
* '-6': '持卡人信息有误'
* '-7': '未开通无卡支付'
* '-8': '此卡被没收'
* '-9': '无效卡号'
* '-10': '此卡无对应发卡行'
* '-11': '该卡未初始化或睡眠卡'
* '-12': '作弊卡、吞卡'
* '-13': '此卡已挂失'
* '-14': '该卡已过期'
* '-15': '受限制的卡'
* '-16': '密码错误次数超限'
* '-17': '发卡行不支持此交易'
* '-18': '服务繁忙'
* @method void setResult(string $Result) 设置认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '手机号码不合法'
* '-6': '持卡人信息有误'
* '-7': '未开通无卡支付'
* '-8': '此卡被没收'
* '-9': '无效卡号'
* '-10': '此卡无对应发卡行'
* '-11': '该卡未初始化或睡眠卡'
* '-12': '作弊卡、吞卡'
* '-13': '此卡已挂失'
* '-14': '该卡已过期'
* '-15': '受限制的卡'
* '-16': '密码错误次数超限'
* '-17': '发卡行不支持此交易'
* '-18': '服务繁忙'
* @method string getDescription() 获取认证结果信息。
* @method void setDescription(string $Description) 设置认证结果信息。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*BankCard4EVerification返回参数结构体
*/
class BankCard4EVerificationResponse extends AbstractModel
{
/**
* @var string 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '手机号码不合法'
* '-6': '持卡人信息有误'
* '-7': '未开通无卡支付'
* '-8': '此卡被没收'
* '-9': '无效卡号'
* '-10': '此卡无对应发卡行'
* '-11': '该卡未初始化或睡眠卡'
* '-12': '作弊卡、吞卡'
* '-13': '此卡已挂失'
* '-14': '该卡已过期'
* '-15': '受限制的卡'
* '-16': '密码错误次数超限'
* '-17': '发卡行不支持此交易'
* '-18': '服务繁忙'
*/
public $Result;
/**
* @var string 认证结果信息。
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Result 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '手机号码不合法'
* '-6': '持卡人信息有误'
* '-7': '未开通无卡支付'
* '-8': '此卡被没收'
* '-9': '无效卡号'
* '-10': '此卡无对应发卡行'
* '-11': '该卡未初始化或睡眠卡'
* '-12': '作弊卡、吞卡'
* '-13': '此卡已挂失'
* '-14': '该卡已过期'
* '-15': '受限制的卡'
* '-16': '密码错误次数超限'
* '-17': '发卡行不支持此交易'
* '-18': '服务繁忙'
* @param string $Description 认证结果信息。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,124 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getIdCard() 获取开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @method void setIdCard(string $IdCard) 设置开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @method string getName() 获取姓名
* @method void setName(string $Name) 设置姓名
* @method string getBankCard() 获取银行卡
* @method void setBankCard(string $BankCard) 设置银行卡
* @method integer getCertType() 获取证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
* @method void setCertType(integer $CertType) 设置证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
/**
*BankCardVerification请求参数结构体
*/
class BankCardVerificationRequest extends AbstractModel
{
/**
* @var string 开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
*/
public $IdCard;
/**
* @var string 姓名
*/
public $Name;
/**
* @var string 银行卡
*/
public $BankCard;
/**
* @var integer 证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
public $CertType;
/**
* @param string $IdCard 开户证件号与CertType参数的证件类型一致身份证则传入身份证号。
* @param string $Name 姓名
* @param string $BankCard 银行卡
* @param integer $CertType 证件类型请确认该证件为开户时使用的证件类型未用于开户的证件信息不支持验证。不填默认0
* 0 身份证
* 1 军官证
* 2 护照
* 3 港澳证
* 4 台胞证
* 5 警官证
* 6 士兵证
* 7 其它证件
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("BankCard", $param) and $param["BankCard"] !== null) {
$this->BankCard = $param["BankCard"];
}
if (array_key_exists("CertType", $param) and $param["CertType"] !== null) {
$this->CertType = $param["CertType"];
}
}
}

View File

@ -0,0 +1,152 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getResult() 获取认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '持卡人信息有误'
* '-6': '未开通无卡支付'
* '-7': '此卡被没收'
* '-8': '无效卡号'
* '-9': '此卡无对应发卡行'
* '-10': '该卡未初始化或睡眠卡'
* '-11': '作弊卡、吞卡'
* '-12': '此卡已挂失'
* '-13': '该卡已过期'
* '-14': '受限制的卡'
* '-15': '密码错误次数超限'
* '-16': '发卡行不支持此交易'
* '-17': '服务繁忙'
* @method void setResult(string $Result) 设置认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '持卡人信息有误'
* '-6': '未开通无卡支付'
* '-7': '此卡被没收'
* '-8': '无效卡号'
* '-9': '此卡无对应发卡行'
* '-10': '该卡未初始化或睡眠卡'
* '-11': '作弊卡、吞卡'
* '-12': '此卡已挂失'
* '-13': '该卡已过期'
* '-14': '受限制的卡'
* '-15': '密码错误次数超限'
* '-16': '发卡行不支持此交易'
* '-17': '服务繁忙'
* @method string getDescription() 获取认证结果信息。
* @method void setDescription(string $Description) 设置认证结果信息。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*BankCardVerification返回参数结构体
*/
class BankCardVerificationResponse extends AbstractModel
{
/**
* @var string 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '持卡人信息有误'
* '-6': '未开通无卡支付'
* '-7': '此卡被没收'
* '-8': '无效卡号'
* '-9': '此卡无对应发卡行'
* '-10': '该卡未初始化或睡眠卡'
* '-11': '作弊卡、吞卡'
* '-12': '此卡已挂失'
* '-13': '该卡已过期'
* '-14': '受限制的卡'
* '-15': '密码错误次数超限'
* '-16': '发卡行不支持此交易'
* '-17': '服务繁忙'
*/
public $Result;
/**
* @var string 认证结果信息。
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Result 认证结果码。
* '0': '认证通过'
* '-1': '认证未通过'
* '-2': '姓名校验不通过'
* '-3': '身份证号码有误'
* '-4': '银行卡号码有误'
* '-5': '持卡人信息有误'
* '-6': '未开通无卡支付'
* '-7': '此卡被没收'
* '-8': '无效卡号'
* '-9': '此卡无对应发卡行'
* '-10': '该卡未初始化或睡眠卡'
* '-11': '作弊卡、吞卡'
* '-12': '此卡已挂失'
* '-13': '该卡已过期'
* '-14': '受限制的卡'
* '-15': '密码错误次数超限'
* '-16': '发卡行不支持此交易'
* '-17': '服务繁忙'
* @param string $Description 认证结果信息。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,136 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getRuleId() 获取用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @method void setRuleId(string $RuleId) 设置用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @method string getTerminalType() 获取本接口不需要传递此参数。
* @method void setTerminalType(string $TerminalType) 设置本接口不需要传递此参数。
* @method string getIdCard() 获取身份标识(与公安权威库比对时必须是身份证号)。
* 规则a-zA-Z0-9组合。最长长度32位。
* @method void setIdCard(string $IdCard) 设置身份标识(与公安权威库比对时必须是身份证号)。
* 规则a-zA-Z0-9组合。最长长度32位。
* @method string getName() 获取姓名。最长长度32位。中文请使用UTF-8编码。
* @method void setName(string $Name) 设置姓名。最长长度32位。中文请使用UTF-8编码。
* @method string getRedirectUrl() 获取认证结束后重定向的回调链接地址。最长长度1024位。
* @method void setRedirectUrl(string $RedirectUrl) 设置认证结束后重定向的回调链接地址。最长长度1024位。
* @method string getExtra() 获取透传字段,在获取验证结果时返回。
* @method void setExtra(string $Extra) 设置透传字段,在获取验证结果时返回。
* @method string getImageBase64() 获取用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @method void setImageBase64(string $ImageBase64) 设置用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
*/
/**
*DetectAuth请求参数结构体
*/
class DetectAuthRequest extends AbstractModel
{
/**
* @var string 用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
*/
public $RuleId;
/**
* @var string 本接口不需要传递此参数。
*/
public $TerminalType;
/**
* @var string 身份标识(与公安权威库比对时必须是身份证号)。
* 规则a-zA-Z0-9组合。最长长度32位。
*/
public $IdCard;
/**
* @var string 姓名。最长长度32位。中文请使用UTF-8编码。
*/
public $Name;
/**
* @var string 认证结束后重定向的回调链接地址。最长长度1024位。
*/
public $RedirectUrl;
/**
* @var string 透传字段,在获取验证结果时返回。
*/
public $Extra;
/**
* @var string 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
*/
public $ImageBase64;
/**
* @param string $RuleId 用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @param string $TerminalType 本接口不需要传递此参数。
* @param string $IdCard 身份标识(与公安权威库比对时必须是身份证号)。
* 规则a-zA-Z0-9组合。最长长度32位。
* @param string $Name 姓名。最长长度32位。中文请使用UTF-8编码。
* @param string $RedirectUrl 认证结束后重定向的回调链接地址。最长长度1024位。
* @param string $Extra 透传字段,在获取验证结果时返回。
* @param string $ImageBase64 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("RuleId", $param) and $param["RuleId"] !== null) {
$this->RuleId = $param["RuleId"];
}
if (array_key_exists("TerminalType", $param) and $param["TerminalType"] !== null) {
$this->TerminalType = $param["TerminalType"];
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("RedirectUrl", $param) and $param["RedirectUrl"] !== null) {
$this->RedirectUrl = $param["RedirectUrl"];
}
if (array_key_exists("Extra", $param) and $param["Extra"] !== null) {
$this->Extra = $param["Extra"];
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
}
}

View File

@ -0,0 +1,84 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getUrl() 获取用于发起核身流程的URL仅微信H5场景使用。
* @method void setUrl(string $Url) 设置用于发起核身流程的URL仅微信H5场景使用。
* @method string getBizToken() 获取一次核身流程的标识有效时间为7, 200秒;
* 完成核身后,可用该标识获取验证结果信息。
* @method void setBizToken(string $BizToken) 设置一次核身流程的标识有效时间为7, 200秒;
* 完成核身后,可用该标识获取验证结果信息。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*DetectAuth返回参数结构体
*/
class DetectAuthResponse extends AbstractModel
{
/**
* @var string 用于发起核身流程的URL仅微信H5场景使用。
*/
public $Url;
/**
* @var string 一次核身流程的标识有效时间为7,200秒;
* 完成核身后,可用该标识获取验证结果信息。
*/
public $BizToken;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Url 用于发起核身流程的URL仅微信H5场景使用。
* @param string $BizToken 一次核身流程的标识有效时间为7,200秒;
* 完成核身后,可用该标识获取验证结果信息。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Url", $param) and $param["Url"] !== null) {
$this->Url = $param["Url"];
}
if (array_key_exists("BizToken", $param) and $param["BizToken"] !== null) {
$this->BizToken = $param["BizToken"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,46 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
*/
/**
*GetActionSequence请求参数结构体
*/
class GetActionSequenceRequest extends AbstractModel
{
/**
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
}
}

View File

@ -0,0 +1,68 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getActionSequence() 获取动作顺序(2, 1 or 1, 2) 。1代表张嘴2代表闭眼。
* @method void setActionSequence(string $ActionSequence) 设置动作顺序(2, 1 or 1, 2) 。1代表张嘴2代表闭眼。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*GetActionSequence返回参数结构体
*/
class GetActionSequenceResponse extends AbstractModel
{
/**
* @var string 动作顺序(2,1 or 1,2) 。1代表张嘴2代表闭眼。
*/
public $ActionSequence;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $ActionSequence 动作顺序(2,1 or 1,2) 。1代表张嘴2代表闭眼。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("ActionSequence", $param) and $param["ActionSequence"] !== null) {
$this->ActionSequence = $param["ActionSequence"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,84 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getBizToken() 获取人脸核身流程的标识调用DetectAuth接口时生成。
* @method void setBizToken(string $BizToken) 设置人脸核身流程的标识调用DetectAuth接口时生成。
* @method string getRuleId() 获取用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @method void setRuleId(string $RuleId) 设置用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @method string getInfoType() 获取指定拉取的结果信息取值0全部1文本类2身份证正反面3视频最佳截图照片4视频
* 134表示拉取文本类、视频最佳截图照片、视频。
* @method void setInfoType(string $InfoType) 设置指定拉取的结果信息取值0全部1文本类2身份证正反面3视频最佳截图照片4视频
* 134表示拉取文本类、视频最佳截图照片、视频。
*/
/**
*GetDetectInfo请求参数结构体
*/
class GetDetectInfoRequest extends AbstractModel
{
/**
* @var string 人脸核身流程的标识调用DetectAuth接口时生成。
*/
public $BizToken;
/**
* @var string 用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
*/
public $RuleId;
/**
* @var string 指定拉取的结果信息取值0全部1文本类2身份证正反面3视频最佳截图照片4视频
* 134表示拉取文本类、视频最佳截图照片、视频。
*/
public $InfoType;
/**
* @param string $BizToken 人脸核身流程的标识调用DetectAuth接口时生成。
* @param string $RuleId 用于细分客户使用场景申请开通服务后可以在腾讯云慧眼人脸核身控制台https://console.cloud.tencent.com/faceid 自助接入里面创建审核通过后即可调用。如有疑问请加慧眼小助手微信faceid001进行咨询。
* @param string $InfoType 指定拉取的结果信息取值0全部1文本类2身份证正反面3视频最佳截图照片4视频
* 134表示拉取文本类、视频最佳截图照片、视频。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("BizToken", $param) and $param["BizToken"] !== null) {
$this->BizToken = $param["BizToken"];
}
if (array_key_exists("RuleId", $param) and $param["RuleId"] !== null) {
$this->RuleId = $param["RuleId"];
}
if (array_key_exists("InfoType", $param) and $param["InfoType"] !== null) {
$this->InfoType = $param["InfoType"];
}
}
}

View File

@ -0,0 +1,224 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getDetectInfo() 获取JSON字符串。
* {
* // 文本类信息
* "Text": {
* "ErrCode": null, // 本次核身最终结果。0为成功
* "ErrMsg": null, // 本次核身最终结果信息描述。
* "IdCard": "", // 本次核身最终获得的身份证号。
* "Name": "", // 本次核身最终获得的姓名。
* "OcrNation": null, // ocr阶段获取的民族
* "OcrAddress": null, // ocr阶段获取的地址
* "OcrBirth": null, // ocr阶段获取的出生信息
* "OcrAuthority": null, // ocr阶段获取的证件签发机关
* "OcrValidDate": null, // ocr阶段获取的证件有效期
* "OcrName": null, // ocr阶段获取的姓名
* "OcrIdCard": null, // ocr阶段获取的身份证号
* "OcrGender": null, // ocr阶段获取的性别
* "LiveStatus": null, // 活体检测阶段的错误码。0为成功
* "LiveMsg": null, // 活体检测阶段的错误信息
* "Comparestatus": null,// 一比一阶段的错误码。0为成功
* "Comparemsg": null, // 一比一阶段的错误信息
* "Location": null, // 地理位置信息
* "Extra": "", // DetectAuth结果传进来的Extra信息
* "Detail": { // 活体一比一信息详情
* "LivenessData": []
* }
* },
* // 身份证正反面照片Base64
* "IdCardData": {
* "OcrFront": null,
* "OcrBack": null
* },
* // 视频最佳帧截图Base64
* "BestFrame": {
* "BestFrame": null
* },
* // 活体视频Base64
* "VideoData": {
* "LivenessVideo": null
* }
* }
* @method void setDetectInfo(string $DetectInfo) 设置JSON字符串。
* {
* // 文本类信息
* "Text": {
* "ErrCode": null, // 本次核身最终结果。0为成功
* "ErrMsg": null, // 本次核身最终结果信息描述。
* "IdCard": "", // 本次核身最终获得的身份证号。
* "Name": "", // 本次核身最终获得的姓名。
* "OcrNation": null, // ocr阶段获取的民族
* "OcrAddress": null, // ocr阶段获取的地址
* "OcrBirth": null, // ocr阶段获取的出生信息
* "OcrAuthority": null, // ocr阶段获取的证件签发机关
* "OcrValidDate": null, // ocr阶段获取的证件有效期
* "OcrName": null, // ocr阶段获取的姓名
* "OcrIdCard": null, // ocr阶段获取的身份证号
* "OcrGender": null, // ocr阶段获取的性别
* "LiveStatus": null, // 活体检测阶段的错误码。0为成功
* "LiveMsg": null, // 活体检测阶段的错误信息
* "Comparestatus": null,// 一比一阶段的错误码。0为成功
* "Comparemsg": null, // 一比一阶段的错误信息
* "Location": null, // 地理位置信息
* "Extra": "", // DetectAuth结果传进来的Extra信息
* "Detail": { // 活体一比一信息详情
* "LivenessData": []
* }
* },
* // 身份证正反面照片Base64
* "IdCardData": {
* "OcrFront": null,
* "OcrBack": null
* },
* // 视频最佳帧截图Base64
* "BestFrame": {
* "BestFrame": null
* },
* // 活体视频Base64
* "VideoData": {
* "LivenessVideo": null
* }
* }
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*GetDetectInfo返回参数结构体
*/
class GetDetectInfoResponse extends AbstractModel
{
/**
* @var string JSON字符串。
* {
* // 文本类信息
* "Text": {
* "ErrCode": null, // 本次核身最终结果。0为成功
* "ErrMsg": null, // 本次核身最终结果信息描述。
* "IdCard": "", // 本次核身最终获得的身份证号。
* "Name": "", // 本次核身最终获得的姓名。
* "OcrNation": null, // ocr阶段获取的民族
* "OcrAddress": null, // ocr阶段获取的地址
* "OcrBirth": null, // ocr阶段获取的出生信息
* "OcrAuthority": null, // ocr阶段获取的证件签发机关
* "OcrValidDate": null, // ocr阶段获取的证件有效期
* "OcrName": null, // ocr阶段获取的姓名
* "OcrIdCard": null, // ocr阶段获取的身份证号
* "OcrGender": null, // ocr阶段获取的性别
* "LiveStatus": null, // 活体检测阶段的错误码。0为成功
* "LiveMsg": null, // 活体检测阶段的错误信息
* "Comparestatus": null,// 一比一阶段的错误码。0为成功
* "Comparemsg": null, // 一比一阶段的错误信息
* "Location": null, // 地理位置信息
* "Extra": "", // DetectAuth结果传进来的Extra信息
* "Detail": { // 活体一比一信息详情
* "LivenessData": []
* }
* },
* // 身份证正反面照片Base64
* "IdCardData": {
* "OcrFront": null,
* "OcrBack": null
* },
* // 视频最佳帧截图Base64
* "BestFrame": {
* "BestFrame": null
* },
* // 活体视频Base64
* "VideoData": {
* "LivenessVideo": null
* }
* }
*/
public $DetectInfo;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $DetectInfo JSON字符串。
* {
* // 文本类信息
* "Text": {
* "ErrCode": null, // 本次核身最终结果。0为成功
* "ErrMsg": null, // 本次核身最终结果信息描述。
* "IdCard": "", // 本次核身最终获得的身份证号。
* "Name": "", // 本次核身最终获得的姓名。
* "OcrNation": null, // ocr阶段获取的民族
* "OcrAddress": null, // ocr阶段获取的地址
* "OcrBirth": null, // ocr阶段获取的出生信息
* "OcrAuthority": null, // ocr阶段获取的证件签发机关
* "OcrValidDate": null, // ocr阶段获取的证件有效期
* "OcrName": null, // ocr阶段获取的姓名
* "OcrIdCard": null, // ocr阶段获取的身份证号
* "OcrGender": null, // ocr阶段获取的性别
* "LiveStatus": null, // 活体检测阶段的错误码。0为成功
* "LiveMsg": null, // 活体检测阶段的错误信息
* "Comparestatus": null,// 一比一阶段的错误码。0为成功
* "Comparemsg": null, // 一比一阶段的错误信息
* "Location": null, // 地理位置信息
* "Extra": "", // DetectAuth结果传进来的Extra信息
* "Detail": { // 活体一比一信息详情
* "LivenessData": []
* }
* },
* // 身份证正反面照片Base64
* "IdCardData": {
* "OcrFront": null,
* "OcrBack": null
* },
* // 视频最佳帧截图Base64
* "BestFrame": {
* "BestFrame": null
* },
* // 活体视频Base64
* "VideoData": {
* "LivenessVideo": null
* }
* }
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("DetectInfo", $param) and $param["DetectInfo"] !== null) {
$this->DetectInfo = $param["DetectInfo"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,46 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
*/
/**
*GetLiveCode请求参数结构体
*/
class GetLiveCodeRequest extends AbstractModel
{
/**
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
}
}

View File

@ -0,0 +1,68 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getLiveCode() 获取数字验证码1234
* @method void setLiveCode(string $LiveCode) 设置数字验证码1234
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*GetLiveCode返回参数结构体
*/
class GetLiveCodeResponse extends AbstractModel
{
/**
* @var string 数字验证码1234
*/
public $LiveCode;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $LiveCode 数字验证码1234
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("LiveCode", $param) and $param["LiveCode"] !== null) {
$this->LiveCode = $param["LiveCode"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,120 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getIdCard() 获取身份证号
* 姓名和身份证号、ImageBase64、ImageUrl三者必须提供其中之一。若都提供了则按照姓名和身份证号>ImageBase64>ImageUrl的优先级使用参数。
* @method void setIdCard(string $IdCard) 设置身份证号
* 姓名和身份证号、ImageBase64、ImageUrl三者必须提供其中之一。若都提供了则按照姓名和身份证号>ImageBase64>ImageUrl的优先级使用参数。
* @method string getName() 获取姓名
* @method void setName(string $Name) 设置姓名
* @method string getImageBase64() 获取身份证人像面的 Base64
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* @method void setImageBase64(string $ImageBase64) 设置身份证人像面的 Base64
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* @method string getImageUrl() 获取身份证人像面的 Url 地址
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
* @method void setImageUrl(string $ImageUrl) 设置身份证人像面的 Url 地址
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
/**
*IdCardOCRVerification请求参数结构体
*/
class IdCardOCRVerificationRequest extends AbstractModel
{
/**
* @var string 身份证号
* 姓名和身份证号、ImageBase64、ImageUrl三者必须提供其中之一。若都提供了则按照姓名和身份证号>ImageBase64>ImageUrl的优先级使用参数。
*/
public $IdCard;
/**
* @var string 姓名
*/
public $Name;
/**
* @var string 身份证人像面的 Base64
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
*/
public $ImageBase64;
/**
* @var string 身份证人像面的 Url 地址
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public $ImageUrl;
/**
* @param string $IdCard 身份证号
* 姓名和身份证号、ImageBase64、ImageUrl三者必须提供其中之一。若都提供了则按照姓名和身份证号>ImageBase64>ImageUrl的优先级使用参数。
* @param string $Name 姓名
* @param string $ImageBase64 身份证人像面的 Base64
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* @param string $ImageUrl 身份证人像面的 Url 地址
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("ImageUrl", $param) and $param["ImageUrl"] !== null) {
$this->ImageUrl = $param["ImageUrl"];
}
}
}

View File

@ -0,0 +1,200 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getResult() 获取认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @method void setResult(string $Result) 设置认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @method string getDescription() 获取认证结果信息。
* @method void setDescription(string $Description) 设置认证结果信息。
* @method string getName() 获取用于验证的姓名
* @method void setName(string $Name) 设置用于验证的姓名
* @method string getIdCard() 获取用于验证的身份证号
* @method void setIdCard(string $IdCard) 设置用于验证的身份证号
* @method string getSex() 获取OCR得到的性别
* 注意:此字段可能返回 null,表示取不到有效值。
* @method void setSex(string $Sex) 设置OCR得到的性别
* 注意:此字段可能返回 null,表示取不到有效值。
* @method string getNation() 获取OCR得到的民族
* 注意:此字段可能返回 null,表示取不到有效值。
* @method void setNation(string $Nation) 设置OCR得到的民族
* 注意:此字段可能返回 null,表示取不到有效值。
* @method string getBirth() 获取OCR得到的生日
* 注意:此字段可能返回 null,表示取不到有效值。
* @method void setBirth(string $Birth) 设置OCR得到的生日
* 注意:此字段可能返回 null,表示取不到有效值。
* @method string getAddress() 获取OCR得到的地址
* 注意:此字段可能返回 null,表示取不到有效值。
* @method void setAddress(string $Address) 设置OCR得到的地址
* 注意:此字段可能返回 null,表示取不到有效值。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*IdCardOCRVerification返回参数结构体
*/
class IdCardOCRVerificationResponse extends AbstractModel
{
/**
* @var string 认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
*/
public $Result;
/**
* @var string 认证结果信息。
*/
public $Description;
/**
* @var string 用于验证的姓名
*/
public $Name;
/**
* @var string 用于验证的身份证号
*/
public $IdCard;
/**
* @var string OCR得到的性别
* 注意:此字段可能返回 null,表示取不到有效值。
*/
public $Sex;
/**
* @var string OCR得到的民族
* 注意:此字段可能返回 null,表示取不到有效值。
*/
public $Nation;
/**
* @var string OCR得到的生日
* 注意:此字段可能返回 null,表示取不到有效值。
*/
public $Birth;
/**
* @var string OCR得到的地址
* 注意:此字段可能返回 null,表示取不到有效值。
*/
public $Address;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Result 认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @param string $Description 认证结果信息。
* @param string $Name 用于验证的姓名
* @param string $IdCard 用于验证的身份证号
* @param string $Sex OCR得到的性别
* 注意:此字段可能返回 null,表示取不到有效值。
* @param string $Nation OCR得到的民族
* 注意:此字段可能返回 null,表示取不到有效值。
* @param string $Birth OCR得到的生日
* 注意:此字段可能返回 null,表示取不到有效值。
* @param string $Address OCR得到的地址
* 注意:此字段可能返回 null,表示取不到有效值。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Sex", $param) and $param["Sex"] !== null) {
$this->Sex = $param["Sex"];
}
if (array_key_exists("Nation", $param) and $param["Nation"] !== null) {
$this->Nation = $param["Nation"];
}
if (array_key_exists("Birth", $param) and $param["Birth"] !== null) {
$this->Birth = $param["Birth"];
}
if (array_key_exists("Address", $param) and $param["Address"] !== null) {
$this->Address = $param["Address"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,68 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getIdCard() 获取身份证号
* @method void setIdCard(string $IdCard) 设置身份证号
* @method string getName() 获取姓名
* @method void setName(string $Name) 设置姓名
*/
/**
*IdCardVerification请求参数结构体
*/
class IdCardVerificationRequest extends AbstractModel
{
/**
* @var string 身份证号
*/
public $IdCard;
/**
* @var string 姓名
*/
public $Name;
/**
* @param string $IdCard 身份证号
* @param string $Name 姓名
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
}
}

View File

@ -0,0 +1,112 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getResult() 获取认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @method void setResult(string $Result) 设置认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @method string getDescription() 获取认证结果信息。
* @method void setDescription(string $Description) 设置认证结果信息。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*IdCardVerification返回参数结构体
*/
class IdCardVerificationResponse extends AbstractModel
{
/**
* @var string 认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
*/
public $Result;
/**
* @var string 认证结果信息。
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $Result 认证结果码,收费情况如下。
* 收费结果码:
* 0: 姓名和身份证号一致
* -1: 姓名和身份证号不一致
* 不收费结果码:
* -2: 非法身份证号(长度、校验位等不正确)
* -3: 非法姓名(长度、格式等不正确)
* -4: 证件库服务异常
* -5: 证件库中无此身份证记录
* @param string $Description 认证结果信息。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,96 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getIdCard() 获取身份证号
* @method void setIdCard(string $IdCard) 设置身份证号
* @method string getName() 获取姓名。中文请使用UTF-8编码。
* @method void setName(string $Name) 设置姓名。中文请使用UTF-8编码。
* @method string getImageBase64() 获取用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @method void setImageBase64(string $ImageBase64) 设置用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @method string getOptional() 获取本接口不需要传递此参数。
* @method void setOptional(string $Optional) 设置本接口不需要传递此参数。
*/
/**
*ImageRecognition请求参数结构体
*/
class ImageRecognitionRequest extends AbstractModel
{
/**
* @var string 身份证号
*/
public $IdCard;
/**
* @var string 姓名。中文请使用UTF-8编码。
*/
public $Name;
/**
* @var string 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
*/
public $ImageBase64;
/**
* @var string 本接口不需要传递此参数。
*/
public $Optional;
/**
* @param string $IdCard 身份证号
* @param string $Name 姓名。中文请使用UTF-8编码。
* @param string $ImageBase64 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @param string $Optional 本接口不需要传递此参数。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("Optional", $param) and $param["Optional"] !== null) {
$this->Optional = $param["Optional"];
}
}
}

View File

@ -0,0 +1,92 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method float getSim() 获取相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method void setSim(float $Sim) 设置相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method string getResult() 获取业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method void setResult(string $Result) 设置业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method string getDescription() 获取业务错误描述
* @method void setDescription(string $Description) 设置业务错误描述
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*ImageRecognition返回参数结构体
*/
class ImageRecognitionResponse extends AbstractModel
{
/**
* @var float 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
*/
public $Sim;
/**
* @var string 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
*/
public $Result;
/**
* @var string 业务错误描述
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param float $Sim 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @param string $Result 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @param string $Description 业务错误描述
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Sim", $param) and $param["Sim"] !== null) {
$this->Sim = $param["Sim"];
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,124 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getImageBase64() 获取用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @method void setImageBase64(string $ImageBase64) 设置用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @method string getVideoBase64() 获取用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method void setVideoBase64(string $VideoBase64) 设置用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method string getLivenessType() 获取活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method void setLivenessType(string $LivenessType) 设置活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method string getValidateData() 获取数字模式传参:数字验证码(),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @method void setValidateData(string $ValidateData) 设置数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @method string getOptional() 获取本接口不需要传递此参数。
* @method void setOptional(string $Optional) 设置本接口不需要传递此参数。
*/
/**
*LivenessCompare请求参数结构体
*/
class LivenessCompareRequest extends AbstractModel
{
/**
* @var string 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
*/
public $ImageBase64;
/**
* @var string 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
*/
public $VideoBase64;
/**
* @var string 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
*/
public $LivenessType;
/**
* @var string 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
*/
public $ValidateData;
/**
* @var string 本接口不需要传递此参数。
*/
public $Optional;
/**
* @param string $ImageBase64 用于人脸比对的照片图片的BASE64值
* BASE64编码后的图片数据大小不超过3M仅支持jpg、png格式。
* @param string $VideoBase64 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @param string $LivenessType 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @param string $ValidateData 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @param string $Optional 本接口不需要传递此参数。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("VideoBase64", $param) and $param["VideoBase64"] !== null) {
$this->VideoBase64 = $param["VideoBase64"];
}
if (array_key_exists("LivenessType", $param) and $param["LivenessType"] !== null) {
$this->LivenessType = $param["LivenessType"];
}
if (array_key_exists("ValidateData", $param) and $param["ValidateData"] !== null) {
$this->ValidateData = $param["ValidateData"];
}
if (array_key_exists("Optional", $param) and $param["Optional"] !== null) {
$this->Optional = $param["Optional"];
}
}
}

View File

@ -0,0 +1,104 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getBestFrameBase64() 获取验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method void setBestFrameBase64(string $BestFrameBase64) 设置验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method float getSim() 获取相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method void setSim(float $Sim) 设置相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method string getResult() 获取业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method void setResult(string $Result) 设置业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method string getDescription() 获取业务错误描述
* @method void setDescription(string $Description) 设置业务错误描述
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*LivenessCompare返回参数结构体
*/
class LivenessCompareResponse extends AbstractModel
{
/**
* @var string 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
*/
public $BestFrameBase64;
/**
* @var float 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
*/
public $Sim;
/**
* @var string 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
*/
public $Result;
/**
* @var string 业务错误描述
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $BestFrameBase64 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @param float $Sim 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @param string $Result 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @param string $Description 业务错误描述
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("BestFrameBase64", $param) and $param["BestFrameBase64"] !== null) {
$this->BestFrameBase64 = $param["BestFrameBase64"];
}
if (array_key_exists("Sim", $param) and $param["Sim"] !== null) {
$this->Sim = $param["Sim"];
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,132 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getIdCard() 获取身份证号
* @method void setIdCard(string $IdCard) 设置身份证号
* @method string getName() 获取姓名。中文请使用UTF-8编码。
* @method void setName(string $Name) 设置姓名。中文请使用UTF-8编码。
* @method string getVideoBase64() 获取用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method void setVideoBase64(string $VideoBase64) 设置用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method string getLivenessType() 获取活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method void setLivenessType(string $LivenessType) 设置活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method string getValidateData() 获取数字模式传参:数字验证码(),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @method void setValidateData(string $ValidateData) 设置数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @method string getOptional() 获取本接口不需要传递此参数。
* @method void setOptional(string $Optional) 设置本接口不需要传递此参数。
*/
/**
*LivenessRecognition请求参数结构体
*/
class LivenessRecognitionRequest extends AbstractModel
{
/**
* @var string 身份证号
*/
public $IdCard;
/**
* @var string 姓名。中文请使用UTF-8编码。
*/
public $Name;
/**
* @var string 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
*/
public $VideoBase64;
/**
* @var string 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
*/
public $LivenessType;
/**
* @var string 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
*/
public $ValidateData;
/**
* @var string 本接口不需要传递此参数。
*/
public $Optional;
/**
* @param string $IdCard 身份证号
* @param string $Name 姓名。中文请使用UTF-8编码。
* @param string $VideoBase64 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @param string $LivenessType 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @param string $ValidateData 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:空。
* @param string $Optional 本接口不需要传递此参数。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("IdCard", $param) and $param["IdCard"] !== null) {
$this->IdCard = $param["IdCard"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("VideoBase64", $param) and $param["VideoBase64"] !== null) {
$this->VideoBase64 = $param["VideoBase64"];
}
if (array_key_exists("LivenessType", $param) and $param["LivenessType"] !== null) {
$this->LivenessType = $param["LivenessType"];
}
if (array_key_exists("ValidateData", $param) and $param["ValidateData"] !== null) {
$this->ValidateData = $param["ValidateData"];
}
if (array_key_exists("Optional", $param) and $param["Optional"] !== null) {
$this->Optional = $param["Optional"];
}
}
}

View File

@ -0,0 +1,104 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getBestFrameBase64() 获取验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method void setBestFrameBase64(string $BestFrameBase64) 设置验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method float getSim() 获取相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method void setSim(float $Sim) 设置相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @method string getResult() 获取业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method void setResult(string $Result) 设置业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method string getDescription() 获取业务错误描述
* @method void setDescription(string $Description) 设置业务错误描述
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*LivenessRecognition返回参数结构体
*/
class LivenessRecognitionResponse extends AbstractModel
{
/**
* @var string 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
*/
public $BestFrameBase64;
/**
* @var float 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
*/
public $Sim;
/**
* @var string 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
*/
public $Result;
/**
* @var string 业务错误描述
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $BestFrameBase64 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @param float $Sim 相似度,取值范围 [0.00, 100.00]。推荐相似度大于等于70时可判断为同一人可根据具体场景自行调整阈值阈值70的误通过率为千分之一阈值80的误通过率是万分之一
* @param string $Result 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @param string $Description 业务错误描述
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("BestFrameBase64", $param) and $param["BestFrameBase64"] !== null) {
$this->BestFrameBase64 = $param["BestFrameBase64"];
}
if (array_key_exists("Sim", $param) and $param["Sim"] !== null) {
$this->Sim = $param["Sim"];
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,108 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getVideoBase64() 获取用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method void setVideoBase64(string $VideoBase64) 设置用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @method string getLivenessType() 获取活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method void setLivenessType(string $LivenessType) 设置活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @method string getValidateData() 获取数字模式传参:数字验证码(),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:不需要传递此参数。
* @method void setValidateData(string $ValidateData) 设置数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:不需要传递此参数。
* @method string getOptional() 获取本接口不需要传递此参数。
* @method void setOptional(string $Optional) 设置本接口不需要传递此参数。
*/
/**
*Liveness请求参数结构体
*/
class LivenessRequest extends AbstractModel
{
/**
* @var string 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
*/
public $VideoBase64;
/**
* @var string 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
*/
public $LivenessType;
/**
* @var string 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:不需要传递此参数。
*/
public $ValidateData;
/**
* @var string 本接口不需要传递此参数。
*/
public $Optional;
/**
* @param string $VideoBase64 用于活体检测的视频视频的BASE64值
* BASE64编码后的大小不超过5M支持mp4、avi、flv格式。
* @param string $LivenessType 活体检测类型取值LIP/ACTION/SILENT。
* LIP为数字模式ACTION为动作模式SILENT为静默模式三种模式选择一种传入。
* @param string $ValidateData 数字模式传参:数字验证码(1234),需先调用接口获取数字验证码;
* 动作模式传参:传动作顺序(2,1 or 1,2),需先调用接口获取动作顺序;
* 静默模式传参:不需要传递此参数。
* @param string $Optional 本接口不需要传递此参数。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("VideoBase64", $param) and $param["VideoBase64"] !== null) {
$this->VideoBase64 = $param["VideoBase64"];
}
if (array_key_exists("LivenessType", $param) and $param["LivenessType"] !== null) {
$this->LivenessType = $param["LivenessType"];
}
if (array_key_exists("ValidateData", $param) and $param["ValidateData"] !== null) {
$this->ValidateData = $param["ValidateData"];
}
if (array_key_exists("Optional", $param) and $param["Optional"] !== null) {
$this->Optional = $param["Optional"];
}
}
}

View File

@ -0,0 +1,92 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Faceid\V20180301\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getBestFrameBase64() 获取验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method void setBestFrameBase64(string $BestFrameBase64) 设置验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @method string getResult() 获取业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method void setResult(string $Result) 设置业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @method string getDescription() 获取业务错误描述
* @method void setDescription(string $Description) 设置业务错误描述
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*Liveness返回参数结构体
*/
class LivenessResponse extends AbstractModel
{
/**
* @var string 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
*/
public $BestFrameBase64;
/**
* @var string 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
*/
public $Result;
/**
* @var string 业务错误描述
*/
public $Description;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $BestFrameBase64 验证通过后的视频最佳截图照片照片为BASE64编码后的值jpg格式。
* @param string $Result 业务错误码成功情况返回Success, 错误情况请参考下方错误码 列表中FailedOperation部分
* @param string $Description 业务错误描述
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("BestFrameBase64", $param) and $param["BestFrameBase64"] !== null) {
$this->BestFrameBase64 = $param["BestFrameBase64"];
}
if (array_key_exists("Result", $param) and $param["Result"] !== null) {
$this->Result = $param["Result"];
}
if (array_key_exists("Description", $param) and $param["Description"] !== null) {
$this->Description = $param["Description"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,96 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getImageBase64() 获取图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method void setImageBase64(string $ImageBase64) 设置图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method string getImageUrl() 获取图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
* @method void setImageUrl(string $ImageUrl) 设置图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
/**
*ArithmeticOCR请求参数结构体
*/
class ArithmeticOCRRequest extends AbstractModel
{
/**
* @var string 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
*/
public $ImageBase64;
/**
* @var string 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public $ImageUrl;
/**
* @param string $ImageBase64 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @param string $ImageUrl 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 3M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("ImageUrl", $param) and $param["ImageUrl"] !== null) {
$this->ImageUrl = $param["ImageUrl"];
}
}
}

View File

@ -0,0 +1,73 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method array getTextDetections() 获取检测到的文本信息,具体内容请点击左侧链接。
* @method void setTextDetections(array $TextDetections) 设置检测到的文本信息,具体内容请点击左侧链接。
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*ArithmeticOCR返回参数结构体
*/
class ArithmeticOCRResponse extends AbstractModel
{
/**
* @var array 检测到的文本信息,具体内容请点击左侧链接。
*/
public $TextDetections;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param array $TextDetections 检测到的文本信息,具体内容请点击左侧链接。
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("TextDetections", $param) and $param["TextDetections"] !== null) {
$this->TextDetections = [];
foreach ($param["TextDetections"] as $key => $value) {
$obj = new TextArithmetic();
$obj->deserialize($value);
array_push($this->TextDetections, $obj);
}
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,96 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getImageBase64() 获取图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method void setImageBase64(string $ImageBase64) 设置图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method string getImageUrl() 获取图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
* @method void setImageUrl(string $ImageUrl) 设置图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
/**
*BankCardOCR请求参数结构体
*/
class BankCardOCRRequest extends AbstractModel
{
/**
* @var string 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
*/
public $ImageBase64;
/**
* @var string 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public $ImageUrl;
/**
* @param string $ImageBase64 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @param string $ImageUrl 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("ImageUrl", $param) and $param["ImageUrl"] !== null) {
$this->ImageUrl = $param["ImageUrl"];
}
}
}

View File

@ -0,0 +1,92 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getCardNo() 获取卡号
* @method void setCardNo(string $CardNo) 设置卡号
* @method string getBankInfo() 获取银行信息
* @method void setBankInfo(string $BankInfo) 设置银行信息
* @method string getValidDate() 获取有效期
* @method void setValidDate(string $ValidDate) 设置有效期
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*BankCardOCR返回参数结构体
*/
class BankCardOCRResponse extends AbstractModel
{
/**
* @var string 卡号
*/
public $CardNo;
/**
* @var string 银行信息
*/
public $BankInfo;
/**
* @var string 有效期
*/
public $ValidDate;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $CardNo 卡号
* @param string $BankInfo 银行信息
* @param string $ValidDate 有效期
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("CardNo", $param) and $param["CardNo"] !== null) {
$this->CardNo = $param["CardNo"];
}
if (array_key_exists("BankInfo", $param) and $param["BankInfo"] !== null) {
$this->BankInfo = $param["BankInfo"];
}
if (array_key_exists("ValidDate", $param) and $param["ValidDate"] !== null) {
$this->ValidDate = $param["ValidDate"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,96 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getImageBase64() 获取图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method void setImageBase64(string $ImageBase64) 设置图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @method string getImageUrl() 获取图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
* @method void setImageUrl(string $ImageUrl) 设置图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
/**
*BizLicenseOCR请求参数结构体
*/
class BizLicenseOCRRequest extends AbstractModel
{
/**
* @var string 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
*/
public $ImageBase64;
/**
* @var string 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public $ImageUrl;
/**
* @param string $ImageBase64 图片的 Base64 值。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小所下载图片经Base64编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。
* @param string $ImageUrl 图片的 Url 地址。
* 支持的图片格式PNG、JPG、JPEG暂不支持 GIF 格式。
* 支持的图片大小:所下载图片经 Base64 编码后不超过 7M。图片下载时间不超过 3 秒。
* 图片存储于腾讯云的 Url 可保障更高的下载速度和稳定性,建议图片存储于腾讯云。
* 非腾讯云存储的 Url 速度和稳定性可能受一定影响。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("ImageBase64", $param) and $param["ImageBase64"] !== null) {
$this->ImageBase64 = $param["ImageBase64"];
}
if (array_key_exists("ImageUrl", $param) and $param["ImageUrl"] !== null) {
$this->ImageUrl = $param["ImageUrl"];
}
}
}

View File

@ -0,0 +1,164 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getRegNum() 获取注册号
* @method void setRegNum(string $RegNum) 设置注册号
* @method string getName() 获取公司名称
* @method void setName(string $Name) 设置公司名称
* @method string getCapital() 获取注册资本
* @method void setCapital(string $Capital) 设置注册资本
* @method string getPerson() 获取法定代表人
* @method void setPerson(string $Person) 设置法定代表人
* @method string getAddress() 获取地址
* @method void setAddress(string $Address) 设置地址
* @method string getBusiness() 获取经营范围
* @method void setBusiness(string $Business) 设置经营范围
* @method string getType() 获取主体类型
* @method void setType(string $Type) 设置主体类型
* @method string getPeriod() 获取营业期限
* @method void setPeriod(string $Period) 设置营业期限
* @method string getComposingForm() 获取组成形式
* @method void setComposingForm(string $ComposingForm) 设置组成形式
* @method string getRequestId() 获取唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @method void setRequestId(string $RequestId) 设置唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
/**
*BizLicenseOCR返回参数结构体
*/
class BizLicenseOCRResponse extends AbstractModel
{
/**
* @var string 注册号
*/
public $RegNum;
/**
* @var string 公司名称
*/
public $Name;
/**
* @var string 注册资本
*/
public $Capital;
/**
* @var string 法定代表人
*/
public $Person;
/**
* @var string 地址
*/
public $Address;
/**
* @var string 经营范围
*/
public $Business;
/**
* @var string 主体类型
*/
public $Type;
/**
* @var string 营业期限
*/
public $Period;
/**
* @var string 组成形式
*/
public $ComposingForm;
/**
* @var string 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public $RequestId;
/**
* @param string $RegNum 注册号
* @param string $Name 公司名称
* @param string $Capital 注册资本
* @param string $Person 法定代表人
* @param string $Address 地址
* @param string $Business 经营范围
* @param string $Type 主体类型
* @param string $Period 营业期限
* @param string $ComposingForm 组成形式
* @param string $RequestId 唯一请求 ID每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("RegNum", $param) and $param["RegNum"] !== null) {
$this->RegNum = $param["RegNum"];
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("Capital", $param) and $param["Capital"] !== null) {
$this->Capital = $param["Capital"];
}
if (array_key_exists("Person", $param) and $param["Person"] !== null) {
$this->Person = $param["Person"];
}
if (array_key_exists("Address", $param) and $param["Address"] !== null) {
$this->Address = $param["Address"];
}
if (array_key_exists("Business", $param) and $param["Business"] !== null) {
$this->Business = $param["Business"];
}
if (array_key_exists("Type", $param) and $param["Type"] !== null) {
$this->Type = $param["Type"];
}
if (array_key_exists("Period", $param) and $param["Period"] !== null) {
$this->Period = $param["Period"];
}
if (array_key_exists("ComposingForm", $param) and $param["ComposingForm"] !== null) {
$this->ComposingForm = $param["ComposingForm"];
}
if (array_key_exists("RequestId", $param) and $param["RequestId"] !== null) {
$this->RequestId = $param["RequestId"];
}
}
}

View File

@ -0,0 +1,81 @@
<?php
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace TencentCloud\Ocr\V20181119\Models;
use TencentCloud\Common\AbstractModel;
/**
* @method string getName() 获取识别出的字段名称(关键字)。
* @method void setName(string $Name) 设置识别出的字段名称(关键字)。
* @method string getValue() 获取识别出的字段名称对应的值也就是字段Name对应的字符串结果。
* @method void setValue(string $Value) 设置识别出的字段名称对应的值也就是字段Name对应的字符串结果。
* @method Rect getRect() 获取文本行在旋转纠正之后的图像中的像素坐标。
* @method void setRect(Rect $Rect) 设置文本行在旋转纠正之后的图像中的像素坐标。
*/
/**
*汽车票字段信息
*/
class BusInvoiceInfo extends AbstractModel
{
/**
* @var string 识别出的字段名称(关键字)。
*/
public $Name;
/**
* @var string 识别出的字段名称对应的值也就是字段Name对应的字符串结果。
*/
public $Value;
/**
* @var Rect 文本行在旋转纠正之后的图像中的像素坐标。
*/
public $Rect;
/**
* @param string $Name 识别出的字段名称(关键字)。
* @param string $Value 识别出的字段名称对应的值也就是字段Name对应的字符串结果。
* @param Rect $Rect 文本行在旋转纠正之后的图像中的像素坐标。
*/
public function __construct()
{
}
/**
* 内部实现,用户禁止调用
*/
public function deserialize($param)
{
if ($param === null) {
return;
}
if (array_key_exists("Name", $param) and $param["Name"] !== null) {
$this->Name = $param["Name"];
}
if (array_key_exists("Value", $param) and $param["Value"] !== null) {
$this->Value = $param["Value"];
}
if (array_key_exists("Rect", $param) and $param["Rect"] !== null) {
$this->Rect = new Rect();
$this->Rect->deserialize($param["Rect"]);
}
}
}

Some files were not shown because too many files have changed in this diff Show More