This commit is contained in:
全栈小学生 2025-09-20 09:09:51 +08:00
parent 18c9a31761
commit a12b495d74
124 changed files with 2525 additions and 701 deletions

View File

@ -114,8 +114,26 @@ class ExceptionHandle extends Handle
return fail($e->getMessage(), http_code:$e->getCode());
} else if ($e instanceof RouteNotFoundException) {
return fail('当前访问路由未定义或不匹配 路由地址:' . request()->baseUrl());
} else {
} else if($e instanceof \RuntimeException){
return fail($e->getMessage(), $massageData);
} else {
return $this->handleException($e);
}
}
private function handleException(Throwable $e) {
$trace = array_map(function ($class){
return str_replace('\\', '/', $class);
}, array_column($e->getTrace(), 'class'));
foreach ($trace as $class) {
if (preg_match('#^addon/([^/]+)/#', $class, $matches)) {
return fail("{$matches[1]}插件内{$class}{$e->getLine()}行出现异常,异常信息:" .$e->getMessage());
}
}
$debug = env("APP_DEBUG", false);
return fail("{$trace[0]}{$e->getLine()}行出现异常,异常信息:" .$e->getMessage(), $debug ? $e->getTrace() : []);
}
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\channel;
use app\service\admin\channel\AppService;
use app\service\admin\channel\H5Service;
use core\base\BaseAdminController;
use think\Response;
/**
* app端配置
* Class H5
* @package app\adminapi\controller\channel
*/
class App extends BaseAdminController
{
/**
* 获取APP配置信息
* @description 获取APP配置信息
* @return Response
*/
public function get()
{
return success((new AppService())->getConfig());
}
/**
* 设置APP配置信息
* @description 设置APP配置信息
* @return Response
*/
public function set()
{
$data = $this->request->params([
['wechat_app_id', ""],
['wechat_app_secret', ""],
]);
(new AppService())->setConfig($data);
return success('SET_SUCCESS');
}
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\dict;
use core\base\BaseAdminController;
use app\service\admin\dict\DictService;
use think\Response;
/**
@ -83,8 +84,8 @@ class Dict extends BaseAdminController
/**
* 数据字典删除
* @description 数据字典删除
* @param $id 数据字典id
* @return \think\Response
* @param int $id 数据字典id
* @return Response
*/
public function del(int $id){
(new DictService())->del($id);
@ -118,8 +119,8 @@ class Dict extends BaseAdminController
/**
* 数据字典详情
* @description 数据字典详情
* @param key 数据字典关键字
* @return \think\Response
* @param string $type
* @return Response
*/
public function getKeyInfo(string $type){
$res = (new DictService())->getKeyInfo($type);

View File

@ -184,6 +184,12 @@ class Diy extends BaseAdminController
return success($diy_service->getLink());
}
public function pageLink()
{
$diy_service = new DiyService();
return success($diy_service->pageLink());
}
/**
* 获取页面模板
* @description 获取页面模板
@ -369,7 +375,7 @@ class Diy extends BaseAdminController
/**
* 删除自定义主题配色
* @description 删除自定义主题配色
* @param $id
* @param int $id
* @return Response
*/
public function delDiyTheme(int $id)

View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\index;
use app\service\core\index\CorePromotionAdvService;
use core\base\BaseAdminController;
use think\Response;
/**
* 推广广告控制器
* Class PromotionAdv
* @package app\adminapi\controller\sys
*/
class PromotionAdv extends BaseAdminController
{
/**
* 广告列表
* @return Response
*/
public function getIndexAdvList()
{
$res = (new CorePromotionAdvService())->getIndexAdvList();
return success('SUCCESS',$res);
}
}

View File

@ -135,7 +135,7 @@ class CashOut extends BaseAdminController
/**
* 校验数组是否
* @description 校验数组是否
* @return void
* @return Response
*/
public function checkTransferStatus($id){
(new MemberCashOutService())->checkTransferStatus($id);
@ -146,7 +146,7 @@ class CashOut extends BaseAdminController
* 取消
* @description 取消
* @param $id
* @return void
* @return Response
*/
public function cancel($id){

View File

@ -231,7 +231,7 @@ class Member extends BaseAdminController
/**
* 获取会员权益字典
* @description 获取会员权益字典
* @return mixed
* @return Response
*/
public function getMemberBenefitsDict()
{
@ -241,7 +241,7 @@ class Member extends BaseAdminController
/**
* 获取会员礼包字典
* @description 获取会员礼包字典
* @return array|null
* @return Response
*/
public function getMemberGiftDict()
{
@ -251,7 +251,7 @@ class Member extends BaseAdminController
/**
* 获取成长值规则字典
* @description 获取成长值规则字典
* @return array|null
* @return Response
*/
public function getGrowthRuleDict()
{
@ -261,7 +261,7 @@ class Member extends BaseAdminController
/**
* 获取积分规则字典
* @description 获取积分规则字典
* @return array|null
* @return Response
*/
public function getPointRuleDict()
{

View File

@ -11,8 +11,10 @@
namespace app\adminapi\controller\niucloud;
use app\service\admin\niucloud\NiucloudService;
use app\service\core\niucloud\CoreCloudBuildService;
use core\base\BaseAdminController;
use core\util\niucloud\CloudService;
/**
* 云编译
@ -74,4 +76,42 @@ class Cloud extends BaseAdminController
public function buildPreCheck() {
return success(data:(new CoreCloudBuildService())->buildPreCheck());
}
/**
* 连通测试
* @description 连通测试
* @return \think\Response
*/
public function connectTest()
{
$data = $this->request->params([
[ 'url', '' ],
]);
$is_connected = (new CloudService(true,$data['url']))->is_connected;
return success('SUCCESS',$is_connected);
}
/**
* 设置本地地址
* @description 连通测试
* @return \think\Response
*/
public function setLocalCloudCompileConfig()
{
$data = $this->request->params([
[ 'url', '' ],
[ 'is_open', 0 ],
]);
return success('SUCCESS',(new NiucloudService())->setLocalCloudCompileConfig($data));
}
/**
* 获取本地地址
* @description 连通测试
* @return \think\Response
*/
public function getLocalCloudCompileConfig()
{
return success('SUCCESS',(new NiucloudService())->getLocalCloudCompileConfig());
}
}

View File

@ -57,7 +57,10 @@ class Config extends BaseAdminController
[ "front_end_name", "" ],
[ "front_end_logo", "" ],
[ "front_end_icon", "" ],
[ "icon", "" ]
[ "icon", "" ],
[ "meta_title", "" ],
[ "meta_desc", "" ],
[ "meta_keyword", "" ],
]);
( new ConfigService() )->setWebSite($data);

View File

@ -14,6 +14,7 @@ namespace app\adminapi\controller\sys;
use app\service\admin\sys\PrinterService;
use app\service\admin\sys\PrinterTemplateService;
use core\base\BaseAdminController;
use think\Response;
/**
@ -90,8 +91,8 @@ class Printer extends BaseAdminController
/**
* 小票打印机编辑
* @description 小票打印机编辑
* @param $id 小票打印机id
* @return \think\Response
* @param int $id 小票打印机id
* @return Response
*/
public function edit(int $id)
{
@ -131,8 +132,8 @@ class Printer extends BaseAdminController
/**
* 小票打印机删除
* @description 小票打印机删除
* @param $id 小票打印机id
* @return \think\Response
* @param int $id 小票打印机id
* @return Response
*/
public function del(int $id)
{
@ -200,8 +201,8 @@ class Printer extends BaseAdminController
/**
* 小票打印模板编辑
* @description 小票打印模板编辑
* @param $id 小票打印模板id
* @return \think\Response
* @param int $id 小票打印模板id
* @return Response
*/
public function templateEdit(int $id)
{
@ -218,8 +219,8 @@ class Printer extends BaseAdminController
/**
* 小票打印模板删除
* @description 小票打印模板删除
* @param $id 小票打印模板id
* @return \think\Response
* @param int $id 小票打印模板id
* @return Response
*/
public function templateDel(int $id)
{
@ -230,7 +231,7 @@ class Printer extends BaseAdminController
/**
* 获取小票打印模板类型
* @description 获取小票打印模板类型
* @return array|\think\Response
* @return \think\Response
*/
public function getType()
{
@ -240,7 +241,7 @@ class Printer extends BaseAdminController
/**
* 获取小票打印机设备品牌
* @description 获取小票打印机设备品牌
* @return array|\think\Response
* @return \think\Response
*/
public function getBrand()
{

View File

@ -154,4 +154,19 @@ class Schedule extends BaseAdminController
return fail('FAIL');
}
}
/**
* 重置定时任务
* @description 重置定时任务
* @return Response
*/
public function resetSchedule()
{
$res = (new ScheduleService())->resetSchedule();
if ($res) {
return success('SUCCESS');
} else {
return fail('FAIL');
}
}
}

View File

@ -116,4 +116,16 @@ class System extends BaseAdminController
]);
return success((new SystemService())->getQrcode($params));
}
/**
* 获取imagick扩展是否开启
* @return Response
*/
public function getImagickIsOpen(){
if (extension_loaded('imagick')) {
return success(data: true);
} else {
return success(data: false);
}
}
}

View File

@ -56,6 +56,22 @@ class Upload extends BaseAdminController
return success($upload_service->video($data['file'], $data['cate_id']));
}
/**
* 视频上传
* @description 音频上传
* @return Response
*/
public function audio()
{
$data = $this->request->params([
['file', 'file'],
['cate_id', 0]
]);
$upload_service = new UploadService();
return success($upload_service->audio($data['file'], $data['cate_id']));
}
/**
* 文件上传(默认不上云)
* @description 文件上传

View File

@ -11,6 +11,7 @@
namespace app\adminapi\controller\verify;
use app\dict\verify\VerifyDict;
use app\service\admin\verify\VerifyService;
use core\base\BaseAdminController;
use think\Response;
@ -43,11 +44,38 @@ class Verify extends BaseAdminController
/**
* 核销信息
* @description 核销信息
* @param int $order_id
* @param string $verify_code
* @return Response
*/
public function detail(string $verify_code)
{
return success(( new VerifyService() )->getDetail($verify_code));
}
/**
* 获取核销类型
* @description 获取核销类型
* @return Response
*/
public function getVerifyType()
{
return success(VerifyDict::getType());
}
/**
* @框架核销
* @description 核销
*/
public function verify(string $verify_code)
{
return success('VERIFY_SUCCESS', (new VerifyService())->verify($verify_code));
}
/**
* @获取核销码对应信息
* @description 核销
*/
public function getInfoByCode(string $verify_code)
{
return success((new VerifyService())->getInfoByCode($verify_code));
}
}

View File

@ -29,6 +29,11 @@ Route::group('channel', function () {
//设置微信配置
Route::put('pc/config', 'channel.Pc/set');
/***************************************************** app端 ****************************************************/
Route::get('app/config', 'channel.App/get');
//设置手机端配置
Route::put('app/config', 'channel.App/set');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -54,6 +54,8 @@ Route::group('diy', function() {
// 获取自定义链接列表
Route::get('link', 'diy.Diy/getLink');
Route::get('page_link', 'diy.Diy/pageLink');
// 设为使用
Route::put('use/:id', 'diy.Diy/setUse');

View File

@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;
/**
* 路由
*/
Route::group('index', function () {
//首页广告列表
Route::get('adv_list', 'index.PromotionAdv/getIndexAdvList');
})->middleware(AdminCheckToken::class, true)
->middleware(AdminLog::class);

View File

@ -17,7 +17,7 @@ use think\facade\Route;
/**
* 应用插件相关路由
*/
Route::group('niucloud', function () {
Route::group('niucloud', function() {
//设置 授权信息
Route::post('authinfo', 'niucloud.Module/setAuthorize');
//获取 授权设置
@ -60,6 +60,12 @@ Route::group('niucloud', function () {
// 申请体验
Route::get('apply/experience', 'niucloud.Module/applyExperience');
//连通测试
Route::post('build/connect_test', 'niucloud.Cloud/connectTest');
//保存本地服务器地址
Route::post('build/set_local_url', 'niucloud.Cloud/setLocalCloudCompileConfig');
//获取本地服务器地址
Route::get('build/get_local_url', 'niucloud.Cloud/getLocalCloudCompileConfig');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -33,6 +33,8 @@ Route::group('sys', function() {
Route::get('role/:role_id', 'sys.Role/info');
//用户组新增
Route::post('role', 'sys.Role/add');
//修改角色状态
Route::put('role/status', 'sys.Role/modifyStatus');
//编辑用户组
Route::put('role/:role_id', 'sys.Role/edit');
//删除用户组
@ -102,6 +104,8 @@ Route::group('sys', function() {
Route::post('image', 'upload.Upload/image');
//附件视频上传
Route::post('video', 'upload.Upload/video');
//附件音频上传
Route::post('audio', 'upload.Upload/audio');
//附件上传
Route::post('document/:type', 'upload.Upload/document');
//附件列表
@ -185,6 +189,8 @@ Route::group('sys', function() {
Route::get('schedule/datetype', 'sys.Schedule/getDateType');
//执行一次任务
Route::put('schedule/do/:id', 'sys.Schedule/doSchedule');
//重置定时任务
Route::post('schedule/reset', 'sys.Schedule/resetSchedule');
//任务执行记录列表
Route::get('schedule/log/list', 'sys.ScheduleLog/lists');
@ -320,6 +326,11 @@ Route::group('sys', function() {
// 打印小票内容
Route::post('printer/printticket', 'sys.Printer/printTicket');
// 检验是否开启imagick
Route::get('check_imagick', 'sys.System/getImagickIsOpen');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -24,6 +24,10 @@ Route::group('verify', function () {
Route::get('verify/record', 'verify.Verify/lists');
// 订单核销记录详情
Route::get('verify/:verify_code', 'verify.Verify/detail');
Route::get('detail/:verify_code', 'verify.Verify/getInfoByCode');
Route::post('verify/:verify_code', 'verify.Verify/verify');
/***************************************************** 核销员相关接口 ****************************************************/
// 添加核销员

View File

@ -0,0 +1,62 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\api\controller\channel;
use app\service\api\login\LoginService;
use app\service\api\wechat\WechatAppService;
use core\base\BaseController;
class App extends BaseController
{
public function wechatLogin()
{
$data = $this->request->params([
[ 'code', '' ],
]);
$wechat_app_service = new WechatAppService();
return success($wechat_app_service->loginByCode($data[ 'code' ]));
}
public function register()
{
$data = $this->request->params([
[ 'register_type', '' ],
]);
switch ($data['register_type']) {
case 'wechat':
return $this->wechatRegister();
}
return fail("不支持的注册方式");
}
public function wechatRegister() {
$data = $this->request->params([
[ 'openid', '' ],
[ 'unionid', '' ],
[ 'nickname', '' ],
[ 'avatar', '' ],
[ 'mobile_code', '' ],
[ 'mobile', '' ],
]);
//参数验证
$this->validate($data, [
'mobile' => 'mobile'
]);
// 校验手机验证码(电脑端扫码)
( new LoginService() )->checkMobileCode($data[ 'mobile' ]);
$wechat_app_service = new WechatAppService();
return success($wechat_app_service->register($data[ 'openid' ], $data[ 'mobile' ], $data[ 'nickname' ], $data[ 'avatar' ], $data[ 'avatar' ]));
}
}

View File

@ -13,6 +13,7 @@ namespace app\api\controller\member;
use core\base\BaseApiController;
use app\service\api\member\AddressService;
use think\Response;
/**
@ -89,8 +90,8 @@ class Address extends BaseApiController
/**
* 会员收货地址删除
* @param $id 会员收货地址id
* @return \think\Response
* @param int $id 会员收货地址id
* @return Response
*/
public function del(int $id){
(new AddressService())->del($id);

View File

@ -50,7 +50,6 @@ class Area extends BaseApiController
/**
* 通过经纬度查询地址
* @param int $level
* @return Response
*/
public function getAddressByLatlng()

View File

@ -113,7 +113,7 @@ class Config extends BaseApiController
}
/**
* 获取用户是否绑定手机
* 获取公众号用户是否绑定手机
* @return Response
*/
public function getMemberMobileExist()

View File

@ -19,16 +19,17 @@ class Verify extends BaseApiController
{
/**
* 获取验证
* 生成核销
* @return Response
*/
public function getVerifyCode()
{
$data = $this->request->params([
[ 'data', [] ],
[ 'type', '' ]
['data', []],
['type', ''],
['need_barcode', 0]//是否需要条形码
]);
return success(data: ( new VerifyService() )->getVerifyCode($data[ 'type' ], $data[ 'data' ]));
return success(data: (new VerifyService())->getVerifyCode($data['type'], $data['data'], $data['need_barcode']));
}
/**
@ -38,9 +39,9 @@ class Verify extends BaseApiController
public function getInfoByCode()
{
$data = $this->request->params([
[ 'code', '' ],
['code', ''],
]);
return success(data: ( new VerifyService() )->getInfoByCode($data[ 'code' ]));
return success(data: (new VerifyService())->getInfoByCode($data['code']));
}
/**
@ -50,7 +51,7 @@ class Verify extends BaseApiController
*/
public function verify($code)
{
return success(data: ( new VerifyService() )->verify($code));
return success(data: (new VerifyService())->verify($code));
}
/**
@ -59,33 +60,48 @@ class Verify extends BaseApiController
*/
public function checkVerifier()
{
return success(data: ( new VerifyService() )->checkVerifier());
return success(data: (new VerifyService())->checkVerifier());
}
/**
* 核销记录
* @return void
* @return Response
*/
public function records()
{
$data = $this->request->params([
[ 'relate_tag', 0 ],
[ 'type', '' ],
[ 'code', '' ],
[ 'keyword', '' ],
[ 'create_time', [] ]
['relate_tag', 0],
['type', ''],
['code', ''],
['keyword', ''],
['order_id', ''],
['create_time', []]
]);
return success(data: ( new VerifyService() )->getRecordsPageByVerifier($data));
return success(data: (new VerifyService())->getRecordsPageByVerifier($data));
}
/**
* 获取核销详情
* @param $code
* @param string|int $code
* @return Response
*/
public function detail(string|int $code)
{
return success(data: ( new VerifyService() )->getRecordsDetailByVerifier($code));
return success(data: (new VerifyService())->getRecordsDetailByVerifier($code));
}
/**
* 会员核销记录
* @return Response
*/
public function memberRecordList()
{
$data = $this->request->params([
['relate_tag', 0],
['type', ''],
['order_id', '']
]);
return success(data: (new VerifyService())->getMemberRecordsList($data));
}
}

View File

@ -62,7 +62,7 @@ class Weapp extends BaseApiController
/**
* 查询小程序是否已开通发货信息管理服务
* @return bool
* @return Response
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
*/
public function getIsTradeManaged()

View File

@ -12,7 +12,6 @@
namespace app\api\controller\wechat;
use app\service\api\login\LoginService;
use app\service\api\wechat\WechatConfigService;
use app\service\api\wechat\WechatAuthService;
use core\base\BaseController;
use think\db\exception\DataNotFoundException;
@ -141,15 +140,6 @@ class Wechat extends BaseController
return success($wechat_auth_service->scanLogin());
}
/**
* 检查微信公众号是否配置
* @return Response
*/
public function checkWechatConfig()
{
return success('SUCCESS', (new WechatConfigService())->checkWechatConfig());
}
/**
* 更新openid
* @return Response
@ -160,4 +150,15 @@ class Wechat extends BaseController
$wechat_auth_service = new WechatAuthService();
return success($wechat_auth_service->updateOpenid($data[ 'code' ]));
}
/**
* 更新openid
* @return Response
*/
public function updateOpenidByH5()
{
$data = $this->request->params([ [ 'wx_openid', '' ] ]);
$wechat_auth_service = new WechatAuthService();
return success($wechat_auth_service->updateOpenidByH5($data[ 'wx_openid' ]));
}
}

View File

@ -33,6 +33,10 @@ class BindDispatch extends Controller
$controller = 'weapp.Weapp';
$action = 'register';
break;
case MemberLoginTypeDict::APP:
$controller = 'channel.App';
$action = 'register';
break;
}
@ -43,4 +47,4 @@ class BindDispatch extends Controller
->setAction($this->actionName);
}
}
}

View File

@ -39,7 +39,7 @@ Route::group(function() {
/**
* 路由
*/
Route::group(function() {
Route::group(function () {
//获取授权地址
Route::get('wechat/codeurl', 'wechat.Wechat/getCodeUrl');
//获取授权信息
@ -70,6 +70,9 @@ Route::group(function() {
// 通过外部交易号获取消息跳转路径
Route::get('weapp/getMsgJumpPath', 'weapp.Weapp/getMsgJumpPath');
// app通过wx code登录
Route::post('wxapp/login', 'channel.App/wechatLogin');
//登录
Route::get('login', 'login.Login/login');
//第三方绑定
@ -102,6 +105,8 @@ Route::group(function() {
Route::get('site', 'sys.Config/site');
//场景域名
Route::get('scene_domain', 'sys.Config/getSceneDomain');
// 获取手机端首页列表
Route::get('wap_index', 'sys.Config/getWapIndexList');
// 获取地图设置
Route::get('map', 'sys.Config/getMap');
@ -133,6 +138,8 @@ Route::group(function() {
Route::get('check_verifier', 'sys.Verify/checkVerifier');
//核销记录
Route::get('verify_records', 'sys.Verify/records');
//会员核销记录
Route::get('member_verify_records', 'sys.Verify/memberRecordList');
//核销详情
Route::get('verify_detail/:code', 'sys.Verify/detail');
//通过code码获取核销信息
@ -150,9 +157,11 @@ Route::group(function() {
->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
Route::group(function() {
Route::group(function () {
//公众号更新用户openid
Route::put('wechat/update_openid', 'wechat.Wechat/updateOpenid');
//公众号更新用户openid
Route::put('wechat/update_openid_h5', 'wechat.Wechat/updateOpenidByH5');
//小程序更新用户openid
Route::put('weapp/update_openid', 'weapp.Weapp/updateOpenid');

View File

@ -19,13 +19,13 @@ use app\service\core\sys\CoreSysConfigService;
* @param int $http_code
* @return Response
*/
function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 200) : Response
function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
$msg = 'SUCCESS';
}
return Response::create([ 'data' => $data, 'msg' => get_lang($msg), 'code' => $code ], 'json', $http_code);
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
}
@ -37,13 +37,13 @@ function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 2
* @param int $http_code
* @return Response
*/
function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = 200) : Response
function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
$msg = 'FAIL';
}
return Response::create([ 'data' => $data, 'msg' => get_lang($msg), 'code' => $code ], 'json', $http_code);
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
}
/**
@ -74,17 +74,17 @@ function list_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'child', $root =
// 创建基于主键的数组引用
$refer = array();
foreach ($list as $key => $data) {
$refer[ $data[ $pk ] ] =& $list[ $key ];
$refer[$data[$pk]] =& $list[$key];
}
foreach ($list as $key => $data) {
// 判断是否存在parent
$parent_id = $data[ $pid ];
$parent_id = $data[$pid];
if ($root == $parent_id) {
$tree[] =& $list[ $key ];
$tree[] =& $list[$key];
} else {
if (isset($refer[ $parent_id ])) {
$parent =& $refer[ $parent_id ];
$parent[ $child ][] =& $list[ $key ];
if (isset($refer[$parent_id])) {
$parent =& $refer[$parent_id];
$parent[$child][] =& $list[$key];
}
}
}
@ -135,11 +135,11 @@ function array_keys_search($array, $keys, $index = '', $is_sort = true)
$list = array();
foreach ($keys as $key) {
if (isset($array[ $key ])) {
if (isset($array[$key])) {
if ($is_sort) {
$list[] = $array[ $key ];
$list[] = $array[$key];
} else {
$list[ $key ] = $array[ $key ];
$list[$key] = $array[$key];
}
}
@ -164,7 +164,7 @@ function del_target_dir($path, $delDir)
//打开目录句柄
$handle = opendir($path);
if ($handle) {
while (false !== ( $item = readdir($handle) )) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("$path/$item")) {
del_target_dir("$path/$item", $delDir);
@ -198,7 +198,7 @@ function system_name(?string $key = '')
'channel_name' => env('system.channel_name', 'channel'),
];
if (!empty($key)) {
return $params[ $key ];
return $params[$key];
} else {
return $params;
}
@ -217,16 +217,16 @@ function get_date_by_time(?int $time = null)
function get_start_and_end_time_by_day($day = '')
{
$date = $day ? : date('Y-m-d');
$date = $day ?: date('Y-m-d');
$day_start_time = strtotime($date);
//当天结束之间
$day_end_time = $day_start_time + 86400;
return [ $day_start_time, $day_end_time ];
return [$day_start_time, $day_end_time];
}
/**
* 获取本周的 开始、结束时间
* @param data 日期
* @param data $date 日期
*/
function get_weekinfo_by_time($date)
{
@ -355,12 +355,12 @@ function format_money($number)
* 金额浮点数格式化
* @param $number
* @param $precision
* @return float|int
* @return string
*/
function format_float_money($number, $precision = 2)
{
if ($precision > 0) {
return sprintf('%.' . $precision . 'f', floor($number * ( 10 ** $precision )) / ( 10 ** $precision ));
return sprintf('%.' . $precision . 'f', floor($number * (10 ** $precision)) / (10 ** $precision));
} else {
return sprintf('%.' . $precision . 'f', floor($number));
}
@ -490,19 +490,19 @@ function array_merge2(array $array1, array $array2)
if (array_key_exists($array2_k, $array1)) {
if (is_array($array2_v)) {
foreach ($array2_v as $array2_kk => $array2_vv) {
if (array_key_exists($array2_kk, $array1[ $array2_k ])) {
if (array_key_exists($array2_kk, $array1[$array2_k])) {
if (is_array($array2_vv)) {
$array1[ $array2_k ][ $array2_kk ] = array_merge($array1[ $array2_k ][ $array2_kk ], $array2_vv);
$array1[$array2_k][$array2_kk] = array_merge($array1[$array2_k][$array2_kk], $array2_vv);
}
} else {
$array1[ $array2_k ][ $array2_kk ] = $array2_vv;
$array1[$array2_k][$array2_kk] = $array2_vv;
}
}
} else {
$array1[ $array2_k ] = $array2_v;
$array1[$array2_k] = $array2_v;
}
} else {
$array1[ $array2_k ] = $array2_v;
$array1[$array2_k] = $array2_v;
}
}
return $array1;
@ -549,8 +549,8 @@ function dir_copy(string $src = '', string $dst = '', &$files = [], $exclude_dir
}
$dir = opendir($src);
dir_mkdir($dst);
while (false !== ( $file = readdir($dir) )) {
if (( $file != '.' ) && ( $file != '..' )) {
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src . '/' . $file)) {
// 排除目录
if (count($exclude_dirs) && in_array($file, $exclude_dirs)) continue;
@ -634,7 +634,7 @@ function parse_sql($content = '', $string = false, $replace = [])
// 多行注释标记
$comment = false;
// 按行分割,兼容多个平台
$content = str_replace([ "\r\n", "\r" ], "\n", $content);
$content = str_replace(["\r\n", "\r"], "\n", $content);
$content = explode("\n", trim($content));
// 循环处理每一行
foreach ($content as $line) {
@ -726,10 +726,10 @@ function getFileMap($path, $arr = [])
if ($file_path != '.' && $file_path != '..') {
$temp_path = $path . '/' . $file_path;
if (is_dir($temp_path)) {
$arr[ $temp_path ] = $file_path;
$arr[$temp_path] = $file_path;
$arr = getFileMap($temp_path, $arr);
} else {
$arr[ $temp_path ] = $file_path;
$arr[$temp_path] = $file_path;
}
}
}
@ -754,9 +754,9 @@ function cache_remember(string $name = null, $value = '', $tag = null, $options
$value = Container::getInstance()->invokeFunction($value);
}
if (is_null($tag)) {
Cache::set($name, $value, $options[ 'expire' ] ?? null);
Cache::set($name, $value, $options['expire'] ?? null);
} else {
Cache::tag($tag)->set($name, $value, $options[ 'expire' ] ?? null);
Cache::tag($tag)->set($name, $value, $options['expire'] ?? null);
}
return $value;
@ -774,14 +774,14 @@ function project_path()
/**
* 图片转base64
* @param string $path
* @param $is_delete 转换后是否删除原图
* @param $is_delete `转换后是否删除原图`
* @return string
*/
function image_to_base64(string $path, $is_delete = false)
{
if (!file_exists($path)) return 'image not exist';
$mime = getimagesize($path)[ 'mime' ];
$mime = getimagesize($path)['mime'];
$image_data = file_get_contents($path);
// 将图片转换为 base64
$base64_data = base64_encode($image_data);
@ -814,10 +814,10 @@ function version_to_int($version)
{
$version_array = explode(".", $version);
$v1 = sprintf('%03s', (int) $version_array[ 0 ] ?? 0);
$v2 = sprintf('%03s', (int) $version_array[ 1 ] ?? 0);
$v3 = sprintf('%03s', (int) $version_array[ 2 ] ?? 0);
return (int) "{$v1}{$v2}{$v3}";
$v1 = sprintf('%03s', (int)$version_array[0] ?? 0);
$v2 = sprintf('%03s', (int)$version_array[1] ?? 0);
$v3 = sprintf('%03s', (int)$version_array[2] ?? 0);
return (int)"{$v1}{$v2}{$v3}";
}
/**
@ -830,13 +830,13 @@ function version_to_string($ver)
if ($ver > 999) {
if ($ver > 999999) {
$ver .= "";
$v3 = (int) substr($ver, -3);
$v2 = (int) substr($ver, -6, 3);
$v1 = (int) substr($ver, 0, -6);
$v3 = (int)substr($ver, -3);
$v2 = (int)substr($ver, -6, 3);
$v1 = (int)substr($ver, 0, -6);
} else {
$ver .= "";
$v3 = (int) substr($ver, -3);
$v2 = (int) substr($ver, 0, -3);
$v3 = (int)substr($ver, -3);
$v2 = (int)substr($ver, 0, -3);
$v1 = 0;
}
} else {
@ -850,7 +850,7 @@ function version_to_string($ver)
/**
* 检测文件是否是本地图片
* @param string $file_path
* @return void
* @return bool
*/
function check_file_is_remote(string $file_path)
{
@ -861,7 +861,7 @@ function check_file_is_remote(string $file_path)
* 文件拷贝
* @param string $source_file
* @param string $to_file
* @return void
* @return bool
*/
function file_copy(string $source_file, string $to_file)
{
@ -886,13 +886,15 @@ function file_copy(string $source_file, string $to_file)
/**
* 创建并生成二维码
* @param $url
* @param $dir
* @param $file_path
* @param $channel
* @param $size
* @param $page
* @param $data
* @param string $dir
* @param string $channel
* @param true[] $style
* @param bool $outfile
* @return string
*/
function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_transparent' => true ], $outfile = true)
function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = ['is_transparent' => true], $outfile = true)
{
if ($outfile) {
$dir = $dir ? : 'upload' . '/' . 'qrcode/';//二维码默认存储位置
@ -914,8 +916,8 @@ function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_t
'channel' => $channel,
'outfile' => $outfile
])));
if (!empty($result[ 0 ])) {
$path = $result[ 0 ];
if (!empty($result[0])) {
$path = $result[0];
}
return $path;
}
@ -927,7 +929,7 @@ function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_t
* @param array $param
* @param string $channel
* @param bool $is_throw_exception
* @return string|void
* @return string|null
*/
function poster($id, $type, array $param = [], string $channel = '', bool $is_throw_exception = true)
{
@ -952,7 +954,7 @@ function is_url($string)
* 获取站点插件
* @return array
*/
function get_site_addons() : array
function get_install_addons() : array
{
$addons = Cache::get("local_install_addons");
return is_null($addons) ? [] : $addons;
@ -973,7 +975,23 @@ function get_wap_domain()
*/
function str_sub($str, $length = 10, $is_need_apostrophe = true)
{
return mb_substr($str, 0, $length, 'UTF-8') . ( $is_need_apostrophe ? '...' : '' );
return mb_substr($str, 0, $length, 'UTF-8') . ($is_need_apostrophe ? '...' : '');
}
/**
* $str为要进行截取的字符串$length为截取长度汉字算一个字字母算半个字
* @param $str
* @param int $length
* @param bool $is_need_apostrophe
* @return string
*/
function str_sub2($str, $length = 10, $is_need_apostrophe=true)
{
if (mb_strlen($str, 'UTF-8') > $length) {
return mb_substr($str, 0, $length, 'UTF-8') . ($is_need_apostrophe ? '...' : '');
} else {
return mb_substr($str, 0, $length, 'UTF-8');
}
}
/**
@ -1013,10 +1031,10 @@ function get_last_time($time = null)
$text = floor($t / 60) . '分钟前'; //一小时内
break;
case $t < 60 * 60 * 24:
$text = floor($t / ( 60 * 60 )) . '小时前'; // 一天内
$text = floor($t / (60 * 60)) . '小时前'; // 一天内
break;
case $t < 60 * 60 * 24 * 3:
$text = floor($time / ( 60 * 60 * 24 )) == 1 ? '昨天' . date('H:i', $time) : '前天' . date('H:i', $time); //昨天和前天
$text = floor($time / (60 * 60 * 24)) == 1 ? '昨天' . date('H:i', $time) : '前天' . date('H:i', $time); //昨天和前天
break;
case $t < 60 * 60 * 24 * 30:
$text = date('m-d H:i', $time); //一个月内
@ -1033,9 +1051,9 @@ function get_last_time($time = null)
/**
* 检查目录及其子目录的权限
* @param $dir 要检查的目录路径
* @param $dir `要检查的目录路径`
* @param $data
* @param $exclude_dir 排除排除无需检测的的文件夹
* @param $exclude_dir `排除排除无需检测的的文件夹`
* @return array|array[]|mixed
*/
function checkDirPermissions($dir, $data = [], $exclude_dir = [])
@ -1053,14 +1071,14 @@ function checkDirPermissions($dir, $data = [], $exclude_dir = [])
try {
if (!is_readable($dir)) {
$data[ 'unreadable' ][] = $dir;
$data['unreadable'][] = $dir;
}
if (!is_writable($dir)) {
$data[ 'not_writable' ][] = $dir;
$data['not_writable'][] = $dir;
}
if (is_readable($dir)) {
$dh = opendir($dir);
while (( $file = readdir($dh) ) !== false) {
while (($file = readdir($dh)) !== false) {
if ($file === '.' || $file === '..') {
continue;
}
@ -1082,24 +1100,24 @@ function checkDirPermissions($dir, $data = [], $exclude_dir = [])
$data = checkDirPermissions($fullPath, $data, $exclude_dir); // 递归调用自身来检查子目录
} else {
// 如果是文件,则检查其读写权限
if (!is_readable($fullPath)) $data[ 'unreadable' ][] = $fullPath;
if (!is_writable($fullPath)) $data[ 'not_writable' ][] = $fullPath;
if (!is_readable($fullPath)) $data['unreadable'][] = $fullPath;
if (!is_writable($fullPath)) $data['not_writable'][] = $fullPath;
}
}
closedir($dh);
}
return $data;
} catch (Exception $e) {
$data[ 'unreadable' ][] = $dir;
$data[ 'not_writable' ][] = $dir;
$data['unreadable'][] = $dir;
$data['not_writable'][] = $dir;
return $data;
}
}
/**
* 下载网络图片
* @param $img_url 图片URL
* @param $file_name 本地保存位置
* @param $img_url `图片URL`
* @param $file_name `本地保存位置`
* @return bool
*/
function downloadImage($img_url, $file_name)
@ -1132,4 +1150,4 @@ function downloadImage($img_url, $file_name)
curl_close($ch);
fclose($fp);
return true;
}
}

View File

@ -73,6 +73,168 @@ class CommonActiveDict
'bg_color' => '#FF1C77'
],
];
return !empty($active) ? $data[$active] : $data;
return !empty($active) ? $data[$active] ?? [] : $data;
}
// 活动背景特效
const ACTIVE_BG_EFFECT = [
'normal' => [
'title' => '无特效',
'child_list' => []
],
'promotion' => [
'title' => '促销',
'child_list' => [
'red_packet' => '红包',
'gift_box' => '礼盒',
'big_wing' => '大元宝'
]
],
// 'graph' => [
// 'title' => '图形',
// 'child_list' => [
// 'english_letters' => '英文字母',
// 'lantern' => '灯笼',
// 'love' => '爱心'
// ]
// ],
// 'natural' => [
// 'title' => '自然',
// 'child_list' => [
// 'roses' => '玫瑰花',
// 'petals' => '花瓣',
// ]
// ],
'festival' => [
'title' => '节庆',
'child_list' => [
// 'santa_claus' => '圣诞老人',
// 'christmas_trees' => '圣诞树',
'blessing' => '花瓣',
'firecrackers' => '爆竹',
'i_love_you' => '我爱你',
'kongmin_light' => '孔明灯',
// 'zongzi' => '粽子',
// 'moon_cake' => '月饼',
]
]
];
// 背景音乐模板
const ACTIVE_BG_MUSIC = [
'popular' => [
'title' => '流行',
'child_list' => [
// 'red_packet_bonus_song' => [
// 'title' => '红包返利歌曲',
// 'url' => ''
// ],
'quiet_guitar_soundtrack' => [
'title' => '安静吉他配乐',
'url' => 'static/resource/audio/quiet_guitar_soundtrack.mp3'
],
'city_of_hope' => [
'title' => 'City Of Hope',
'url' => 'static/resource/audio/city_of_hope.mp3'
],
'intro' => [
'title' => 'Intro',
'url' => 'static/resource/audio/intro.mp3'
],
'dreams_exploring_world' => [
'title' => '探索世界的梦想',
'url' => 'static/resource/audio/dreams_exploring_world.mp3'
],
]
],
'holiday' => [
'title' => '节日',
'child_list' => [
'spring_festival_overture' => [
'title' => '过年春节序曲',
'url' => 'static/resource/audio/spring_festival_overture.mp3'
],
]
],
'classical' => [
'title' => '古典',
'child_list' => [
'elegant_chinese_style' => [
'title' => '古典高雅中国风',
'url' => 'static/resource/audio/elegant_chinese_style.mp3'
],
'city_hope_soundtrack' => [
'title' => '希望之城配乐',
'url' => 'static/resource/audio/city_hope_soundtrack.mp3'
],
'ink_painting_chinese_style' => [
'title' => '墨水画中国风',
'url' => 'static/resource/audio/ink_painting_chinese_style.mp3'
],
]
],
'epic' => [
'title' => '史诗',
'child_list' => [
'destiny_honor' => [
'title' => 'Destiny & Honor',
'url' => 'static/resource/audio/destiny_honor.mp3'
],
'electric_romeo' => [
'title' => 'Electric Romeo',
'url' => 'static/resource/audio/electric_romeo.mp3'
],
]
],
'piano' => [
'title' => '钢琴',
'child_list' => [
'tapeworm_compilation' => [
'title' => 'Tapeworm Compilation I',
'url' => 'static/resource/audio/tapeworm_compilation.mp3'
],
]
],
'happy' => [
'title' => '欢快',
'child_list' => [
'laugh_smile_no_vox' => [
'title' => 'A Laugh And A Smile No Vox',
'url' => 'static/resource/audio/laugh_smile_no_vox.mp3'
],
'easy_run_soundtrack' => [
'title' => '轻松奔跑配乐',
'url' => 'static/resource/audio/easy_run_soundtrack.mp3'
],
'theme_happy_no_1' => [
'title' => 'Theme-Happy No.1',
'url' => 'static/resource/audio/theme_happy_no_1.mp3'
],
'sunny_jim' => [
'title' => 'Sunny Jim',
'url' => 'static/resource/audio/sunny_jim.mp3'
],
'energetic_warm_soundtrack' => [
'title' => '活力温暖配乐',
'url' => 'static/resource/audio/energetic_warm_soundtrack.mp3'
],
'light_soothing_soundtrack' => [
'title' => '轻快舒缓配乐',
'url' => 'static/resource/audio/light_soothing_soundtrack.mp3'
],
'inspirational_bright_music' => [
'title' => '励志明亮配乐',
'url' => 'static/resource/audio/inspirational_bright_music.mp3'
],
'sharp_rhythm_whistling' => [
'title' => '节奏鲜明口哨',
'url' => 'static/resource/audio/sharp_rhythm_whistling.mp3'
],
'cheerful_korean_music' => [
'title' => '欢快韩风配乐',
'url' => 'static/resource/audio/cheerful_korean_music.mp3'
],
]
],
];
}

View File

@ -148,7 +148,10 @@ class PagesDict
'bgHeightScale' => 0,
'imgWidth' => '',
'imgHeight' => '',
"bottomTabBarSwitch" => true,
"bottomTabBar" => [
'control' => true,
'isShow' => true
],
"template" => [
'textColor' => "#303133",
'pageStartBgColor' => '',
@ -220,7 +223,10 @@ class PagesDict
'bgHeightScale' => 0,
'imgWidth' => '',
'imgHeight' => '',
"bottomTabBarSwitch" => true,
"bottomTabBar" => [
'control' => true,
'isShow' => true
],
"template" => [
'textColor' => "#303133",
'pageStartBgColor' => '',
@ -686,7 +692,10 @@ class PagesDict
'bgHeightScale' => 0,
'imgWidth' => 750,
'imgHeight' => 403,
"bottomTabBarSwitch" => true,
"bottomTabBar" => [
'control' => true,
'isShow' => true
],
"template" => [
'textColor' => "#303133",
'pageStartBgColor' => '',

View File

@ -35,7 +35,9 @@ class TemplateDict
'title' => get_lang('dict_diy.page_index'),
'page' => '/app/pages/index/index',
'action' => 'decorate', // 页面是否装修标识为空标识不装修decorate装修
'type' => 'index' // 页面类型index首页、member_index个人中心普通页面
'type' => 'index', // 页面类型index首页、member_index个人中心普通页面
'ignoreComponents' => [], // 忽略组件名单
'global' => [] // 页面数据结构,初始化时覆盖
],
'DIY_MEMBER_INDEX' => [
'title' => get_lang('dict_diy.page_member_index'),

View File

@ -77,7 +77,10 @@ class TemplateDict
"name" => ""
]
],
"bottomTabBarSwitch" => true,
"bottomTabBar" => [
'control' => true,
'isShow' => true
],
"popWindow" => [
"imgUrl" => "",
"imgWidth" => "",
@ -719,7 +722,10 @@ class TemplateDict
"name" => ""
]
],
"bottomTabBarSwitch" => true,
"bottomTabBar" => [
'control' => true,
'isShow' => true
],
"popWindow" => [
"imgUrl" => "",
"imgWidth" => "",

View File

@ -30,13 +30,17 @@ class MemberLoginTypeDict
// PC登录
public const PC = 'pc';
public const APP = 'app';
public static function getType($type = '')
{
$data = [
self::USERNAME => get_lang('dict_member.login_username'),//用户名密码登录
self::MOBILE => get_lang('dict_member.login_mobile'),//手机号验证码登录,
self::WECHAT => get_lang('dict_member.login_wechat'),//'微信公众号授权登录',
self::WEAPP => get_lang('dict_member.login_weapp'),//'微信小程序授权登录',
self::PC => get_lang('dict_member.login_pc'),//'微信小程序授权登录',
self::APP => get_lang('dict_member.login_app')
];
if (empty($type)) {
return $data;

View File

@ -30,6 +30,8 @@ class MemberRegisterTypeDict
//手动添加
const MANUAL = 'manual';
const APP = 'app';
public static function getType($type = '')
{
$data = [

View File

@ -8,7 +8,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconzhuangxiu3',
'api_url' => '',
'router_path' => '',
'router_path' => 'diy/index',
'view_path' => '',
'methods' => '',
'sort' => '90',
@ -204,20 +204,6 @@ return [
'status' => '1',
'is_show' => '1',
],
[
'menu_name' => '添加分组',
'menu_key' => 'add_attachment_category',
'menu_short_name' => '删除素材',
'menu_type' => '2',
'icon' => '',
'api_url' => 'sys/attachment/category',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
],
[
'menu_name' => '添加分组',
'menu_key' => 'add_attachment_category',
@ -247,9 +233,9 @@ return [
'is_show' => '1',
],
[
'menu_name' => '编辑分组',
'menu_key' => 'edit_attachment_category',
'menu_short_name' => '编辑分组',
'menu_name' => '删除分组',
'menu_key' => 'del_attachment_category',
'menu_short_name' => '删除分组',
'menu_type' => '2',
'icon' => '',
'api_url' => 'sys/attachment/category/<id>',
@ -259,7 +245,7 @@ return [
'sort' => '100',
'status' => '1',
'is_show' => '1',
],
]
]
],
[
@ -301,7 +287,7 @@ return [
'router_path' => 'diy/theme_style',
'view_path' => 'diy/theme_style',
'methods' => 'get',
'sort' => '93',
'sort' => '92',
'status' => '1',
'is_show' => '1'
],
@ -547,7 +533,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconhuiyuan',
'api_url' => '',
'router_path' => '',
'router_path' => 'member/member',
'view_path' => '',
'methods' => '',
'sort' => '89',
@ -870,7 +856,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconjifen-xianxing',
'api_url' => '',
'router_path' => '',
'router_path' => 'member/point',
'view_path' => '',
'methods' => '',
'sort' => '51',
@ -961,7 +947,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconcaiwu1',
'api_url' => '',
'router_path' => '',
'router_path' => 'finance/account',
'view_path' => '',
'methods' => '',
'sort' => '88',
@ -970,7 +956,7 @@ return [
'children' => [
[
'menu_name' => '财务流水',
'menu_key' => 'site_account_list',
'menu_key' => 'account_list',
'menu_short_name' => '财务流水',
'menu_type' => '1',
'icon' => 'element Postcard',
@ -984,7 +970,7 @@ return [
],
[
'menu_name' => '支付单据详情',
'menu_key' => 'site_pay_detail',
'menu_key' => 'pay_detail',
'menu_short_name' => '支付单据详情',
'menu_type' => '1',
'icon' => 'element Postcard',
@ -1095,7 +1081,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconyingxiao2',
'api_url' => '',
'router_path' => '',
'router_path' => 'app/marketing',
'view_path' => '',
'methods' => '',
'sort' => '87',
@ -1112,7 +1098,7 @@ return [
'router_path' => 'app/marketing',
'view_path' => 'app/marketing',
'methods' => 'get',
'sort' => '50',
'sort' => '160',
'status' => '1',
'is_show' => '1',
],
@ -1121,17 +1107,32 @@ return [
[
'menu_name' => '核销管理',
'menu_key' => 'verify',
'menu_short_name' => '核销管理',
'menu_short_name' => '核销',
'parent_key' => 'addon',
'menu_type' => '0',
'icon' => '',
'api_url' => '',
'router_path' => '',
'router_path' => 'marketing/verify/index',
'view_path' => '',
'methods' => 'get',
'sort' => '48',
'status' => '1',
'is_show' => '0',
'is_show' => '1',
'children' => [
[
'menu_name' => '核销台',
'menu_key' => 'verify_index',
'menu_short_name' => '核销',
'menu_type' => '1',
'icon' => '',
'api_url' => '',
'router_path' => 'marketing/verify/index',
'view_path' => 'marketing/verify_index',
'methods' => 'get',
'sort' => '100',
'status' => '1',
'is_show' => '1',
],
[
'menu_name' => '核销员',
'menu_key' => 'verifier_list',
@ -1224,15 +1225,16 @@ return [
'menu_name' => '签到管理',
'menu_key' => 'sign',
'menu_short_name' => '签到管理',
'parent_key' => 'active',
'menu_type' => '0',
'icon' => 'element FolderChecked',
'api_url' => '',
'router_path' => '',
'router_path' => 'marketing/sign/config',
'view_path' => '',
'methods' => 'get',
'sort' => '30',
'status' => '1',
'is_show' => '0',
'is_show' => '1',
'children' => [
[
'menu_name' => '签到设置',
@ -1305,7 +1307,7 @@ return [
'router_path' => 'app/index',
'view_path' => 'app/index',
'methods' => 'get',
'sort' => '50',
'sort' => '130',
'status' => '1',
'is_show' => '1',
],
@ -1781,7 +1783,7 @@ return [
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
]
],
],
[
@ -1829,7 +1831,7 @@ return [
],
[
'menu_name' => '添加管理员',
'menu_key' => 'add_site_user',
'menu_key' => 'add_user',
'menu_short_name' => '添加管理员',
'menu_type' => '2',
'icon' => '',
@ -1843,7 +1845,7 @@ return [
],
[
'menu_name' => '编辑管理员',
'menu_key' => 'edit_site_user',
'menu_key' => 'edit_user',
'menu_short_name' => '编辑管理员',
'menu_type' => '2',
'icon' => '',
@ -1857,7 +1859,7 @@ return [
],
[
'menu_name' => '修改管理员属性',
'menu_key' => 'edit_site_user_field',
'menu_key' => 'edit_user_field',
'menu_short_name' => '修改管理员属性',
'menu_type' => '2',
'icon' => '',
@ -1871,7 +1873,7 @@ return [
],
[
'menu_name' => '锁定',
'menu_key' => 'lock_site_user',
'menu_key' => 'lock_user',
'menu_short_name' => '锁定',
'menu_type' => '2',
'icon' => '',
@ -1885,7 +1887,7 @@ return [
],
[
'menu_name' => '解锁',
'menu_key' => 'unlock_site_user',
'menu_key' => 'unlock_user',
'menu_short_name' => '解锁用户',
'menu_type' => '2',
'icon' => '',
@ -1896,6 +1898,20 @@ return [
'sort' => '100',
'status' => '1',
'is_show' => '1',
],
[
'menu_name' => '删除管理员',
'menu_key' => 'delete_user',
'menu_short_name' => '删除管理员',
'menu_type' => '2',
'icon' => '',
'api_url' => 'user/<uid>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
]
]
],
@ -1906,7 +1922,7 @@ return [
'menu_type' => '1',
'icon' => 'iconfont iconhuiyuanliebiao',
'api_url' => 'sys/role',
'router_path' => 'auth/role',
'router_path' => 'setting/auth/role',
'view_path' => 'auth/role',
'methods' => 'get',
'sort' => '99',
@ -1981,7 +1997,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconshezhi3',
'api_url' => '',
'router_path' => '',
'router_path' => 'setting/system',
'view_path' => '',
'methods' => '',
'sort' => '83',
@ -1995,7 +2011,7 @@ return [
'menu_type' => '0',
'icon' => 'element Basketball',
'api_url' => '',
'router_path' => '',
'router_path' => 'setting/system',
'view_path' => '',
'methods' => '',
'sort' => '100',
@ -2101,7 +2117,7 @@ return [
'menu_type' => '0',
'icon' => 'iconfont iconjiaoseyonghu',
'api_url' => '',
'router_path' => '',
'router_path' => 'setting/member',
'view_path' => '',
'methods' => '',
'sort' => '71',
@ -2177,7 +2193,7 @@ return [
'menu_type' => '1',
'icon' => 'element Wallet',
'api_url' => '',
'router_path' => 'setting/pay',
'router_path' => 'setting/pay/channel',
'view_path' => '',
'methods' => 'get',
'sort' => '60',
@ -2298,7 +2314,7 @@ return [
'menu_type' => '1',
'icon' => 'element ChatLineSquare',
'api_url' => '',
'router_path' => 'setting/notice',
'router_path' => 'setting/notice/template',
'view_path' => '',
'methods' => '',
'sort' => '50',
@ -2386,7 +2402,7 @@ return [
'menu_type' => '0',
'icon' => 'element Message',
'api_url' => '',
'router_path' => '',
'router_path' => 'setting/sms/setting',
'view_path' => '',
'methods' => '',
'sort' => '40',
@ -2505,7 +2521,7 @@ return [
'menu_type' => '0',
'icon' => 'element FolderChecked',
'api_url' => '',
'router_path' => '',
'router_path' => 'setting/agreement',
'view_path' => '',
'methods' => '',
'sort' => '20',
@ -2644,6 +2660,7 @@ return [
]
]
],
]
],
@ -2730,6 +2747,7 @@ return [
'menu_name' => '万能表单',
'menu_key' => 'diy_form',
'menu_short_name' => '万能表单',
'parent_key' => 'addon',
'menu_type' => '0',
'icon' => 'element Files',
'api_url' => '',
@ -2779,6 +2797,7 @@ return [
'menu_name' => '数据导出',
'menu_key' => 'setting_export',
'menu_short_name' => '数据导出',
'parent_key' => 'addon',
'menu_type' => '0',
'icon' => 'element Files',
'api_url' => '',
@ -2791,9 +2810,9 @@ return [
'menu_attr' => 'setting_export',
'children' => [
[
'menu_name' => '数据导出列表',
'menu_name' => '数据导出',
'menu_key' => 'setting_export_list',
'menu_short_name' => '数据导出列表',
'menu_short_name' => '列表',
'menu_type' => '1',
'icon' => 'element FolderChecked',
'api_url' => 'sys/export',
@ -2828,6 +2847,7 @@ return [
'menu_name' => '打印管理',
'menu_key' => 'printer_management',
'menu_short_name' => '打印管理',
'parent_key' => 'addon',
'menu_type' => '0',
'icon' => 'element Files',
'api_url' => '',
@ -3339,7 +3359,7 @@ return [
],
[
'menu_name' => '菜单管理',
'menu_key' => 'site_menu',
'menu_key' => 'menu',
'menu_short_name' => '菜单管理',
'menu_type' => '1',
'icon' => '',
@ -3353,7 +3373,7 @@ return [
'children' => [
[
'menu_name' => '新增',
'menu_key' => 'auth_site_menu_add',
'menu_key' => 'auth_menu_add',
'menu_short_name' => '新增',
'menu_type' => '2',
'icon' => '',
@ -3367,7 +3387,7 @@ return [
],
[
'menu_name' => '编辑',
'menu_key' => 'auth_site_menu_update',
'menu_key' => 'auth_menu_update',
'menu_short_name' => '编辑',
'menu_type' => '2',
'icon' => '',
@ -3381,7 +3401,7 @@ return [
],
[
'menu_name' => '删除',
'menu_key' => 'auth_site_menu_del',
'menu_key' => 'auth_menu_del',
'menu_short_name' => '删除',
'menu_type' => '2',
'icon' => '',
@ -3395,7 +3415,7 @@ return [
],
[
'menu_name' => '详情',
'menu_key' => 'auth_site_menu_info',
'menu_key' => 'auth_menu_info',
'menu_short_name' => '详情',
'menu_type' => '2',
'icon' => '',

View File

@ -20,6 +20,7 @@ class NoticeTypeDict
//微信小程序
public const WEAPP = 'weapp';
public const TEMPLATE_NEED_PULL = -4;
public const TEMPLATE_AUDIT_STATUS_NEED_AGAIN_REPORT = -3;
public const TEMPLATE_AUDIT_STATUS_NEED_EDIT = -2;
public const TEMPLATE_AUDIT_STATUS_NOT_REPORT = -1;
@ -79,6 +80,7 @@ class NoticeTypeDict
self::TEMPLATE_AUDIT_STATUS_WAIT => get_lang('dict_sms_api.template_status_wait'),
self::TEMPLATE_AUDIT_STATUS_PASS => get_lang('dict_sms_api.template_status_pass'),
self::TEMPLATE_AUDIT_STATUS_REFUSE => get_lang('dict_sms_api.template_status_refuse'),
self::TEMPLATE_NEED_PULL => get_lang('dict_sms_api.template_need_pull'),
];
return $type ? $data[$type] : $data;
}

View File

@ -18,6 +18,7 @@ class RefundDict
const DEALING = 'dealing';//退款处理中
const WAIT = 'wait';//待退款
const FAIL = 'fail';//失败
const CANCEL = 'cancel';//取消
// 退款方式
const WECHATPAY = 'wechatpay';//微信支付
@ -38,6 +39,7 @@ class RefundDict
self::DEALING => get_lang('dict_pay_refund.status_dealing'),
self::SUCCESS => get_lang('dict_pay_refund.status_success'),
self::FAIL => get_lang('dict_pay_refund.status_fail'),
self::CANCEL => get_lang('dict_pay_refund.cancel'),
];
}

View File

@ -129,7 +129,7 @@ class TransferDict
/**
* 获取微信转账场景
* @return void
* @return array[]
*/
public static function getWechatTransferScene(){
return [
@ -219,4 +219,4 @@ class TransferDict
],
];
}
}
}

View File

@ -29,7 +29,7 @@ return [
"y" => 759,
"angle" => 0,
"zIndex" => 8,
"fontFamily" => "static/font/SourceHanSansCN-Regular.ttf",
"fontFamily" => "static/font/PingFang-Medium.ttf",
"fontSize" => 24,
"weight" => false,
"lineHeight" => 20,
@ -75,7 +75,7 @@ return [
"y" => 1097,
"angle" => 0,
"zIndex" => 10,
"fontFamily" => "static/font/SourceHanSansCN-Regular.ttf",
"fontFamily" => "static/font/PingFang-Medium.ttf",
"fontSize" => 26,
"weight" => false,
"lineHeight" => 26,
@ -98,7 +98,7 @@ return [
"y" => 570,
"angle" => 0,
"zIndex" => 4,
"fontFamily" => "static/font/SourceHanSansCN-Regular.ttf",
"fontFamily" => "static/font/PingFang-Medium.ttf",
"fontSize" => 26,
"weight" => false,
"lineHeight" => 10,
@ -139,7 +139,7 @@ return [
"y" => 512,
"angle" => 0,
"zIndex" => 6,
"fontFamily" => "static/font/SourceHanSansCN-Regular.ttf",
"fontFamily" => "static/font/PingFang-Medium.ttf",
"fontSize" => 30,
"weight" => false,
"lineHeight" => 10,

View File

@ -1,17 +1,6 @@
<?php
return [
[
'key' => 'order_close',
'name' => '未支付订单自动关闭',
'desc' => '',
'time' => [
'type' => 'min',
'min' => 1
],
'class' => '',
'function' => ''
],
[
'key' => 'auto_clear_schedule_log',
'name' => '定时清理计划任务日志表',
@ -24,6 +13,18 @@ return [
],
'class' => 'app\job\schedule\AutoClearScheduleLog',
'function' => ''
], [
'key' => 'auto_clear_poster_qrcode',
'name' => '定时清理海报及二维码数据',
'desc' => '',
'time' => [
'type' => 'day',
'day' => 1,
'hour' => 1,
'min' => 1
],
'class' => 'app\job\schedule\AutoClearPosterAndQrcode',
'function' => ''
],
[
'key' => 'transfer_check_finish',
@ -60,5 +61,5 @@ return [
],
'class' => 'app\job\sys\ClearUserLog',
'function' => ''
],
]
];

View File

@ -39,5 +39,7 @@ class ConfigKeyDict
public const WECHAT_TRANSFER_SCENE_CONFIG = 'WECHAT_TRANSFER_SCENE_CONFIG';//微信转账场景配置
public const SMS = 'SMS';//短信配置
public const SHOP_THIRD_PARTY_DELIVERY_CONFIG = 'SHOP_THREE_PARTY_DELIVERY_CONFIG';//短信配置
public const PINTUAN_ORDER_CONFIG = 'PINTUAN_ORDER_CONFIG';//拼团订单配置
public const APP = 'app';
}

View File

@ -17,6 +17,9 @@ class FileDict
public const IMAGE = 'image';
//上传方式 视频
public const VIDEO = 'video';
//上传方式 音频
public const AUDIO = 'audio';
//上传方式 文件
public const DOCUMENT = 'document';
@ -41,6 +44,7 @@ class FileDict
return [
self::IMAGE => get_lang('dict_file.type_image'),//图片
self::VIDEO => get_lang('dict_file.type_video'),//视频
self::AUDIO => get_lang('dict_file.type_audio'),//视频
];
}
@ -69,6 +73,7 @@ class FileDict
self::ALIYUN,//阿里云相关上传
self::IMAGE,//图片上传
self::VIDEO,//视频上传
self::AUDIO,//视频上传
self::APPLET,//小程序包上传
self::EXCEL,//excel导入
];

View File

@ -62,6 +62,9 @@ class Index extends BaseInstall
//sodium
$sodium = extension_loaded('sodium');
$system_variables[] = [ "name" => "sodium", "need" => "开启", "status" => $sodium ];
//imagick
$imagick = extension_loaded('imagick');
$system_variables[] = [ "name" => "imagick", "need" => "开启", "status" => $imagick ];
$root_path = str_replace("\\", DIRECTORY_SEPARATOR, dirname(__FILE__, 4));
$root_path = str_replace("../", DIRECTORY_SEPARATOR, $root_path);
@ -260,6 +263,7 @@ class Index extends BaseInstall
$password = input('password', "");
$password2 = input('password2', "");
if ($admin_name == '' || $username == '' || $password == '') {
$this->setSuccessLog([ '平台信息不能为空', 'error' ]);
return fail('平台信息不能为空!');
@ -379,6 +383,7 @@ class Index extends BaseInstall
$this->setSuccessLog([ "写入失败,请检查目录" . dirname(__FILE__, 2) . "是否可写入!'", 'error' ]);
return fail("写入失败,请检查目录" . dirname(__FILE__, 2) . "是否可写入!'");
}
$this->setSuccessLog([ '初始化成功', 'success' ]);
fwrite($fp, '已安装');
fclose($fp);

View File

@ -1,6 +1,7 @@

SET NAMES utf8mb4;
DROP TABLE IF EXISTS `account_log`;
CREATE TABLE `account_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
@ -11,6 +12,28 @@ CREATE TABLE `account_log` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci COMMENT='站点账单记录';
DROP TABLE IF EXISTS `activity_exchange_code`;
CREATE TABLE `activity_exchange_code`
(
`id` INT(11) NOT NULL AUTO_INCREMENT,
`code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '兑换码',
`status` VARCHAR(20) NOT NULL DEFAULT 'normal' COMMENT 'normal-正常 received-被领取',
`activity_type` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '例seckill-秒杀活动',
`activity_id` INT(11) NOT NULL DEFAULT 0 COMMENT '活动ID',
`type` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '类型 例seckill_goods-秒杀商品',
`type_id` INT(11) NOT NULL DEFAULT 0 COMMENT '类型对应id 秒杀商品id',
`expire_time` INT(11) NOT NULL DEFAULT 0 COMMENT '过期时间 0-不过期',
`member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '领取会员',
`received_time` INT(11) NOT NULL DEFAULT 0 COMMENT '领取时间',
`order_id` INT(11) NOT NULL DEFAULT 0 COMMENT '对应订单id',
`admin_username` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '操作人名称(添加人)',
`admin_id` INT(11) NOT NULL DEFAULT 0 COMMENT '操作人id',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='活动兑换码表';
DROP TABLE IF EXISTS `addon`;
CREATE TABLE `addon` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
@ -46,7 +69,7 @@ CREATE TABLE `addon_log` (
DROP TABLE IF EXISTS `applet_site_version`;
CREATE TABLE `applet_site_version` (
CREATE TABLE `applet_site_version` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`version_id` int(11) NOT NULL DEFAULT 0 COMMENT '版本id',
`type` varchar(20) NOT NULL DEFAULT '' COMMENT '小程序类型',
@ -57,7 +80,7 @@ CREATE TABLE `applet_site_version` (
DROP TABLE IF EXISTS `applet_version`;
CREATE TABLE `applet_version` (
CREATE TABLE `applet_version` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`config` varchar(255) NOT NULL DEFAULT '' COMMENT '配置信息',
`type` varchar(20) NOT NULL DEFAULT '' COMMENT '小程序类型',
@ -188,7 +211,7 @@ CREATE TABLE `diy_form_write_config` (
DROP TABLE IF EXISTS `diy_page`;
CREATE TABLE `diy_page` (
CREATE TABLE `diy_page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`page_title` varchar(255) NOT NULL DEFAULT '' COMMENT '页面名称(用于后台展示)',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '页面标题(用于前台展示)',
@ -208,7 +231,7 @@ CREATE TABLE `diy_page` (
DROP TABLE IF EXISTS `diy_route`;
CREATE TABLE `diy_route` (
CREATE TABLE `diy_route` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '页面名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '页面标识',
@ -239,7 +262,7 @@ CREATE TABLE `diy_theme` (
DROP TABLE IF EXISTS `generate_column`;
CREATE TABLE `generate_column` (
CREATE TABLE `generate_column` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`table_id` int(11) NOT NULL DEFAULT 0 COMMENT '表id',
`column_name` varchar(100) NOT NULL DEFAULT '' COMMENT '字段名称',
@ -269,7 +292,7 @@ CREATE TABLE `generate_column` (
DROP TABLE IF EXISTS `generate_table`;
CREATE TABLE `generate_table` (
CREATE TABLE `generate_table` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`table_name` varchar(255) NOT NULL DEFAULT '' COMMENT '表名',
`table_content` varchar(255) NOT NULL DEFAULT '' COMMENT '描述前缀',
@ -287,7 +310,7 @@ CREATE TABLE `generate_table` (
DROP TABLE IF EXISTS `jobs`;
CREATE TABLE `jobs` (
CREATE TABLE `jobs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`queue` varchar(255) NOT NULL DEFAULT '',
`payload` longtext NOT NULL,
@ -300,7 +323,7 @@ CREATE TABLE `jobs` (
DROP TABLE IF EXISTS `jobs_failed`;
CREATE TABLE `jobs_failed` (
CREATE TABLE `jobs_failed` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`connection` text NOT NULL,
`queue` text NOT NULL,
@ -312,7 +335,7 @@ CREATE TABLE `jobs_failed` (
DROP TABLE IF EXISTS `member`;
CREATE TABLE `member` (
CREATE TABLE `member` (
`member_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`member_no` varchar(255) NOT NULL DEFAULT '' COMMENT '会员编码',
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '推广会员id',
@ -341,7 +364,7 @@ CREATE TABLE `member` (
`sex` tinyint(4) NOT NULL DEFAULT 0 COMMENT '性别 0保密 1男 2女',
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '用户状态 用户状态默认为1',
`birthday` varchar(20) NOT NULL DEFAULT '' COMMENT '出生日期',
`id_card` varchar(50) NOT NULL DEFAULT '' COMMENT '身份证号',
`id_card` varchar(30) NOT NULL DEFAULT '' COMMENT '身份证号',
`point` int(11) NOT NULL DEFAULT 0 COMMENT '可用积分',
`point_get` int(11) NOT NULL DEFAULT 0 COMMENT '累计获取积分',
`balance` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '可用余额',
@ -362,7 +385,7 @@ CREATE TABLE `member` (
`district_id` int(11) NOT NULL DEFAULT 0 COMMENT '区县id',
`address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
`location` varchar(255) NOT NULL DEFAULT '' COMMENT '定位地址',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
`remark` varchar(300) NOT NULL DEFAULT '' COMMENT '备注',
`delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
PRIMARY KEY (`member_id`) USING BTREE
@ -370,7 +393,7 @@ CREATE TABLE `member` (
DROP TABLE IF EXISTS `member_account_log`;
CREATE TABLE `member_account_log` (
CREATE TABLE `member_account_log` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
`account_type` varchar(255) NOT NULL DEFAULT 'point' COMMENT '账户类型',
@ -406,7 +429,7 @@ ALTER TABLE `member_address`ADD INDEX IDX_member_address (member_id);
DROP TABLE IF EXISTS `member_cash_out`;
CREATE TABLE `member_cash_out` (
CREATE TABLE `member_cash_out` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cash_out_no` varchar(50) NOT NULL DEFAULT '' COMMENT '提现交易号',
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
@ -439,7 +462,7 @@ CREATE TABLE `member_cash_out` (
DROP TABLE IF EXISTS `member_cash_out_account`;
CREATE TABLE `member_cash_out_account` (
CREATE TABLE `member_cash_out_account` (
`account_id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
`account_type` varchar(255) NOT NULL DEFAULT '' COMMENT '账户类型',
@ -454,7 +477,7 @@ CREATE TABLE `member_cash_out_account` (
DROP TABLE IF EXISTS `member_label`;
CREATE TABLE `member_label` (
CREATE TABLE `member_label` (
`label_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签id',
`label_name` varchar(50) NOT NULL DEFAULT '' COMMENT '标签名称',
`memo` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
@ -467,7 +490,7 @@ CREATE TABLE `member_label` (
DROP TABLE IF EXISTS `member_level`;
CREATE TABLE `member_level` (
CREATE TABLE `member_level` (
`level_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '会员等级',
`level_name` varchar(50) NOT NULL DEFAULT '' COMMENT '等级名称',
`growth` int(11) NOT NULL DEFAULT '0' COMMENT '所需成长值',
@ -515,9 +538,8 @@ CREATE TABLE `niu_sms_template` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='牛云短信模板表';
DROP TABLE IF EXISTS `pay`;
CREATE TABLE `pay` (
CREATE TABLE `pay` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`main_id` int(11) NOT NULL DEFAULT 0 COMMENT '支付会员id',
`from_main_id` INT(11) NOT NULL DEFAULT 0 COMMENT '发起支付会员id',
@ -543,7 +565,7 @@ CREATE TABLE `pay` (
DROP TABLE IF EXISTS `pay_channel`;
CREATE TABLE `pay_channel` (
CREATE TABLE `pay_channel` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付类型',
`channel` varchar(255) NOT NULL DEFAULT '' COMMENT '支付渠道',
@ -557,7 +579,7 @@ CREATE TABLE `pay_channel` (
DROP TABLE IF EXISTS `pay_refund`;
CREATE TABLE `pay_refund` (
CREATE TABLE `pay_refund` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`refund_no` varchar(255) NOT NULL DEFAULT '' COMMENT '退款单号',
`out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
@ -582,7 +604,7 @@ CREATE TABLE `pay_refund` (
DROP TABLE IF EXISTS `pay_transfer`;
CREATE TABLE `pay_transfer` (
CREATE TABLE `pay_transfer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`trade_type` varchar(255) NOT NULL DEFAULT '' COMMENT '业务类型',
`transfer_no` varchar(50) NOT NULL DEFAULT '' COMMENT '转账单号',
@ -663,9 +685,8 @@ CREATE TABLE `stat_hour` (
PRIMARY KEY (`id`)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小时统计表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `sys_agreement`;
CREATE TABLE `sys_agreement` (
CREATE TABLE `sys_agreement` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`agreement_key` varchar(255) NOT NULL DEFAULT '' COMMENT '协议关键字',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '协议标题',
@ -677,7 +698,7 @@ CREATE TABLE `sys_agreement` (
DROP TABLE IF EXISTS `sys_area`;
CREATE TABLE `sys_area` (
CREATE TABLE `sys_area` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '父级',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
@ -692,7 +713,7 @@ CREATE TABLE `sys_area` (
DROP TABLE IF EXISTS `sys_attachment`;
CREATE TABLE `sys_attachment` (
CREATE TABLE `sys_attachment` (
`att_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '附件名称',
`real_name` varchar(255) NOT NULL DEFAULT '' COMMENT '原始文件名',
@ -710,7 +731,7 @@ CREATE TABLE `sys_attachment` (
DROP TABLE IF EXISTS `sys_attachment_category`;
CREATE TABLE `sys_attachment_category` (
CREATE TABLE `sys_attachment_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '父级ID',
`type` varchar(50) NOT NULL DEFAULT '' COMMENT '文件管理类型image,video',
@ -723,22 +744,23 @@ CREATE TABLE `sys_attachment_category` (
DROP TABLE IF EXISTS `sys_backup_records`;
CREATE TABLE `sys_backup_records` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '主键id',
`version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备份版本号',
`backup_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备份标识',
`content` TEXT DEFAULT NULL COMMENT '备份内容',
`status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '状态',
`fail_reason` LONGTEXT DEFAULT NULL COMMENT '失败原因',
`remark` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '备注',
`create_time` INT NOT NULL DEFAULT 0 COMMENT '创建时间',
`complete_time` INT NOT NULL DEFAULT 0 COMMENT '完成时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '备份记录表' ROW_FORMAT = Dynamic;
CREATE TABLE `sys_backup_records`
(
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备份版本号',
`backup_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备份标识',
`content` TEXT DEFAULT NULL COMMENT '备份内容',
`status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '状态',
`fail_reason` LONGTEXT DEFAULT NULL COMMENT '失败原因',
`remark` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '备注',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`complete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '完成时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='备份记录表';
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` (
CREATE TABLE `sys_config` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`config_key` varchar(255) NOT NULL DEFAULT '' COMMENT '配置项关键字',
`value` text NULL COMMENT '配置值json',
@ -751,7 +773,7 @@ CREATE TABLE `sys_config` (
DROP TABLE IF EXISTS `sys_cron_task`;
CREATE TABLE `sys_cron_task` (
CREATE TABLE `sys_cron_task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`status` int(11) NOT NULL DEFAULT 1 COMMENT '任务状态',
`count` int(11) NOT NULL DEFAULT 0 COMMENT '执行次数',
@ -773,7 +795,7 @@ CREATE TABLE `sys_cron_task` (
DROP TABLE IF EXISTS `sys_dict`;
CREATE TABLE `sys_dict` (
CREATE TABLE `sys_dict` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '字典名称',
`key` varchar(100) NOT NULL DEFAULT '' COMMENT '字典关键词',
@ -817,16 +839,17 @@ CREATE TABLE `verify` (
`data` varchar(255) NOT NULL DEFAULT '' COMMENT '核销参数',
`type` varchar(30) NOT NULL DEFAULT '' COMMENT '核销类型',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '核销时间',
`verifier_member_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销会员id',
`verifier_member_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员的会员id',
`value` varchar(1000) NOT NULL DEFAULT '' COMMENT '核销内容',
`body` varchar(500) NOT NULL DEFAULT '' COMMENT '描述',
`relate_tag` varchar(255) NOT NULL DEFAULT '' COMMENT '业务标识',
`is_admin` tinyint NOT NULL DEFAULT 0 COMMENT '是否后台核销0-否1-是',
PRIMARY KEY (`id`)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '核销记录' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
CREATE TABLE `sys_menu` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
`app_type` varchar(255) NOT NULL DEFAULT 'admin' COMMENT '应用类型',
`menu_name` varchar(32) NOT NULL DEFAULT '' COMMENT '菜单名称',
@ -853,7 +876,7 @@ CREATE TABLE `sys_menu` (
DROP TABLE IF EXISTS `sys_notice`;
CREATE TABLE `sys_notice` (
CREATE TABLE `sys_notice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(50) NOT NULL DEFAULT '' COMMENT '标识',
`sms_content` text NULL COMMENT '短信配置参数',
@ -871,7 +894,7 @@ CREATE TABLE `sys_notice` (
DROP TABLE IF EXISTS `sys_notice_log`;
CREATE TABLE `sys_notice_log` (
CREATE TABLE `sys_notice_log` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '通知记录ID',
`key` varchar(255) NULL DEFAULT '' COMMENT '消息key',
`notice_type` varchar(50) NULL DEFAULT 'sms' COMMENT '消息类型sms,wechat.weapp',
@ -891,7 +914,7 @@ CREATE TABLE `sys_notice_log` (
DROP TABLE IF EXISTS `sys_notice_sms_log`;
CREATE TABLE `sys_notice_sms_log` (
CREATE TABLE `sys_notice_sms_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号码',
`sms_type` varchar(32) NOT NULL DEFAULT '' COMMENT '发送关键字(注册、找回密码)',
@ -910,11 +933,11 @@ CREATE TABLE `sys_notice_sms_log` (
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
CREATE TABLE `sys_role` (
`role_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '角色id',
`role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
`rules` text NULL COMMENT '角色权限(menus_id)',
`addon_keys` text COMMENT '角色应用权限应用key',
`addon_keys` TEXT DEFAULT NULL COMMENT '角色应用权限应用key',
`status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '最后修改时间',
@ -971,7 +994,7 @@ CREATE TABLE `sys_printer_template` (
DROP TABLE IF EXISTS `sys_schedule`;
CREATE TABLE `sys_schedule` (
CREATE TABLE `sys_schedule` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`addon` varchar(255) NOT NULL DEFAULT '' COMMENT '所属插件',
`key` varchar(255) NOT NULL DEFAULT '' COMMENT '计划任务模板key',
@ -1005,23 +1028,25 @@ CREATE TABLE `sys_schedule_log` (
DROP TABLE IF EXISTS `sys_upgrade_records`;
CREATE TABLE `sys_upgrade_records` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '主键id',
`upgrade_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '升级标识',
`app_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '插件标识',
`name` LONGTEXT DEFAULT NULL COMMENT '升级名称',
`content` TEXT DEFAULT NULL COMMENT '升级内容',
`prev_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '前一版本',
`current_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '当前版本',
`status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '状态',
`fail_reason` LONGTEXT DEFAULT NULL COMMENT '失败原因',
`create_time` INT NOT NULL DEFAULT 0 COMMENT '创建时间',
`complete_time` INT NOT NULL DEFAULT 0 COMMENT '完成时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '升级记录表' ROW_FORMAT = Dynamic;
CREATE TABLE `sys_upgrade_records`
(
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`upgrade_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '升级标识',
`app_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '插件标识',
`name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '升级名称',
`content` TEXT DEFAULT NULL COMMENT '升级内容',
`prev_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '前一版本',
`current_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '当前版本',
`status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '状态',
`fail_reason` LONGTEXT DEFAULT NULL COMMENT '失败原因',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`complete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '完成时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='升级记录表';
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
CREATE TABLE `sys_user` (
`uid` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '系统用户ID',
`username` varchar(255) NOT NULL DEFAULT '' COMMENT '用户账号',
`head_img` varchar(255) NOT NULL DEFAULT '',
@ -1043,13 +1068,13 @@ CREATE TABLE `sys_user` (
DROP TABLE IF EXISTS `sys_user_log`;
CREATE TABLE `sys_user_log` (
CREATE TABLE `sys_user_log` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理员操作记录ID',
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT '登录IP',
`uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员id',
`username` varchar(255) NOT NULL DEFAULT '' COMMENT '管理员姓名',
`operation` varchar(255) NOT NULL DEFAULT '' COMMENT '操作描述',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '链接',
`url` varchar(300) NOT NULL DEFAULT '' COMMENT '链接',
`params` longtext DEFAULT NULL COMMENT '参数',
`type` varchar(32) NOT NULL DEFAULT '' COMMENT '请求方式',
`create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作时间',
@ -1058,7 +1083,7 @@ CREATE TABLE `sys_user_log` (
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
CREATE TABLE `sys_user_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
`role_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '角色id',
@ -1070,7 +1095,7 @@ CREATE TABLE `sys_user_role` (
DROP TABLE IF EXISTS `weapp_version`;
CREATE TABLE `weapp_version` (
CREATE TABLE `weapp_version` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`version` varchar(255) NOT NULL DEFAULT '',
`version_no` int(11) NOT NULL DEFAULT 1,
@ -1124,7 +1149,7 @@ CREATE TABLE `web_nav` (
DROP TABLE IF EXISTS `wechat_fans`;
CREATE TABLE `wechat_fans` (
CREATE TABLE `wechat_fans` (
`fans_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '粉丝ID',
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '昵称',
`avatar` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
@ -1149,7 +1174,7 @@ CREATE TABLE `wechat_fans` (
DROP TABLE IF EXISTS `wechat_media`;
CREATE TABLE `wechat_media` (
CREATE TABLE `wechat_media` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '类型',
`value` text NULL COMMENT '',
@ -1161,7 +1186,7 @@ CREATE TABLE `wechat_media` (
DROP TABLE IF EXISTS `wechat_reply`;
CREATE TABLE `wechat_reply` (
CREATE TABLE `wechat_reply` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '规则名称',
`keyword` varchar(64) NOT NULL DEFAULT '' COMMENT '关键词',

View File

@ -11,10 +11,9 @@
namespace app\job\notice;
use app\dict\sys\ConfigKeyDict;
use app\service\core\sys\CoreConfigService;
use core\base\BaseJob;
use core\exception\NoticeException;
use think\facade\Log;
/**
* 消息发送任务
@ -35,10 +34,13 @@ class Notice extends BaseJob
//通过业务获取模板变量属于以及发送对象
$result = event('NoticeData', ['key' => $key, 'data' => $data, 'template' => $template]);
$notice_data = array_values(array_filter($result))[0] ?? [];
Log::write("消息发送任务");
Log::write($notice_data);
if (empty($notice_data)) throw new NoticeException('NOTICE_TEMPLATE_IS_NOT_EXIST');
event('Notice', ['key' => $key, 'to' => $notice_data['to'], 'vars' => $notice_data['vars'], 'template' => $template]);
return true;
}catch (\Exception $e){
Log::write("消息发送任务异常".$e->getMessage());
throw new \Exception($e->getMessage());
}
}

View File

@ -0,0 +1,124 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\schedule;
use core\base\BaseJob;
use think\facade\Log;
/**
* 队列异步调用定时任务
*/
class AutoClearPosterAndQrcode extends BaseJob
{
public function doJob()
{
Log::write('AutoClearPosterAndQrcode 定时清除 二维码及海报数据开始' . date('Y-m-d H:i:s'));
try {
// 清理海报目录
$dir = 'upload/poster';
$dir = public_path($dir);
Log::write('AutoClearPosterAndQrcode尝试清理海报目录: ' . $dir);
$res = $this->clearDirectory($dir);
Log::write('AutoClearPosterAndQrcode海报目录清理结果: ' . ($res ? '成功' : '失败'));
// 清理二维码目录
$qrcode_dir = 'upload/qrcode';
$qrcode_dir = public_path($qrcode_dir);
Log::write('AutoClearPosterAndQrcode尝试清理二维码目录: ' . $qrcode_dir);
$res = $this->clearDirectory($qrcode_dir);
Log::write('AutoClearPosterAndQrcode二维码目录清理结果: ' . ($res ? '成功' : '失败'));
return true;
} catch (\Exception $e) {
Log::write('AutoClearPosterAndQrcode 定时清除异常: ' . $e->getMessage() . ' 位置: ' . $e->getFile() . ':' . $e->getLine() . $e->getTraceAsString());
return false;
}
}
/**
* 清空指定目录下的所有文件和子目录
*
* @param string $directory 目录路径
* @param bool $preserveDirectory 是否保留根目录(默认保留)
* @return bool 是否成功执行
*/
function clearDirectory(string $directory, bool $preserveDirectory = true): bool
{
// 规范化目录路径统一使用DIRECTORY_SEPARATOR
$directory = rtrim(realpath($directory), DIRECTORY_SEPARATOR);
Log::write('AutoClearPosterAndQrcode开始清理目录: ' . $directory);
// 检查目录是否存在
if (!is_dir($directory)) {
Log::write('AutoClearPosterAndQrcode目录不存在或不是有效目录: ' . $directory);
return false;
}
// 打开目录
$handle = opendir($directory);
if (!$handle) {
Log::write('AutoClearPosterAndQrcode无法打开目录: ' . $directory);
return false;
}
// 遍历目录内容
while (($entry = readdir($handle)) !== false) {
// 跳过当前目录和上级目录
if ($entry === '.' || $entry === '..') {
continue;
}
// 使用DIRECTORY_SEPARATOR确保路径分隔符正确
$path = $directory . DIRECTORY_SEPARATOR . $entry;
// 递归处理子目录
if (is_dir($path)) {
// 递归清空子目录
if (!$this->clearDirectory($path, false)) {
Log::write('AutoClearPosterAndQrcode递归清理子目录失败: ' . $path);
closedir($handle);
return false;
}
Log::write('AutoClearPosterAndQrcode已递归删除子目录: ' . $path);
// 子目录已经在递归调用中被删除,不需要再次删除
} else {
// 删除文件
if (!unlink($path)) {
Log::write('AutoClearPosterAndQrcode删除文件失败: ' . $path);
closedir($handle);
return false;
}
}
}
// 关闭目录句柄
closedir($handle);
// 是否删除根目录本身
if (!$preserveDirectory) {
Log::write('AutoClearPosterAndQrcode准备删除根目录: ' . $directory);
if (!rmdir($directory)) {
Log::write('AutoClearPosterAndQrcode删除根目录失败: ' . $directory);
return false;
}
Log::write('AutoClearPosterAndQrcode成功删除根目录: ' . $directory);
} else {
Log::write('AutoClearPosterAndQrcode保留根目录: ' . $directory);
}
return true;
}
}

View File

@ -15,6 +15,7 @@ return [
'EDIT_SUCCESS' => '编辑成功',
'DELETE_SUCCESS' => '删除成功',
'MODIFY_SUCCESS' => '更新成功',
'VERIFY_SUCCESS' => '核销成功',
'FAIL' => '操作失败',
'SAVE_FAIL' => '保存失败',
'EDIT_FAIL' => '修改失败',
@ -39,6 +40,7 @@ return [
'ADDON_INSTALL_EXECUTED' => '插件安装任务已执行',
'ADDON_INSTALLING' => '插件安装中',
'INSTALL_CHECK_NOT_PASS' => '安装校验未通过',
'ADMIN_INDEX_VIEW_PATH_NOT_EXIST' => '当前首页路径不存在',
'ADDON_SQL_FAIL' => '插件sql执行失败',
'ADDON_DIR_FAIL' => '插件文件操作失败',
'LAYOUT_NOT_EXIST' => '该布局不存在',
@ -92,6 +94,7 @@ return [
//用户管理
'USER_NOT_EXIST' => '用户不存在',
'ADMIN_NOT_ALLOW_EDIT_ROLE' => '超级管理员不允许改动权限',
'USERNAME_REPEAT' => '账号重复',
//角色管理
@ -144,6 +147,7 @@ return [
'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在',
'MEMBER_IS_EXIST' => '账号已存在',
'MEMBER_NO_IS_EXIST' => '会员编号已存在',
'MEMBER_NO_CREATE_ERROR' => '会员编号创建失败',
'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道',
'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开启账号登录注册',
'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册',
@ -192,6 +196,7 @@ return [
//海报
'POSTER_NOT_EXIST' => '海报不存在',
'POSTER_IN_USE_NOT_ALLOW_MODIFY' => '海报使用中禁止修改状态',
'POSTER_CREATE_ERROR' => '海报组件未配置完善,请联系管理员',
//万能表单
'DIY_FORM_NOT_EXIST' => '表单不存在',
@ -287,6 +292,7 @@ return [
'NEED_TO_AUTHORIZE_FIRST' => '使用云服务需先进行授权',
'WEAPP_UPLOADING' => '小程序有正在上传的版本,请等待上一版本上传完毕后再进行操作',
'CLOUD_BUILD_TASK_EXIST' => '已有正在执行中的编译任务',
'CONNECT_FAIL' => '连接失败',
//核销相关
'VERIFY_TYPE_ERROR' => '核销类型错误',

View File

@ -79,10 +79,12 @@ return [
'dict_sms_api' => [
'template_status_again_report' => '需重新报备',
'template_status_need_edit' => '需修改报备参数',
'template_status_need_pull' => '需拉取同步状态',
'template_status_not_report' => '未报备',
'template_status_wait' => '待审核',
'template_status_pass' => '审核通过',
'template_status_refuse' => '审核不通过',
'template_need_pull' => '需拉取同步',
//验证码-1 行业通知-2 营销推广-3
'template_type_verify_code' => '验证码',
@ -102,6 +104,7 @@ return [
//上传附件类型
'type_image' => '图片',
'type_video' => '视频',
'type_audio' => '音频',
//存储方式
'storage_type_local' => '本地存储',
'storage_type_qiniu' => '七牛云',
@ -346,6 +349,7 @@ return [
'dealing' => '退款中',
'wait' => '待退款',
'fail' => '退款失败',
'cancel' => '已取消',
'wechatpay' => '微信原路退款',
'alipay' => '支付宝原路退款',
'unipay' => '银联原路退款',

View File

@ -11,7 +11,6 @@
namespace app\listener\diy_form_export;
use app\model\diy_form\DiyFormRecords;
use app\model\diy_form\DiyFormRecordsFields;
use app\service\admin\diy_form\DiyFormService;
@ -33,7 +32,7 @@ class DiyFormRecordsFieldsExportDataListener
$json_field_list = array_filter($field_list, function($v) { return in_array($v[ 'field_type' ], [ 'FormRadio', 'FormCheckbox', 'FormDateScope', 'FormTimeScope' ]); });
$records_field_model = new DiyFormRecordsFields();
foreach ($simple_field_list as $k => &$v) {
foreach ($simple_field_list as $k => $v) {
$value_list = $records_field_model->field('form_id, field_key, field_type, field_name, field_value, count(*) as write_count')->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
@ -56,7 +55,7 @@ class DiyFormRecordsFieldsExportDataListener
}
$data = array_merge($data, $value_list);
}
foreach ($json_field_list as $k => &$v) {
foreach ($json_field_list as $k => $v) {
$field_list = $records_field_model->field('form_id, field_key, field_type, field_name, field_value')->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
@ -64,7 +63,7 @@ class DiyFormRecordsFieldsExportDataListener
$total_count = 0;
$value_list = [];
foreach ($field_list as $k1 => &$v1) {
foreach ($field_list as $k1 => $v1) {
if ($v1[ 'field_type' ] != 'FormCheckbox') {
$key = $v1[ 'field_key' ] . '_' . $v1[ 'render_value' ];
if (isset($value_list[ $key ])) {
@ -114,4 +113,4 @@ class DiyFormRecordsFieldsExportDataListener
}
return $data;
}
}
}

View File

@ -7,6 +7,7 @@ use app\service\core\member\CoreMemberService;
use app\service\core\notice\CoreNoticeLogService;
use core\exception\NoticeException;
use core\template\TemplateLoader;
use think\facade\Log;
class Weapp
{
@ -18,6 +19,7 @@ class Weapp
$key = $data['key'];
$to = $data['to'];//发送对象主题
Log::write("小程序消息发送" . json_encode($data));
//完全信任消息的设置, 不再依赖support_type
if ($template['is_weapp']) {
$member_id = $to['member_id'] ?? 0;
@ -26,6 +28,7 @@ class Weapp
$openid = $info['weapp_openid'] ?? '';
$nickname = $info['nickname'] ?? '';
}
Log::write("小程序消息发送 member_id:{$member_id} openid:{$openid}");
if (!empty($openid)) {
$weapp_template_id = $template['weapp_template_id'];
$weapp = $template['weapp'];
@ -49,6 +52,8 @@ class Weapp
'params' => $data,
'content' => $weapp
);
Log::write("小程序消息发送参数" . json_encode($log_data));
try {
(new TemplateLoader(NoticeTypeDict::WEAPP))->send(
[
@ -58,7 +63,7 @@ class Weapp
'page' => $url,
]);
(new CoreNoticeLogService())->add($log_data);
} catch ( NoticeException $e ) {
} catch (NoticeException $e) {
$log_data['result'] = $e->getMessage();
(new CoreNoticeLogService())->add($log_data);
//这儿决定要不要抛出
@ -71,4 +76,4 @@ class Weapp
return true;
}
}
}

View File

@ -21,6 +21,5 @@ class AppInitListener
public function handle()
{
//加载插件语言包
return;
}
}
}

View File

@ -23,7 +23,6 @@ class Poster
switch ($type) {
case 'friendspay':// 找朋友帮忙付海报
return ( new FriendspayPoster() )->handle($data);
break;
default:
$param = $data[ 'param' ];
$member_id = $param[ 'member_id' ] ?? 0;
@ -51,7 +50,6 @@ class Poster
'headimg' => $headimg,
];
return $return_data;
break;
}
}
}

View File

@ -21,7 +21,7 @@ class PosterType
'type' => 'friendspay',
'addon' => '',
'name' => '找朋友帮忙付海报',
'decs' => '找朋友帮忙付,分享后进入帮付页面',
'desc' => '找朋友帮忙付,分享后进入帮付页面',
'icon' => 'static/resource/images/poster/type_friendspay.png'
],
];

View File

@ -30,6 +30,13 @@ class ShowAppListener
],
// 工具
'tool' => [
[
'title' => '核销管理',
'desc' => '管理核销员及核销记录',
'icon' => 'static/resource/images/marketing/verifier.png',
'key' => 'verify',
'url' => '/marketing/verify/index',
],
[
'title' => '万能表单',
'desc' => '适用于各种应用场景,满足多样化的业务需求',
@ -51,6 +58,7 @@ class ShowAppListener
'key' => 'setting_export',
'url' => '/setting/export',
],
],
// 营销
'promotion' => [

View File

@ -30,17 +30,9 @@ class ShowMarketingListener
],
// 工具
'tool' => [
],
// 营销
'marketing' => [
[
'title' => '核销管理',
'desc' => '管理核销员及核销记录',
'icon' => 'static/resource/images/marketing/verifier.png',
'key' => 'verify',
'url' => '/marketing/verifier',
],
[
'title' => '签到管理',
'desc' => '客户每日签到发放奖励',

View File

@ -44,6 +44,7 @@ class Dict extends BaseModel
/**
* 搜索器:数据字典字典名称
* @param $query
* @param $value
* @param $data
*/
@ -56,6 +57,7 @@ class Dict extends BaseModel
/**
* 搜索器:数据字典字典关键词
* @param $query
* @param $value
* @param $data
*/

View File

@ -201,7 +201,11 @@ class Diy extends BaseModel
public function searchTypeAttr($query, $value, $data)
{
if ($value) {
$query->where("type", $value);
if(is_array($value)){
$query->where("type", 'in', $value);
}else{
$query->where("type", $value);
}
}
}

View File

@ -11,8 +11,6 @@
namespace app\model\diy;
use app\dict\diy\PagesDict;
use app\dict\diy\TemplateDict;
use core\base\BaseModel;

View File

@ -76,7 +76,7 @@ class DiyFormRecords extends BaseModel
/**
* 搜索器:创建时间
* @param $query
* @param Query $query
* @param $value
* @param $data
*/

View File

@ -17,6 +17,7 @@ use app\dict\member\MemberDict;
use app\dict\member\MemberLoginTypeDict;
use app\dict\member\MemberRegisterChannelDict;
use app\dict\member\MemberRegisterTypeDict;
use app\dict\sys\FileDict;
use core\base\BaseModel;
use think\db\Query;
use think\model\concern\SoftDelete;
@ -275,5 +276,15 @@ class Member extends BaseModel
{
return $this->hasOne(MemberLevel::class, 'level_id', 'member_level')->bind([ 'member_level_name' => 'level_name' ]);
}
/**
* 获取头像缩略图(小)
*/
public function getHeadimgSmallAttr($value, $data)
{
if (isset($data['headimg']) && $data['headimg'] != '') {
return get_thumb_images($data['headimg'], FileDict::SMALL);
}
return '';
}
}

View File

@ -128,7 +128,7 @@ class MemberAccountLog extends BaseModel
/**
* 关键词搜索
* @param $query
* @param Query $query
* @param $value
* @param $data
*/

View File

@ -11,6 +11,7 @@
namespace app\model\pay;
use app\dict\common\CommonActiveDict;
use app\dict\pay\PayDict;
use app\dict\pay\RefundDict;
use core\base\BaseModel;
@ -134,4 +135,12 @@ class Refund extends BaseModel
$query->where('refund_no', 'like', "%$value%");
}
}
public function getTradeTypeNameAttr($value, $data)
{
if (empty($data['trade_type'])){
return '';
}
return CommonActiveDict::getActiveShort($data['trade_type'])['active_name'] ?? "";
}
}

View File

@ -11,7 +11,6 @@
namespace app\model\pay;
use app\dict\pay\TransferDict;
use core\base\BaseModel;
/**

View File

@ -57,6 +57,7 @@ class SysPrinter extends BaseModel
/**
* 搜索器:小票打印机
* @param $query
* @param $value
* @param $data
*/
@ -69,6 +70,7 @@ class SysPrinter extends BaseModel
/**
* 搜索器:小票打印机设备品牌易联云365飞鹅
* @param $query
* @param $value
* @param $data
*/
@ -81,6 +83,7 @@ class SysPrinter extends BaseModel
/**
* 搜索器:小票打印机打印机名称
* @param $query
* @param $value
* @param $data
*/
@ -93,6 +96,7 @@ class SysPrinter extends BaseModel
/**
* 搜索器:小票打印机状态0关闭1开启
* @param $query
* @param $value
* @param $data
*/

View File

@ -57,6 +57,7 @@ class SysPrinterTemplate extends BaseModel
/**
* 搜索器:小票打印模板
* @param $query
* @param $value
* @param $data
*/
@ -69,6 +70,7 @@ class SysPrinterTemplate extends BaseModel
/**
* 搜索器:小票打印模板模板类型
* @param $query
* @param $value
* @param $data
*/
@ -81,6 +83,7 @@ class SysPrinterTemplate extends BaseModel
/**
* 搜索器:小票打印模板模板名称
* @param $query
* @param $value
* @param $data
*/

View File

@ -35,7 +35,7 @@ class Verify extends BaseModel
protected $name = 'verify';
// 设置json类型字段
protected $json = [ 'data', 'value' ];
protected $json = ['data', 'value'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
@ -47,7 +47,7 @@ class Verify extends BaseModel
/**
* 核销码搜索
* @param $query
* @param Query $query
* @param $value
* @param $data
*/
@ -60,7 +60,7 @@ class Verify extends BaseModel
/**
* 关键词搜索
* @param $query
* @param Query $query
* @param $value
* @param $data
*/
@ -120,27 +120,57 @@ class Verify extends BaseModel
*/
public function searchCreateTimeAttr(Query $query, $value, $data)
{
$start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]);
$end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]);
$start_time = empty($value[0]) ? 0 : strtotime($value[0]);
$end_time = empty($value[1]) ? 0 : strtotime($value[1]);
if ($start_time > 0 && $end_time > 0) {
$query->whereBetweenTime('create_time', $start_time, $end_time);
} else if ($start_time > 0 && $end_time == 0) {
$query->where([ [ 'create_time', '>=', $start_time ] ]);
$query->where([['create_time', '>=', $start_time]]);
} else if ($start_time == 0 && $end_time > 0) {
$query->where([ [ 'create_time', '<=', $end_time ] ]);
$query->where([['create_time', '<=', $end_time]]);
}
}
/**
* 订单id搜索
* @param $query
* @param $value
* @param $data
* @return void
*/
public function searchOrderIdAttr($query, $value, $data)
{
if ($value) {
$query->where("data", "like", '%"' . $value . '"%');
}
}
/**
* 会员id搜索
* @param $query
* @param $value
* @param $data
* @return void
*/
public function searchMemberIdAttr($query, $value, $data)
{
if ($value) {
$query->where("data", "like", '%"' . $value . '"%');
}
}
/**
* 核销类型转换
* @param $value
* @param $data
* @return void
*/
public function getTypeNameAttr($value, $data)
{
if (empty($data[ 'type' ]))
if (empty($data['type']))
return '';
return VerifyDict::getType()[ $data[ 'type' ] ][ 'name' ] ?? '';
return VerifyDict::getType()[$data['type']]['name'] ?? '';
}
}

View File

@ -24,15 +24,16 @@ use core\base\BaseAdminService;
*/
class AddonDevelopService extends BaseAdminService
{
public $core_addon_develop_service;
public function __construct()
{
parent::__construct();
}
/**
* 新增插件开发
* @param string $key
* @param array $data
* @return mixed
* @return true
*/
public function add(string $key, array $data)
{
@ -41,9 +42,9 @@ class AddonDevelopService extends BaseAdminService
/**
* 编辑插件开发
* @param int $id
* @param string $key
* @param array $data
* @return SysAttachment
* @return true
*/
public function edit(string $key, array $data)
{
@ -53,8 +54,8 @@ class AddonDevelopService extends BaseAdminService
/**
* 删除插件开发
* @param int $id
* @return mixed
* @param string $key
* @return true
*/
public function del(string $key)
{
@ -74,7 +75,7 @@ class AddonDevelopService extends BaseAdminService
/**
* 查询
* @param $key
* @return void
* @return array
*/
public function getInfo($key){
return (new CoreAddonService())->getAddonDevelopInfo($key);
@ -83,7 +84,7 @@ class AddonDevelopService extends BaseAdminService
/**
* 打包
* @param string $key
* @return array
* @return true|null
*/
public function build(string $key){
return (new CoreAddonDevelopBuildService())->build($key);
@ -93,7 +94,7 @@ class AddonDevelopService extends BaseAdminService
/**
* 下载
* @param string $key
* @return true
* @return array|string|string[]|\think\response\File
*/
public function download(string $key){
return (new CoreAddonDevelopBuildService())->download($key);

View File

@ -14,6 +14,7 @@ namespace app\service\admin\addon;
use app\dict\addon\AddonDict;
use app\model\addon\Addon;
use app\model\sys\SysMenu;
use app\service\core\addon\CoreAddonCloudService;
use app\service\core\addon\CoreAddonDownloadService;
use app\service\core\addon\CoreAddonInstallService;
@ -108,7 +109,7 @@ class AddonService extends BaseAdminService
/**
* @param string $addon
* @return void
* @return array|array[]|null
*/
public function uninstallCheck(string $addon)
{
@ -176,6 +177,12 @@ class AddonService extends BaseAdminService
return ( new CoreAddonService() )->getInstallAddonList();
}
public function getAddonList()
{
$addon_list = $this->model->where([ [ 'status', '=', AddonDict::ON ], [ 'type', '=', 'addon' ] ])->append([ 'status_name' ])->column('title, icon, key, desc, status, type, support_app', 'key');
return $addon_list;
}
/**
* 应用key缓存
* @param $keys
@ -219,18 +226,69 @@ class AddonService extends BaseAdminService
public function getShowAppTools()
{
$list = [
'addon' => [
'title' => '运营工具',
'tool' => $this->getAllAddonAndTool()[ 'tool' ],
];
return $list;
}
/**
* 查询营销列表
* @return array
*/
public function getShowMarketingTools()
{
$all = $this->getAllAddonAndTool();
$list = [
'marketing' => $all[ 'marketing' ],
'addon' => $all[ 'addon' ],
];
return $list;
}
private function getMarketing()
{
$list = [
'marketing' => [
'title' => '营销活动',
'list' => []
]
];
$apps = event('ShowMarketing');
$keys = [];
foreach ($apps as $v) {
foreach ($v as $ck => $cv) {
if (!empty($cv)) {
foreach ($cv as $addon_k => $addon_v) {
if (in_array($addon_v[ 'key' ], $keys)) {
continue;
}
$list[ $ck ][ 'list' ][] = $addon_v;
$keys[] = $addon_v[ 'key' ];
}
}
}
}
return $list;
}
private function getAllAddonAndTool()
{
$markting_list = $this->getMarketing() ?? [];
$markting = $markting_list[ 'marketing' ];
$marking_addon = $markting_list[ 'tool' ][ 'list' ] ?? [];
$list = [
'marketing' => $markting,
'addon' => [
'title' => '营销工具',
'list' => $marking_addon
],
'tool' => [
'title' => '系统工具',
'list' => []
],
// 'promotion' => [
// 'title' => '营销活动',
// 'list' => []
// ]
]
];
$apps = event('ShowApp');
@ -252,15 +310,40 @@ class AddonService extends BaseAdminService
}
$addons = $this->model->where([ [ 'status', '=', AddonDict::ON ] ])->append([ 'status_name' ])->column('title, icon, key, desc, status, type, support_app', 'key');
if (!empty($addons)) {
foreach ($addons as $k => $v) {
if (!in_array($v[ 'key' ], $keys) && $v[ 'type' ] == AddonDict::ADDON && $v[ 'status' ] == AddonDict::ON) {
$menu_model = ( new SysMenu() );
$site_addons = $this->getAddonList();
if (!empty($site_addons)) {
foreach ($site_addons as $k => $v) {
if ($v[ 'type' ] == 'app') {
unset($site_addons[ $k ]);
}
}
$addon_urls = $menu_model
->where([ [ 'addon', 'in', array_column($site_addons, 'key') ], [ 'is_show', '=', 1 ], [ 'menu_type', '=', 1 ] ])
->order('id asc')
->group('addon')
->column('router_path', 'addon');
foreach ($site_addons as $k => $v) {
$continue = true;
if (!empty($markting[ 'list' ])) {
foreach ($markting[ 'list' ] as $key => $val) {
if ($v[ 'key' ] == $val[ 'key' ]) {
unset($site_addons[ $k ]);
$continue = false;
}
}
}
if ($continue && !in_array($v[ 'key' ], $keys)) {
$url = $addon_urls[ $v[ 'key' ] ] ?? '';
$list[ 'addon' ][ 'list' ][] = [
'title' => $v[ 'title' ],
'desc' => $v[ 'desc' ],
'icon' => $v[ 'icon' ],
'key' => $v[ 'key' ]
'key' => $v[ 'key' ],
'url' => $url ? '/' . $url : ''
];
}
}
@ -268,38 +351,4 @@ class AddonService extends BaseAdminService
return $list;
}
/**
* 查询营销列表
* @return array
*/
public function getShowMarketingTools()
{
$list = [
'marketing' => [
'title' => '营销活动',
'list' => []
]
];
$apps = event('ShowMarketing');
$keys = [];
foreach ($apps as $v) {
foreach ($v as $ck => $cv) {
if (!empty($cv)) {
foreach ($cv as $addon_k => $addon_v) {
if (in_array($addon_v[ 'key' ], $keys)) {
continue;
}
$list[ $ck ][ 'list' ][] = $addon_v;
$keys[] = $addon_v[ 'key' ];
}
}
}
}
return $list;
}
}

View File

@ -88,8 +88,8 @@ class LoginService extends BaseAdminService
//查询权限以及菜单
$data = [
'token' => $token_info[ 'token' ],
'expires_time' => $token_info[ 'params' ][ 'exp' ],
'token' => $token_info['token'],
'expires_time' => $token_info['params']['exp'],
'userinfo' => [
'uid' => $userinfo->uid,
'username' => $userinfo->username,

View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\channel;
use app\dict\sys\ConfigKeyDict;
use app\service\core\channel\CoreAppService;
use app\service\core\channel\CoreH5Service;
use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService;
/**
* 配置服务层
* Class ConfigService
* @package app\service\core\sys
*/
class AppService extends BaseAdminService
{
/**
* 设置app信息
* @param array $value
* @return bool
*/
public function setConfig(array $value)
{
return (new CoreAppService())->setConfig($value);
}
/**
* 获取app配置
* @return mixed
*/
public function getConfig(){
return (new CoreAppService())->getConfig();
}
}

View File

@ -13,6 +13,9 @@ namespace app\service\admin\dict;
use app\model\dict\Dict;
use core\base\BaseAdminService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
@ -99,8 +102,10 @@ class DictService extends BaseAdminService
/**
* 获取全部数据字典
* @param array $where
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getAll()
{

View File

@ -314,6 +314,17 @@ class DiyService extends BaseAdminService
$data[ 'component' ] = $this->getComponentList($data[ 'type' ]);
$data[ 'domain_url' ] = ( new SystemService() )->getUrl();
$diy_template = [];
if (!empty($data[ 'name' ])) {
$diy_template = TemplateDict::getTemplate([
'key' => [ $data[ 'name' ] ]
]);
if (!empty($diy_template)) {
$diy_template = $diy_template[ $data[ 'name' ] ];
}
}
$data[ 'global' ] = $diy_template[ 'global' ] ?? [];
return $data;
}
@ -325,11 +336,27 @@ class DiyService extends BaseAdminService
public function getComponentList(string $name = '')
{
$data = ComponentDict::getComponent();
$diy_template = [];
if (!empty($name)) {
$diy_template = TemplateDict::getTemplate([
'key' => [ $name ]
]);
if (!empty($diy_template)) {
$diy_template = $diy_template[ $name ];
}
}
foreach ($data as $k => $v) {
// 查询组件支持的页面
$sort_arr = [];
foreach ($v[ 'list' ] as $ck => $cv) {
$support_page = $cv[ 'support_page' ];
// 过滤忽略组件名单
if (!empty($name) && !empty($diy_template) && isset($diy_template[ 'ignoreComponents' ]) && in_array($ck, $diy_template[ 'ignoreComponents' ])) {
unset($data[ $k ][ 'list' ][ $ck ]);
continue;
}
// 过滤页面不支持的组件
if (!( count($support_page) == 0 || in_array($name, $support_page) )) {
unset($data[ $k ][ 'list' ][ $ck ]);
continue;
@ -338,6 +365,10 @@ class DiyService extends BaseAdminService
$sort_arr [] = $cv[ 'sort' ];
unset($data[ $k ][ 'list' ][ $ck ][ 'sort' ], $data[ $k ][ 'list' ][ $ck ][ 'support_page' ]);
}
if (empty($data[ $k ][ 'list' ])) {
unset($data[ $k ]);
continue;
}
array_multisort($sort_arr, SORT_ASC, $data[ $k ][ 'list' ]); //排序,根据 sort 排序
}
@ -394,6 +425,34 @@ class DiyService extends BaseAdminService
return $link;
}
/**
* 获取自定义链接
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function pageLink()
{
$order = "update_time desc";
$field = 'id,title,page_title,name,template,type,mode,is_default,share,visit_count,create_time,update_time';
$query = $this->model
->whereOr([
[
[ 'type', '=', 'DIY_PAGE' ],
],
[
[ 'type', '<>', 'DIY_PAGE' ],
[ 'is_default', '=', 0 ]
]
])->field($field)->append([ 'type_name' ])->order($order);
$list = $this->pageQuery($query);
foreach ($list[ 'data' ] as &$item) {
$item[ 'url' ] = '/app/pages/index/diy?id=' . $item[ 'id' ];
}
return $list;
}
/**
* 修改分享内容
* @param int $id
@ -746,7 +805,7 @@ class DiyService extends BaseAdminService
$data[ $value[ 'key' ] ][ 'title' ] = $theme_data[ $value[ 'key' ] ][ 'title' ] ?? ( !empty($addon_theme) ? $addon_theme[ 'theme_color' ][ 0 ][ 'title' ] : '' );
$data[ $value[ 'key' ] ][ 'theme' ] = $theme_data[ $value[ 'key' ] ][ 'theme' ] ?? ( !empty($addon_theme) ? $addon_theme[ 'theme_color' ][ 0 ][ 'theme' ] : '' );
}
if (count($apps) > 1) {// 应用数量大于1时展示系统主题色设置只有一个应用时不展示系统主题色设置
if (empty($data) || count($apps) > 1) {// 应用数量大于1时展示系统主题色设置只有一个应用时不展示系统主题色设置
$data = array_merge($app_theme, $data);
}

View File

@ -37,15 +37,14 @@ class NiucloudService extends BaseAdminService
* @param $data
* @return \app\model\sys\SysConfig|bool|\think\Model
*/
public function setAuthorize($data)
{
public function setAuthorize($data){
$data = [
'auth_code' => $data[ 'auth_code' ],
'auth_secret' => $data[ 'auth_secret' ]
'auth_code' => $data['auth_code'],
'auth_secret' => $data['auth_secret']
];
$service = ( new CoreAuthService($data[ 'auth_code' ], $data[ 'auth_secret' ]) );
$auth_info = $service->getAuthInfo()[ 'data' ] ?? [];
$service = (new CoreAuthService($data['auth_code'], $data['auth_secret']));
$auth_info = $service->getAuthInfo()['data'] ?? [];
if (empty($auth_info)) throw new CommonException('AUTH_NOT_EXISTS');
$service->clearAccessToken();
return $this->core_config_service->setConfig(ConfigKeyDict::NIUCLOUD_CONFIG, $data);
@ -55,33 +54,31 @@ class NiucloudService extends BaseAdminService
* 获取授权信息
* @return mixed|string[]
*/
public function getAuthorize()
{
public function getAuthorize(){
$info = $this->core_config_service->getConfig(ConfigKeyDict::NIUCLOUD_CONFIG);
if (empty($info)) {
if(empty($info))
{
$info = [];
$info[ 'value' ] = [
$info['value'] = [
'auth_code' => '',
'auth_secret' => ''
];
}
return $info[ 'value' ];
return $info['value'];
}
/**
* 获取框架最新版本
*/
public function getFrameworkLastVersion()
{
return ( new CoreModuleService() )->getFrameworkLastVersion();
public function getFrameworkLastVersion() {
return (new CoreModuleService())->getFrameworkLastVersion();
}
/**
* 获取框架版本更新记录
*/
public function getFrameworkVersionList()
{
return ( new CoreModuleService() )->getFrameworkVersionList();
public function getFrameworkVersionList() {
return (new CoreModuleService())->getFrameworkVersionList();
}
public function applyExperience()
@ -92,8 +89,37 @@ class NiucloudService extends BaseAdminService
/**
* 获取应用/插件的版本更新记录
*/
public function getAppVersionList($app_key)
{
return ( new CoreModuleService() )->getAppVersionList($app_key);
public function getAppVersionList($app_key) {
return (new CoreModuleService())->getAppVersionList($app_key);
}
/**
* 设置 本地服务器地址
* @param $data
* @return \app\model\sys\SysConfig|bool|\think\Model
*/
public function setLocalCloudCompileConfig($data){
$data = [
'baseUri' => $data['url'],
'isOpen' => $data['is_open'],
];
return $this->core_config_service->setConfig('LOCAL_CLOUD_COMPILE_CONFIG', $data);
}
/**
* 获取 本地服务器地址
* @param $data
* @return \app\model\sys\SysConfig|bool|array|\think\Model
*/
public function getLocalCloudCompileConfig(){
$config = $this->core_config_service->getConfig('LOCAL_CLOUD_COMPILE_CONFIG')['value'] ?? [];
return [
'baseUri' => $config['baseUri'] ?? '',
'isOpen' => $config['isOpen'] ?? 0,
];
}
}

View File

@ -20,6 +20,9 @@ use app\service\core\notice\CoreNiuSmsService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use core\exception\ApiException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 消息管理服务层
@ -30,7 +33,7 @@ class NiuSmsService extends BaseAdminService
{
parent::__construct();
$this->template_model = new NiuSmsTemplate();
$this->niu_service = new CoreNiuSmsService();
$this->niu_service = (new CoreNiuSmsService());
}
public function enableNiuSms($enable)
@ -73,7 +76,7 @@ class NiuSmsService extends BaseAdminService
/**
* 发送动态码
* @param $mobile
* @param $params
* @return mixed
*/
public function sendMobileCode($params)
@ -84,7 +87,6 @@ class NiuSmsService extends BaseAdminService
/**
* 发送动态码
* @param $mobile
* @return mixed
*/
public function captcha()
@ -100,7 +102,11 @@ class NiuSmsService extends BaseAdminService
*/
public function registerAccount($data)
{
$data['imgUrl'] = !empty($data['imgUrl']) ? request()->domain() . $data['imgUrl'] : "";
if (!empty($data['imgUrl']) && strstr($data['imgUrl'], 'http') === false) {
$data['imgUrl'] = request()->domain() . "/" . $data['imgUrl'];
} else {
$data['imgUrl'] = $data['imgUrl'] ?? '';
}
$res = $this->niu_service->registerAccount($data);
return $res;
}
@ -114,7 +120,7 @@ class NiuSmsService extends BaseAdminService
{
$account_info = $this->niu_service->loginAccount($params);
if ($account_info) {
(new CoreNiuSmsService())->setNiuLoginConfig($params);
(new CoreNiuSmsService())->setNiuLoginConfig($params, true);
}
return $account_info;
}
@ -147,7 +153,7 @@ class NiuSmsService extends BaseAdminService
* 重置转牛云短信账号密码
* @param $username
* @param $params
* @return mixed
* @return array
*/
public function resetPassword($username, $params)
{
@ -163,29 +169,10 @@ class NiuSmsService extends BaseAdminService
];
}
/**
* 重置转牛云短信账号密码
* @param $username
* @param $params
* @return mixed
*/
public function forgetPassword($username, $params)
{
$account_info = $this->accountInfo($username);
$mobile_arr = explode(",", $account_info['mobiles']);
if (!in_array($params['mobile'], $mobile_arr)) {
throw new ApiException('ACCOUNT_BIND_MOBILE_ERROR');
}
$res = $this->niu_service->resetPassword($username, $params);
$this->niu_service->setNiuLoginConfig(['username' => $username, 'password' => $res['newPassword']]);
return [
'password' => $res['newPassword'],
];
}
/**
* 获取牛云短信账号发送短信列表
* @param $username
* @param $params
* @return array
*/
public function accountSendList($username, $params)
@ -246,7 +233,11 @@ class NiuSmsService extends BaseAdminService
*/
public function signCreate($username, $params)
{
$params['imgUrl'] = !empty($params['imgUrl']) ? request()->domain() . $params['imgUrl'] : "";
if (!empty($params['imgUrl']) && strstr($params['imgUrl'], 'http') === false) {
$params['imgUrl'] = request()->domain() . '/' . $params['imgUrl'];
} else {
$params['imgUrl'] = $params['imgUrl'] ?? '';
}
$res = $this->niu_service->signCreate($username, $params);
if (!empty($res['failList'])) {
throw new AdminException($res['failList'][0]['msg']);
@ -257,6 +248,8 @@ class NiuSmsService extends BaseAdminService
* 签名创建
* @param $username
* @param $params
* @return array|mixed
* @throws \Exception
*/
public function signDelete($username, $params)
{
@ -273,8 +266,10 @@ class NiuSmsService extends BaseAdminService
* 拉取模版状态
* @param $sms_type
* @param $username
* @param $page
* @return void|array
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function syncTemplateList($sms_type, $username)
{
@ -398,17 +393,22 @@ class NiuSmsService extends BaseAdminService
sort($variable);
$audit_status = $report_info['audit_status'] ?? NoticeTypeDict::TEMPLATE_AUDIT_STATUS_NOT_REPORT;
$error_status = '';
if (!empty($report_info) && $variable != $params_json) {
$error_status = $audit_status == NoticeTypeDict::TEMPLATE_AUDIT_STATUS_PASS
? NoticeTypeDict::TEMPLATE_AUDIT_STATUS_NEED_AGAIN_REPORT
: NoticeTypeDict::TEMPLATE_AUDIT_STATUS_NEED_EDIT;
if (empty($params_json)) {
$error_status = NoticeTypeDict::TEMPLATE_NEED_PULL;
} else {
$error_status = $audit_status == NoticeTypeDict::TEMPLATE_AUDIT_STATUS_PASS
? NoticeTypeDict::TEMPLATE_AUDIT_STATUS_NEED_AGAIN_REPORT
: NoticeTypeDict::TEMPLATE_AUDIT_STATUS_NEED_EDIT;
}
}
$item['audit_info'] = [
'audit_msg' => $report_info['audit_msg'] ?? '',
'audit_status' => $audit_status,
'audit_status_name' => NoticeTypeDict::getTemplateAuditStatus($audit_status),
'error_status' => $error_status ?? '',
'error_status' => $error_status,
'error_status_name' => !empty($error_status) ? NoticeTypeDict::getTemplateAuditStatus($error_status) : ""
];
}
@ -491,7 +491,7 @@ class NiuSmsService extends BaseAdminService
* @param $sms_type
* @param $username
* @param $template_key
* @return mixed
* @return array
*/
public function templateInfo($sms_type, $username, $template_key)
{
@ -608,6 +608,7 @@ class NiuSmsService extends BaseAdminService
/**
* 获取订单列表
* @param $username
* @param $params
* @return mixed
*/
public function orderList($username, $params)

View File

@ -11,25 +11,11 @@
namespace app\service\admin\pay;
use app\dict\common\ChannelDict;
use app\dict\pay\PayDict;
use app\dict\pay\PaySceneDict;
use app\dict\pay\TransferDict;
use app\model\member\Member;
use app\model\pay\Pay;
use app\model\sys\Poster;
use app\service\core\pay\CorePayService;
use app\service\core\pay\CoreTransferSceneService;
use app\service\core\pay\CoreTransferService;
use app\service\core\paytype\CoreOfflineService;
use app\service\core\sys\CoreSysConfigService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Log;
/**
* 支付服务层
*/

View File

@ -149,4 +149,15 @@ class ScheduleService extends BaseAdminService
{
return (new CoreScheduleService())->doSchedule($id);
}
/**
* 重置定时任务
* @return true
*/
public function resetSchedule()
{
return (new CoreScheduleService())->resetSchedule();
}
}

View File

@ -142,6 +142,11 @@ class AreaService extends BaseAdminService
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
// 设置 Referer 头(需替换为你的授权域名)
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Referer: ' . $this->request->domain()
]);
$res = curl_exec($curl);
$res = json_decode($res, true);
if($res){

View File

@ -11,11 +11,10 @@
namespace app\service\admin\sys;
use app\service\core\channel\CoreH5Service;
use app\service\core\sys\CoreConfigService;
use app\service\core\sys\CoreSysConfigService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use app\service\core\channel\CoreH5Service;
/**
* 配置服务层
@ -200,10 +199,11 @@ class ConfigService extends BaseAdminService
/**
* 设置开发者key
* @param array $data
* @return array
* @return \app\model\sys\SysConfig|array|bool|\think\Model
*/
public function setDeveloperToken(array $data)
{
return ( new CoreConfigService() )->setConfig("DEVELOPER_TOKEN", $data);
}
}

View File

@ -137,7 +137,7 @@ class MenuService extends BaseAdminService
$where = [
[ 'menu_key', 'in', $menu_keys ],
];
$addons = get_site_addons();
$addons = get_install_addons();
$addons[] = '';
$delete_menu_addon = [];
@ -194,7 +194,7 @@ class MenuService extends BaseAdminService
$cache_name,
function() use ($status, $is_tree, $is_button) {
$where = [
[ 'addon', 'in', array_merge([ '' ], get_site_addons()) ]
[ 'addon', 'in', array_merge([ '' ], get_install_addons()) ]
];
if ($status != 'all') {
$where[] = [ 'status', '=', $status ];
@ -203,7 +203,7 @@ class MenuService extends BaseAdminService
// 排除菜单
$delete_menu_addon = [];
$addon_loader = new DictLoader("Menu");
foreach (get_site_addons() as $addon) {
foreach (get_install_addons() as $addon) {
$delete_menu = $addon_loader->load([ "addon" => $addon, "app_type" => 'admin' ])[ 'delete' ] ?? [];
if (!empty($delete_menu) && is_array($delete_menu)) $delete_menu_addon[] = $delete_menu;
}

View File

@ -230,6 +230,9 @@ class RoleService extends BaseAdminService
*/
public function getUserRoles($role_ids)
{
if (empty($role_ids)){
return [];
}
$cache_name = 'user_roles_' . md5(implode('_', $role_ids));;
return cache_remember(
$cache_name,

View File

@ -210,15 +210,15 @@ class BackupRecordsService extends BaseAdminService
// 检测全部目录及文件是否可读可写,忽略指定目录
// 忽略指定目录admin
$exclude_admin_dir = [ 'dist', 'node_modules' ];
$exclude_admin_dir = [ 'dist', 'node_modules', '.git' ];
$check_res = checkDirPermissions(project_path() . 'admin', [], $exclude_admin_dir);
// 忽略指定目录uni-app
$exclude_uniapp_dir = [ 'dist', 'node_modules' ];
$exclude_uniapp_dir = [ 'dist', 'node_modules', '.git' ];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'uni-app', [], $exclude_uniapp_dir));
// 忽略指定目录web
$exclude_web_dir = [ '.nuxt', '.output', 'dist', 'node_modules' ];
$exclude_web_dir = [ '.nuxt', '.output', 'dist', 'node_modules', '.git' ];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'web', [], $exclude_web_dir));
// 忽略指定目录niucloud
@ -229,7 +229,8 @@ class BackupRecordsService extends BaseAdminService
'public' . DIRECTORY_SEPARATOR . 'upload',
'public' . DIRECTORY_SEPARATOR . 'file',
'runtime',
'vendor'
'vendor',
'.git'
];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'niucloud', [], $exclude_niucloud_dir));
@ -632,7 +633,7 @@ class BackupRecordsService extends BaseAdminService
// 备份niucloud全部代码
$niucloud_dir = $backup_dir . 'niucloud' . DIRECTORY_SEPARATOR;
dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs: [ 'runtime', 'upload' ]);
dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs: [ 'runtime', 'upload' ], exclude_files: ['.user.ini']);
return true;
}

View File

@ -11,6 +11,7 @@
namespace app\service\admin\upgrade;
/**
* 框架及插件升级备份
* @package app\service\core\upgrade
@ -19,7 +20,7 @@ class BackupService extends UpgradeService
{
/**
* 备份代码
* @return void
* @return true
*/
public function backupCode()
{
@ -40,7 +41,7 @@ class BackupService extends UpgradeService
// 备份niucloud全部代码
$niucloud_dir = $backup_dir . 'niucloud' . DIRECTORY_SEPARATOR;
dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs: [ 'runtime', 'upload' ]);
dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs: [ 'runtime', 'upload' ], exclude_files: ['.user.ini']);
return true;
}

View File

@ -42,6 +42,7 @@ trait ExecuteSqlTrait
/**
* 处理sql增加表前缀
* @param $sql
* @param $prefix
* @return void
*/
public function handleSqlPrefix($sql, $prefix) {

View File

@ -14,7 +14,6 @@ namespace app\service\admin\upgrade;
use app\dict\sys\UpgradeDict;
use app\model\sys\SysUpgradeRecords;
use core\base\BaseAdminService;
use think\facade\Log;
/**
* 升级记录表服务层
@ -81,7 +80,8 @@ class UpgradeRecordsService extends BaseAdminService
/**
* 执行失败,更新升级记录状态,备份记录状态
* @param $fail_reason
* @param $upgrade_key
* @param array $fail_reason
* @return void
*/
public function failed($upgrade_key, $fail_reason = [])

View File

@ -86,7 +86,7 @@ class UpgradeService extends BaseAdminService
/**
* 升级前环境检测
* @param string $addon
* @return void
* @return array|array[]
*/
public function upgradePreCheck(string $addon = '')
{
@ -126,15 +126,15 @@ class UpgradeService extends BaseAdminService
// 检测全部目录及文件是否可读可写,忽略指定目录
// 忽略指定目录admin
$exclude_admin_dir = [ 'dist', 'node_modules' ];
$exclude_admin_dir = [ 'dist', 'node_modules', '.git' ];
$check_res = checkDirPermissions(project_path() . 'admin', [], $exclude_admin_dir);
// 忽略指定目录uni-app
$exclude_uniapp_dir = [ 'dist', 'node_modules' ];
$exclude_uniapp_dir = [ 'dist', 'node_modules', '.git' ];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'uni-app', [], $exclude_uniapp_dir));
// 忽略指定目录web
$exclude_web_dir = [ '.nuxt', '.output', 'dist', 'node_modules' ];
$exclude_web_dir = [ '.nuxt', '.output', 'dist', 'node_modules', '.git' ];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'web', [], $exclude_web_dir));
// 忽略指定目录niucloud
@ -146,7 +146,8 @@ class UpgradeService extends BaseAdminService
'public' . DIRECTORY_SEPARATOR . 'file',
'runtime',
'vendor',
'.user.ini'
'.user.ini',
'.git'
];
$check_res = array_merge2($check_res, checkDirPermissions(project_path() . 'niucloud', [], $exclude_niucloud_dir));
@ -431,7 +432,7 @@ class UpgradeService extends BaseAdminService
/**
* 覆盖更新升级的代码
* @return void
* @return array|true
*/
public function coverCode($index = 0, $addon = "")
{
@ -563,7 +564,6 @@ class UpgradeService extends BaseAdminService
/**
* 处理手机端
* @param string $verson_no
* @return true
*/
public function handleUniapp()
@ -639,7 +639,7 @@ class UpgradeService extends BaseAdminService
/**
* 刷新菜单
* @return void
* @return array|true
*/
public function refreshMenu($addon = "")
{
@ -692,7 +692,7 @@ class UpgradeService extends BaseAdminService
/**
* 获取云编译日志
* @return void
* @return array|true
*/
public function gteCloudBuildLog()
{
@ -730,7 +730,7 @@ class UpgradeService extends BaseAdminService
/**
* 更新完成
* @return void
* @return true
*/
public function upgradeComplete()
{
@ -750,7 +750,7 @@ class UpgradeService extends BaseAdminService
/**
* 升级出错之后的处理
* @return true|void
* @return void
*/
public function upgradeErrorHandle($fail_reason = [])
{
@ -771,7 +771,7 @@ class UpgradeService extends BaseAdminService
/**
* 恢复源码
* @return void
* @return true
*/
public function restoreCode()
{
@ -794,7 +794,7 @@ class UpgradeService extends BaseAdminService
/**
* 恢复数据库
* @return void
* @return array|true
*/
public function restoreSql($index = 0)
{
@ -833,7 +833,7 @@ class UpgradeService extends BaseAdminService
/**
* 获取升级内容
* @param string $addon
* @return array|\core\util\niucloud\Response|object|\Psr\Http\Message\ResponseInterface
* @return array
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getUpgradeContent(string $addon = '')

View File

@ -32,13 +32,16 @@ class UploadService extends BaseAdminService
* 附件库上传图片
* @param $file
* @param int $cate_id
* @param bool $is_attachment
* @return array
* @throws Exception
*/
public function image($file, int $cate_id = 0, $is_attachment = true){
$dir = $this->root_path.'/image/'.date('Ym').'/'.date('d');
public function image($file, int $cate_id = 0, $is_attachment = true)
{
$dir = $this->root_path . '/' . 'image' . '/' . date('Ym') . '/' . date('d');
$core_upload_service = new CoreUploadService($is_attachment);
//如果没有选择相册分组的话,就选择第一个相册分组
return $core_upload_service->image($file, $dir, $cate_id);
return $core_upload_service->image($file,$dir, $cate_id);
}
/**
@ -47,12 +50,26 @@ class UploadService extends BaseAdminService
* @param int $cate_id
* @return array
*/
public function video($file, int $cate_id = 0){
$dir = $this->root_path.'/video/'.date('Ym').'/'.date('d');
public function video($file, int $cate_id = 0)
{
$dir = $this->root_path . '/' . 'video' . '/' . date('Ym') . '/' . date('d');
$core_upload_service = new CoreUploadService(true);
return $core_upload_service->video($file, $dir, $cate_id);
}
/**
* 附件库上传音频
* @param $file
* @param int $cate_id
* @return array
*/
public function audio($file, int $cate_id = 0)
{
$dir = $this->root_path . '/' . 'audio' . '/' . date('Ym') . '/' . date('d');
$core_upload_service = new CoreUploadService(true);
return $core_upload_service->audio($file,$dir, $cate_id);
}
/**
* 文件上传
* @param $file
@ -60,11 +77,12 @@ class UploadService extends BaseAdminService
* @return array
* @throws Exception
*/
public function document($file, string $type){
if(!in_array($type, FileDict::getSceneType()))
public function document($file, string $type)
{
if (!in_array($type, FileDict::getSceneType()))
throw new UploadFileException('UPLOAD_TYPE_ERROR');
$dir = $this->root_path.'/document/'.$type.'/'.date('Ym').'/'.date('d');
$dir = $this->root_path . '/document/' . $type . '/' . date('Ym') . '/' . date('d');
$core_upload_service = new CoreUploadService();
return $core_upload_service->document($file, $type, $dir, StorageDict::LOCAL);
}
}
}

View File

@ -12,6 +12,7 @@
namespace app\service\admin\verify;
use app\model\verify\Verify;
use app\service\core\verify\CoreVerifyService;
use core\base\BaseAdminService;
/**
@ -35,14 +36,29 @@ class VerifyService extends BaseAdminService
*/
public function getPage(array $where = [])
{
$search_model = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'code', 'type', 'create_time', 'verifier_member_id' ], $where)
->with([ 'member' => function($query) {
$search_model = $this->model->where([['id', '>', 0]])->withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag', 'keyword', 'order_id'], $where)
->with(['member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
} ])->field('*')->order('create_time desc')->append([ 'type_name' ]);
}])->field('*')->order('create_time desc')->append(['type_name']);
$list = $this->pageQuery($search_model);
return $list;
}
/**
* 获取核销记录列表
* @param array $where
* @return array
* @throws \think\db\exception\DbException
*/
public function getList(array $where = [])
{
$list = $this->model->where([['id', '>', 0]])->withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag', 'keyword', 'order_id'], $where)
->with(['member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}])->field('*')->order('create_time desc')->append(['type_name'])->select()->toArray();
return $list;
}
/**
* 获取核销信息
* @param string $verify_code
@ -51,15 +67,40 @@ class VerifyService extends BaseAdminService
public function getDetail(string $verify_code)
{
$info = $this->model->where([
[ 'code', '=', $verify_code ]
['code', '=', $verify_code]
])->field('*')
->with([ 'member' => function($query) {
->with(['member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
} ])->append([ 'type_name' ])->findOrEmpty()->toArray();
}])->append(['type_name'])->findOrEmpty()->toArray();
$info[ 'verify_info' ] = event('VerifyInfo', $info);
$info['verify_info'] = event('VerifyInfo', $info);
return $info;
}
/**
* 框架后台核销
* @param string $verify_code
* @param $num
* @return true
*/
public function verify(string $verify_code, $num = 1)
{
return (new CoreVerifyService())->adminVerify($verify_code);
}
/**
* 框架后台核销
* @param string $verify_code
* @param $num
* @return true
*/
public function getInfoByCode(string $verify_code)
{
return (new CoreVerifyService())->adminGetInfoByCode($verify_code);
}
}

View File

@ -12,17 +12,9 @@
namespace app\service\api\pay;
use app\dict\common\ChannelDict;
use app\dict\pay\PaySceneDict;
use app\model\member\Member;
use app\model\pay\Pay;
use app\model\sys\Poster;
use app\service\core\member\CoreMemberService;
use app\service\core\pay\CorePayService;
use core\base\BaseApiService;
use core\exception\ApiException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 支付业务
@ -39,16 +31,9 @@ class TransferService extends BaseApiService
/**
* 去支付
* @param string $type
* @param string $trade_type
* @param int $trade_id
* @param string $return_url
* @param string $quit_url
* @param string $buyer_id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @param string $transfer_no
* @param array $data
* @return void
*/
public function confirm(string $transfer_no, array $data = []){

View File

@ -103,7 +103,7 @@ class AreaService extends BaseApiService
/**
* 通过经纬度查询地址
* @param $params
* @return array|int
* @return array
*/
public function getAddressByLatlng($params)
{

View File

@ -15,6 +15,8 @@ use app\model\verify\Verifier;
use app\model\verify\Verify;
use app\service\core\verify\CoreVerifyService;
use core\base\BaseApiService;
use core\util\Barcode;
use think\db\exception\DbException;
/**
* 核销服务层
@ -26,29 +28,38 @@ class VerifyService extends BaseApiService
* 获取核销码(对应业务调用)
* @param $type
* @param $data = ['order_id' => , 'goods_id' => ]
* @return string
* @return array
*/
public function getVerifyCode($type, array $data)
public function getVerifyCode($type, array $data, $is_need_barcode = 0)
{
$list = ( new CoreVerifyService() )->create($this->member_id, $type, $data);
$temp = [];
foreach ($list as $item) {
$temp[] = [
'code' => $item,
'qrcode' => qrcode($item, '', [], outfile: false)
$list = (new CoreVerifyService())->create($this->member_id, $type, $data);
$return = [];
foreach ($list as $code) {
$temp = [
'code' => $code,
'qrcode' => qrcode($code, '', [], outfile: false)
];
if ($is_need_barcode == 1) {
$qrcode_dir = 'upload/temp';
if (!is_dir($qrcode_dir)) mkdir($qrcode_dir, intval('0755', 8), true);
// 生成核销码条形码
$barcode_path = (new Barcode(14, $code))->generateBarcode($qrcode_dir, 2);
$barcode = image_to_base64($barcode_path);
$temp['barcode'] = $barcode;
}
$return[] = $temp;
}
return $temp;
return $return;
}
/**
* 获取核销信息
* @param $code
* @return bool
* @return array
*/
public function getInfoByCode($code)
{
return ( new CoreVerifyService() )->getInfoByCode($this->member_id,$code);
return (new CoreVerifyService())->getInfoByCode($this->member_id, $code);
}
/**
@ -58,7 +69,7 @@ class VerifyService extends BaseApiService
*/
public function verify($code)
{
return ( new CoreVerifyService() )->verify($code, $this->member_id);
return (new CoreVerifyService())->verify($code, $this->member_id);
}
/**
@ -67,50 +78,94 @@ class VerifyService extends BaseApiService
*/
public function checkVerifier()
{
$verifier = ( new Verifier() )->where([ [ 'member_id', '=', $this->member_id ] ])->findOrEmpty();
$verifier = (new Verifier())->where([['member_id', '=', $this->member_id]])->findOrEmpty();
if (!$verifier->isEmpty()) return true;
return false;
}
/**
* 获取核销员核销记录
* @param $data
* @param array $data
* @return array
* @throws \think\db\exception\DbException
* @throws DbException
*/
public function getRecordsPageByVerifier(array $data)
{
$field = '*';
$search_model = ( new Verify() )->where([
[ 'verifier_member_id', '=', $this->member_id ]
])->withSearch([ 'code', 'type', 'create_time', 'relate_tag', 'keyword' ], $data)
$search_model = (new Verify())->where([
['verifier_member_id', '=', $this->member_id]
])->withSearch(['code', 'type', 'create_time', 'relate_tag', 'keyword'], $data)
->with([
'member' => function($query) {
'member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}
])
->field($field)
->order('create_time desc')
->append([ 'type_name' ]);
->append(['type_name']);
return $this->pageQuery($search_model);
}
/**
* 获取记录详情
* @param int $id
* @param $code
* @return array
*/
public function getRecordsDetailByVerifier($code)
{
$field = '*';
return ( new Verify() )->where([
[ 'verifier_member_id', '=', $this->member_id ],
[ 'code', '=', $code ]
return (new Verify())->where([
['verifier_member_id', '=', $this->member_id],
['code', '=', $code]
])->with([
'member' => function($query) {
'member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}
])->field($field)->append([ 'type_name' ])->findOrEmpty()->toArray();
])->field($field)->append(['type_name'])->findOrEmpty()->toArray();
}
/**
* 获取核销记录列表
* @return array
* @throws DbException
*/
public function getRecordsList($data)
{
$field = '*';
$search_model = (new Verify())->where([
])->withSearch(['code', 'type', 'create_time', 'relate_tag', 'keyword', 'order_id'], $data)
->with([
'member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}
])
->field($field)
->order('create_time desc')
->append(['type_name']);
return $this->pageQuery($search_model);
}
/**
* 获取核销记录列表
* @return array
* @throws DbException
*/
public function getMemberRecordsList($data)
{
$data['member_id'] = $this->member_id;
$field = '*';
$search_model = (new Verify())->where([
])->withSearch(['code', 'type', 'create_time', 'relate_tag', 'keyword', 'order_id', 'member_id'], $data)
->with([
'member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}
])
->field($field)
->order('create_time desc')
->append(['type_name']);
return $this->pageQuery($search_model);
}
}

View File

@ -0,0 +1,203 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\api\wechat;
use app\dict\member\MemberLoginTypeDict;
use app\dict\member\MemberRegisterTypeDict;
use app\dict\scan\ScanDict;
use app\service\api\login\LoginService;
use app\service\api\login\RegisterService;
use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberService;
use app\service\core\scan\CoreScanService;
use app\service\core\wechat\CoreWechatAppService;
use app\service\core\wechat\CoreWechatFansService;
use app\service\core\wechat\CoreWechatServeService;
use core\base\BaseApiService;
use core\exception\ApiException;
use core\exception\AuthException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 微信配置模型
* Class WechatConfigService
* @package app\service\core\wechat
*/
class WechatAppService extends BaseApiService
{
/**
* 处理授权回调
* @param string $code
* @return array
*/
public function userFromCode(string $code)
{
$userinfo = CoreWechatAppService::userFromCode($code);
if (empty($userinfo)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$token_response = $userinfo->getTokenResponse();
if (empty($token_response)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$scope = $token_response[ 'scope' ];
if ($scope == 'snsapi_base') {//静默授权
$openid = $token_response[ 'openid' ] ?? '';
} else {
$openid = $userinfo->getId();//对应微信的 openid
$nickname = $userinfo->getNickname();//对应微信的 nickname
$avatar = $userinfo->getAvatar();//对应微信的 头像地址
}
$unionid = $userinfo->getRaw()[ 'unionid' ] ?? '';
if (empty($openid)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$is_snapshotuser = $userinfo->getRaw()[ 'is_snapshotuser' ] ?? 0;
if ($is_snapshotuser == 1) throw new ApiException('WECHAT_SNAPSHOUTUSER');
//todo 这儿还可能会获取用户昵称 头像 性别 ....用以更新会员信息
return [ $avatar ?? '', $nickname ?? '', $openid, $unionid ];
//todo 业务落地
}
/**
* 登录通过code
* @param string $code
* @return array|string[]|null
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function loginByCode(string $code)
{
[ $avatar, $nickname, $openid, $unionid ] = $this->userFromCode($code);
return $this->login($openid, $nickname, $avatar, $unionid);
}
/**
* 公众号登录
* @param string $openid
* @param string $nickname
* @param string $avatar
* @param string $unionid
* @return array|null
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function login(string $openid, string $nickname = '', string $avatar = '', string $unionid = '')
{
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo([ 'wxapp_openid' => $openid]);
if ($member_info->isEmpty() && !empty($unionid)) {
$member_info = $member_service->findMemberInfo([ 'wx_unionid' => $unionid]);
if (!$member_info->isEmpty()) {
$member_info->wx_openid = $openid;
}
}
if ($member_info->isEmpty()) {
$config = ( new MemberConfigService() )->getLoginConfig();
$is_auth_register = $config[ 'is_auth_register' ];
$is_force_access_user_info = $config[ 'is_force_access_user_info' ];
$is_bind_mobile = $config[ 'is_bind_mobile' ];
// 开启自动注册会员
if ($is_auth_register) {
// 开启强制获取会员信息并且开启强制绑定手机号,必须获取手机号才能进行注册,由于公众号无法主动获取,所以不能注册
if ($is_force_access_user_info && $is_bind_mobile) {
return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ];
} else if ($is_force_access_user_info) {
// 开启强制获取会员信息时,必须获取到昵称和头像才能进行注册
// if (!empty($nickname) && !empty($avatar)) {
if (empty($nickname)){
$nickname = unique_random();
}
return $this->register($openid, '', $nickname, $avatar, $unionid); // 获取到昵称和头像,然后进行注册
// } else {
// return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ];
// }
} else if ($is_bind_mobile) {
// 开启强制绑定手机号,必须获取手机号才能进行注册,由于公众号无法主动获取,所以不能注册
return [ 'openid' => $openid, 'unionid' => $unionid ];
} else if (!$is_force_access_user_info && !$is_bind_mobile) {
// 关闭强制获取用户信息、并且关闭强制绑定手机号的情况下允许注册
return $this->register($openid, '', $nickname, $avatar, $unionid);
}
} else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
} else {
// 可能会更新用户和粉丝表
$login_service = new LoginService();
// 若用户头像为空,那么从微信获取头像和昵称,然后进行更新
if (empty($member_info->headimg)) {
if (!empty($avatar)) $member_info->headimg = $avatar;
if (!empty($nickname)) $member_info->nickname = $nickname;
}
return $login_service->login($member_info, MemberLoginTypeDict::WECHAT);
}
}
/**
* 同步数据
* @param string $code
* @return true
*/
public function sync(string $code)
{
[ $avatar, $nickname, $openid ] = $this->userFromCode($code);
//更新粉丝
$core_wechat_fans_service = new CoreWechatFansService();
//这儿或许可以异步
$core_wechat_fans_service->edit($openid, [ 'avatar' => $avatar, 'nickname' => $nickname ]);
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo([ 'wxapp_openid' => $openid]);
if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
$member_service->editByFind($member_info, [ 'headimg' => $avatar, 'nickname' => $nickname ]);
return true;
}
/**
* 注册
* @param string $openid
* @param string $mobile
* @param string $nickname
* @param string $avatar
* @param string $wx_unionid
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function register(string $openid, string $mobile = '', string $nickname = '', string $avatar = '', string $wx_unionid = '')
{
$member_service = new MemberService();
$member_info = $member_service->findMemberInfo([ 'wxapp_openid' => $openid]);
if (!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在, 不能在注册
if (!empty($wx_unionid)) {
$member_info = $member_service->findMemberInfo([ 'wx_unionid' => $wx_unionid]);
if (!$member_info->isEmpty()) throw new AuthException('MEMBER_IS_EXIST');//账号已存在, 不能在注册
}
$register_service = new RegisterService();
return $register_service->register($mobile,
[
'wxapp_openid' => $openid,
'nickname' => $nickname,
'headimg' => $avatar,
'wx_unionid' => $wx_unionid
],
MemberRegisterTypeDict::APP
);
}
}

View File

@ -105,6 +105,7 @@ class WechatAuthService extends BaseApiService
* @param string $openid
* @param string $nickname
* @param string $avatar
* @param string $unionid
* @return array|null
* @throws DataNotFoundException
* @throws DbException
@ -268,4 +269,21 @@ class WechatAuthService extends BaseApiService
$member_service->editByFind($member_info, [ 'wx_openid' => $openid ]);
return true;
}
/**
* 更新openid用于H5注册账号后在公众号进行登录时绑定wx_openid
* @param string $wx_openid
* @return true
*/
public function updateOpenidByH5($wx_openid)
{
$member_service = new MemberService();
$member = $member_service->findMemberInfo([ 'wx_openid' => $wx_openid]);
if (!$member->isEmpty()) throw new AuthException('MEMBER_OPENID_EXIST');//openid已存在
$member_info = $member_service->findMemberInfo([ 'member_id' => $this->member_id]);
if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
$member_service->editByFind($member_info, [ 'wx_openid' => $wx_openid ]);
return true;
}
}

View File

@ -24,7 +24,7 @@ class CoreAddonCloudService extends CoreCloudBaseService
{
/**
* 云编译
* @param $addon
* @param string $addon
* @return void
*/
public function cloudBuild(string $addon) {
@ -148,6 +148,8 @@ class CoreAddonCloudService extends CoreCloudBaseService
/**
* 云编译成功
* @param string $addon
* @param array $log
* @param $timestamp
* @return void
*/
public function buildSuccess(string $addon, array $log, $timestamp) {
@ -290,8 +292,12 @@ class CoreAddonCloudService extends CoreCloudBaseService
/**
* 下载升级文件
* @param string $dir
* @param string $app_key
* @param string $token
* @param string $dir
* @param int $index
* @param int $step
* @param int $length
* @return void
*/
public function downloadUpgradeFile(string $app_key, string $token, string $dir = '', int $index = -1, $step = 0, $length = 0) {

View File

@ -37,7 +37,7 @@ class CoreAddonDevelopBuildService extends BaseCoreService
/**
* 插件打包
* @param string $addon
* @return void
* @return true
*/
public function build(string $addon)
{
@ -70,7 +70,7 @@ class CoreAddonDevelopBuildService extends BaseCoreService
/**
* 下载
* @param string $addon
* @return \think\response\File
* @return array|string|string[]
*/
public function download(string $addon) {
$zip_file = runtime_path() . $addon . '.zip';
@ -180,7 +180,7 @@ class CoreAddonDevelopBuildService extends BaseCoreService
/**
* admin打包
* @return void
* @return true
*/
public function admin()
{
@ -200,7 +200,7 @@ class CoreAddonDevelopBuildService extends BaseCoreService
/**
* wap打包
* @return void
* @return true
*/
public function uniapp()
{
@ -267,7 +267,7 @@ class CoreAddonDevelopBuildService extends BaseCoreService
/**
* web打包
* @return void
* @return true
*/
public function web()
{

View File

@ -41,7 +41,7 @@ class CoreAddonDevelopDownloadService extends CoreAddonBaseService
/**
* 下载插件
* @return true
* @return \think\response\File
*/
public function download()
{

View File

@ -283,13 +283,7 @@ class CoreAddonDevelopService extends CoreAddonBaseService
/**
* 生成新建插件
* @param array $title
* @param $desc
* @param $key
* @param $version
* @param $author
* @param $type
* @param $support_app
* @param array $data
* @return true
*/
public function add(array $data)

View File

@ -12,9 +12,7 @@
namespace app\service\core\addon;
use app\model\addon\Addon;
use app\service\core\niucloud\CoreModuleService;
use core\exception\AddonException;
use GuzzleHttp\Exception\GuzzleException;
use ZipArchive;
/**
@ -37,9 +35,8 @@ class CoreAddonDownloadService extends CoreAddonBaseService
/**
* 下载文件
* @param $app_key
* @param $version
* @return true
* @throws GuzzleException
* @throws GuzzleException
*/
public function download($app_key, $version)
{

View File

@ -34,12 +34,13 @@ trait WapTrait
$content .= " <view class=\"diy-group\" id=\"componentList\">\n";
$content .= " <top-tabbar :scrollBool=\"diyGroup.componentsScrollBool.TopTabbar\" v-if=\"data.global && Object.keys(data.global).length && data.global.topStatusBar && data.global.topStatusBar.isShow\" ref=\"topTabbarRef\" :data=\"data.global\" />\n";
$content .= " <pop-ads v-if=\"data.global && Object.keys(data.global).length && data.global.popWindow && data.global.popWindow.show\" ref=\"popAbsRef\" :data=\"data.global\" />\n";
$content .= " <view v-for=\"(component, index) in data.value\" :key=\"component.id\"\n";
$content .= " @click=\"diyStore.changeCurrentIndex(index, component)\"\n";
$content .= " :class=\"diyGroup.getComponentClass(index,component)\" :style=\"component.pageStyle\">\n";
$content .= " <view class=\"relative\" :style=\"{ marginTop : component.margin.top < 0 ? (component.margin.top * 2) + 'rpx' : '0' }\">\n";
$content .= " <!-- 装修模式下,设置负上边距后超出的内容,禁止选中设置 -->\n";
$content .= " <view v-if=\"diyGroup.isShowPlaceHolder(index,component)\" class=\"absolute w-full z-1\" :style=\"{ height : (component.margin.top * 2 * -1) + 'rpx' }\" @click.stop=\"diyGroup.placeholderEvent\"></view>\n";
$content .= " <template v-for=\"(component, index) in data.value\" :key=\"component.id\">\n";
$content .= " <view v-show=\"component.componentIsShow\"\n";
$content .= " @click=\"diyStore.changeCurrentIndex(index, component)\"\n";
$content .= " :class=\"diyGroup.getComponentClass(index,component)\" :style=\"component.pageStyle\">\n";
$content .= " <view class=\"relative\" :style=\"{ marginTop : component.margin.top < 0 ? (component.margin.top * 2) + 'rpx' : '0' }\">\n";
$content .= " <!-- 装修模式下,设置负上边距后超出的内容,禁止选中设置 -->\n";
$content .= " <view v-if=\"diyGroup.isShowPlaceHolder(index,component)\" class=\"absolute w-full z-1\" :style=\"{ height : (component.margin.top * 2 * -1) + 'rpx' }\" @click.stop=\"diyGroup.placeholderEvent\"></view>\n";
$root_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'app/components/diy'); // 系统自定义组件根目录
$file_arr = getFileMap($root_path);
@ -63,9 +64,10 @@ trait WapTrait
$name = implode('', $name_arr);
$file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name ref=\"diy{$name}Ref\" :component=\"component\" :global=\"data.global\" :index=\"index\" :scrollBool=\"diyGroup.componentsScrollBool.{$name}\" />\n";
$content .= " </template>\n";
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$event_str = '$event';
$content .= " <$file_name ref=\"diy{$name}Ref\" :component=\"component\" :global=\"data.global\" :index=\"index\" :scrollBool=\"diyGroup.componentsScrollBool.{$name}\" @update:componentIsShow=\"component.componentIsShow = {$event_str}\" />\n";
$content .= " </template>\n";
}
}
}
@ -80,7 +82,7 @@ trait WapTrait
$addon_arr[] = $v[ 'key' ];
}
}
if(!empty($addon)) {
if (!empty($addon)) {
$addon_arr[] = $addon; // 追加新装插件
}
$addon_arr = array_unique($addon_arr);
@ -104,9 +106,11 @@ trait WapTrait
$name = implode('', $name_arr);
$file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name ref=\"diy{$name}Ref\" :component=\"component\" :global=\"data.global\" :index=\"index\" :scrollBool=\"diyGroup.componentsScrollBool.{$name}\" />\n";
$content .= " </template>\n";
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$event_str = '$event';
$content .= " <$file_name ref=\"diy{$name}Ref\" :component=\"component\" :global=\"data.global\" :index=\"index\" :scrollBool=\"diyGroup.componentsScrollBool.{$name}\" @update:componentIsShow=\"component.componentIsShow = {$event_str}\" />\n";
$content .= " </template>\n";
$addon_import_content .= " import diy{$name} from '@/addon/" . $v . "/components/diy/{$path}/index.vue';\n";
}
@ -114,10 +118,10 @@ trait WapTrait
}
}
$content .= " </view>\n";
$content .= " </view>\n";
$content .= " </view>\n";
$content .= " <template v-if=\"diyStore.mode == '' && data.global && data.global.bottomTabBarSwitch\">\n";
$content .= " </template>\n";
$content .= " <template v-if=\"diyStore.mode == '' && data.global && data.global.bottomTabBar && data.global.bottomTabBar.isShow\">\n";
$content .= " <view class=\"pt-[20rpx]\"></view>\n";
$content .= " <tabbar />\n";
$content .= " </template>\n";
@ -198,7 +202,7 @@ trait WapTrait
$page_end = strtoupper($addon) . '_PAGE_END';
// 对0.2.0之前的版本做处理
$uniapp_pages[ 'pages' ] = preg_replace_callback('/(.*)(\\r\\n.*\/\/ PAGE_END.*)/s', function($match) {
$uniapp_pages[ 'pages' ] = preg_replace_callback('/(.*)(\\r\\n.*\/\/ PAGE_END.*)/s', function ($match) {
return $match[ 1 ] . ( substr($match[ 1 ], -1) == ',' ? '' : ',' ) . $match[ 2 ];
}, $uniapp_pages[ 'pages' ]);
@ -210,7 +214,7 @@ trait WapTrait
}
$content = @file_get_contents($compile_path . "pages.json");
$content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function($match) use ($pages) {
$content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function ($match) use ($pages) {
return $match[ 1 ] . PHP_EOL . implode(PHP_EOL, $pages) . PHP_EOL . $match[ 3 ];
}, $content);
@ -252,7 +256,7 @@ trait WapTrait
}
$content = @file_get_contents($compile_path . "pages.json");
$content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function($match) use ($pages) {
$content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function ($match) use ($pages) {
return $match[ 1 ] . PHP_EOL . implode(PHP_EOL, $pages) . PHP_EOL . $match[ 3 ];
}, $content);
// 找到页面路由文件 pages.json写入内容
@ -263,14 +267,13 @@ trait WapTrait
* 编译 加载插件标题语言包
* @param $compile_path
* @param $addon
* @param $addon
*/
public function compileLocale($compile_path, $addon)
{
$locale_data = [];
$root_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'locale'); // 系统语言包根目录
$file_arr = getFileMap($root_path, [], false);
$file_arr = getFileMap($root_path, []);
if (!empty($file_arr)) {
foreach ($file_arr as $ck => $cv) {
if (str_contains($cv, '.json')) {
@ -303,7 +306,7 @@ trait WapTrait
$addon_arr = array_unique($addon_arr);
foreach ($addon_arr as $k => $v) {
$addon_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'addon/' . $v . '/locale'); // 插件语言包根目录
$addon_file_arr = getFileMap($addon_path, [], false);
$addon_file_arr = getFileMap($addon_path, []);
if (!empty($addon_file_arr)) {
foreach ($addon_file_arr as $ck => $cv) {
if (str_contains($cv, '.json')) {

Some files were not shown because too many files have changed in this diff Show More