jh-admin/addon/wxoplatform/api/controller/Yzweapp.php

66 lines
2.1 KiB
PHP

<?php
namespace addon\wxoplatform\api\controller;
use addon\wxoplatform\model\OpenPlatform;
use app\api\controller\BaseApi;
class Yzweapp extends BaseApi
{
/**
* 微信小程序代码上传
*/
public function commit(){
// 参数获取
// $siteId = 1071;
$template_id = 81;
$host = 'https://gl.cdwwzc.com';
// $uniacid = 139;
$version = '1.0.11';
$siteId = input('site_id',0);
// $template_id = input('template_id',0);
// $host = input('host','');
$uniacid = input('uniacid',0);
// $version = input('version','');
// 小程序相关信息获取
$open_platform_model = new OpenPlatform($siteId);
$data = array(
'template_id' => $template_id,
'ext_json' => [
'extEnable' => true,
'extAppid' => $open_platform_model->appid,
'ext' => [
'host' => $host,
'uniacid' => $uniacid,
'site_id' => $siteId,
]
],
'user_version' => $version,
'user_desc' => '上传时间' . date('Y-m-d H:i:s', time())
);
if (input('islive') == 'yes') {
$data['ext_json']['plugins'] = [
'live-player-plugin' => [
'version' => 'latest',
'provider' => 'wx2b03c6e691cd7370'
]
];
$data['recompile'] = true;
}
// if (input('isLocation') == 'yes') {
$data['ext_json']['permission'] = [
'scope.userLocation' => [
'desc' => '为了更好地为您提供就近的服务点'
]
];
$data['ext_json']['requiredPrivateInfos'] = [
'getLocation',
'chooseAddress'
];
// }else{
// $data['ext_json']['privacy_api_not_use']=true;
// }
// var_dump($data);die;
$result = $open_platform_model->weappCommit($data);
return $this->response($result);
}
}