初始化项目:添加后端代码、ThinkPHP框架、前端资源

This commit is contained in:
amb
2026-09-03 12:42:39 +08:00
commit 482bece22e
3726 changed files with 416708 additions and 0 deletions
@@ -0,0 +1,48 @@
<?php
namespace app\admin\controller\channel\wxapp;
use app\common\controller\Backend;
use ZipArchive;
/**
* 小鹅通
*/
class Package extends Backend
{
public function _initialize()
{
parent::_initialize();
}
/**
* 压缩
* @remark 递归将文件夹中的所有文件和子文件夹添加到压缩包中
* @param string $folderPath 文件夹路径
* @param ZipArchive $zip 压缩包实例
* @param string $parentFolder 父文件夹路径(用于保持相对路径)
*/
public function addFolderToZip($folderPath, $zip, $parentFolder = '') {
$handle = opendir($folderPath);
while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
$filePath = $folderPath . '/' . $file;
if (is_file($filePath)) {
// 获取相对于父文件夹的路径
$relativePath = ltrim($parentFolder . '/' . $file, '/');
// 将文件添加到压缩包中,并使用相对路径作为在压缩包中的文件名
$zip->addFile($filePath, $relativePath);
} elseif (is_dir($filePath)) {
// 递归添加子文件夹中的文件和子文件夹
$this->addFolderToZip($filePath, $zip, $parentFolder . '/' . $file);
}
}
}
closedir($handle);
}
}
@@ -0,0 +1,187 @@
<?php
namespace app\admin\controller\channel\wxapp;
use app\common\controller\Backend;
use ZipArchive;
/**
* 版本管理
*/
class Version extends Backend
{
public function _initialize()
{
parent::_initialize();
}
/**
* 获取授权链接
* @return void
*/
public function getAuthUrl(){
if(\app\common\library\Platform::getSystemType() == 'single'){
$domain = $this->request->domain();
//thinkphp5获取系统的域名,如 baidu.com 去除 https或 http
}else{
$domain = $this->request->domain() . '/app/index.php';
}
$domain = preg_replace('/^(http|https):\/\//i', '', $domain);
try{
$data = \app\common\library\Client::request('api/wechat/auth/getAuthUrl',[
'domain'=>$domain
]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("获取成功",$data);
}
/**
* 获取版本信息
* @return void
*/
public function getVersionInfo(){
//应该获取授权状态
//小程序版本
try{
$data = \app\common\library\Client::request('api/wechat/auth/versionInfo',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("获取成功",$data);
}
/**
* 获取审核版本信息
* @return void
*/
public function getAuditVersionInfo(){
//应该获取授权状态
//小程序版本
try{
$data = \app\common\library\Client::request('api/wechat/auth/getLatestAuditStatus',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("获取成功",$data);
}
/**
* 提交审核
* @return void
*/
public function submitAudit(){
//应该获取授权状态
//小程序版本
$version_desc = input('version_desc','');
try{
$data = \app\common\library\Client::request('api/wechat/auth/submitAudit',[
'version_desc'=>$version_desc
]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("提交成功",$data);
}
/**
* 撤回审核
* @return void
*/
public function undoAudit(){
try{
$data = \app\common\library\Client::request('api/wechat/auth/undoAudit',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("撤回审核成功");
}
/**
* 发布已通过审核版本
* @return void
*/
public function release(){
try{
\app\common\library\Client::request('api/wechat/auth/release',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("发布版本成功");
}
/**
* 撤回审核
* @return void
*/
public function getQrcode(){
$path = input('path');
try{
$data = \app\common\library\Client::request('api/wechat/auth/getQrcode',[
'path'=>$path
]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("操作成功",$data);
}
/**
* 解除小程序绑定
* @return void
*/
public function unbind(){
try{
$data = \app\common\library\Client::request('api/wechat/auth/unbind',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("操作成功");
}
/**
* 获取授权信息
* @return void
*/
public function authorization()
{
try{
$data = \app\common\library\Client::request('api/wechat/auth/authorization',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("获取成功",$data);
}
/**
* 提交代码到体验版
* @return false|void
*/
public function commit(){
try{
$data = \app\common\library\Client::request('api/wechat/auth/commit',[]);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("提交成功",$data);
}
}