...
|
...
|
@@ -510,7 +510,7 @@ class Api |
|
|
public function PayOrder()
|
|
|
{
|
|
|
//生成订单号
|
|
|
$yCode = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K','L');
|
|
|
$yCode = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L');
|
|
|
// $PayOrder = $yCode[intval(date('Y')) - 2011] . strtoupper(dechex(date('m'))) . date('d') . substr(time(), -5) . substr(microtime(), 2, 5) . sprintf('%02d', rand(0, 99));
|
|
|
$PayOrder = date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
|
|
|
return $PayOrder;
|
...
|
...
|
@@ -633,6 +633,38 @@ class Api |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//生成User小程序码
|
|
|
public function UserInserMiniAppQrCode($UserId, $Path)
|
|
|
{
|
|
|
//小程序码
|
|
|
$options = [
|
|
|
'app_id' => appid,
|
|
|
'secret' => secret,
|
|
|
];
|
|
|
$app = new Application($options);
|
|
|
// 获取 access token 实例
|
|
|
$accessToken = $app->access_token;
|
|
|
$AccessToken = $accessToken->getToken();
|
|
|
$url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $AccessToken;
|
|
|
$Json = [
|
|
|
'scene' => 'User_id=' . $UserId,
|
|
|
'path' => $Path,
|
|
|
// 'is_hyaline' => True
|
|
|
];
|
|
|
$MiniAppQrcodeVendor = $this->curlPost1($url, $Json);
|
|
|
$PayOrder = $this->PayOrder();
|
|
|
$path = './MiniAppQrCode/' . $PayOrder . '.png';
|
|
|
$res = file_put_contents($path, $MiniAppQrcodeVendor);//将微信返回的图片数据流写入文件
|
|
|
if ($res === false) {
|
|
|
$this->error('生成小程序码失败', 0);
|
|
|
die;
|
|
|
} else {
|
|
|
$MiniAppQrcodeUrl = $this->request->domain() . '/MiniAppQrCode/' . $UserId . $Path . '.png';
|
|
|
return $MiniAppQrcodeUrl;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//收益计算
|
|
|
public function CountMoney($UserId, $Map1, $Map2)
|
|
|
{
|
...
|
...
|
|