chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ywxapp<admin@ywxapp.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace addon\wxchat\controller\api;
|
||||
|
||||
use think\facade\View;
|
||||
use ywxapp\controller\FrontendBase as AddonController;
|
||||
|
||||
/**
|
||||
* Index 类
|
||||
*
|
||||
* @author ywxapp <admin@ywxapp.cn>
|
||||
*/
|
||||
class Index extends AddonController
|
||||
{
|
||||
|
||||
/**
|
||||
* Summary of noNeedLogin
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedLogin = ['*'];
|
||||
|
||||
/**
|
||||
* Summary of noNeedVerify
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedVerify = ['*'];
|
||||
|
||||
/**
|
||||
* 控制器初始化 initialize
|
||||
* @return void
|
||||
*/
|
||||
protected function initialize()
|
||||
{}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
return View::fetch();
|
||||
event('user.UserLogin', ['id' => 123]);
|
||||
return '您好!这是一个[wxchat]示例应用';
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用配置接口
|
||||
* @return array
|
||||
*/
|
||||
public function appConf()
|
||||
{
|
||||
$defaults = [
|
||||
'chatEnabled' => true, //聊天功能启用:布尔值
|
||||
'videoCallEnabled' => true, //视频通话功能启用:布尔值
|
||||
'voiceRoomEnabled' => true, //语音聊天室功能启用:布尔值
|
||||
'giftShopEnabled' => true, //礼物商店功能启用:布尔值
|
||||
'rechargeEnabled' => true, //充值功能启用:布尔值
|
||||
'vipEnabled' => true, //VIP功能启用:布尔值
|
||||
'matchEnabled' => true, //匹配功能启用:布尔值
|
||||
'momentEnabled' => true, //动态功能启用:布尔值
|
||||
|
||||
// 业务限制配置
|
||||
'dailyMatchLimit' => 10, //每日匹配次数限制:数字
|
||||
'dailyMessageLimit' => 100, //每日消息发送次数限制:数字
|
||||
'maxFriends' => 100, //好友数量上限:数字
|
||||
'maxMomentImages' => 9, //动态图片数量上限:数字
|
||||
'maxChatImageSize' => 1024, //聊天图片大小上限:数字
|
||||
'maxVideoDuration' => 60, //视频时长上限:数字
|
||||
'maxVoiceDuration' => 60, //音频时长上限:数字
|
||||
// 广告配置
|
||||
'enableAd' => true, //启用
|
||||
'splashAdId' => 'splash_1', //启动广告ID:字符串
|
||||
'bannerAdId' => 'banner_1', //横幅广告ID:字符串
|
||||
'interstitialAdId' => 'interstitial_1', //间隙广告ID:字符串
|
||||
'rewardAdId' => 'reward_1', //奖励广告ID:字符串
|
||||
'adFrequency' => 10, //广告频率:数字
|
||||
// 服务器配置
|
||||
'socketUrl' => 'wss://dev.xixingwl.cn:2346',
|
||||
'uploadUrl' => 'https://dev.xixingwl.cn:',
|
||||
'cdnUrl' => 'https://dev.xixingwl.cn',
|
||||
'apiUrl' => 'https://dev.xixingwl.cn',
|
||||
'apiVersion' => 'v1',
|
||||
// 第三方服务配置
|
||||
'wechatAppId' => 'wechat_1', //微信AppId:字符串
|
||||
'qqAppId' => 'qq_1', //qq AppId:字符串
|
||||
'appleServiceId' => 'apple_1', //苹果 服务ID:字符串
|
||||
'pushService' => 'default', //推送服务:字符串
|
||||
'mapService' => 'amap', //地图服务
|
||||
// 客服配置
|
||||
//customerService ?: ICustomerService
|
||||
// 版本兼容性
|
||||
'minIosVersion' => '10.0', //最小iOS版本:字符串
|
||||
'minAndroidVersion' => '5.0', //最小Android版本:字符串
|
||||
'supportedPlatforms' => ['ios', 'android'], //支持平台:字符串数组(保持代码默认,不纳入后台配置)
|
||||
];
|
||||
// 统一从数据库配置表读取(后台"插件管理 → 配置"可改),覆盖默认值
|
||||
$saved = \ywxapp\service\AddonService::config('wxchat');
|
||||
$data = $defaults;
|
||||
foreach ($defaults as $k => $dv) {
|
||||
if (!array_key_exists($k, $saved)) {
|
||||
continue;
|
||||
}
|
||||
$val = $saved[$k];
|
||||
if (is_bool($dv)) {
|
||||
$data[$k] = in_array($val, [true, 'true', '1', 1], true);
|
||||
} elseif (is_int($dv)) {
|
||||
$data[$k] = (int) $val;
|
||||
} elseif (is_array($dv)) {
|
||||
$data[$k] = is_array($val) ? $val : $dv;
|
||||
} else {
|
||||
$data[$k] = $val;
|
||||
}
|
||||
}
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
|
||||
public function launchData()
|
||||
{
|
||||
$data = [
|
||||
// 启动页广告
|
||||
'splashAds' => [[
|
||||
'id' => 1,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/splash.jpg',
|
||||
'title' => '启动页广告',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 1,
|
||||
], [
|
||||
'id' => 2,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/splash.jpg',
|
||||
'title' => '启动页广告2',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 2,
|
||||
], [
|
||||
'id' => 3,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/splash.jpg',
|
||||
'title' => '启动页广告3',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 3,
|
||||
]],
|
||||
// 首页轮播图
|
||||
'banners' => [[
|
||||
'id' => 1,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/banner.jpg',
|
||||
'title' => '首页轮播图1',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 1,
|
||||
], [
|
||||
'id' => 2,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/banner.jpg',
|
||||
'title' => '首页轮播图2',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 2,
|
||||
], [
|
||||
'id' => 3,
|
||||
'image' => 'https://dev.xixingwl.cn:2346/banner.jpg',
|
||||
'title' => '首页轮播图3',
|
||||
'link' => 'https://dev.xixingwl.cn:2346',
|
||||
'type' => 'url',
|
||||
'order' => 3,
|
||||
]],
|
||||
// 系统公告
|
||||
// 'announcements' => IAnnouncement[]
|
||||
// 运营活动
|
||||
'activities' => [[
|
||||
'id' => 1,
|
||||
'title' => '运营活动1',
|
||||
'description' => '运营活动1描述',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/activity1.png',
|
||||
'badge' => 'new',
|
||||
'link' => 'https://dev.xixingwl.cn:2346/activity1',
|
||||
'startTime' => 1609459200,
|
||||
'endTime' => 1609545600,
|
||||
'status' => 'ongoing',
|
||||
], [
|
||||
'id' => 2,
|
||||
'title' => '运营活动2',
|
||||
'description' => '运营活动2描述',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/activity2.png',
|
||||
'badge' => 'hot',
|
||||
'link' => 'https://dev.xixingwl.cn:2346/activity2',
|
||||
'startTime' => 1609459200,
|
||||
'endTime' => 1609545600,
|
||||
'status' => 'upcoming',
|
||||
], [
|
||||
'id' => 3,
|
||||
'title' => '运营活动3',
|
||||
'description' => '运营活动3描述',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/activity3.png',
|
||||
'badge' => '',
|
||||
'link' => 'https://dev.xixingwl.cn:2346/activity3',
|
||||
'startTime' => 1609459200,
|
||||
'endTime' => 1609545600,
|
||||
'status' => 'ended',
|
||||
]],
|
||||
// 快捷入口
|
||||
'quickActions' => [[
|
||||
'id' => 1,
|
||||
'name' => '快捷入口1',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/quick_action1.png',
|
||||
'color' => '#ff0000',
|
||||
'route' => '/quick_action1',
|
||||
'badge' => 5,
|
||||
'visible' => true,
|
||||
], [
|
||||
'id' => 2,
|
||||
'name' => '快捷入口2',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/quick_action2.png',
|
||||
'color' => '#00ff00',
|
||||
'route' => '/quick_action2',
|
||||
'badge' => 10,
|
||||
'visible' => true,
|
||||
], [
|
||||
'id' => 3,
|
||||
'name' => '快捷入口3',
|
||||
'icon' => 'https://dev.xixingwl.cn:2346/quick_action3.png',
|
||||
'color' => '#0000ff',
|
||||
'route' => '/quick_action3',
|
||||
'badge' => 15,
|
||||
'visible' => true,
|
||||
]],
|
||||
// 新手引导
|
||||
'newbieGuide' => [
|
||||
'enabled' => true,
|
||||
'steps' => [
|
||||
[
|
||||
'id' => 1,
|
||||
'title' => '新手引导步骤1',
|
||||
'content' => '这是新手引导步骤1的内容',
|
||||
'image' => 'https://dev.xixingwl.cn:2346/newbie_guide1.png',
|
||||
'action' => 'next',
|
||||
], [
|
||||
'id' => 2,
|
||||
'title' => '新手引导步骤2',
|
||||
'content' => '这是新手引导步骤2的内容',
|
||||
'image' => 'https://dev.xixingwl.cn:2346/newbie_guide2.png',
|
||||
'action' => 'prev',
|
||||
], [
|
||||
'id' => 3,
|
||||
'title' => '新手引导步骤3',
|
||||
'content' => '这是新手引导步骤3的内容',
|
||||
'image' => 'https://dev.xixingwl.cn:2346/newbie_guide3.png',
|
||||
'action' => 'finish',
|
||||
],
|
||||
],
|
||||
]];
|
||||
$this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function baseData()
|
||||
{
|
||||
$this->error();
|
||||
$data = [];
|
||||
$this->success($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user