113 lines
3.8 KiB
PHP
113 lines
3.8 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\common\pay;
|
|
|
|
|
|
use app\common\traits\ReturnTrait;
|
|
use app\common\yun\Base;
|
|
use app\common\yun\service\BaseService;
|
|
|
|
class SignContract
|
|
{
|
|
use ReturnTrait;
|
|
static $cart_type = [
|
|
['id' => 'idcard', 'name' => '身份证'],
|
|
['id' => 'mtphkm', 'name' => '港澳居民来往内地通行证'],
|
|
['id' => 'passport', 'name' => '护照'],
|
|
['id' => 'mtpt', 'name' => '台湾居民往来大陆通行证'],
|
|
];
|
|
/**
|
|
* 签约状态
|
|
* @param $real_name
|
|
* @param $id_card
|
|
* @return array
|
|
*/
|
|
public static function getSignStatus($real_name, $id_card)
|
|
{
|
|
$config = Conf::config();
|
|
$base = new Base('api/sign/v1/user/status', 'get');
|
|
$base->addParam("dealer_id", $config->dealer_id); # 商户代码(必填)
|
|
$base->addParam("broker_id", $config->broker_id);
|
|
$base->addParam("real_name", $real_name);
|
|
$base->addParam("id_card", $id_card);
|
|
$go_service = new BaseService($config, $base);
|
|
$result = $go_service->request();
|
|
if ($result['code'] == '0000') {
|
|
// 订单接收成功,支付结果未知,待异步通知
|
|
$data = $result['data'];
|
|
return self::rep_success('成功', $data);
|
|
|
|
} else
|
|
return self::rep_fail($result['message']);
|
|
}
|
|
|
|
/**
|
|
* 获取签约协议链接
|
|
* @return array
|
|
*/
|
|
public static function getSignContractUrl()
|
|
{
|
|
$config = Conf::config();
|
|
$base = new Base('api/sign/v1/user/contract', 'get');
|
|
$base->addParam("dealer_id", $config->dealer_id); # 商户代码(必填)
|
|
$base->addParam("broker_id", $config->broker_id);
|
|
$go_service = new BaseService($config, $base);
|
|
$result = $go_service->request();
|
|
if ($result['code'] == '0000') {
|
|
$data = $result['data'];
|
|
return self::rep_success('获取成功', $data);
|
|
} else {
|
|
return self::rep_fail($result['message']);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 签约
|
|
* @param $real_name
|
|
* @param $id_card
|
|
* @param $card_type
|
|
* @param string $phone
|
|
* @return array
|
|
*/
|
|
public static function submitSign($real_name, $id_card, $card_type, $phone = '')
|
|
{
|
|
$config = Conf::config();
|
|
$base = new Base('api/sign/v1/user/sign', 'post');
|
|
$base->addParam("dealer_id", $config->dealer_id); # 商户代码(必填)
|
|
$base->addParam("broker_id", $config->broker_id);
|
|
$base->addParam("real_name", $real_name);
|
|
$base->addParam("id_card", $id_card);
|
|
$base->addParam("phone", $phone);
|
|
$base->addParam("card_type", $card_type);
|
|
$go_service = new BaseService($config, $base);
|
|
$result = $go_service->request();
|
|
// halt($result);
|
|
if ($result['code'] == '0000') {
|
|
$data = $result['data'];
|
|
return self::rep_success('获取成功', $data);
|
|
} else {
|
|
return self::rep_fail($result['message']);
|
|
}
|
|
}
|
|
|
|
public static function release($real_name, $id_card)
|
|
{
|
|
$config = Conf::config();
|
|
$base = new Base('api/sign/v1/user/release', 'post');
|
|
$base->addParam("dealer_id", $config->dealer_id); # 商户代码(必填)
|
|
$base->addParam("broker_id", $config->broker_id);
|
|
$base->addParam("real_name", $real_name);
|
|
$base->addParam("id_card", $id_card);
|
|
$base->addParam("card_type", 'idcard');
|
|
$go_service = new BaseService($config, $base);
|
|
$result = $go_service->request();
|
|
if ($result['code'] == '0000') {
|
|
$data = $result['data'];
|
|
return self::rep_success('获取成功', $data);
|
|
} else {
|
|
return self::rep_fail($result['message']);
|
|
}
|
|
}
|
|
|
|
} |