基于crmeb多商户端,使用PHP二次开发接入艾科智泊
1、自己写的service,暂时只写了发券这一个接口
<?php
namespace crmeb\servicesRew;
use crmeb\services\HttpService;
use think\exception\ValidateException;
class YiDianTingService extends HttpService
{
private $apiHost = 'https://open.yidianting.xin/openydt/api/v2/';
private $key = '';
private $secret = '';
private $sellBillId = 1099999999;
private $traderCode = '';
public function sendCoupon(string $carCode)
{
$body = [
'traderCode' => $this->traderCode,
'sellBillId' => $this->sellBillId,
'carCodeColor' => 1,
'carCode' => $carCode
];
return $this->httpRequest('sendCoupon', json_encode($body));
}
public function httpRequest(string $interface, $body)
{
$time = date('YmdHis', time());
$sign = md5($this->key . ':' . $time . ':' . $this->secret);
$auth = base64_encode($this->key . '