This commit is contained in:
zhangxingye 2025-02-22 17:20:36 +08:00
parent 9cecfc6c6a
commit b6b7198a2d
113 changed files with 7842 additions and 741 deletions

View File

@ -10,6 +10,7 @@ use think\db\exception\ModelNotFoundException;
use think\exception\Handle; use think\exception\Handle;
use think\exception\HttpException; use think\exception\HttpException;
use think\exception\HttpResponseException; use think\exception\HttpResponseException;
use think\exception\RouteNotFoundException;
use think\exception\ValidateException; use think\exception\ValidateException;
use think\facade\Log; use think\facade\Log;
use think\Response; use think\Response;
@ -92,6 +93,9 @@ class ExceptionHandle extends Handle
if (strpos($e->getMessage(), 'open_basedir') !== false) { if (strpos($e->getMessage(), 'open_basedir') !== false) {
return fail('OPEN_BASEDIR_ERROR'); return fail('OPEN_BASEDIR_ERROR');
} }
if (strpos($e->getMessage(), 'Allowed memory size of') !== false) {
return fail('PHP_SCRIPT_RUNNING_OUT_OF_MEMORY');
}
if ($e instanceof DbException) { if ($e instanceof DbException) {
return fail(get_lang('DATA_GET_FAIL').':'.$e->getMessage(), [ return fail(get_lang('DATA_GET_FAIL').':'.$e->getMessage(), [
'file' => $e->getFile(), 'file' => $e->getFile(),
@ -108,7 +112,9 @@ class ExceptionHandle extends Handle
return fail($e->getMessage(), [], $e->getCode() ?: 400); return fail($e->getMessage(), [], $e->getCode() ?: 400);
}else if($e instanceof ServerException){ }else if($e instanceof ServerException){
return fail($e->getMessage(), http_code:$e->getCode()); return fail($e->getMessage(), http_code:$e->getCode());
}else { } else if ($e instanceof RouteNotFoundException) {
return fail('当前访问路由未定义或不匹配 路由地址:' . request()->baseUrl());
} else {
return fail($e->getMessage(), $massageData); return fail($e->getMessage(), $massageData);
} }
} }

View File

@ -185,4 +185,9 @@ class Addon extends BaseAdminController
public function upgrade($addon = ''){ public function upgrade($addon = ''){
return success('DOWNLOAD_SUCCESS', (new AddonService())->upgrade($addon)); return success('DOWNLOAD_SUCCESS', (new AddonService())->upgrade($addon));
} }
public function showApp()
{
return success(data:(new AddonService())->getShowAppTools());
}
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -268,4 +268,41 @@ class Diy extends BaseAdminController
$id = ( new DiyService() )->copy($params); $id = ( new DiyService() )->copy($params);
return success('ADD_SUCCESS', [ 'id' => $id ]); return success('ADD_SUCCESS', [ 'id' => $id ]);
} }
/**
* 获取自定义主题配色
* @return Response
*/
public function getDiyTheme()
{
return success(( new DiyService() )->getDiyTheme());
}
/**
* 添加主题配色
* @return Response
*/
public function setDiyTheme()
{
$data = $this->request->params([
[ 'id', '' ],
[ 'key', '' ],
[ 'mode', '' ],
[ 'color_mark', '' ],
[ 'color_name', '' ],
[ 'diy_value', '' ],
[ 'value', '' ],
]);
( new DiyService() )->setDiyTheme($data);
return success('ADD_SUCCESS');
}
/**
* 设置主题配色
* @return Response
*/
public function getDefaultThemeColor()
{
return success(( new DiyService() )->getDefaultThemeColor());
}
} }

View File

@ -0,0 +1,370 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\diy;
use app\service\admin\diy_form\DiyFormConfig;
use app\service\admin\diy_form\DiyFormRecordsService;
use app\service\admin\diy_form\DiyFormService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
* 万能表单控制器
* Class DiyForm
* @package app\adminapi\controller\diy
*/
class DiyForm extends BaseAdminController
{
/**
* @notes 获取万能表单分页列表
* @return Response
*/
public function pages()
{
$data = $this->request->params([
[ "title", "" ],
[ "type", "" ],
[ 'addon', '' ]
]);
return success(( new DiyFormService() )->getPage($data));
}
/**
* @notes 获取万能表单列表
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function lists()
{
$data = $this->request->params([
[ "title", "" ],
[ 'status', 0 ],
[ "type", "" ],
[ 'addon', '' ]
]);
return success(( new DiyFormService() )->getList($data));
}
/**
* 万能表单详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new DiyFormService() )->getInfo($id));
}
/**
* 添加万能表单
* @return Response
*/
public function add()
{
$data = $this->request->params([
[ "title", "" ],
[ "page_title", "" ],
[ "type", "" ],
[ "value", [] ],
[ 'template', '' ],
]);
$this->validate($data, 'app\validate\diy\DiyForm.add');
$id = ( new DiyFormService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
}
/**
* 万能表单编辑
* @param $id
* @return Response
*/
public function edit($id)
{
$data = $this->request->params([
[ "title", "" ],
[ "page_title", "" ],
[ "value", [] ],
[ 'template', '' ],
]);
$this->validate($data, 'app\validate\diy\DiyForm.edit');
( new DiyFormService() )->edit($id, $data);
return success('MODIFY_SUCCESS');
}
/**
* 万能表单删除
* @return Response
*/
public function del()
{
$params = $this->request->params([
[ 'form_ids', [] ]
]);
( new DiyFormService() )->del($params[ 'form_ids' ]);
return success('DELETE_SUCCESS');
}
/**
* 获取万能表单初始化数据
* @return Response
* @throws DbException
*/
public function getInit()
{
$params = $this->request->params([
[ 'form_id', "" ],
[ "type", "" ],
[ "title", "" ],
]);
$diy_service = new DiyFormService();
return success($diy_service->getInit($params));
}
/**
* 获取万能表单模板
* @return Response
*/
public function getTemplate()
{
$params = $this->request->params([
[ 'type', '' ],
[ 'template_key', '' ],
]);
$diy_service = new DiyFormService();
return success($diy_service->getTemplate($params));
}
/**
* 修改页面分享内容
* @return Response
*/
public function modifyShare()
{
$data = $this->request->params([
[ "form_id", "" ],
[ "share", "" ],
]);
( new DiyFormService() )->modifyShare($data);
return success('MODIFY_SUCCESS');
}
/**
* 获取模板页面(存在的应用插件列表)
* @return Response
*/
public function getApps()
{
return success(( new DiyFormService() )->getApps());
}
/**
* 复制模版 todo 靠后
* @return Response
*/
public function copy()
{
$params = $this->request->params([
[ 'form_id', '' ],
]);
$form_id = ( new DiyFormService() )->copy($params);
return success('ADD_SUCCESS', [ 'form_id' => $form_id ]);
}
/**
* 获取模板页面(存在的应用插件列表)
* @return Response
*/
public function getFormType()
{
return success(( new DiyFormService() )->getFormType());
}
/**
* 修改状态
* @return \think\Response
*/
public function modifyStatus()
{
$data = $this->request->params([
[ 'form_id', '' ],
[ 'status', 1 ],
]);
( new DiyFormService() )->modifyStatus($data);
return success('SUCCESS');
}
/**
* 获取使用记录
* @return Response
*/
public function getRecordPages()
{
$data = $this->request->params([
[ "form_id", 0 ],
[ "keyword", "" ],
[ "create_time", "" ],
]);
return success(( new DiyFormService() )->getRecordPages($data));
}
/**
* 获取使用记录详情
* @param int $record_id
* @return Response
*/
public function getRecordInfo(int $record_id)
{
return success(( new DiyFormService() )->getRecordInfo($record_id));
}
/**
* 使用记录删除
* @return Response
*/
public function delRecord()
{
$data = $this->request->params([
[ "form_id", 0 ],
[ 'record_id', 0 ],
]);
( new DiyFormService() )->delRecord($data);
return success('DELETE_SUCCESS');
}
/**
* 获取万能表单字段记录
* @return Response
*/
public function getFieldsList()
{
$data = $this->request->params([
[ "form_id", 0 ],
[ 'order', '' ],
[ 'sort', '' ]
]);
return success(( new DiyFormService() )->getFieldsList($data));
}
/**
* 获取表单填写配置
* @param $form_id int 所属万能表单id
* @return Response
*/
public function getWriteConfig($form_id)
{
return success(( new DiyFormConfig() )->getWriteConfig($form_id));
}
/**
* 编辑表单填写配置
* @return Response
*/
public function editWriteConfig()
{
$data = $this->request->params([
[ 'id', 0 ],
[ 'form_id', 0 ], // 所属万能表单id
[ 'write_way', '' ], // 填写方式no_limit不限制scan仅限微信扫一扫url仅限链接进入
[ 'join_member_type', '' ], // 参与会员all_member所有会员参与selected_member_level指定会员等级selected_member_label指定会员标签
[ 'level_ids', [] ], // 会员等级id集合
[ 'label_ids', [] ], // 会员标签id集合
[ 'member_write_type', '' ], // 每人可填写次数no_limit不限制diy自定义
[ 'member_write_rule', [] ], // 每人可填写次数自定义规则
[ 'form_write_type', '' ], // 表单可填写数量no_limit不限制diy自定义
[ 'form_write_rule', [] ], // 表单可填写总数自定义规则
[ 'time_limit_type', '' ], // 填写时间限制类型no_limit不限制 specify_time指定开始结束时间open_day_time设置每日开启时间
[ 'time_limit_rule', [] ], // 填写时间限制规则
[ 'is_allow_update_content', 0 ], // 是否允许修改自己填写的内容01
[ 'write_instruction', '' ], // 表单填写须知
]);
( new DiyFormConfig() )->editWriteConfig($data);
return success('EDIT_SUCCESS');
}
/**
* 获取表单提交成功 也配置
* @param $form_id int 所属万能表单id
* @return Response
*/
public function getSubmitConfig($form_id)
{
return success(( new DiyFormConfig() )->getSubmitConfig($form_id));
}
/**
* 编辑表单提交成功页配置
* @return Response
*/
public function editSubmitConfig()
{
$data = $this->request->params([
[ 'id', 0 ],
[ 'form_id', 0 ], // 所属万能表单id
[ 'submit_after_action', '' ], // 填表人提交后操作text文字信息voucher核销凭证
[ 'tips_type', '' ], // 提示内容类型default默认提示diy自定义提示
[ 'tips_text', '' ], // 自定义提示内容
[ 'time_limit_type', [] ], // 核销凭证有效期限制类型no_limit不限制specify_time指定固定开始结束时间submission_time按提交时间设置有效期
[ 'time_limit_rule', '' ], // 核销凭证时间限制规则json格式 todo 结构待定
[ 'voucher_content_rule', [] ], // 核销凭证内容json格式 todo 结构待定
[ 'success_after_action', '' ], // 填写成功后续操作
]);
( new DiyFormConfig() )->editSubmitConfig($data);
return success('EDIT_SUCCESS');
}
// todo 查询表单详情
/**
* 获取万能表单填表人统计列表
* @return Response
*/
public function memberStatPages()
{
$data = $this->request->params([
[ "form_id", 0 ],
[ "keyword", '' ],
]);
return success(( new DiyFormRecordsService() )->getPage($data));
}
/**
* 获取万能表单字段统计列表
* @return Response
*/
public function fieldStatList()
{
$data = $this->request->params([
[ "form_id", 0 ],
]);
return success(( new DiyFormRecordsService() )->getFieldStatList($data));
}
/**
* 获取万能表单微信小程序二维码
* @return Response
*/
public function getQrcode()
{
$data = $this->request->params([
[ "form_id", '' ],
]);
return success(( new DiyFormService() )->getQrcode($data[ 'form_id' ]));
}
}

View File

@ -19,7 +19,6 @@ use think\Response;
class Config extends BaseAdminController class Config extends BaseAdminController
{ {
/** /**
* 获取登录设置 * 获取登录设置
* @return Response * @return Response

View File

@ -82,6 +82,19 @@ class CashOut extends BaseAdminController
return success(); return success();
} }
/**
* 备注转账信息
* @param $id
* @return Response
*/
public function remark($id)
{
$data = $this->request->params([
['remark', ''],
]);
(new MemberCashOutService())->remark($id, $data);
return success();
}
/** /**
* 状态 * 状态
* @return Response * @return Response
@ -98,4 +111,13 @@ class CashOut extends BaseAdminController
{ {
return success((new MemberCashOutService())->stat()); return success((new MemberCashOutService())->stat());
} }
/**
* 校验数组是否
* @return void
*/
public function checkTransferStatus($id){
(new MemberCashOutService())->checkTransferStatus($id);
return success();
}
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -109,4 +109,4 @@ class Pay extends BaseAdminController
{ {
return success(data:(new PayService())->getPayTypeList()); return success(data:(new PayService())->getPayTypeList());
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -33,32 +33,30 @@ class Config extends BaseAdminController
public function setWebsite() public function setWebsite()
{ {
$data = $this->request->params([ $data = $this->request->params([
["site_name", ""], [ "site_name", "" ],
["logo", ""], [ "logo", "" ],
["keywords", ""], [ "keywords", "" ],
["desc", ""], [ "desc", "" ],
["latitude", ""], [ "latitude", "" ],
["longitude", ""], [ "longitude", "" ],
["province_id", 0], [ "province_id", 0 ],
["city_id", 0], [ "city_id", 0 ],
["district_id", 0], [ "district_id", 0 ],
["address", ""], [ "address", "" ],
["full_address", ""], [ "full_address", "" ],
["phone", ""], [ "phone", "" ],
["business_hours", ""], [ "business_hours", "" ],
["site_name", ""], [ "front_end_name", "" ],
["logo", ""], [ "front_end_logo", "" ],
["front_end_name", ""], [ "front_end_icon", "" ],
["front_end_logo", ""], [ "icon", "" ]
["front_end_icon", ""],
["icon", ""]
]); ]);
(new ConfigService())->setWebSite($data); (new ConfigService())->setWebSite($data);
$service_data = $this->request->params([ $service_data = $this->request->params([
["wechat_code", ""], [ "wechat_code", "" ],
["enterprise_wechat", ""], [ "enterprise_wechat", "" ],
["tel", ""], [ "tel", "" ],
]); ]);
(new ConfigService())->setService($service_data); (new ConfigService())->setService($service_data);

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -84,4 +84,6 @@ Route::group(function () {
Route::group(function () { Route::group(function () {
//获取已安装插件列表 //获取已安装插件列表
Route::get('addon/list/install', 'addon.Addon/getInstallList'); Route::get('addon/list/install', 'addon.Addon/getInstallList');
// 获取应用列表
Route::get('addon/list/showapp', 'addon.Addon/showApp');
}); });

View File

@ -84,6 +84,15 @@ Route::group('diy', function() {
// 复制模版 // 复制模版
Route::post('copy', 'diy.Diy/copy'); Route::post('copy', 'diy.Diy/copy');
// 获取自定义主题配色
Route::get('theme', 'diy.Diy/getDiyTheme');
// 设置主题配色
Route::post('theme', 'diy.Diy/setDiyTheme');
// 获取默认主题配色
Route::get('theme/color', 'diy.Diy/getDefaultThemeColor');
/***************************************************** 配置相关 *****************************************************/ /***************************************************** 配置相关 *****************************************************/
// 底部导航列表 // 底部导航列表
@ -95,6 +104,77 @@ Route::group('diy', function() {
// 设置底部导航 // 设置底部导航
Route::post('bottom', 'diy.Config/setBottomConfig'); Route::post('bottom', 'diy.Config/setBottomConfig');
/***************************************************** 万能表单管理 ****************************************************/
// 万能表单分页列表
Route::get('form', 'diy.DiyForm/pages');
// 万能表单列表
Route::get('form/list', 'diy.DiyForm/lists');
// 万能表单类型
Route::get('form/type', 'diy.DiyForm/getFormType');
// 添加万能表单
Route::post('form', 'diy.DiyForm/add');
// 编辑万能表单
Route::put('form/:id', 'diy.DiyForm/edit');
// 万能表单详情
Route::get('form/:id', 'diy.DiyForm/info');
// 删除万能表单
Route::put('form/delete', 'diy.DiyForm/del');
// 获取万能表单微信小程序二维码
Route::get('form/qrcode', 'diy.DiyForm/getQrcode');
// 页面初始化数据
Route::get('form/init', 'diy.DiyForm/getInit');
// 获取页面模板
Route::get('form/template', 'diy.DiyForm/getTemplate');
// 获取万能表单填写配置
Route::get('form/write/:form_id', 'diy.DiyForm/getWriteConfig');
// 编辑万能表单填写配置
Route::put('form/write', 'diy.DiyForm/editWriteConfig');
// 获取万能表单填写配置
Route::get('form/submit/:form_id', 'diy.DiyForm/getSubmitConfig');
// 编辑万能表单填写配置
Route::put('form/submit', 'diy.DiyForm/editSubmitConfig');
// 编辑万能表单分享内容
Route::put('form/share', 'diy.DiyForm/modifyShare');
// 复制模版
Route::post('form/copy', 'diy.DiyForm/copy');
// 修改万能表单状态
Route::put('form/status', 'diy.DiyForm/modifyStatus');
//获取填写记录列表
Route::get('form/records', 'diy.DiyForm/getRecordPages');
//获取填写记录详情
Route::get('form/records/:record_id', 'diy.DiyForm/getRecordInfo');
//删除填写记录
Route::put('form/records/delete', 'diy.DiyForm/delRecord');
//获取万能表单字段记录
Route::get('form/fields/list', 'diy.DiyForm/getFieldsList');
//获取填表人统计列表
Route::get('form/records/member/stat', 'diy.DiyForm/memberStatPages');
//获取字段统计列表
Route::get('form/records/field/stat', 'diy.DiyForm/fieldStatList');
})->middleware([ })->middleware([
AdminCheckToken::class, AdminCheckToken::class,
AdminCheckRole::class, AdminCheckRole::class,

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -120,6 +120,10 @@ Route::group('member', function() {
Route::get('cash_out/:id', 'member.CashOut/info'); Route::get('cash_out/:id', 'member.CashOut/info');
//会员提现审核 //会员提现审核
Route::put('cash_out/audit/:id/:action', 'member.CashOut/audit'); Route::put('cash_out/audit/:id/:action', 'member.CashOut/audit');
//会员提现备注
Route::put('cash_out/remark/:id', 'member.CashOut/remark');
//校验会员提现转账状态
Route::put('cash_out/check/:id', 'member.CashOut/checkTransferStatus');
//转账方式 //转账方式
Route::get('cash_out/transfertype', 'member.CashOut/getTransferType'); Route::get('cash_out/transfertype', 'member.CashOut/getTransferType');
//转账方式 //转账方式

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\api\controller\diy;
use app\service\api\diy_form\DiyFormService;
use core\base\BaseApiController;
use think\Response;
class DiyForm extends BaseApiController
{
/**
* 万能表单详情
* @return Response
*/
public function info()
{
$data = $this->request->params([
[ 'form_id', '' ],
]);
return success(( new DiyFormService() )->getInfo($data[ 'form_id' ]));
}
/**
* 提交填表记录
* @return Response
*/
public function addRecord()
{
$data = $this->request->params([
[ 'form_id', '' ],
[ 'value', [] ],
[ 'relate_id', '' ],
]);
return success('SUCCESS', ( new DiyFormService() )->addRecord($data));
}
/**
* 获取表单填写结果信息
* @return Response
*/
public function getResult()
{
$data = $this->request->params([
[ 'record_id', '' ],
]);
return success('SUCCESS', ( new DiyFormService() )->getResult($data));
}
/**
* 获取表单填写记录
* @return Response
*/
public function getRecord()
{
$data = $this->request->params([
[ 'record_id', '' ],
]);
return success('SUCCESS', ( new DiyFormService() )->getFormRecordInfo($data));
}
}

View File

@ -84,10 +84,13 @@ class Login extends BaseController
{ {
$data = $this->request->params([ $data = $this->request->params([
[ 'mobile', '' ], [ 'mobile', '' ],
[ 'nickname', '' ],
[ 'headimg', '' ],
[ 'mobile', '' ]
]); ]);
//校验登录注册配置 //校验登录注册配置
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE); ( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE);
return success(( new LoginService() )->mobile($data[ 'mobile' ])); return success(( new LoginService() )->mobile($data));
} }
/** /**

View File

@ -57,7 +57,8 @@ class CashOutAccount extends BaseApiController
['account_type', ''], ['account_type', ''],
['bank_name', ''], ['bank_name', ''],
['realname', ''], ['realname', ''],
['account_no', ''] ['account_no', ''],
['transfer_payment_code', '']
]); ]);
$this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit'); $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
$id = (new MemberCashOutAccountService())->add($data); $id = (new MemberCashOutAccountService())->add($data);
@ -74,7 +75,8 @@ class CashOutAccount extends BaseApiController
['account_type', ''], ['account_type', ''],
['bank_name', ''], ['bank_name', ''],
['realname', ''], ['realname', ''],
['account_no', ''] ['account_no', ''],
['transfer_payment_code', '']
]); ]);
$this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit'); $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
(new MemberCashOutAccountService())->edit($account_id, $data); (new MemberCashOutAccountService())->edit($account_id, $data);
@ -90,4 +92,4 @@ class CashOutAccount extends BaseApiController
(new MemberCashOutAccountService())->del($account_id); (new MemberCashOutAccountService())->del($account_id);
return success('DELETE_SUCCESS'); return success('DELETE_SUCCESS');
} }
} }

View File

@ -24,16 +24,18 @@ class Member extends BaseApiController
* 会员信息 * 会员信息
* @return Response * @return Response
*/ */
public function info(){ public function info()
return success((new MemberService())->getInfo()); {
return success(( new MemberService() )->getInfo());
} }
/** /**
* 会员中心 * 会员中心
* @return Response * @return Response
*/ */
public function center(){ public function center()
return success((new MemberService())->center()); {
return success(( new MemberService() )->center());
} }
/** /**
@ -41,14 +43,15 @@ class Member extends BaseApiController
* @param $field * @param $field
* @return Response * @return Response
*/ */
public function modify($field){ public function modify($field)
{
$data = $this->request->params([ $data = $this->request->params([
['value', ''], [ 'value', '' ],
['field', $field], [ 'field', $field ],
]); ]);
$data[$field] = $data['value']; $data[ $field ] = $data[ 'value' ];
$this->validate($data, 'app\validate\member\Member.modify'); $this->validate($data, 'app\validate\member\Member.modify');
(new MemberService())->modify($field, $data['value']); ( new MemberService() )->modify($field, $data[ 'value' ]);
return success('MODIFY_SUCCESS'); return success('MODIFY_SUCCESS');
} }
@ -56,11 +59,12 @@ class Member extends BaseApiController
* 编辑会员 * 编辑会员
* @return Response * @return Response
*/ */
public function edit(){ public function edit()
{
$data = $this->request->params([ $data = $this->request->params([
['data', []], [ 'data', [] ],
]); ]);
(new MemberService())->edit($data['data']); ( new MemberService() )->edit($data[ 'data' ]);
return success('MODIFY_SUCCESS'); return success('MODIFY_SUCCESS');
} }
@ -68,32 +72,47 @@ class Member extends BaseApiController
* 绑定手机号 * 绑定手机号
* @return Response * @return Response
*/ */
public function mobile(){ public function mobile()
{
$data = $this->request->params([ $data = $this->request->params([
['mobile', ''], [ 'mobile', '' ],
['mobile_code', ''], [ 'mobile_code', '' ],
]); ]);
return success((new AuthService())->bindMobile($data['mobile'], $data['mobile_code'])); return success(( new AuthService() )->bindMobile($data[ 'mobile' ], $data[ 'mobile_code' ]));
} }
/** /**
* 会员日志 * 会员日志
* @return Response * @return Response
*/ */
public function log(){ public function log()
{
$data = $this->request->params([ $data = $this->request->params([
['route', ''], [ 'route', '' ],
['params', ''], [ 'params', '' ],
['pre_route', ''] [ 'pre_route', '' ]
]); ]);
(new MemberLogService())->log($data); ( new MemberLogService() )->log($data);
return success(); return success();
} }
/** /**
* 获取会员码 * 获取会员码
*/ */
public function qrcode(){ public function qrcode()
return success((new MemberService())->getQrcode()); {
return success(( new MemberService() )->getQrcode());
}
/**
* 获取手机号
* @return Response
*/
public function getMobile()
{
$data = $this->request->params([
[ 'mobile_code', '' ],
]);
return success(( new AuthService() )->getMobile($data[ 'mobile_code' ]));
} }
} }

View File

@ -72,7 +72,8 @@ class MemberCashOut extends BaseApiController
[ 'apply_money', 0 ], [ 'apply_money', 0 ],
[ 'account_type', MemberAccountTypeDict::MONEY ], [ 'account_type', MemberAccountTypeDict::MONEY ],
[ 'transfer_type', '' ], [ 'transfer_type', '' ],
[ 'account_id', 0 ] [ 'account_id', 0 ],
[ 'transfer_payee', []] ,//收款方信息
]); ]);
$this->validate($data, 'app\validate\member\CashOut.apply'); $this->validate($data, 'app\validate\member\CashOut.apply');
return success(data:( new MemberCashOutService() )->apply($data)); return success(data:( new MemberCashOutService() )->apply($data));

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -12,6 +12,7 @@
namespace app\api\controller\sys; namespace app\api\controller\sys;
use app\service\api\diy\DiyConfigService; use app\service\api\diy\DiyConfigService;
use app\service\api\diy\DiyService;
use app\service\api\member\MemberConfigService; use app\service\api\member\MemberConfigService;
use app\service\api\member\MemberLevelService; use app\service\api\member\MemberLevelService;
use app\service\api\member\MemberService; use app\service\api\member\MemberService;
@ -78,6 +79,7 @@ class Config extends BaseApiController
{ {
$data = $this->request->params([ $data = $this->request->params([
[ 'url', '' ], [ 'url', '' ],
[ 'openid', '' ]
]); ]);
$res = []; $res = [];
@ -86,6 +88,13 @@ class Config extends BaseApiController
$res[ 'site_info' ] = ( new ConfigService() )->getWebSite(); $res[ 'site_info' ] = ( new ConfigService() )->getWebSite();
$res[ 'member_level' ] = ( new MemberLevelService() )->getList(); $res[ 'member_level' ] = ( new MemberLevelService() )->getList();
$res[ 'login_config' ] = ( new MemberConfigService() )->getLoginConfig($data[ 'url' ]); $res[ 'login_config' ] = ( new MemberConfigService() )->getLoginConfig($data[ 'url' ]);
$res[ 'theme_list' ] = ( new DiyService() )->getDiyTheme();
// 查询是否已经存在该小程序用户, 如果存在则小程序端快捷登录时不再弹出授权弹框
$res[ 'member_exist' ] = 0;
if (!empty($data['openid'])) {
$res[ 'member_exist' ] = ( new MemberService() )->getCount([['weapp_openid' ,'=', $data['openid']]]) > 0 ? 1 : 0;
}
( new MemberService() )->initMemberData(); ( new MemberService() )->initMemberData();

View File

@ -32,6 +32,18 @@ class Upload extends BaseApiController
return success($upload_service->image($data['file'])); return success($upload_service->image($data['file']));
} }
/**
* 视频上传
* @return Response
*/
public function video(){
$data = $this->request->params([
['file', 'file'],
]);
$upload_service = new UploadService();
return success($upload_service->video($data['file']));
}
/** /**
* 远程图片拉取 * 远程图片拉取
* @return Response * @return Response

View File

@ -26,9 +26,15 @@ class Weapp extends BaseApiController
*/ */
public function login() public function login()
{ {
$data = $this->request->params([ [ 'code', '' ] ]); $data = $this->request->params([
[ 'code', '' ],
[ 'nickname', '' ],
[ 'headimg', '' ],
[ 'mobile', '' ],
[ 'mobile_code', '' ]
]);
$weapp_auth_service = new WeappAuthService(); $weapp_auth_service = new WeappAuthService();
return success($weapp_auth_service->login($data[ 'code' ])); return success($weapp_auth_service->login($data));
} }
/** /**

View File

@ -28,5 +28,26 @@ Route::group('diy', function() {
Route::get('share', 'diy.Diy/share'); Route::get('share', 'diy.Diy/share');
// 万能表单详情
Route::get('form', 'diy.DiyForm/info');
})->middleware(ApiLog::class) })->middleware(ApiLog::class)
->middleware(ApiCheckToken::class, false); ->middleware(ApiCheckToken::class, false);
/**
* 自定义表单
*/
Route::group('diy', function() {
// 提交填表记录
Route::post('form/record', 'diy.DiyForm/addRecord');
// 获取表单填写结果信息
Route::get('form/result', 'diy.DiyForm/getResult');
// 获取填表记录
Route::get('form/record', 'diy.DiyForm/getRecord');
})->middleware(ApiLog::class)
->middleware(ApiCheckToken::class, true);

View File

@ -18,16 +18,27 @@ use think\facade\Route;
/** /**
* 会员个人信息管理 * 会员个人信息管理
*/ */
Route::group('file', function () { Route::group('file', function() {
/***************************************************** 会员管理 ****************************************************/ /***************************************************** 会员管理 ****************************************************/
//上传图片 //上传图片
Route::post('image', 'upload.Upload/image'); Route::post('image', 'upload.Upload/image');
//上传视频
Route::post('video', 'upload.Upload/video');
//拉取图片 //拉取图片
Route::post('image/fetch', 'upload.Upload/imageFetch'); Route::post('image/fetch', 'upload.Upload/imageFetch');
//base64图片
Route::post('image/base64', 'upload.Upload/imageBase64');
})->middleware(ApiChannel::class) })->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true) ->middleware(ApiCheckToken::class, true)
->middleware(ApiLog::class); ->middleware(ApiLog::class);
/**
* 会员个人信息管理
*/
Route::group('file', function() {
//base64图片
Route::post('image/base64', 'upload.Upload/imageBase64');
})->middleware(ApiChannel::class)
->middleware(ApiLog::class);

View File

@ -116,6 +116,9 @@ Route::group('member', function () {
//会员日志 //会员日志
Route::post('log', 'member.Member/log'); Route::post('log', 'member.Member/log');
// 获取手机号
Route::put('getMobile', 'member.Member/getMobile');
/***************************************************** 会员等级 **************************************************/ /***************************************************** 会员等级 **************************************************/
Route::get('level', 'member.Level/lists'); Route::get('level', 'member.Level/lists');
})->middleware(ApiChannel::class) })->middleware(ApiChannel::class)

View File

@ -985,3 +985,43 @@ function is_special_character($str)
return false; return false;
} }
} }
/**
* 时间格式转换
* @param $time
* @return string
*/
function get_last_time($time = null)
{
$text = '';
$time = $time === null || $time > time() ? time() : intval($time);
$t = time() - $time; //时间差 (秒)
$y = date('Y', $time) - date('Y', time());//是否跨年
switch ($t) {
case 0:
$text = '刚刚';
break;
case $t < 60:
$text = $t . '秒前'; // 一分钟内
break;
case $t < 60 * 60:
$text = floor($t / 60) . '分钟前'; //一小时内
break;
case $t < 60 * 60 * 24:
$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); //昨天和前天
break;
case $t < 60 * 60 * 24 * 30:
$text = date('m-d H:i', $time); //一个月内
break;
case $t < 60 * 60 * 24 * 365 && $y == 0:
$text = date('m-d', $time); //一年内
break;
default:
$text = date('Y-m-d', $time); //一年以前
break;
}
return $text;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\diy_form;
/**
* 万能表单提交页配置项
*/
class ConfigDict
{
//填表人提交后操作
const TEXT = 'text'; // 文字
const VOUCHER = 'voucher'; // 核销凭证
//提示内容类型
const DEFAULT = 'default'; // 默认提示
const DIY = 'diy'; // 自定义提示
// 核销凭证有效期限制类型 / 填写时间限制类型
const NO_LIMIT = 'no_limit'; // 不限制
const SPECIFY_TIME = 'specify_time'; // 指定固定开始结束时间
const VALIDITY_TIME = 'validity_time'; // 按提交时间设置有效期
// 填写方式
const WRITE_WAY_NO_LIMIT = 'no_limit'; // 不限制
const WRITE_WAY_SCAN = 'scan'; // 仅限微信扫一扫
const WRITE_WAY_URL = 'url'; // 仅限链接进入
// 参与会员
const ALL_MEMBER = 'all_member';// 所有会员参与
const SELECTED_MEMBER_LEVEL = 'selected_member_level'; // 指定会员等级
const SELECTED_MEMBER_LABEL = 'selected_member_label'; // 指定会员标签
// 填写次数限制
const WRITE_NUM_NO_LIMIT = 'no_limit'; // 不限制
const WRITE_NUM_DIY = 'diy'; // 自定义
// 是否允许修改自己填写的内容
const NO = 0; // 否
const YES = 1; // 是
}

View File

@ -0,0 +1,785 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\diy_form;
use core\dict\DictLoader;
/**
* 页面模板
*/
class TemplateDict
{
/**
* 获取万能表单模版
* @param array $params
* @return array|null
*/
public static function getTemplate($params = [])
{
$other_template_data = ( new DictLoader("DiyFormTemplate") )->load([]);
$template = self::template();
$data = array_merge($other_template_data, $template);
if (!empty($params) && !empty($params[ 'type' ])) {
if (!empty($params[ 'template_key' ])) {
return $data[ $params[ 'type' ] ][ $params[ 'template_key' ] ] ?? [];
}
return $data[ $params[ 'type' ] ] ?? [];
}
return $data;
}
public static function template()
{
$data = [
"DIY_FORM" => [
'active_sign_up' => [ // 页面标识
"title" => "活动报名", // 页面名称
'cover' => '', // 页面封面图
'preview' => '', // 页面预览图
'desc' => '适用于活动宣传,收集报名信息,快速统计报名总人数', // 页面描述
'containField' => '共8个字段包含8个字段姓名、手机号、身份证号、邮箱、日期、报名职位、特长优点、入职时长', // 包含字段
// 页面数据源
"data" => [
"global" => [
"title" => "活动报名",
"completeLayout" => "style-1",
"completeAlign" => "left",
"borderControl" => true,
"pageStartBgColor" => "rgba(255, 255, 255, 1)",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"bgUrl" => "",
"bgHeightScale" => 100,
"imgWidth" => "",
"imgHeight" => "",
"topStatusBar" => [
"isShow" => true,
"bgColor" => "#ffffff",
"rollBgColor" => "#ffffff",
"style" => "style-1",
"styleName" => "风格1",
"textColor" => "#333333",
"rollTextColor" => "#333333",
"textAlign" => "center",
"inputPlaceholder" => "请输入搜索关键词",
"imgUrl" => "",
"link" => [
"name" => ""
]
],
"bottomTabBarSwitch" => true,
"popWindow" => [
"imgUrl" => "",
"imgWidth" => "",
"imgHeight" => "",
"count" => -1,
"show" => 0,
"link" => [
"name" => ""
]
],
"template" => [
"textColor" => "#303133",
"pageStartBgColor" => "",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 0,
"bottom" => 0,
"both" => 0
],
"isHidden" => false
]
],
"value" => [
[
"path" => "edit-image-ads",
"uses" => 0,
"componentType" => "diy",
"id" => "36vpa1zz5mw0",
"componentName" => "ImageAds",
"componentTitle" => "图片广告",
"ignore" => [
"componentBgUrl"
],
"imageHeight" => 150,
"isSameScreen" => false,
"list" => [
[
"link" => [
"name" => ""
],
"imageUrl" => "static/resource/images/diy_form/diy_form_active_sign_up_banner.png",
"imgWidth" => 750,
"imgHeight" => 300,
"id" => "4wk5whtbi0m0",
"width" => 375,
"height" => 150
]
],
"textColor" => "#303133",
"pageStartBgColor" => "",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 0,
"bottom" => 0,
"both" => 0
],
"isHidden" => false,
"pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;"
],
[
"path" => "edit-form-input",
"uses" => 0,
"position" => "",
"componentType" => "diy_form",
"id" => "46wkksoz5ew0",
"componentName" => "FormInput",
"componentTitle" => "单行文本",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "姓名",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => true,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => "",
"value" => ""
],
"placeholder" => "请输入姓名",
"fontSize" => 14,
"fontWeight" => "bold",
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 15,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:30rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-mobile",
"uses" => 1,
"componentType" => "diy_form",
"id" => "6tsdwql8ds00",
"componentName" => "FormMobile",
"componentTitle" => "手机号",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "手机号",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => false,
"unique" => true,
"autofill" => false,
"privacyProtection" => true,
"default" => "",
"value" => ""
],
"placeholder" => "请输入手机号",
"fontSize" => 14,
"fontWeight" => "bold",
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-identity",
"uses" => 1,
"componentType" => "diy_form",
"id" => "4hy63cm1lj80",
"componentName" => "FormIdentity",
"componentTitle" => "身份证号",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "身份证号",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => false,
"unique" => true,
"autofill" => false,
"privacyProtection" => false,
"default" => "",
"value" => ""
],
"placeholder" => "请输入身份证号",
"fontSize" => 14,
"fontWeight" => "bold",
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-email",
"uses" => 0,
"componentType" => "diy_form",
"id" => "13f2w3r9h9vg",
"componentName" => "FormEmail",
"componentTitle" => "邮箱",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "邮箱",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => false,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => "",
"value" => ""
],
"placeholder" => "请输入邮箱",
"fontSize" => 14,
"fontWeight" => "bold",
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-date",
"uses" => 0,
"componentType" => "diy_form",
"id" => "7dc7gd9hh400",
"componentName" => "FormDate",
"componentTitle" => "日期",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "日期",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => true,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => [
"date" => "",
"timestamp" => 0
],
"value" => [
"date" => "",
"timestamp" => 0
]
],
"placeholder" => "请选择日期",
"fontSize" => 14,
"fontWeight" => "bold",
"dateFormat" => "YYYY-MM-DD HH:mm",
"dateWay" => "current",
"defaultControl" => true,
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-radio",
"uses" => 0,
"componentType" => "diy_form",
"id" => "3z2yq22p9xc0",
"componentName" => "FormRadio",
"componentTitle" => "单选项",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "报名职位",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => true,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => [],
"value" => []
],
"fontSize" => 14,
"fontWeight" => "bold",
"style" => "style-2",
"options" => [
[
"id" => "fzjmiaochnsd",
"text" => "前台"
],
[
"id" => "mabstfflrdpj",
"text" => "收银"
],
[
"id" => "1ogre1qndmrk",
"text" => "后厨"
],
[
"id" => "1mv5qku9wihs",
"text" => "财务"
],
[
"id" => "qfdjp035qsw",
"text" => "经理"
]
],
"logicalRule" => [
[
"triggerOptionId" => "",
"execEvent" => [
[
"id" => "",
"componentName" => "",
"componentTitle" => ""
]
]
]
],
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-textarea",
"uses" => 0,
"componentType" => "diy_form",
"id" => "39m5zel59cw0",
"componentName" => "FormTextarea",
"componentTitle" => "多行文本",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "特长优点",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => false,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => "",
"value" => ""
],
"placeholder" => "请输入特长优点",
"fontSize" => 14,
"fontWeight" => "bold",
"rowCount" => 4,
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-date-scope",
"uses" => 0,
"convert" => [],
"componentType" => "diy_form",
"id" => "mj9fl99x02o",
"componentName" => "FormDateScope",
"componentTitle" => "日期范围",
"ignore" => [
"componentBgUrl"
],
"field" => [
"name" => "入职时长",
"remark" => [
"text" => "",
"color" => "#999999",
"fontSize" => 14
],
"required" => false,
"unique" => false,
"autofill" => false,
"privacyProtection" => false,
"default" => [
"start" => [
"date" => "",
"timestamp" => 0
],
"end" => [
"date" => "",
"timestamp" => 0
]
],
"value" => [
"start" => [
"date" => "",
"timestamp" => 0
],
"end" => [
"date" => "",
"timestamp" => 0
]
]
],
"fontSize" => 14,
"fontWeight" => "bold",
"dateFormat" => "YYYY/MM/DD",
"start" => [
"placeholder" => "请选择起始日期",
"dateWay" => "current",
"defaultControl" => true
],
"end" => [
"placeholder" => "请选择结束日期",
"dateWay" => "current",
"defaultControl" => true
],
"textColor" => "#303133",
"pageStartBgColor" => "#FFFFFF",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 0,
"bottomElementRounded" => 0,
"margin" => [
"top" => 5,
"bottom" => 10,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "background-color:#FFFFFF;padding-top:10rpx;padding-bottom:20rpx;padding-right:34rpx;padding-left:34rpx;"
],
[
"path" => "edit-form-submit",
"uses" => 1,
"position" => "bottom_fixed",
"componentType" => "diy_form",
"id" => "38b02iygfzc0",
"componentName" => "FormSubmit",
"componentTitle" => "表单提交",
"ignore" => [
"componentBgUrl"
],
"btnPosition" => "follow_content",
"submitBtn" => [
"text" => "提交",
"color" => "#ffffff",
"bgColor" => "#409EFF"
],
"resetBtn" => [
"control" => true,
"text" => "重置",
"color" => "",
"bgColor" => ""
],
"textColor" => "#303133",
"pageStartBgColor" => "",
"pageEndBgColor" => "",
"pageGradientAngle" => "to bottom",
"componentBgUrl" => "",
"componentBgAlpha" => 2,
"componentStartBgColor" => "",
"componentEndBgColor" => "",
"componentGradientAngle" => "to bottom",
"topRounded" => 0,
"bottomRounded" => 0,
"elementBgColor" => "",
"topElementRounded" => 50,
"bottomElementRounded" => 50,
"margin" => [
"top" => 5,
"bottom" => 5,
"both" => 25
],
"isHidden" => false,
"pageStyle" => "padding-top:10rpx;padding-bottom:10rpx;padding-right:20rpx;padding-left:20rpx;"
]
]
]
],
],
// todo 靠后完善
// 'SIGN_REGISTRATION' => [
// 'active_sign_up' => [ // 页面标识
// "title" => "活动报名", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '适用于活动宣传,收集报名信息,快速统计报名总人数', // 页面描述
// 'containField' => '共2个字段包含2个字段姓名、手机号', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// 'attendance_clock_in' => [ // 页面标识
// "title" => "考勤打卡", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '无需额外设备,员工直接使用微信扫码完成考勤打卡,管理员可随时查看考勤汇总数据,导出后进行工作考核', // 页面描述
// 'containField' => '包含5个字段打卡类型、姓名、手机号、定位、备注', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// 'meeting_sign_up' => [ // 页面标识
// "title" => "会议报名", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '填表人报名后获取核销凭证,活动现场出示,主办方可核销', // 页面描述
// 'containField' => '包含4个字段姓名、手机号、公司名称、职务', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// 'service_reservation' => [ // 页面标识
// "title" => "服务预约", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '扫码填写预约报名信息,管理者可及时查看预约情况', // 页面描述
// 'containField' => '共5个字段包含5个字段姓名、联系方式、预约日期、预约时间、备注', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// 'person_registration' => [ // 页面标识
// "title" => "人员信息登记", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '适用于员工、学生、居民和访客等各类人员的信息收集场景', // 页面描述
// 'containField' => '包含8个字段姓名、手机号、性别、身份证号、出生日期、民族、籍贯、家庭地址', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// ],
// 'LEAVE_MESSAGE_SUGGESTION' => [
// 'feedback_collection' => [ // 页面标识
// "title" => "反馈意见收集", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '反馈人扫码即可随时随地进行留言建议,管理人可以审核内容,在线回复', // 页面描述
// 'containField' => '共5个字段包含5个字段您要反馈哪方面的问题、详细描述、相关图片、反馈人、手机号', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// 'Satisfaction_level_questionnaire' => [ // 页面标识
// "title" => "满意度调查问卷", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '通过满意度调研表单制作一个满意度调研二维码,所有人扫码即可填写,代替原有纸质方式;所有的评价都将汇总在管理后台,可以统一导出进行统计,了解整体的服务质量', // 页面描述
// 'containField' => '包含12个字段1. 商场温度舒适度、2. 电梯及扶梯是否运行正常、3. 商场地面、墙面及天花板清洁、4. 卫生间地面、台盆及镜面清洁、5. 卫生间客用品是否缺失、6. 卫生间有无异味、7. 保洁员工仪容仪表及工作态度、8. 安保员工仪容仪表及工作态度、9. 车场停车费扫码付费便捷度、姓名、联系方式、图文描述', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// ],
// 'WRITE_OFF_VOUCHER' => [
// 'gift_receive_reservation' => [ // 页面标识
// "title" => "礼品领取预约", // 页面名称
// 'cover' => '', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '客户线上填写信息并选择礼品,完成后获取二维码凭证。在现场,出示该凭证领取礼品,工作人员扫描凭证进行核销', // 页面描述
// 'containField' => '包含3个字段姓名、手机、礼品选择', // 包含字段
// // 页面数据源
// "data" => [
// "global" => [],
// "value" => []
// ]
// ],
// ],
];
return $data;
}
}

View File

@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\diy_form;
use core\dict\DictLoader;
/**
* 万能表单类型
*/
class TypeDict
{
/**
* 获取万能表单类型
* @param array $params
* @return array|null
*/
public static function getType($params = [])
{
$system_pages = [
//自定义表单
'DIY_FORM' => [
'title' => get_lang('dict_diy_form.type_diy_form'),
'preview' => 'static/resource/images/diy_form/diy_from_preview.jpg', // 预览图
'sort' => 10001,
'addon' => ''
],
//签到报名登记 todo 靠后完善
// 'SIGN_REGISTRATION' => [
// 'title' => get_lang('dict_diy_form.type_sign_registration'),
// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png',
// 'sort' => 10002,
// 'addon' => ''
// ],
//留言建议 todo 靠后完善
// 'LEAVE_MESSAGE_SUGGESTION' => [
// 'title' => get_lang('dict_diy_form.type_leave_message_suggestion'),
// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png',
// 'sort' => 10003,
// 'addon' => ''
// ],
//核销凭证 todo 靠后完善
// 'WRITE_OFF_VOUCHER' => [
// 'title' => get_lang('dict_diy_form.type_write_off_voucher'),
// 'preview' => 'static/resource/images/diy_form/diy_from_preview.png',
// 'sort' => 10004,
// 'addon' => ''
// ],
];
$data = ( new DictLoader("DiyFormType") )->load($system_pages);
if (!empty($params) && !empty($params[ 'type' ])) {
return $data[ $params[ 'type' ] ];
}
return $data;
}
}

View File

@ -20,6 +20,7 @@ class MemberCashOutDict
{ {
public const WAIT_AUDIT = 1;//待审核 public const WAIT_AUDIT = 1;//待审核
public const WAIT_TRANSFER = 2;//待转账 public const WAIT_TRANSFER = 2;//待转账
public const TRANSFER_ING = 4;//转账中
public const TRANSFERED = 3;//已转账 public const TRANSFERED = 3;//已转账
public const REFUSE = -1;//已拒绝 public const REFUSE = -1;//已拒绝
public const CANCEL = -2;//已取消 public const CANCEL = -2;//已取消
@ -33,10 +34,11 @@ class MemberCashOutDict
return [ return [
self::WAIT_AUDIT => get_lang('dict_member_cash_out.status_wait_audit'),//待审核 self::WAIT_AUDIT => get_lang('dict_member_cash_out.status_wait_audit'),//待审核
self::WAIT_TRANSFER => get_lang('dict_member_cash_out.status_wait_transfer'),//待转账 self::WAIT_TRANSFER => get_lang('dict_member_cash_out.status_wait_transfer'),//待转账
self::TRANSFER_ING => get_lang('dict_member_cash_out.status_transfer_ing'),//转账中
self::TRANSFERED => get_lang('dict_member_cash_out.status_transfered'),//已转账 self::TRANSFERED => get_lang('dict_member_cash_out.status_transfered'),//已转账
self::REFUSE => get_lang('dict_member_cash_out.status_refuse'),//已拒绝 self::REFUSE => get_lang('dict_member_cash_out.status_refuse'),//已拒绝
self::CANCEL => get_lang('dict_member_cash_out.status_cancel'),//已取消 self::CANCEL => get_lang('dict_member_cash_out.status_cancel'),//已取消
]; ];
} }
} }

View File

@ -11,8 +11,6 @@
namespace app\dict\member; namespace app\dict\member;
use app\dict\common\ChannelDict;
/** /**
* 会员签到状态枚举类 * 会员签到状态枚举类
* Class MemberDict * Class MemberDict
@ -34,4 +32,4 @@ class MemberSignDict
self::SIGNED => get_lang('dict_member_sign.status_signed'),//已签到 self::SIGNED => get_lang('dict_member_sign.status_signed'),//已签到
]; ];
} }
} }

View File

@ -11,8 +11,6 @@
namespace app\dict\member; namespace app\dict\member;
use app\dict\common\ChannelDict;
/** /**
* 会员签到类型枚举类 * 会员签到类型枚举类
* Class MemberDict * Class MemberDict
@ -34,4 +32,4 @@ class MemberSignTypeDict
self::CONTINUE => get_lang('dict_member_sign_award.type_continue'),//连签 self::CONTINUE => get_lang('dict_member_sign_award.type_continue'),//连签
]; ];
} }
} }

View File

@ -289,6 +289,34 @@ return [
'status' => '1', 'status' => '1',
'is_show' => '0', 'is_show' => '0',
], ],
[
'menu_name' => '主题风格',
'menu_key' => 'diy_theme_style',
'menu_short_name' => '主题风格',
'menu_type' => '1',
'icon' => 'element Files',
'api_url' => '',
'router_path' => 'diy/theme_style',
'view_path' => 'diy/theme_style',
'methods' => 'get',
'sort' => '93',
'status' => '1',
'is_show' => '1'
],
[
'menu_name' => '数据列表',
'menu_key' => 'diy_form_record_list',
'menu_short_name' => '数据列表',
'menu_type' => '1',
'icon' => '',
'api_url' => 'diy_form/records',
'router_path' => 'diy_form/records',
'view_path' => 'diy_form/records',
'methods' => 'get',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[ [
'menu_name' => '电脑端', 'menu_name' => '电脑端',
'menu_key' => 'diy_web', 'menu_key' => 'diy_web',
@ -299,7 +327,7 @@ return [
'router_path' => 'web', 'router_path' => 'web',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '93', 'sort' => '92',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' =>[ 'children' =>[
@ -2381,6 +2409,122 @@ return [
], ],
], ],
], ],
[
'menu_name' => '小票打印',
'menu_key' => 'printer_management',
'menu_short_name' => '小票打印',
'menu_type' => '1',
'icon' => 'element FolderChecked',
'api_url' => 'printer',
'router_path' => 'printer/list',
'view_path' => 'printer/list',
'methods' => 'get',
'sort' => '30',
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '删除打印机',
'menu_key' => 'delete_printer',
'menu_short_name' => '删除打印机',
'menu_type' => '2',
'icon' => '',
'api_url' => 'printer/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
]
]
],
[
'menu_name' => '添加打印机',
'menu_key' => 'printer_add',
'menu_short_name' => '添加打印机',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer',
'router_path' => 'printer/add',
'view_path' => 'printer/edit',
'methods' => 'post',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑打印机',
'menu_key' => 'printer_edit',
'menu_short_name' => '添加打印机',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/<id>',
'router_path' => 'printer/edit',
'view_path' => 'printer/edit',
'methods' => 'put',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '小票打印模板',
'menu_key' => 'printer_template_management',
'menu_short_name' => '小票打印模板',
'menu_type' => '1',
'icon' => 'element FolderChecked',
'api_url' => 'printer/template',
'router_path' => 'printer/template/list',
'view_path' => 'printer/template_list',
'methods' => 'get',
'sort' => '96',
'status' => '1',
'is_show' => '0',
'children' => [
[
'menu_name' => '删除打印模板',
'menu_key' => 'delete_printer_template',
'menu_short_name' => '删除打印模板',
'menu_type' => '2',
'icon' => '',
'api_url' => 'printer/template/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
]
]
],
[
'menu_name' => '添加打印模板',
'menu_key' => 'printer_template_add',
'menu_short_name' => '添加打印模板',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/template',
'router_path' => 'printer/template/add',
'view_path' => 'printer/template_edit',
'methods' => 'post',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑打印模板',
'menu_key' => 'printer_template_edit',
'menu_short_name' => '编辑打印模板',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/template/<id>',
'router_path' => 'printer/template/edit',
'view_path' => 'printer/template_edit',
'methods' => 'put',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[ [
'menu_name' => '系统工具', 'menu_name' => '系统工具',
'menu_key' => 'setting_tool', 'menu_key' => 'setting_tool',
@ -2391,7 +2535,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '30', 'sort' => '20',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -2557,122 +2701,6 @@ return [
] ]
] ]
], ],
[
'menu_name' => '小票打印',
'menu_key' => 'printer_management',
'menu_short_name' => '小票打印',
'menu_type' => '1',
'icon' => 'element FolderChecked',
'api_url' => 'printer',
'router_path' => 'printer/list',
'view_path' => 'printer/list',
'methods' => 'get',
'sort' => '97',
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '删除打印机',
'menu_key' => 'delete_printer',
'menu_short_name' => '删除打印机',
'menu_type' => '2',
'icon' => '',
'api_url' => 'printer/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
]
]
],
[
'menu_name' => '添加打印机',
'menu_key' => 'printer_add',
'menu_short_name' => '添加打印机',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer',
'router_path' => 'printer/add',
'view_path' => 'printer/edit',
'methods' => 'post',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑打印机',
'menu_key' => 'printer_edit',
'menu_short_name' => '添加打印机',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/<id>',
'router_path' => 'printer/edit',
'view_path' => 'printer/edit',
'methods' => 'put',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '小票打印模板',
'menu_key' => 'printer_template_management',
'menu_short_name' => '小票打印模板',
'menu_type' => '1',
'icon' => 'element FolderChecked',
'api_url' => 'printer/template',
'router_path' => 'printer/template/list',
'view_path' => 'printer/template_list',
'methods' => 'get',
'sort' => '96',
'status' => '1',
'is_show' => '0',
'children' => [
[
'menu_name' => '删除打印模板',
'menu_key' => 'delete_printer_template',
'menu_short_name' => '删除打印模板',
'menu_type' => '2',
'icon' => '',
'api_url' => 'printer/template/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
]
]
],
[
'menu_name' => '添加打印模板',
'menu_key' => 'printer_template_add',
'menu_short_name' => '添加打印模板',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/template',
'router_path' => 'printer/template/add',
'view_path' => 'printer/template_edit',
'methods' => 'post',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑打印模板',
'menu_key' => 'printer_template_edit',
'menu_short_name' => '编辑打印模板',
'menu_type' => '1',
'icon' => '',
'api_url' => 'printer/template/<id>',
'router_path' => 'printer/template/edit',
'view_path' => 'printer/template_edit',
'methods' => 'put',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
] ]
], ],
@ -2707,6 +2735,20 @@ return [
'status' => '1', 'status' => '1',
'is_show' => '0', 'is_show' => '0',
], ],
[
'menu_name' => '表单装修',
'menu_key' => 'form_page_decorate',
'menu_short_name' => '表单装修',
'menu_type' => '1',
'icon' => '',
'api_url' => '', // diy/diy/<id>
'router_path' => 'decorate/form/edit',
'view_path' => 'diy_form/edit',
'methods' => 'put',
'sort' => '0',
'status' => '1',
'is_show' => '0',
],
], ],
], ],
[ [
@ -2740,6 +2782,55 @@ return [
], ],
], ],
], ],
[
'menu_name' => '万能表单',
'menu_key' => 'diy_form',
'menu_short_name' => '万能表单',
'menu_type' => '0',
'icon' => 'element Files',
'api_url' => '',
'router_path' => '',
'view_path' => '',
'methods' => '',
'sort' => '0',
'status' => '1',
'is_show' => '1',
'menu_attr' => 'diy_form',
'children' => [
[
'menu_name' => '表单列表',
'menu_key' => 'diy_form_list',
'menu_short_name' => '表单列表',
'menu_type' => '1',
'icon' => 'element Files',
'api_url' => 'diy_form',
'router_path' => 'diy_form/list',
'view_path' => 'diy_form/list',
'methods' => 'get',
'sort' => '0',
'status' => '1',
'is_show' => '1',
'menu_attr' => 'diy_form',
'children' => [
[
'menu_name' => '分享设置',
'menu_key' => 'save_diy_form_share',
'menu_short_name' => '分享设置',
'menu_type' => '2',
'icon' => '',
'api_url' => 'diy_form/share',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '100',
'status' => '1',
'is_show' => '1',
'menu_attr' => 'diy_form',
],
],
],
]
],
[ [
'menu_name' => '开发', 'menu_name' => '开发',
'menu_key' => 'tool', 'menu_key' => 'tool',

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -14,14 +14,17 @@ namespace app\dict\pay;
class TransferDict class TransferDict
{ {
public const WECHAT = 'wechatpay';//微信支付 public const WECHAT = 'wechatpay';//微信零钱
public const ALIPAY = 'alipay';//支付宝支付 public const ALIPAY = 'alipay';//支付宝支付 (默认收款码)
public const OFFLINE = 'offline';//线下转账 public const OFFLINE = 'offline';//线下转账
public const BANK = 'bank';//银行卡转账 public const BANK = 'bank';//银行卡转账
public const WECHAT_CODE = 'wechat_code';//微信收款码(线下转账)
//转账状态 //转账状态
public const SUCCESS = 'success';//转账成功 public const SUCCESS = 'success';//转账成功
@ -43,7 +46,7 @@ class TransferDict
} }
/** /**
* 支付类型 * 转账类型
* @return array * @return array
*/ */
public static function getTransferType(array $types = [], $is_all = true) public static function getTransferType(array $types = [], $is_all = true)
@ -64,6 +67,11 @@ class TransferDict
'key' => self::BANK, 'key' => self::BANK,
'is_online' => false 'is_online' => false
],//银行卡 ],//银行卡
self::WECHAT_CODE => [
'name' => get_lang('dict_transfer.type_wechat_code'),
'key' => self::WECHAT_CODE,
'is_online' => false
],//微信收款码(线下转账)
]; ];
if ($is_all) { if ($is_all) {
$list[self::OFFLINE] = [ $list[self::OFFLINE] = [
@ -96,4 +104,4 @@ class TransferDict
]; ];
} }
} }

View File

@ -12,5 +12,15 @@ return [
'class' => '', 'class' => '',
'function' => '' 'function' => ''
], ],
[
'key' => 'transfer_check_finish',
'name' => '检验在线转账是否处理完毕',
'desc' => '',
'time' => [
'type' => 'min',
'min' => 5
],
'class' => 'app\job\transfer\schedule\CheckFinish',
'function' => ''
]
]; ];

View File

@ -80,11 +80,23 @@ $system_event = [
'ExportDataType' => [ 'ExportDataType' => [
//会员导出 //会员导出
'app\listener\member_export\MemberExportTypeListener', 'app\listener\member_export\MemberExportTypeListener',
//表单填写明细导出
'app\listener\diy_form_export\DiyFormRecordsExportTypeListener',
//表单填表人统计导出
'app\listener\diy_form_export\DiyFormRecordsMemberExportTypeListener',
//表单字段统计导出
'app\listener\diy_form_export\DiyFormRecordsFieldsExportTypeListener',
], ],
//导出数据源 //导出数据源
'ExportData' => [ 'ExportData' => [
//会员导出 //会员导出
'app\listener\member_export\MemberExportDataListener', 'app\listener\member_export\MemberExportDataListener',
//表单填写明细导出
'app\listener\diy_form_export\DiyFormRecordsExportDataListener',
//表单填表人统计导出
'app\listener\diy_form_export\DiyFormRecordsMemberExportDataListener',
//表单字段统计导出
'app\listener\diy_form_export\DiyFormRecordsFieldsExportDataListener',
], ],
//统计执行 //统计执行
'StatExecute' => [], 'StatExecute' => [],
@ -94,6 +106,10 @@ $system_event = [
// 获取海报数据 // 获取海报数据
'GetPosterType' => [ 'app\listener\system\PosterType' ], 'GetPosterType' => [ 'app\listener\system\PosterType' ],
'GetPosterData' => [ 'app\listener\system\Poster' ], 'GetPosterData' => [ 'app\listener\system\Poster' ],
'ShowApp' => [
'app\listener\system\ShowAppListener'
]
], ],
'subscribe' => [ 'subscribe' => [
], ],

View File

@ -7,6 +7,7 @@ use app\model\sys\Poster;
use app\model\sys\SysUser; use app\model\sys\SysUser;
use app\service\admin\auth\LoginService; use app\service\admin\auth\LoginService;
use app\service\admin\install\InstallSystemService; use app\service\admin\install\InstallSystemService;
use app\service\admin\sys\ConfigService;
use app\service\core\addon\CoreAddonInstallService; use app\service\core\addon\CoreAddonInstallService;
use app\service\core\addon\CoreAddonService; use app\service\core\addon\CoreAddonService;
use app\service\core\poster\CorePosterService; use app\service\core\poster\CorePosterService;
@ -346,6 +347,29 @@ class Index extends BaseInstall
]); ]);
} }
// 设置网站信息
if (!empty($admin_name)) {
(new ConfigService())->setWebSite([
'site_name' => $admin_name,
'logo' => config('install.admin_logo'),
'keywords' => '',
'desc' => '',
'latitude' => '',
'longitude' => '',
'province_id' => 0,
'city_id' => 0,
'district_id' => 0,
'address' => '',
'full_address' => '',
'phone' => '',
'business_hours' => '',
'front_end_name' => '',
'front_end_logo' => '',
'front_end_icon' => '',
'icon' => ''
]);
}
// 安装插件 // 安装插件
$this->installAddon(); $this->installAddon();

View File

@ -75,17 +75,116 @@ CREATE TABLE `applet_version` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `web_adv`; DROP TABLE IF EXISTS `diy_form`;
CREATE TABLE `web_adv` ( CREATE TABLE `diy_form` (
`adv_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `form_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '表单id',
`adv_key` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '广告位key', `page_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单名称(用于后台展示)',
`adv_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容描述', `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单名称(用于前台展示)',
`adv_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告链接', `type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '表单类型',
`adv_image` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容图片', `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态0关闭1开启',
`sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', `template` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模板名称',
`background` VARCHAR(255) NOT NULL DEFAULT '#FFFFFF' COMMENT '背景色', `value` LONGTEXT DEFAULT NULL COMMENT '表单数据json格式包含展示组件',
PRIMARY KEY (`adv_id`) `addon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属插件标识',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='广告表'; `share` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '分享内容',
`write_num` INT(11) NOT NULL DEFAULT 0 COMMENT '表单填写总数量',
`remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注说明',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`form_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单表';
DROP TABLE IF EXISTS `diy_form_fields`;
CREATE TABLE `diy_form_fields` (
`field_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '字段id',
`form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id',
`field_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段唯一标识',
`field_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段类型',
`field_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段名称',
`field_remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段说明',
`field_default` TEXT DEFAULT NULL COMMENT '字段默认值',
`write_num` INT(11) NOT NULL DEFAULT 0 COMMENT '字段填写总数量',
`field_required` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否必填 0:否 1:是',
`field_hidden` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否隐藏 0:否 1:是',
`field_unique` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段内容防重复 0:否 1:是',
`privacy_protection` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '隐私保护 0:关闭 1:开启',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`field_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单字段表';
DROP TABLE IF EXISTS `diy_form_records`;
CREATE TABLE `diy_form_records` (
`record_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '表单填写记录id',
`form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id',
`value` LONGTEXT DEFAULT NULL COMMENT '填写的表单数据',
`member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '填写人会员id',
`relate_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联业务id',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`record_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='万能表单填写记录表';
DROP TABLE IF EXISTS `diy_form_records_fields`;
CREATE TABLE `diy_form_records_fields` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id',
`form_field_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联表单字段id',
`record_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联表单填写记录id',
`member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '填写会员id',
`field_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段唯一标识',
`field_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段类型',
`field_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '字段名称',
`field_value` LONGTEXT NOT NULL COMMENT '字段值,根据类型展示对应效果',
`field_required` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否必填 0:否 1:是',
`field_hidden` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段是否隐藏 0:否 1:是',
`field_unique` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '字段内容防重复 0:否 1:是',
`privacy_protection` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '隐私保护 0:关闭 1:开启',
`update_num` INT(11) NOT NULL DEFAULT 0 COMMENT '字段修改次数',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_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 `diy_form_submit_config`;
CREATE TABLE `diy_form_submit_config` (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id',
`submit_after_action` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '填表人提交后操作text文字信息voucher核销凭证',
`tips_type` VARCHAR(255) NOT NULL COMMENT '提示内容类型default默认提示diy自定义提示',
`tips_text` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '自定义提示内容',
`time_limit_type` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '核销凭证有效期限制类型no_limit不限制specify_time指定固定开始结束时间submission_time按提交时间设置有效期',
`time_limit_rule` TEXT DEFAULT NULL COMMENT '核销凭证时间限制规则json格式',
`voucher_content_rule` TEXT DEFAULT NULL COMMENT '核销凭证内容json格式',
`success_after_action` TEXT DEFAULT NULL COMMENT '填写成功后续操作',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_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 `diy_form_write_config`;
CREATE TABLE `diy_form_write_config` (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '所属万能表单id',
`write_way` VARCHAR(255) NOT NULL COMMENT '填写方式no_limit不限制scan仅限微信扫一扫url仅限链接进入',
`join_member_type` VARCHAR(255) NOT NULL DEFAULT 'all_member' COMMENT '参与会员all_member所有会员参与selected_member_level指定会员等级selected_member_label指定会员标签',
`level_ids` TEXT DEFAULT NULL COMMENT '会员等级id集合',
`label_ids` TEXT DEFAULT NULL COMMENT '会员标签id集合',
`member_write_type` VARCHAR(255) NOT NULL COMMENT '每人可填写次数no_limit不限制diy自定义',
`member_write_rule` TEXT NOT NULL COMMENT '每人可填写次数自定义规则',
`form_write_type` VARCHAR(255) NOT NULL COMMENT '表单可填写数量no_limit不限制diy自定义',
`form_write_rule` TEXT NOT NULL COMMENT '表单可填写总数自定义规则',
`time_limit_type` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '填写时间限制类型no_limit不限制 specify_time指定开始结束时间open_day_time设置每日开启时间',
`time_limit_rule` TEXT NOT NULL COMMENT '填写时间限制规则',
`is_allow_update_content` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否允许修改自己填写的内容01',
`write_instruction` TEXT DEFAULT NULL COMMENT '表单填写须知',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_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 `diy_page`; DROP TABLE IF EXISTS `diy_page`;
@ -98,12 +197,12 @@ CREATE TABLE `diy_page` (
`template` varchar(255) NOT NULL DEFAULT '' COMMENT '模板名称', `template` varchar(255) NOT NULL DEFAULT '' COMMENT '模板名称',
`mode` varchar(255) NOT NULL DEFAULT 'diy' COMMENT '页面展示模式diy自定义fixed固定', `mode` varchar(255) NOT NULL DEFAULT 'diy' COMMENT '页面展示模式diy自定义fixed固定',
`value` longtext COMMENT '页面数据json格式', `value` longtext COMMENT '页面数据json格式',
`is_default` int(11) NOT NULL DEFAULT '0' COMMENT '是否默认页面10', `is_default` int(11) NOT NULL DEFAULT 0 COMMENT '是否默认页面10',
`is_change` int(11) NOT NULL DEFAULT '0' COMMENT '数据是否发生过变化1变化了2没有', `is_change` int(11) NOT NULL DEFAULT 0 COMMENT '数据是否发生过变化1变化了2没有',
`share` varchar(1000) NOT NULL DEFAULT '' COMMENT '分享内容', `share` varchar(1000) NOT NULL DEFAULT '' COMMENT '分享内容',
`visit_count` int(11) NOT NULL DEFAULT '0' COMMENT '访问量', `visit_count` int(11) NOT NULL DEFAULT 0 COMMENT '访问量',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义页面' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义页面' ROW_FORMAT = Dynamic;
@ -121,6 +220,23 @@ CREATE TABLE `diy_route` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义路由' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义路由' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `diy_theme`;
CREATE TABLE `diy_theme` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '标题',
`type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '插件类型appaddon',
`addon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '所属应用app系统shop商城、o2o上门服务',
`color_mark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '颜色标识',
`color_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '颜色名称',
`mode` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模式default默认【跟随系统】diy自定义配色',
`value` TEXT DEFAULT NULL COMMENT '配色',
`diy_value` TEXT DEFAULT NULL COMMENT '自定义配色',
`create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_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 `generate_column`; DROP TABLE IF EXISTS `generate_column`;
CREATE TABLE `generate_column` ( CREATE TABLE `generate_column` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
@ -252,8 +368,8 @@ CREATE TABLE `member` (
DROP TABLE IF EXISTS `member_account_log`; 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, `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id', `member_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
`account_type` varchar(255) NOT NULL DEFAULT 'point' COMMENT '账户类型', `account_type` varchar(255) NOT NULL DEFAULT 'point' COMMENT '账户类型',
`account_data` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '账户数据', `account_data` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '账户数据',
`account_sum` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '变动后的账户余额', `account_sum` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '变动后的账户余额',
@ -267,8 +383,8 @@ CREATE TABLE `member_account_log` (
DROP TABLE IF EXISTS `member_address`; DROP TABLE IF EXISTS `member_address`;
CREATE TABLE `member_address` ( CREATE TABLE `member_address` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id', `member_id` int NOT NULL DEFAULT 0 COMMENT '会员id',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '用户姓名', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '用户姓名',
`mobile` varchar(255) NOT NULL DEFAULT '' COMMENT '手机', `mobile` varchar(255) NOT NULL DEFAULT '' COMMENT '手机',
`province_id` int NOT NULL DEFAULT 0 COMMENT '省id', `province_id` int NOT NULL DEFAULT 0 COMMENT '省id',
@ -297,6 +413,8 @@ CREATE TABLE `member_cash_out` (
`transfer_mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号', `transfer_mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
`transfer_bank` varchar(255) NOT NULL DEFAULT '' COMMENT '银行名称', `transfer_bank` varchar(255) NOT NULL DEFAULT '' COMMENT '银行名称',
`transfer_account` varchar(255) NOT NULL DEFAULT '' COMMENT '收款账号', `transfer_account` varchar(255) NOT NULL DEFAULT '' COMMENT '收款账号',
`transfer_payee` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '转账收款方(json),主要用于对接在线的打款方式',
`transfer_payment_code` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '收款码图片',
`transfer_fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因', `transfer_fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
`transfer_status` varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态', `transfer_status` varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态',
`transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间', `transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
@ -327,13 +445,14 @@ CREATE TABLE `member_cash_out_account` (
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间', `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
`account_no` varchar(255) NOT NULL DEFAULT '' COMMENT '提现账户', `account_no` varchar(255) NOT NULL DEFAULT '' COMMENT '提现账户',
`transfer_payment_code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收款码',
PRIMARY KEY (`account_id`) USING BTREE PRIMARY KEY (`account_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员提现账户' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员提现账户' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `member_label`; 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_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签id',
`label_name` varchar(50) NOT NULL DEFAULT '' COMMENT '标签名称', `label_name` varchar(50) NOT NULL DEFAULT '' COMMENT '标签名称',
`memo` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注', `memo` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
`sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序', `sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
@ -376,7 +495,7 @@ CREATE TABLE `member_sign` (
DROP TABLE IF EXISTS `pay`; DROP TABLE IF EXISTS `pay`;
CREATE TABLE `pay` ( CREATE TABLE `pay` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`main_id` int(11) NOT NULL DEFAULT 0 COMMENT '支付会员id', `main_id` int(11) NOT NULL DEFAULT 0 COMMENT '支付会员id',
`from_main_id` INT(11) NOT NULL DEFAULT 0 COMMENT '发起支付会员id', `from_main_id` INT(11) NOT NULL DEFAULT 0 COMMENT '发起支付会员id',
`out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号', `out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
@ -402,7 +521,7 @@ CREATE TABLE `pay` (
DROP TABLE IF EXISTS `pay_channel`; DROP TABLE IF EXISTS `pay_channel`;
CREATE TABLE `pay_channel` ( CREATE TABLE `pay_channel` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付类型', `type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付类型',
`channel` varchar(255) NOT NULL DEFAULT '' COMMENT '支付渠道', `channel` varchar(255) NOT NULL DEFAULT '' COMMENT '支付渠道',
`config` text NOT NULL COMMENT '支付配置', `config` text NOT NULL COMMENT '支付配置',
@ -416,7 +535,7 @@ CREATE TABLE `pay_channel` (
DROP TABLE IF EXISTS `pay_refund`; DROP TABLE IF EXISTS `pay_refund`;
CREATE TABLE `pay_refund` ( CREATE TABLE `pay_refund` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`refund_no` varchar(255) NOT NULL DEFAULT '' COMMENT '退款单号', `refund_no` varchar(255) NOT NULL DEFAULT '' COMMENT '退款单号',
`out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号', `out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付方式', `type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付方式',
@ -453,15 +572,18 @@ CREATE TABLE `pay_transfer` (
`transfer_account` varchar(255) NOT NULL DEFAULT '' COMMENT '收款账号', `transfer_account` varchar(255) NOT NULL DEFAULT '' COMMENT '收款账号',
`transfer_voucher` varchar(255) NOT NULL DEFAULT '' COMMENT '凭证', `transfer_voucher` varchar(255) NOT NULL DEFAULT '' COMMENT '凭证',
`transfer_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '凭证说明', `transfer_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '凭证说明',
`transfer_fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因', `transfer_payment_code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收款码图片',
`transfer_fail_reason` varchar(2000) NOT NULL DEFAULT '' COMMENT '失败原因',
`transfer_status` varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态', `transfer_status` varchar(20) NOT NULL DEFAULT '' COMMENT '转账状态',
`money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '转账金额', `money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '转账金额',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '申请时间', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '申请时间',
`transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间', `transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
`update_time` int(11) NOT NULL DEFAULT 0, `update_time` int(11) NOT NULL DEFAULT 0,
`openid` varchar(50) NOT NULL DEFAULT '', `openid` varchar(50) NOT NULL DEFAULT '',
`remark` varchar(255) NOT NULL, `remark` varchar(255) NOT NULL DEFAULT '',
`batch_id` varchar(500) NOT NULL DEFAULT '' COMMENT '转账批次id', `batch_id` varchar(500) NOT NULL DEFAULT '' COMMENT '转账批次id',
`transfer_payee` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '在线转账数据(json)',
`out_batch_no` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '扩展数据,主要用于记录接收到线上打款的业务数据编号',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '转账表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '转账表' ROW_FORMAT = Dynamic;
@ -507,7 +629,7 @@ CREATE TABLE `stat_hour` (
DROP TABLE IF EXISTS `sys_agreement`; DROP TABLE IF EXISTS `sys_agreement`;
CREATE TABLE `sys_agreement` ( CREATE TABLE `sys_agreement` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`agreement_key` varchar(255) NOT NULL DEFAULT '' COMMENT '协议关键字', `agreement_key` varchar(255) NOT NULL DEFAULT '' COMMENT '协议关键字',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '协议标题', `title` varchar(255) NOT NULL DEFAULT '' COMMENT '协议标题',
`content` text NULL COMMENT '协议内容', `content` text NULL COMMENT '协议内容',
@ -519,7 +641,7 @@ CREATE TABLE `sys_agreement` (
DROP TABLE IF EXISTS `sys_area`; DROP TABLE IF EXISTS `sys_area`;
CREATE TABLE `sys_area` ( CREATE TABLE `sys_area` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '父级', `pid` int(11) NOT NULL DEFAULT 0 COMMENT '父级',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称', `name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
`shortname` varchar(30) NOT NULL DEFAULT '' COMMENT '简称', `shortname` varchar(30) NOT NULL DEFAULT '' COMMENT '简称',
@ -565,7 +687,7 @@ CREATE TABLE `sys_attachment_category` (
DROP TABLE IF EXISTS `sys_config`; DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` ( CREATE TABLE `sys_config` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`config_key` varchar(255) NOT NULL DEFAULT '' COMMENT '配置项关键字', `config_key` varchar(255) NOT NULL DEFAULT '' COMMENT '配置项关键字',
`value` text NULL COMMENT '配置值json', `value` text NULL COMMENT '配置值json',
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否启用 1启用 0不启用', `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否启用 1启用 0不启用',
@ -653,7 +775,7 @@ CREATE TABLE `verify` (
DROP TABLE IF EXISTS `sys_menu`; DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` ( CREATE TABLE `sys_menu` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '菜单ID', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
`app_type` varchar(255) NOT NULL DEFAULT 'admin' COMMENT '应用类型', `app_type` varchar(255) NOT NULL DEFAULT 'admin' COMMENT '应用类型',
`menu_name` varchar(32) NOT NULL DEFAULT '' COMMENT '菜单名称', `menu_name` varchar(32) NOT NULL DEFAULT '' COMMENT '菜单名称',
`menu_short_name` varchar(50) NOT NULL DEFAULT '' COMMENT '菜单短标题', `menu_short_name` varchar(50) NOT NULL DEFAULT '' COMMENT '菜单短标题',
@ -697,7 +819,7 @@ CREATE TABLE `sys_notice` (
DROP TABLE IF EXISTS `sys_notice_log`; 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', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '通知记录ID',
`key` varchar(255) NULL DEFAULT '' COMMENT '消息key', `key` varchar(255) NULL DEFAULT '' COMMENT '消息key',
`notice_type` varchar(50) NULL DEFAULT 'sms' COMMENT '消息类型sms,wechat.weapp', `notice_type` varchar(50) NULL DEFAULT 'sms' COMMENT '消息类型sms,wechat.weapp',
`uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '通知的用户id', `uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '通知的用户id',
@ -736,7 +858,7 @@ CREATE TABLE `sys_notice_sms_log` (
DROP TABLE IF EXISTS `sys_role`; 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_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '角色id',
`role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称', `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
`rules` text NULL COMMENT '角色权限(menus_id)', `rules` text NULL COMMENT '角色权限(menus_id)',
`addon_keys` text COMMENT '角色应用权限应用key', `addon_keys` text COMMENT '角色应用权限应用key',
@ -749,7 +871,7 @@ CREATE TABLE `sys_role` (
DROP TABLE IF EXISTS `sys_poster`; DROP TABLE IF EXISTS `sys_poster`;
CREATE TABLE `sys_poster` ( CREATE TABLE `sys_poster` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '海报名称', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '海报名称',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '海报类型', `type` varchar(255) NOT NULL DEFAULT '' COMMENT '海报类型',
`channel` varchar(255) NOT NULL DEFAULT '' COMMENT '海报支持渠道', `channel` varchar(255) NOT NULL DEFAULT '' COMMENT '海报支持渠道',
@ -853,7 +975,7 @@ CREATE TABLE `sys_user` (
DROP TABLE IF EXISTS `sys_user_log`; 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', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理员操作记录ID',
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT '登录IP', `ip` varchar(50) NOT NULL DEFAULT '' COMMENT '登录IP',
`uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员id', `uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员id',
`username` varchar(64) NOT NULL DEFAULT '' COMMENT '管理员姓名', `username` varchar(64) NOT NULL DEFAULT '' COMMENT '管理员姓名',
@ -868,7 +990,7 @@ CREATE TABLE `sys_user_log` (
DROP TABLE IF EXISTS `sys_user_role`; DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` ( CREATE TABLE `sys_user_role` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0' COMMENT '用户id', `uid` int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
`role_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '角色id', `role_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '角色id',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
`is_admin` int(11) NOT NULL DEFAULT 0 COMMENT '是否是超级管理员', `is_admin` int(11) NOT NULL DEFAULT 0 COMMENT '是否是超级管理员',
@ -892,6 +1014,19 @@ CREATE TABLE `weapp_version` (
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `web_adv`;
CREATE TABLE `web_adv` (
`adv_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`adv_key` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '广告位key',
`adv_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容描述',
`adv_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告链接',
`adv_image` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容图片',
`sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号',
`background` VARCHAR(255) NOT NULL DEFAULT '#FFFFFF' COMMENT '背景色',
PRIMARY KEY (`adv_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='广告表';
DROP TABLE IF EXISTS `web_friendly_link`; DROP TABLE IF EXISTS `web_friendly_link`;
CREATE TABLE `web_friendly_link` ( CREATE TABLE `web_friendly_link` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '索引id', `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '索引id',
@ -957,8 +1092,8 @@ CREATE TABLE `wechat_media` (
DROP TABLE IF EXISTS `wechat_reply`; DROP TABLE IF EXISTS `wechat_reply`;
CREATE TABLE `wechat_reply` ( CREATE TABLE `wechat_reply` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '规则名称', `name` varchar(64) NOT NULL DEFAULT '' COMMENT '规则名称',
`keyword` varchar(64) NOT NULL DEFAULT '' COMMENT '关键词', `keyword` varchar(64) NOT NULL DEFAULT '' COMMENT '关键词',
`reply_type` varchar(30) NOT NULL DEFAULT '' COMMENT '回复类型 subscribe-关注回复 keyword-关键字回复 default-默认回复', `reply_type` varchar(30) NOT NULL DEFAULT '' COMMENT '回复类型 subscribe-关注回复 keyword-关键字回复 default-默认回复',
`matching_type` varchar(30) NOT NULL DEFAULT '1' COMMENT '匹配方式full 全匹配like-模糊匹配', `matching_type` varchar(30) NOT NULL DEFAULT '1' COMMENT '匹配方式full 全匹配like-模糊匹配',

View File

@ -22,7 +22,7 @@ class ExportJob extends BaseJob
public function doJob($type, $where, $page) public function doJob($type, $where, $page)
{ {
//获取导出数据列 //获取导出数据列
$data_column = (new CoreExportService())->getExportDataColumn($type); $data_column = (new CoreExportService())->getExportDataColumn($type, $where);
//获取导出数据源 //获取导出数据源
$data = (new CoreExportService())->getExportData($type, $where, $page); $data = (new CoreExportService())->getExportData($type, $where, $page);
(new CoreExportService())->export($type, $data_column, $data); (new CoreExportService())->export($type, $data_column, $data);

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\transfer\schedule;
use app\dict\pay\TransferDict;
use app\model\pay\Transfer;
use app\service\core\pay\CoreTransferService;
use core\base\BaseJob;
use think\facade\Log;
/**
* 定时校验转账是否完毕(每分钟一次)
*/
class CheckFinish extends BaseJob
{
public function doJob()
{
$condition = [
'transfer_status' => TransferDict::DEALING,
'transfer_type' => TransferDict::WECHAT
];
$list = (new Transfer())->where($condition)->select();
$core_transfer_service = new CoreTransferService();
foreach($list as $item){
$core_transfer_service->check($item->toArray());
}
return true;
}
}

View File

@ -56,6 +56,7 @@ return [
'ADDON_KEY_IS_EXIST' => '已存在相同插件标识的应用', 'ADDON_KEY_IS_EXIST' => '已存在相同插件标识的应用',
'ADDON_IS_INSTALLED_NOT_ALLOW_DEL' => '已安装的插件不允许删除', 'ADDON_IS_INSTALLED_NOT_ALLOW_DEL' => '已安装的插件不允许删除',
'ADDON_ZIP_ERROR' => '插件压缩失败', 'ADDON_ZIP_ERROR' => '插件压缩失败',
'PHP_SCRIPT_RUNNING_OUT_OF_MEMORY' => 'PHP脚本运行内存不足, 具体操作方法<a style="text-decoration: underline;" href="https://www.kancloud.cn/niushop/niushop_v6/3248604" target="blank">点击查看相关手册</a>',
//登录注册重置账号.... //登录注册重置账号....
'LOGIN_SUCCESS' => '登录成功', 'LOGIN_SUCCESS' => '登录成功',
@ -179,9 +180,18 @@ return [
'MEMBER_CASHOUT_TRANSFER' => '会员提现转账', 'MEMBER_CASHOUT_TRANSFER' => '会员提现转账',
'CASH_OUT_ACCOUNT_NOT_EXIST' => '提现账户不存在', 'CASH_OUT_ACCOUNT_NOT_EXIST' => '提现账户不存在',
'CASH_OUT_ACCOUNT_NOT_FOUND_VALUE' => '转账到微信零钱缺少参数',
//DIY //DIY
'PAGE_NOT_EXIST' => '页面不存在', 'PAGE_NOT_EXIST' => '页面不存在',
//万能表单
'DIY_FORM_NOT_EXIST' => '表单不存在',
'DIY_FORM_NOT_OPEN' => '该表单已关闭',
'DIY_FORM_EXCEEDING_LIMIT' => '已达提交次数上限',
'ON_STATUS_PROHIBIT_DELETE' => '启用状态下禁止删除',
'DIY_FORM_TYPE_NOT_EXIST' => '表单类型不存在',
//渠道相关 占用 4****** //渠道相关 占用 4******
//微信 //微信
'WECHAT_NOT_EXIST' => '微信公众号未配置完善', 'WECHAT_NOT_EXIST' => '微信公众号未配置完善',
@ -209,6 +219,7 @@ return [
//支付相关(todo 注意:7段不共享) //支付相关(todo 注意:7段不共享)
'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号', 'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号',
'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持', 'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持',
'WECHAT_TRANSFER_CONFIG_NOT_EXIST' => '微信零钱打款设置未配置完善',
'PAYMENT_LOCK' => '支付中,请稍后再试', 'PAYMENT_LOCK' => '支付中,请稍后再试',
'PAY_SUCCESS' => '当前支付已完成', 'PAY_SUCCESS' => '当前支付已完成',
'PAY_IS_REMOVE' => '当前支付已取消', 'PAY_IS_REMOVE' => '当前支付已取消',
@ -293,7 +304,10 @@ return [
'SIGN_AWARD' => '签到奖励', 'SIGN_AWARD' => '签到奖励',
'GET_AWARD' => '恭喜您获得以下奖励', 'GET_AWARD' => '恭喜您获得以下奖励',
'WILL_GET_AWARD' => '您将获得以下奖励', 'WILL_GET_AWARD' => '您将获得以下奖励',
'SIGN_PERIOD_GREATER_THAN' => '签到周期必须大于0天', 'SIGN_PERIOD_CANNOT_EMPTY' => '签到周期不能为空',
'SIGN_PERIOD_BETWEEN_2_365_DAYS' => '签到周期为2-365天',
'CONTINUE_SIGN_BETWEEN_2_365_DAYS' => '连签天数为2-365天',
'CONTINUE_SIGN_CANNOT_GREATER_THAN_SIGN_PERIOD' => '连签天数不能大于签到周期',
//导出相关 //导出相关
'EXPORT_SUCCESS' => '导出成功', 'EXPORT_SUCCESS' => '导出成功',

View File

@ -198,10 +198,11 @@ return [
], ],
//转账相关 //转账相关
'dict_transfer' => [ 'dict_transfer' => [
'type_wechat' => '微信', 'type_wechat' => '微信零钱',
'type_ali' => '支付宝', 'type_ali' => '支付宝',
'type_bank' => '银行卡', 'type_bank' => '银行卡',
'type_offline' => '线下转账', 'type_offline' => '线下转账',
'type_wechat_code' => '微信',//微信线下打款
'status_wait' => '待转账', 'status_wait' => '待转账',
'status_dealing' => '处理中', 'status_dealing' => '处理中',
@ -257,6 +258,14 @@ return [
'dict_diy_poster' => [ 'dict_diy_poster' => [
'component_type_basic' => '基础组件', 'component_type_basic' => '基础组件',
], ],
// 系统自定义表单
'dict_diy_form' => [
'component_type_form' => '表单组件',
'type_diy_form' => '自定义表单',
'type_sign_registration' => '签到报名登记',
'type_leave_message_suggestion' => '留言建议',
'type_write_off_voucher' => '核销凭证',
],
//短信相关 //短信相关
'dict_sms' => [ 'dict_sms' => [
'status_sending' => '发送中', 'status_sending' => '发送中',
@ -277,6 +286,7 @@ return [
//状态 //状态
'status_wait_audit' => '待审核', 'status_wait_audit' => '待审核',
'status_wait_transfer' => '待转账', 'status_wait_transfer' => '待转账',
'status_transfer_ing' => '转账中',
'status_transfered' => '已转账', 'status_transfered' => '已转账',
'status_refuse' => '已拒绝', 'status_refuse' => '已拒绝',
'status_cancel' => '已取消' 'status_cancel' => '已取消'

View File

@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\diy_form_export;
use app\model\diy_form\DiyFormFields;
use app\model\diy_form\DiyFormRecords;
/**
* 表单填写记录导出数据源查询
* Class DiyFormRecordsExportDataListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsExportDataListener
{
public function handle($param)
{
$data = [];
if ($param['type'] == 'diy_form_records') {
$model = new DiyFormRecords();
$member_where = [];
if (!empty($param[ 'where' ][ 'keyword' ])) {
$member_where[] = [ 'member_no|nickname|username|mobile', 'like', '%' . $param[ 'where' ][ 'keyword' ] . '%' ];
}
$field = 'record_id, form_id, member_id, relate_id, create_time';
$order = "create_time desc";
$search_model = $model->where([
[ 'form_id', '=', $param[ 'where' ] [ 'form_id' ] ]
])->field($field)->withSearch([ 'create_time' ], $param[ 'where' ])
->withJoin([
'member' => function($query) use ($member_where) {
$query->where($member_where);
}
])->with([
// 关联填写字段列表
'recordsFieldList' => function($query) {
$query->field('id, form_id, form_field_id, record_id, member_id, field_key, field_type, field_name, field_value, update_num, update_time')->append([ 'render_value' ]);
},
'form'
])
->order($order);
if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) {
$data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray();
} else {
$data = $search_model->select()->toArray();
}
$field_key_list = ( new DiyFormFields() )->where([
[ 'form_id', '=', $param['where']['form_id'] ]
])->column('field_key');
foreach ($data as $key => $value) {
$data[$key]['page_title'] = $value[ 'form' ]['page_title'] ?? '';
$data[$key]['type_name'] = $value[ 'form' ]['type_name'] ?? '';
$data[$key]['nickname'] = $value[ 'member' ]['nickname'] ?? '';
$data[$key]['mobile'] = $value[ 'member' ]['mobile']."\t" ?? '';
$list_key = array_column($value[ 'recordsFieldList' ], null, 'field_key');
foreach ($field_key_list as $field_key) {
$data[$key][$field_key] = !empty($list_key[$field_key]) ? $list_key[$field_key]['render_value']."\t" : '';
}
}
}
return $data;
}
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\diy_form_export;
use app\model\diy_form\DiyFormFields;
/**
* 表单填写记录导出数据类型查询
* Class DiyFormRecordsExportTypeListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsExportTypeListener
{
public function handle($param)
{
$column = [
'record_id' => [ 'name' => '记录编号' ],
'create_time' => [ 'name' => '填表时间' ],
'page_title' => [ 'name' => '表单名称' ],
'type_name' => [ 'name' => '表单类型' ],
'form_id' => [ 'name' => '表单编号' ],
'nickname' => [ 'name' => '填表人名称' ],
'mobile' => [ 'name' => '填表人手机号' ],
];
if (!empty($param['where']['form_id'])) {
$field_list = ( new DiyFormFields() )->where([
[ 'form_id', '=', $param['where']['form_id'] ]
])->field('field_key,field_name')->select()->toArray();
foreach ($field_list as $key => $value) {
$column[$value['field_key']] = [ 'name' => $value['field_name'] ];
}
}
return [
'diy_form_records' => [
'name' => '表单填写明细',
'column' => $column,
]
];
}
}

View File

@ -0,0 +1,117 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
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;
/**
* 表单填表人统计导出数据源查询
* Class DiyFormRecordsMemberExportDataListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsFieldsExportDataListener
{
public function handle($param)
{
$data = [];
if ($param['type'] == 'diy_form_records_fields') {
$where = $param[ 'where' ];
$field_list = ( new DiyFormService() )->getFieldsList($where, 'field_id, field_key, field_type, field_name');
$simple_field_list = array_filter($field_list, function($v) { return !in_array($v[ 'field_type' ], [ 'FormRadio', 'FormCheckbox', 'FormDateScope', 'FormTimeScope', 'FormImage' ]); });
$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) {
$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' ] ]
])->withSearch([ 'form_id' ], $where)->group('field_value')->append([ 'render_value' ])->select()->toArray();
$total_count = $records_field_model->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
])->withSearch([ 'form_id' ], $where)->count();
if ($total_count > 0) {
$total_percent = 100;
foreach ($value_list as $k1 => &$v1) {
if ($k1 == count($value_list) - 1) {
$item_percent = $total_percent;
} else {
$item_percent = round($v1[ 'write_count' ] / $total_count * 100, 2);
}
$v1[ 'write_percent' ] = floatval($item_percent);
$total_percent = bcsub($total_percent, $item_percent, 2);
}
}
$data = array_merge($data, $value_list);
}
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' ] ]
])->withSearch([ 'form_id' ], $where)->append([ 'render_value' ])->select()->toArray();
$total_count = 0;
$value_list = [];
foreach ($field_list as $k1 => &$v1) {
if ($v1[ 'field_type' ] != 'FormCheckbox') {
$key = $v1[ 'field_key' ] . '_' . $v1[ 'render_value' ];
if (isset($value_list[ $key ])) {
$value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1;
$total_count++;
} else {
// 如果不存在则初始化为1
$value_list[ $key ] = $v1;
$value_list[ $key ][ 'write_count' ] = 1;
$total_count++;
}
} else {
$value_arr = explode(',', $v1[ 'render_value' ]);
foreach ($value_arr as $k2 => $v2) {
$key = $v1[ 'field_key' ] . '_' . $v2;
if (isset($value_list[ $key ])) {
$value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1;
$total_count++;
} else {
$value_list[ $key ] = $v1;
$value_list[ $key ][ 'render_value' ] = $v2;
$value_list[ $key ][ 'write_count' ] = 1;
$total_count++;
}
}
}
}
if ($total_count > 0) {
$value_list = array_values($value_list);
$total_percent = 100;
foreach ($value_list as $k1 => &$v1) {
if ($k1 == count($value_list) - 1) {
$item_percent = $total_percent;
} else {
$item_percent = round($v1[ 'write_count' ] / $total_count * 100, 2);
}
$v1[ 'write_percent' ] = floatval($item_percent);
$total_percent = bcsub($total_percent, $item_percent, 2);
}
}
$data = array_merge($data, $value_list);
}
foreach ($data as $k => &$v) {
$v[ 'render_value' ] = $v[ 'render_value' ] . "\t";
}
$data = array_values($data);
}
return $data;
}
}

View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\diy_form_export;
/**
* 表单字段统计导出数据类型查询
* Class DiyFormRecordsFieldsExportTypeListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsFieldsExportTypeListener
{
public function handle($param)
{
return [
'diy_form_records_fields' => [
'name' => '表单字段统计列表',
'column' => [
'field_name' => [ 'name' => '字段', 'merge_type' => 'column' ],
'render_value' => [ 'name' => '选项值' ],
'write_count' => [ 'name' => '小计' ],
'write_percent' => [ 'name' => '比例' ],
]
]
];
}
}

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\diy_form_export;
use app\model\diy_form\DiyFormRecords;
/**
* 表单填表人统计导出数据源查询
* Class DiyFormRecordsMemberExportDataListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsMemberExportDataListener
{
public function handle($param)
{
$data = [];
if ($param['type'] == 'diy_form_records_member') {
$model = new DiyFormRecords();
$field = 'form_id, diy_form_records.member_id, count(*) as write_count';
$order = "create_time desc";
$search_model = $model->where([ [ 'diy_form_records.record_id', '>', 0 ] ])->withSearch([ 'form_id' ], $param[ 'where' ])
->withJoin(['member' => function ($query) use ($param) {
$query->where([ [ 'nickname|mobile', 'like', "%" . $param[ 'where' ]['keyword'] . "%" ] ]);
}])->field($field)->group('diy_form_records.member_id')->order($order);
if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) {
$data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray();
} else {
$data = $search_model->select()->toArray();
}
foreach ($data as $key => $value) {
$data[$key]['nickname'] = $value[ 'member' ]['nickname'] ?? '';
}
}
return $data;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\diy_form_export;
/**
* 表单填表人统计导出数据类型查询
* Class DiyFormRecordsExportTypeListener
* @package app\listener\diy_form_export
*/
class DiyFormRecordsMemberExportTypeListener
{
public function handle($param)
{
return [
'diy_form_records_member' => [
'name' => '填表人统计列表',
'column' => [
'nickname' => [ 'name' => '填表人名称' ],
'write_count' => [ 'name' => '总计' ]
]
]
];
}
}

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -43,4 +43,4 @@ class MemberExportTypeListener
] ]
]; ];
} }
} }

View File

@ -13,23 +13,23 @@ class Sms
public function handle(array $data) public function handle(array $data)
{ {
$template = $data['template'];//模板 $template = $data[ 'template' ];//模板
$vars = $data['vars'];//模板变量 $vars = $data[ 'vars' ];//模板变量
$key = $data['key']; $key = $data[ 'key' ];
$to = $data['to'];//发送对象主题 $to = $data[ 'to' ];//发送对象主题
$mobile = $to['mobile'] ?? ''; $mobile = $to[ 'mobile' ] ?? '';
//完全信任消息的设置, 不再依赖support_type //完全信任消息的设置, 不再依赖support_type
if ($template['is_sms']) { if ($template[ 'is_sms' ]) {
$sms_id = $template['sms_id'];//发送模板id $sms_id = $template[ 'sms_id' ];//发送模板id
$content = $template['sms']['content']; $content = $template[ 'sms' ][ 'content' ];
$member_id = $to['member_id'] ?? 0; $member_id = $to[ 'member_id' ] ?? 0;
$uid = $to['uid'] ?? 0; $uid = $to[ 'uid' ] ?? 0;
if (!$mobile) { if (!$mobile) {
//会员的 //会员的
if ($member_id > 0) {//查询openid if ($member_id > 0) {//查询openid
$info = (new CoreMemberService())->getInfoByMemberId($member_id); $info = ( new CoreMemberService() )->getInfoByMemberId($member_id);
$mobile = $info['mobile'] ?? ''; $mobile = $info[ 'mobile' ] ?? '';
$nickname = $info['nickname'] ?? ''; $nickname = $info[ 'nickname' ] ?? '';
} }
} }
@ -49,17 +49,17 @@ class Sms
'result' => '' 'result' => ''
); );
$core_sms_service->send($mobile, $vars, $key, $sms_id, $content); $core_sms_service->send($mobile, $vars, $key, $sms_id, $content);
(new CoreNoticeLogService())->add($log_data); ( new CoreNoticeLogService() )->add($log_data);
} catch ( NoticeException $e ) { } catch (NoticeException $e) {
$log_data['result'] = $e->getMessage(); $log_data[ 'result' ] = $e->getMessage();
(new CoreNoticeLogService())->add($log_data); ( new CoreNoticeLogService() )->add($log_data);
//这儿决定要不要抛出 //这儿决定要不要抛出
if (!$template['async']) { if (!$template[ 'async' ]) {
throw new NoticeException($e->getMessage()); throw new NoticeException($e->getMessage());
} }
} }
} else { } else {
if (!$template['async']) { if (!$template[ 'async' ]) {
throw new NoticeException('NOTICE_NOT_OPEN_SMS'); throw new NoticeException('NOTICE_NOT_OPEN_SMS');
} }
} }

View File

@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\system;
/**
* 查询应用列表
* Class ShowAppListener
* @package app\listener\system
*/
class ShowAppListener
{
public function handle()
{
// 应用app、addon 待定
// 营销promotion
// 工具tool
return [
// 应用
'app' => [
],
// 工具
'tool' => [
[
'title' => '万能表单',
'desc' => '适用于各种应用场景,满足多样化的业务需求',
'icon' => 'static/resource/images/diy_form/icon.png',
'key' => 'diy_form',
'url' => '/diy_form/list',
],
// [
// 'title' => '万能a表单',
// 'desc' => '万能a表单',
// 'icon' => 'static/resource/images/diy_form/icon.png',
// 'key' => 'diy_faorm',
// 'url' => '/diy_faorm/list',
// ]
],
// 营销
'promotion' => [
]
];
}
}

View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy;
use app\dict\diy\PagesDict;
use app\dict\diy\TemplateDict;
use core\base\BaseModel;
/**
* 自定义主题配色表
* Class DiyTheme
* @package app\model\diy
*/
class DiyTheme extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_theme';
// 设置json类型字段
protected $json = [ 'value', 'diy_value' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
}

View File

@ -0,0 +1,196 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use app\dict\diy_form\TypeDict;
use app\model\addon\Addon;
use core\base\BaseModel;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
/**
* 自定义万能表单模型
* Class DiyForm
* @package app\model\diy
*/
class DiyForm extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
/**
* 数据表主键
* @var string
*/
protected $pk = 'form_id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form';
// 设置json类型字段
protected $json = [ 'value', 'share' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getTypeNameAttr($value, $data)
{
if (!empty($data[ 'type' ])) {
return TypeDict::getType([ 'key' => [ $data[ 'type' ] ] ])[ $data[ 'type' ] ][ 'title' ] ?? '';
}
return '';
}
/**
* 状态字段转化:所属插件名称
* @param $value
* @param $data
* @return array
*/
public function getAddonNameAttr($value, $data)
{
if (empty($data[ 'addon' ])) {
return [];
}
return ( new Addon() )->where([ [ 'key', '=', $data[ 'addon' ] ] ])->column('title');
}
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getShareAttr($value, $data)
{
if (empty($data[ 'share' ])) {
$data[ 'share' ] = [
'wechat' => [
'title' => $data[ 'title' ],
'desc' => '',
'url' => ''
],
'weapp' => [
'title' => $data[ 'title' ],
'url' => ''
]
];
}
return $data[ 'share' ] ?? '';
}
/**
* 搜索器:表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
/**
* 搜索器:表单名称
* @param $query
* @param $value
* @param $data
*/
public function searchTitleAttr($query, $value, $data)
{
if ($value != '') {
$query->where("title|page_title", 'like', '%' . $this->handelSpecialCharacter($value) . '%');
}
}
/**
* 搜索器:表单类型
* @param $query
* @param $value
* @param $data
*/
public function searchTypeAttr($query, $value, $data)
{
if ($value) {
$query->where("type", $value);
}
}
/**
* 搜索器:所属插件标识
* @param $query
* @param $value
* @param $data
*/
public function searchAddonAttr($query, $value, $data)
{
if ($value) {
$query->where("addon", $value);
}
}
/**
* 搜索器:状态
* @param $query
* @param $value
* @param $data
*/
public function searchStatusAttr($query, $value, $data)
{
if ($value !== '') {
$query->where("status", $value);
}
}
/**
*
* @return HasOne
*/
public function writeConfig()
{
return $this->hasOne(DiyFormWriteConfig::class, 'form_id', 'form_id');
}
/**
*
* @return HasOne
*/
public function submitConfig()
{
return $this->hasOne(DiyFormSubmitConfig::class, 'form_id', 'form_id');
}
/**
*
* @return hasMany
*/
public function formField()
{
return $this->hasMany(DiyFormFields::class, 'form_id', 'form_id');
}
}

View File

@ -0,0 +1,159 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use core\base\BaseModel;
/**
* 自定义万能表单字段模型
* Class DiyFormFields
* @package app\model\diy
*/
class DiyFormFields extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
/**
* 数据表主键
* @var string
*/
protected $pk = 'field_id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form_fields';
/**
* 搜索器:字段id
* @param $query
* @param $value
* @param $data
*/
public function searchFieldIdAttr($query, $value, $data)
{
if ($value) {
$query->where("field_id", $value);
}
}
/**
* 搜索器:表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
/**
* 搜索器:字段唯一标识
* @param $query
* @param $value
* @param $data
*/
public function searchFieldKeyAttr($query, $value, $data)
{
if ($value) {
$query->where("field_key", $value);
}
}
/**
* 搜索器:字段类型
* @param $query
* @param $value
* @param $data
*/
public function searchFieldTypeAttr($query, $value, $data)
{
if ($value) {
$query->where("field_type", $value);
}
}
/**
* 搜索器:字段名称
* @param $query
* @param $value
* @param $data
*/
public function searchFieldNameAttr($query, $value, $data)
{
if ($value) {
$query->where("field_name", 'like', '%' . $value . '%');
}
}
/**
* 搜索器:字段是否必填 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldRequiredAttr($query, $value, $data)
{
if ($value) {
$query->where("field_required", $value);
}
}
/**
* 搜索器:字段是否隐藏 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldHiddenAttr($query, $value, $data)
{
if ($value) {
$query->where("field_hidden", $value);
}
}
/**
* 搜索器:字段内容防重复 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldUniqueAttr($query, $value, $data)
{
if ($value) {
$query->where("field_unique", $value);
}
}
/**
* 搜索器:隐私保护 0:关闭 1:开启
* @param $query
* @param $value
* @param $data
*/
public function searchPrivacyProtectionAttr($query, $value, $data)
{
if ($value) {
$query->where("privacy_protection", $value);
}
}
}

View File

@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use app\model\member\Member;
use core\base\BaseModel;
use think\model\relation\HasOne;
use think\db\Query;
/**
* 自定义万能表单填写记录模型
* Class DiyFormRecords
* @package app\model\diy
*/
class DiyFormRecords extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
/**
* 数据表主键
* @var string
*/
protected $pk = 'record_id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form_records';
// 设置json类型字段
protected $json = [ 'value' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* 搜索器:记录id
* @param $query
* @param $value
* @param $data
*/
public function searchRecordIdAttr($query, $value, $data)
{
if ($value) {
$query->where("record_id", $value);
}
}
/**
* 搜索器:关联表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
/**
* 搜索器:创建时间
* @param $query
* @param $value
* @param $data
*/
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 ]);
if ($start_time > 0 && $end_time > 0) {
$query->whereBetweenTime('diy_form_records.create_time', $start_time, $end_time);
} else if ($start_time > 0 && $end_time == 0) {
$query->where([ [ 'diy_form_records.create_time', '>=', $start_time ] ]);
} else if ($start_time == 0 && $end_time > 0) {
$query->where([ [ 'diy_form_records.create_time', '<=', $end_time ] ]);
}
}
/**
* 会员关联
* @return HasOne
*/
public function member()
{
return $this->hasOne(Member::class, 'member_id', 'member_id')->joinType('left')
->withField('member_id,member_no, username, mobile, nickname, headimg');
}
/**
* 关联表单字段列表
* @return \think\model\relation\HasMany
*/
public function formFieldList()
{
return $this->hasMany(DiyFormFields::class, 'form_id', 'form_id');
}
/**
* 关联填写字段列表
* @return \think\model\relation\HasMany
*/
public function recordsFieldList()
{
return $this->hasMany(DiyFormRecordsFields::class, 'record_id', 'record_id');
}
/**
* 关联表单提交页配置
* @return HasOne
*/
public function submitConfig()
{
return $this->hasOne(DiyFormSubmitConfig::class, 'form_id', 'form_id')->joinType('left')
->withField('id,form_id,submit_after_action,tips_type,tips_text,success_after_action');
}
/**
* 表单关联
* @return HasOne
*/
public function form()
{
return $this->hasOne(DiyForm::class, 'form_id', 'form_id')->joinType('left')
->withField('form_id,page_title,type')->append([ 'type_name' ]);
}
}

View File

@ -0,0 +1,218 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use app\dict\diy_form\ComponentDict;
use core\base\BaseModel;
/**
* 自定义万能表单填写字段模型
* Class DiyFormRecordsFields
* @package app\model\diy_form
*/
class DiyFormRecordsFields extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form_records_fields';
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getRenderValueAttr($value, $data)
{
if (!empty($data[ 'field_value' ])) {
$component = ComponentDict::getComponent([
'component_name' => $data[ 'field_type' ]
]);
$render_value = $data[ 'field_value' ]; // 默认渲染值
if (isset($component[ 'render' ])) {
$render = $component[ 'render' ];
if ($render instanceof \Closure) {
$render_value = $render($data[ 'field_value' ]);
}
}
return $render_value;
}
return '';
}
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getHandleFieldValueAttr($value, $data)
{
if (!empty($data[ 'field_value' ])) {
$component = ComponentDict::getComponent([
'component_name' => $data[ 'field_type' ]
]);
$render_value = $data[ 'field_value' ]; // 默认渲染值
if (isset($component[ 'convert' ])) {
$render = $component[ 'convert' ];
if ($render instanceof \Closure) {
$render_value = $render($data[ 'field_value' ]);
}
}
return $render_value;
}
return '';
}
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getDetailComponentAttr($value, $data)
{
if (!empty($data[ 'field_key' ])) {
$detail_component = '';
$component = ComponentDict::getComponent([ 'component_name' => $data[ 'field_type' ] ]);
if (!empty($component)) {
$detail_component = $component[ 'value' ][ 'field' ][ 'detailComponent' ] ?? '';
}
if (empty($detail_component)) {
$detail_component = '/src/app/views/diy_form/components/detail-form-render.vue';
}
return $detail_component;
}
return '';
}
/**
* 搜索器:表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
/**
* 搜索器:字段唯一标识
* @param $query
* @param $value
* @param $data
*/
public function searchFieldKeyAttr($query, $value, $data)
{
if ($value) {
$query->where("field_key", $value);
}
}
/**
* 搜索器:字段类型
* @param $query
* @param $value
* @param $data
*/
public function searchFieldTypeAttr($query, $value, $data)
{
if ($value) {
$query->where("field_type", $value);
}
}
/**
* 搜索器:字段名称
* @param $query
* @param $value
* @param $data
*/
public function searchFieldNameAttr($query, $value, $data)
{
if ($value) {
$query->where("field_name", 'like', '%' . $value . '%');
}
}
/**
* 搜索器:字段是否必填 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldRequiredAttr($query, $value, $data)
{
if ($value) {
$query->where("field_required", $value);
}
}
/**
* 搜索器:字段是否隐藏 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldHiddenAttr($query, $value, $data)
{
if ($value) {
$query->where("field_hidden", $value);
}
}
/**
* 搜索器:字段内容防重复 0: 1:
* @param $query
* @param $value
* @param $data
*/
public function searchFieldUniqueAttr($query, $value, $data)
{
if ($value) {
$query->where("field_unique", $value);
}
}
/**
* 搜索器:隐私保护 0:关闭 1:开启
* @param $query
* @param $value
* @param $data
*/
public function searchPrivacyProtectionAttr($query, $value, $data)
{
if ($value) {
$query->where("privacy_protection", $value);
}
}
}

View File

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use core\base\BaseModel;
/**
* 万能表单提交页配置模型
* Class DiyFormSubmitConfig
* @package app\model\diy_form
*/
class DiyFormSubmitConfig extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
// 设置json类型字段
protected $json = [ 'time_limit_rule', 'voucher_content_rule', 'success_after_action' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form_submit_config';
/**
* 搜索器:表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
}

View File

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\diy_form;
use core\base\BaseModel;
/**
* 万能表单填写配置模型
* Class DiyFormWriteConfig
* @package app\model\diy_form
*/
class DiyFormWriteConfig extends BaseModel
{
protected $type = [
'create_time' => 'timestamp',
'update_time' => 'timestamp',
];
// 设置json类型字段
protected $json = [ 'level_ids', 'label_ids', 'member_write_rule', 'form_write_rule', 'time_limit_rule' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'diy_form_write_config';
/**
* 搜索器:表单id
* @param $query
* @param $value
* @param $data
*/
public function searchFormIdAttr($query, $value, $data)
{
if ($value) {
$query->where("form_id", $value);
}
}
}

View File

@ -40,6 +40,12 @@ class MemberCashOut extends BaseModel
'transfer_time' => 'timestamp', 'transfer_time' => 'timestamp',
]; ];
// 设置json类型字段
protected $json = [ 'transfer_payee' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/** /**
* 会员信息 * 会员信息
* @return HasOne * @return HasOne

View File

@ -41,6 +41,12 @@ class Transfer extends BaseModel
'finish_time' => 'timestamp', 'finish_time' => 'timestamp',
]; ];
// 设置json类型字段
protected $json = [ 'transfer_payee' ];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/** /**
* 状态字段转化 * 状态字段转化
* @param $value * @param $value

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -203,4 +203,61 @@ class AddonService extends BaseAdminService
{ {
return $this->model->where([ [ 'key', '=', $key ] ])->field('title, icon, key, desc, status, cover')->findOrEmpty()->toArray(); return $this->model->where([ [ 'key', '=', $key ] ])->field('title, icon, key, desc, status, cover')->findOrEmpty()->toArray();
} }
/**
* 查询应用列表todo 完善
* @return array
*/
public function getShowAppTools()
{
$list = [
'addon' => [
'title' => '运营工具',
'list' => []
],
'tool' => [
'title' => '系统工具',
'list' => []
],
// 'promotion' => [
// 'title' => '营销活动',
// 'list' => []
// ]
];
$apps = event('ShowApp');
$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' ];
}
}
}
}
$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) {
$list[ 'addon' ][ 'list' ][] = [
'title' => $v[ 'title' ],
'desc' => $v[ 'desc' ],
'icon' => $v[ 'icon' ],
'key' => $v[ 'key' ]
];
}
}
}
return $list;
}
} }

View File

@ -11,13 +11,18 @@
namespace app\service\admin\diy; namespace app\service\admin\diy;
use app\dict\addon\AddonDict;
use app\dict\diy\ComponentDict; use app\dict\diy\ComponentDict;
use app\dict\diy\LinkDict; use app\dict\diy\LinkDict;
use app\dict\diy\PagesDict; use app\dict\diy\PagesDict;
use app\dict\diy\TemplateDict; use app\dict\diy\TemplateDict;
use app\dict\sys\FileDict;
use app\model\addon\Addon; use app\model\addon\Addon;
use app\model\diy\Diy; use app\model\diy\Diy;
use app\model\diy\DiyTheme;
use app\service\admin\sys\SystemService; use app\service\admin\sys\SystemService;
use app\service\core\addon\CoreAddonService;
use app\service\core\diy\CoreDiyService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\AdminException; use core\exception\AdminException;
use Exception; use Exception;
@ -90,7 +95,7 @@ class DiyService extends BaseAdminService
public function getList(array $where = [], $field = 'id,title,page_title,name,template,type,mode,is_default,share,visit_count,create_time,update_time') public function getList(array $where = [], $field = 'id,title,page_title,name,template,type,mode,is_default,share,visit_count,create_time,update_time')
{ {
$order = "update_time desc"; $order = "update_time desc";
return $this->model->withSearch([ "title", "type", 'mode' ], $where)->field($field)->order($order)->select()->toArray(); return $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ "title", "type", 'mode' ], $where)->field($field)->order($order)->select()->toArray();
} }
/** /**
@ -648,6 +653,47 @@ class DiyService extends BaseAdminService
} }
} }
// todo 处理缩略图
public function handleThumbImgs($data)
{
$data = json_decode($data, true);
// todo $data['global']
foreach ($data[ 'value' ] as $k => $v) {
// 如果图片尺寸超过 中图的大写才压缩
// 图片广告
if ($v[ 'componentName' ] == 'ImageAds') {
foreach ($v[ 'list' ] as $ck => $cv) {
if (!empty($cv[ 'imageUrl' ]) &&
strpos($cv[ 'imageUrl' ], 'addon/') === false &&
strpos($cv[ 'imageUrl' ], 'static/') === false &&
!isset($data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ])) {
$data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ] = get_thumb_images($cv[ 'imageUrl' ], FileDict::MID);
}
}
}
// 图文导航
if ($v[ 'componentName' ] == 'GraphicNav') {
foreach ($v[ 'list' ] as $ck => $cv) {
if (!empty($cv[ 'imageUrl' ]) &&
strpos($cv[ 'imageUrl' ], 'addon/') === false &&
strpos($cv[ 'imageUrl' ], 'static/') === false &&
!isset($data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ])) {
$data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ] = get_thumb_images($cv[ 'imageUrl' ], FileDict::MID);
}
}
}
}
$data = json_encode($data);
return $data;
}
/** /**
* 复制自定义页面 * 复制自定义页面
* @param array $param * @param array $param
@ -670,4 +716,108 @@ class DiyService extends BaseAdminService
return $res->id; return $res->id;
} }
/**
* 获取自定义主题配色
* @return array
*/
public function getDiyTheme()
{
$addon_list = ( new Addon() )->where([['status', '=', AddonDict::ON]])->append(['status_name'])->column('title, icon, key, desc, status, type, support_app', 'key');
$theme_data = ( new DiyTheme() )->where([ ['type', '=', 'app'] ])->column('id,color_mark,color_name,diy_value,value,title,mode','addon');
$defaultColor = ( new CoreDiyService() )->getDefaultColor();
$app_theme['app'] = [
'id' => $theme_data['app']['id'] ?? '',
'icon' => '',
'addon_title' => '系统',
'mode' => 'diy',
'title' => $theme_data['app']['title'] ?? '系统主色调',
'color_mark' => $theme_data['app']['color_mark'] ?? $defaultColor['name'],
'color_name' => $theme_data['app']['color_name'] ?? $defaultColor['title'],
'value' => $theme_data['app']['value'] ?? $defaultColor['theme'],
'diy_value' => $theme_data['app']['diy_value'] ?? '',
];
$data = [];
foreach ($addon_list as $value){
if ($value[ 'type' ] == 'app') {
$default_theme_data = array_values(array_filter(event('ThemeColor', [ 'key' => $value['key']])))[0] ?? [];
$data[$value['key']]['id'] = $theme_data[$value['key']]['id'] ?? '';
$data[$value['key']]['icon'] = $value['icon'] ?? '';
$data[$value['key']]['mode'] = $theme_data[$value['key']]['mode'] ?? 'diy';
$data[$value['key']]['addon_title'] = $value['title'] ?? '';
$data[$value['key']]['title'] = $theme_data[$value['key']]['title'] ?? $value['title'].'主色调';
$data[$value['key']]['color_mark'] = $theme_data[$value['key']]['color_mark'] ?? ($default_theme_data ? $default_theme_data[ 'name' ] : $defaultColor['name']);
$data[$value['key']]['color_name'] = $theme_data[$value['key']]['color_name'] ?? ($default_theme_data ? $default_theme_data[ 'title' ] : $defaultColor['title']);
$data[$value['key']]['value'] = $theme_data[$value['key']]['value'] ?? ($default_theme_data ? $default_theme_data[ 'theme' ] : $defaultColor['theme']);
$data[$value['key']]['diy_value'] = $theme_data[$value['key']]['diy_value'] ?? '';
}
}
$data = array_merge($app_theme,$data);
return $data;
}
/**
* 设置主题配色
* @param array $data
* @return bool
*/
public function setDiyTheme($data)
{
$diy_theme_model = new (new DiyTheme());
$addon_data = (new addon())->where([['support_app', '=', $data['key']]])->select()->toArray();
$addon_save_data = [];
if (!empty($addon_data)){
foreach ($addon_data as $value){
$addon_save_data[] = [
'type' => 'addon',
'addon' => $value['key'],
'color_mark' => $data['color_mark'],
'color_name' => $data['color_name'],
'mode' => $data['mode'],
'value' => $data['value'],
'diy_value' => $data['diy_value'],
'update_time' => time(),
];
}
}
try {
Db::startTrans();
if(!empty($data['id'])){
$data['update_time'] = time();
unset($data['key']);
$diy_theme_model->where([['id', '=', $data['id']]])->update($data);
if (!empty($addon_save_data)){
foreach ($addon_save_data as $value){
$diy_theme_model->where([['addon', '=', $value['addon']]])->update($value);
}
}
}else{
$data['type'] = 'app';
$data['addon'] = $data['key'];
$data['crete_time'] = time();
unset($data['id'],$data['key']);
array_unshift($addon_save_data, $data);
foreach ($addon_save_data as $value){
unset($value['update_time']);
$diy_theme_model->create($value);
}
}
Db::commit();
return true;
} catch (Exception $e) {
Db::rollback();
throw new AdminException($e->getMessage());
}
}
/**
* 获取默认主题配色
* @return array
*/
public function getDefaultThemeColor()
{
return ( new CoreDiyService() )->getDefaultThemeColor();
}
} }

View File

@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\diy_form;
use app\service\core\diy_form\CoreDiyFormConfigService;
use core\base\BaseAdminService;
/**
* 万能表单配置服务层
* Class DiyFormService
* @package app\service\admin\diy
*/
class DiyFormConfig extends BaseAdminService
{
public function __construct()
{
parent::__construct();
}
/**
* 编辑填写配置
* @param $data
* @return bool
*/
public function editWriteConfig($data)
{
return ( new CoreDiyFormConfigService() )->editWriteConfig($data);
}
/**
* 获取表单填写配置
* @param $form_id
* @return mixed
*/
public function getWriteConfig($form_id)
{
$data = [
'form_id' => $form_id
];
return ( new CoreDiyFormConfigService() )->getWriteConfig($data);
}
/**
* 编辑提交配置
* @param array $data
* @return mixed
*/
public function editSubmitConfig($data)
{
return ( new CoreDiyFormConfigService() )->editSubmitConfig($data);
}
/**
* 获取表单提交成功页配置
* @param $form_id
* @return mixed
*/
public function getSubmitConfig($form_id)
{
$data = [
'form_id' => $form_id
];
return ( new CoreDiyFormConfigService() )->getSubmitConfig($data);
}
}

View File

@ -0,0 +1,136 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\diy_form;
use app\model\diy_form\DiyFormRecords;
use app\model\diy_form\DiyFormRecordsFields;
use core\base\BaseAdminService;
/**
* 万能表单填写记录服务层
* Class DiyFormRecordsService
* @package app\service\admin\diy
*/
class DiyFormRecordsService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
$this->model = new DiyFormRecords();
}
/**
* 获取万能表单填表人统计列表
* @param array $where
* @return array
*/
public function getPage(array $where = [])
{
$field = 'form_id, diy_form_records.member_id, count(*) as write_count';
$search_model = $this->model->where([ [ 'diy_form_records.record_id', '>', 0 ] ])->withSearch([ 'form_id' ], $where)
->withJoin([ 'member' => function($query) use ($where) {
$query->where([ [ 'nickname|mobile', 'like', "%" . $where[ 'keyword' ] . "%" ] ]);
} ])->field($field)->group('diy_form_records.member_id');
return $this->pageQuery($search_model);
}
/**
* 获取万能表单字段统计列表
* @param array $where
* @return array
*/
public function getFieldStatList(array $where = [])
{
$field_list = ( new DiyFormService() )->getFieldsList($where, 'field_id, field_key, field_type, field_name');
$simple_field_list = array_filter($field_list, function($v) { return !in_array($v[ 'field_type' ], [ 'FormRadio', 'FormCheckbox', 'FormDateScope', 'FormTimeScope', 'FormImage' ]); });
$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) {
$value_list = $records_field_model->field('form_id, field_key, field_type, field_value, count(*) as write_count')->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
])->withSearch([ 'form_id' ], $where)->group('field_value')->append([ 'render_value' ])->select()->toArray();
$total_count = $records_field_model->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
])->withSearch([ 'form_id' ], $where)->count();
if ($total_count > 0) {
$total_percent = 100;
foreach ($value_list as $k1 => &$v1) {
if ($k1 == count($value_list) - 1) {
$item_percent = $total_percent;
} else {
$item_percent = round($v1['write_count'] / $total_count * 100, 2);
}
$v1['write_percent'] = floatval($item_percent);
$total_percent = bcsub($total_percent, $item_percent, 2);
}
}
$v[ 'value_list' ] = $value_list;
}
foreach ($json_field_list as $k => &$v) {
$field_list = $records_field_model->field('form_id, field_key, field_type, field_value')->where([
[ 'field_key', '=', $v[ 'field_key' ] ],
[ 'field_type', '=', $v[ 'field_type' ] ]
])->withSearch([ 'form_id' ], $where)->append([ 'render_value' ])->select()->toArray();
$total_count = 0;
$value_list = [];
foreach ($field_list as $k1 => &$v1) {
if ($v1[ 'field_type' ] != 'FormCheckbox') {
$key = $v1[ 'field_key' ] . '_' . $v1[ 'render_value' ];
if (isset($value_list[ $key ])) {
$value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1;
$total_count++;
} else {
// 如果不存在则初始化为1
$value_list[ $key ] = $v1;
$value_list[ $key ][ 'write_count' ] = 1;
$total_count++;
}
} else {
$value_arr = explode(',', $v1[ 'render_value' ]);
foreach ($value_arr as $k2 => $v2) {
$key = $v1[ 'field_key' ] . '_' . $v2;
if (isset($value_list[ $key ])) {
$value_list[ $key ][ 'write_count' ] = $value_list[ $key ][ 'write_count' ] + 1;
$total_count++;
} else {
$value_list[ $key ] = $v1;
$value_list[ $key ][ 'render_value' ] = $v2;
$value_list[ $key ][ 'write_count' ] = 1;
$total_count++;
}
}
}
}
if ($total_count > 0) {
$value_list = array_values($value_list);
$total_percent = 100;
foreach ($value_list as $k1 => &$v1) {
if ($k1 == count($value_list) - 1) {
$item_percent = $total_percent;
} else {
$item_percent = round($v1['write_count'] / $total_count * 100, 2);
}
$v1['write_percent'] = floatval($item_percent);
$total_percent = bcsub($total_percent, $item_percent, 2);
}
}
$v[ 'value_list' ] = $value_list;
}
return array_merge($simple_field_list, $json_field_list);
}
}

View File

@ -0,0 +1,629 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\diy_form;
use app\dict\diy_form\ComponentDict as DiyFormComponentDict;
use app\dict\diy\PagesDict;
use app\dict\diy_form\TemplateDict;
use app\dict\diy_form\TypeDict;
use app\model\diy_form\DiyForm;
use app\model\diy_form\DiyFormFields;
use app\model\diy_form\DiyFormRecords;
use app\model\diy_form\DiyFormRecordsFields;
use app\model\diy_form\DiyFormSubmitConfig;
use app\model\diy_form\DiyFormWriteConfig;
use app\service\admin\diy\DiyService;
use app\service\admin\sys\SystemService;
use app\service\core\diy_form\CoreDiyFormConfigService;
use app\service\core\diy_form\CoreDiyFormRecordsService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use core\exception\CommonException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Db;
use think\facade\Log;
/**
* 万能表单服务层
* Class DiyFormService
* @package app\service\admin\diy
*/
class DiyFormService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
$this->model = new DiyForm();
}
/**
* 获取万能表单分页列表
* @param array $where
* @return array
*/
public function getPage(array $where = [])
{
$field = 'form_id, page_title, title, type, status, addon, share, write_num, remark, update_time';
$order = "form_id desc";
$search_model = $this->model->where([ [ 'form_id', '>', 0 ] ])->withSearch([ "title", "type", 'addon' ], $where)->field($field)->order($order)->append([ 'type_name', 'addon_name' ]);
return $this->pageQuery($search_model);
}
/**
* 获取万能表单列表
* @param array $where
* @param string $field
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getList(array $where = [], $field = 'form_id, page_title, title, type, status, addon, share, write_num, remark, update_time')
{
$order = "form_id desc";
return $this->model->where([ [ 'form_id', '>', 0 ] ])->withSearch([ "title", "type", 'addon', 'status' ], $where)->field($field)->order($order)->append([ 'type_name', 'addon_name' ])->select()->toArray();
}
/**
* 获取万能表单信息
* @param int $form_id
* @param string $field
* @return mixed
*/
public function getInfo(int $form_id, $field = 'form_id, page_title, title, type, status, value, addon, share, write_num,template')
{
return $this->model->field($field)->where([ [ 'form_id', '=', $form_id ] ])->findOrEmpty()->toArray();
}
/**
* 获取万能表单数量
* @param array $where
* @return mixed
*/
public function getCount(array $where = [])
{
return $this->model->where([ [ 'form_id', '>', 0 ] ])->withSearch([ 'type' ], $where)->count();
}
/**
* 添加万能表单
* @param array $data
* @return mixed
*/
public function add(array $data)
{
Db::startTrans();
try {
$data[ 'status' ] = 1; // 默认为开启状态
$data[ 'create_time' ] = time();
$data[ 'update_time' ] = time();
$data[ 'addon' ] = TypeDict::getType([ 'type' => $data[ 'type' ] ])[ 'addon' ] ?? '';
$res = $this->model->create($data);
$diy_form_fields = [];
if (!empty($data[ 'value' ])) {
$value = json_decode($data[ 'value' ], true);
foreach ($value[ 'value' ] as $component) {
// 过滤非表单组件和表单提交按钮组件
if ($component[ 'componentType' ] != 'diy_form' || $component[ 'componentName' ] == 'FormSubmit') {
continue;
}
if (isset($component[ 'field' ][ 'default' ]) && is_array($component[ 'field' ][ 'default' ])) {
$component[ 'field' ][ 'default' ] = json_encode($component[ 'field' ][ 'default' ]);
}
$diy_form_fields[] = [
'form_id' => $res->form_id, // 所属万能表单id
'field_key' => $component[ 'id' ], // 字段唯一标识
'field_type' => $component[ 'componentName' ], // 字段类型
'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称
'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明
'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值
'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是
'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是
'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是
'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启
'create_time' => time(),
'update_time' => time()
];
}
}
$form_fields_model = new DiyFormFields();
$form_fields_model->insertAll($diy_form_fields);
// 初始化表单填写配置
( new CoreDiyFormConfigService() )->addWriteConfig([ 'form_id' => $res->form_id ]);
// 初始化表单提交成功页配置
( new CoreDiyFormConfigService() )->addSubmitConfig([ 'form_id' => $res->form_id ]);
Db::commit();
return $res->id;
} catch (\Exception $e) {
Db::rollback();
throw new CommonException($e->getMessage());
}
}
/**
* 编辑万能表单
* @param int $form_id
* @param array $data
* @return bool
*/
public function edit(int $form_id, array $data)
{
Db::startTrans();
try {
$data[ 'update_time' ] = time();
// 更新万能表单
$this->model->where([ [ 'form_id', '=', $form_id ] ])->update($data);
// 更新万能表单字段信息
$form_fields_model = new DiyFormFields();
if (!empty($data[ 'value' ])) {
$value = json_decode($data[ 'value' ], true);
if (!empty($value[ 'value' ])) {
$form_fields_add = $form_fields_update = $form_fields_delete_ids = [];
$form_component = []; // 存储表单组件集合
$form_fields_list = $form_fields_model->where([ [ 'form_id', '=', $form_id ] ])->column('field_id', 'field_key');
foreach ($value[ 'value' ] as $component) {
// 过滤非表单组件和表单提交按钮组件
if ($component[ 'componentType' ] != 'diy_form' || $component[ 'componentName' ] == 'FormSubmit') {
continue;
}
if (isset($component[ 'field' ][ 'default' ]) && is_array($component[ 'field' ][ 'default' ])) {
$component[ 'field' ][ 'default' ] = json_encode($component[ 'field' ][ 'default' ]);
}
$form_component[] = $component;
if (isset($form_fields_list[ $component[ 'id' ] ])) {
$form_fields_update = [
'field_id' => $form_fields_list[ $component[ 'id' ] ],
'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称
'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明
'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值
'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是
'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是
'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是
'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启
'update_time' => time()
];
// 更新万能表单字段
$form_fields_model->where([
[ 'field_id', '=', $form_fields_list[ $component[ 'id' ] ] ]
])->update($form_fields_update);
} else {
$form_fields_add[] = [
'form_id' => $form_id,
'field_key' => $component[ 'id' ], // 字段唯一标识
'field_type' => $component[ 'componentName' ], // 字段类型
'field_name' => $component[ 'field' ][ 'name' ] ?? '', // 字段名称
'field_remark' => $component[ 'field' ][ 'remark' ][ 'text' ] ?? '', // 字段说明
'field_default' => $component[ 'field' ][ 'default' ] ?? '', // 字段默认值
'field_required' => $component[ 'field' ][ 'required' ], // 字段是否必填 0:否 1:是
'field_hidden' => $component[ 'isHidden' ], // 字段是否隐藏 0:否 1:是
'field_unique' => $component[ 'field' ][ 'unique' ], // 字段内容防重复 0:否 1:是
'privacy_protection' => $component[ 'field' ][ 'privacyProtection' ], // 隐私保护 0:关闭 1:开启
'create_time' => time(),
'update_time' => time()
];
}
}
$field_key_list = array_column($form_component, 'id');
$form_fields_delete_ids = array_diff(array_keys($form_fields_list), $field_key_list);
// 添加万能表单字段
if (!empty($form_fields_add)) {
$form_fields_model->insertAll($form_fields_add);
}
// 删除万能表单字段
if (!empty($form_fields_delete_ids)) {
$form_fields_model->where([ [ 'form_id', '=', $form_id ], [ 'field_key', 'in', $form_fields_delete_ids ] ])->delete();
}
} else {
// 未找到表单组件,则全部清空
$form_fields_model->where([ [ 'form_id', '=', $form_id ] ])->delete();
}
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new CommonException($e->getMessage());
}
}
/**
* 删除万能表单
* @param array $form_ids
* @return bool
*/
public function del(array $form_ids)
{
$where = [
[ 'form_id', 'in', $form_ids ]
];
$status_count = $this->model->where($where)->where([ [ 'status', '=', 1 ] ])->count();
if ($status_count > 0) throw new AdminException('ON_STATUS_PROHIBIT_DELETE');
foreach ($form_ids as $form_id) {
$result = event('BeforeFormDelete', [ 'form_id' => $form_id ])[0] ?? [];
if (!empty($result) && !$result[ 'allow_operate' ]) {
$form_info = $this->model->field('page_title')->where([ [ 'form_id', '=', $form_id ] ])->findOrEmpty()->toArray();
throw new AdminException($form_info[ 'page_title' ] . '已被使用,禁止删除');
}
}
$form_fields_model = new DiyFormFields();
$form_submit_config_model = new DiyFormSubmitConfig();
$form_write_config_model = new DiyFormWriteConfig();
Db::startTrans();
try {
//删除万能表单表
$this->model->where($where)->delete();
//删除万能表单字段表
$form_fields_model->where($where)->delete();
//删除万能表单提交页配置
$form_submit_config_model->where($where)->delete();
//删除万能表单填写配置
$form_write_config_model->where($where)->delete();
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new CommonException($e->getMessage());
}
}
/**
* 页面加载初始化
* @param array $params
* @return array
* @throws DbException
*/
public function getInit(array $params = [])
{
$time = time();
$data = [];
if (!empty($params[ 'form_id' ])) {
$data = $this->getInfo($params[ 'form_id' ]);
}
if (!empty($data)) {
$current_type = TypeDict::getType([ 'type' => $data[ 'type' ] ]);
$type_name = $current_type[ 'title' ];
$data[ 'type_name' ] = $type_name;
} else {
if (!isset($params[ 'type' ]) || empty($params[ 'type' ])) throw new AdminException('DIY_FORM_TYPE_NOT_EXIST');
$type = $params[ 'type' ];
// 新页面赋值
$page_title = $params[ 'title' ] ? : '表单页面' . $time; // 页面标题(用于前台展示)
$current_type = TypeDict::getType([ 'type' => $params[ 'type' ] ]);
$type_name = $current_type[ 'title' ];
$title = $type_name;
$value = '';
$data = [
'page_title' => $page_title, // 页面名称(用于后台展示)
'title' => $title, // 页面标题(用于前台展示)
'type' => $type,
'type_name' => $type_name,
'value' => $value,
];
}
$data[ 'component' ] = $this->getComponentList($data[ 'type' ]);
$data[ 'domain_url' ] = ( new SystemService() )->getUrl();
return $data;
}
/**
* 修改分享内容
* @param $data
* @return bool
*/
public function modifyShare($data)
{
$this->model->where([ [ 'form_id', '=', $data[ 'form_id' ] ] ])->update([ 'share' => $data[ 'share' ] ]);
return true;
}
/**
* 获取组件列表(表单组件+自定义装修的组件)
* @param string $type 支持表单类型
* @return array
*/
public function getComponentList(string $type = '')
{
$componentType = function(&$component_list, $type) {
if (!empty($component_list)) {
foreach ($component_list as $k => &$value) {
if (!empty($value[ 'list' ])) {
foreach ($value[ 'list' ] as $ck => &$v) {
$v[ 'componentType' ] = $type;
}
}
}
}
};
$form_component_list = DiyFormComponentDict::getComponent();
foreach ($form_component_list as $k => $v) {
// 查询组件支持的表单类型
$sort_arr = [];
foreach ($v[ 'list' ] as $ck => $cv) {
$support = $cv[ 'support' ] ?? [];
if (!( count($support) == 0 || in_array($type, $support) )) {
unset($form_component_list[ $k ][ 'list' ][ $ck ]);
continue;
}
$sort_arr [] = $cv[ 'sort' ];
unset($form_component_list[ $k ][ 'list' ][ $ck ][ 'sort' ], $form_component_list[ $k ][ 'list' ][ $ck ][ 'support' ]);
}
array_multisort($sort_arr, SORT_ASC, $form_component_list[ $k ][ 'list' ]); //排序,根据 sort 排序
}
$componentType($form_component_list, 'diy_form');
$data = $form_component_list;
if($type == 'DIY_FORM') {
$diy_service = new DiyService();
$diy_component_list = $diy_service->getComponentList();
$componentType($diy_component_list, 'diy');
$data = array_merge($form_component_list, $diy_component_list);
}
return $data;
}
/**
* 获取万能表单模板数据
* @param $type
* @param $name
* @return array
*/
public function getPageData($type, $name)
{
$pages = PagesDict::getPages([ 'type' => $type ]);
return $pages[ $name ] ?? [];
}
/**
* 复制万能表单
* @param array $param
* @return mixed
*/
public function copy($param)
{
$info = $this->model
->withoutfield('create_time,update_time')
->with([
'writeConfig' => function($query) {
$query->withoutfield('id,create_time,update_time');
},
'submitConfig' => function($query) {
$query->withoutfield('id,create_time,update_time');
},
'formField' => function($query) {
$query->withoutfield('field_id,create_time,update_time');
} ])
->where([ [ 'form_id', '=', $param[ 'form_id' ] ] ])->findOrEmpty()->toArray();
if (empty($info)) throw new AdminException('DIY_FORM_NOT_EXIST');
unset($info[ 'form_id' ]);
$info[ 'page_title' ] = $info[ 'page_title' ] . '_副本';
$info[ 'status' ] = 0;
$info[ 'share' ] = '';
$info[ 'write_num' ] = 0;
$info[ 'create_time' ] = time();
$info[ 'update_time' ] = time();
Db::startTrans();
try {
$res = $this->model->create($info);
$form_id = $res->form_id;
if (!empty($info[ 'formField' ])) {
$form_field_list = array_map(function($item) use ($form_id) {
$item[ 'form_id' ] = $form_id;
$item[ 'write_num' ] = 0;
$item[ 'create_time' ] = time();
$item[ 'update_time' ] = time();
return $item;
}, $info[ 'formField' ]);
( new DiyFormFields() )->saveALl($form_field_list);
unset($info[ 'formField' ]);
}
if (!empty($info[ 'writeConfig' ])) {
$info[ 'writeConfig' ][ 'form_id' ] = $form_id;
( new CoreDiyFormConfigService() )->addWriteConfig($info[ 'writeConfig' ]);
}
if (!empty($info[ 'submitConfig' ])) {
$info[ 'submitConfig' ][ 'form_id' ] = $form_id;
( new CoreDiyFormConfigService() )->addSubmitConfig($info[ 'submitConfig' ]);
}
Db::commit();
return $form_id;
} catch (\Exception $e) {
Db::rollback();
throw new CommonException($e->getMessage());
}
}
/**
* 获取页面模板
* @param array $params
* @return array
*/
public function getTemplate($params = [])
{
$page_template = TemplateDict::getTemplate($params);
return $page_template;
}
/**
* 获取万能表单类型
* @return array|null
*/
public function getFormType()
{
$type_list = TypeDict::getType();
return $type_list;
}
/**
* 修改状态
* @param $data
* @return Bool
*/
public function modifyStatus($data)
{
$result = event('BeforeFormDelete', [ 'form_id' => $data[ 'form_id' ] ])[0] ?? [];
if (!empty($result) && !$result[ 'allow_operate' ] && $data[ 'status' ] == 0) {
$form_info = $this->model->field('page_title')->where([ [ 'form_id', '=', $data[ 'form_id' ] ] ])->findOrEmpty()->toArray();
throw new AdminException($form_info[ 'page_title' ] . '已被使用,不可禁用');
}
return $this->model->where([
[ 'form_id', '=', $data[ 'form_id' ] ]
])->update([ 'status' => $data[ 'status' ] ]);
}
/**
* 获取使用记录
* @param array $data
* @return array|null
*/
public function getRecordPages($data)
{
return ( new CoreDiyFormRecordsService() )->getPage($data);
}
/**
* 获取使用记录
* @param int $record_id
* @return array|null
*/
public function getRecordInfo(int $record_id)
{
$data[ 'record_id' ] = $record_id;
return ( new CoreDiyFormRecordsService() )->getInfo($data);
}
/**
* 删除填写记录
* @param $params
* @return bool
*/
public function delRecord($params)
{
Db::startTrans();
try {
// 减少填写数量
$this->model->where([ [ 'form_id', '=', $params[ 'form_id' ] ] ])->dec('write_num', 1)->update();
$form_records_model = new DiyFormRecords();
$form_records_model->where([
[ 'record_id', '=', $params[ 'record_id' ] ]
])->delete();
$form_records_fields_model = new DiyFormRecordsFields();
// 删除万能表单填写字段
$form_records_fields_model->where([
[ 'record_id', '=', $params[ 'record_id' ] ]
])->delete();
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new CommonException($e->getMessage());
}
}
/**
* 获取万能表单字段列表
* @param array $where
* @param string $field
* @param string $order
* @return mixed
*/
public function getFieldsList($where = [], $field = 'field_id, form_id, field_key, field_type, field_name, field_remark, write_num, field_required, field_hidden, field_unique, privacy_protection, create_time, update_time')
{
$order = "update_time desc";
if (!empty($where[ 'order' ])) {
$order = $where[ 'order' ] . ' ' . $where[ 'sort' ];
}
return ( new DiyFormFields() )->where([ [ 'field_id', '>', 0 ] ])->withSearch([ 'form_id' ], $where)->field($field)->order($order)->select()->toArray();
}
/**
* 获取万能表单微信小程序二维码
* @param $form_id
* @return array
*/
public function getQrcode($form_id)
{
if (empty($form_id)) {
throw new AdminException('缺少参考form_id');
}
$page = 'app/pages/index/diy_form';
$data = [
[
'key' => 'form_id',
'value' => $form_id
],
];
$dir = 'upload/diy_form_qrcode';
$path = '';
try {
$path = qrcode('', $page, $data, $dir, 'weapp');
} catch (\Exception $e) {
Log::write('万能表单微信小程序二维码生成error' . $e->getMessage() . $e->getFile() . $e->getLine());
}
return [
'path' => $path
];
}
}

View File

@ -95,7 +95,8 @@ class InstallSystemService extends BaseAdminService
'methods' => $value[ 'methods' ] ?? '', 'methods' => $value[ 'methods' ] ?? '',
'sort' => $value[ 'sort' ] ?? '', 'sort' => $value[ 'sort' ] ?? '',
'status' => 1, 'status' => 1,
'is_show' => $value[ 'is_show' ] ?? 1 'is_show' => $value[ 'is_show' ] ?? 1,
'menu_attr' => $value['menu_attr'] ?? ''
]; ];
$refer = $value; $refer = $value;
if (isset($refer[ 'children' ])) { if (isset($refer[ 'children' ])) {

View File

@ -35,11 +35,11 @@ class MemberCashOutService extends BaseAdminService
public function getPage(array $where = []) public function getPage(array $where = [])
{ {
$field = 'id,cash_out_no,member_cash_out.member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,member_cash_out.money,audit_time,member_cash_out.status,remark,member_cash_out.create_time,refuse_reason,transfer_no'; $field = 'id,cash_out_no,member_cash_out.member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,member_cash_out.money,audit_time,member_cash_out.status,remark,member_cash_out.create_time,refuse_reason,transfer_no, transfer_payment_code';
$member_where = []; $member_where = [];
if(!empty($where['keywords'])) if(!empty($where['keywords']))
{ {
$member_where = [['member.member_no|member.nickname|member.mobile', '=', $where['keywords']]]; $member_where = [['member.member_no|member.nickname|member.mobile|member.username', '=', $where['keywords']]];
} }
$search_model = $this->model $search_model = $this->model
->withSearch(['member_id','status', 'join_create_time' => 'create_time', 'audit_time', 'transfer_time', 'transfer_type', 'cash_out_no'],$where)->with(['transfer']) ->withSearch(['member_id','status', 'join_create_time' => 'create_time', 'audit_time', 'transfer_time', 'transfer_type', 'cash_out_no'],$where)->with(['transfer'])
@ -55,7 +55,7 @@ class MemberCashOutService extends BaseAdminService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,cash_out_no,member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no'; $field = 'id,cash_out_no,member_id,account_type,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_status,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason,transfer_no, transfer_payment_code';
return $this->model->where([['id', '=', $id]])->with(['memberInfo', 'transfer'])->field($field)->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name'])->findOrEmpty()->toArray(); return $this->model->where([['id', '=', $id]])->with(['memberInfo', 'transfer'])->field($field)->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name'])->findOrEmpty()->toArray();
} }
@ -82,6 +82,16 @@ class MemberCashOutService extends BaseAdminService
return $core_member_cash_out_service->transfer($id, $data); return $core_member_cash_out_service->transfer($id, $data);
} }
/**
* 备注
* @param int $id
* @param array $data
* @return true
*/
public function remark(int $id, array $data){
$core_member_cash_out_service = new CoreMemberCashOutService();
return $core_member_cash_out_service->remark($id, $data);
}
/** /**
* 统计数据 * 统计数据
* @return array * @return array
@ -98,4 +108,14 @@ class MemberCashOutService extends BaseAdminService
return $stat; return $stat;
} }
} /**
* 检测实际的转账状态
* @param int $id
* @return true
*/
public function checkTransferStatus(int $id){
$core_member_cash_out_service = new CoreMemberCashOutService();
return $core_member_cash_out_service->checkTransferStatus($id);
}
}

View File

@ -15,6 +15,7 @@ use app\model\member\MemberSign;
use app\service\core\member\CoreMemberService; use app\service\core\member\CoreMemberService;
use app\service\core\sys\CoreConfigService; use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\AdminException;
/** /**
* 会员签到服务层 * 会员签到服务层
@ -83,6 +84,14 @@ class MemberSignService extends BaseAdminService
*/ */
public function setSign(array $value) public function setSign(array $value)
{ {
if (empty($value[ 'sign_period' ])) throw new AdminException('SIGN_PERIOD_CANNOT_EMPTY');
if ($value[ 'sign_period' ] < 2 || $value[ 'sign_period' ] > 365) throw new AdminException('SIGN_PERIOD_BETWEEN_2_365_DAYS');
if (!empty($value[ 'continue_award' ])) {
foreach ($value[ 'continue_award' ] as $v) {
if ($v[ 'continue_sign' ] < 2 || $v[ 'continue_sign' ] > 365) throw new AdminException('CONTINUE_SIGN_BETWEEN_2_365_DAYS');
if ($v[ 'continue_sign' ] > $value[ 'sign_period' ]) throw new AdminException('CONTINUE_SIGN_CANNOT_GREATER_THAN_SIGN_PERIOD');
}
}
$data = [ $data = [
'is_use' => $value[ 'is_use' ], //是否开启 'is_use' => $value[ 'is_use' ], //是否开启
'sign_period' => $value[ 'sign_period' ], // 签到周期 'sign_period' => $value[ 'sign_period' ], // 签到周期
@ -114,4 +123,4 @@ class MemberSignService extends BaseAdminService
} }
return $info[ 'value' ]; return $info[ 'value' ];
} }
} }

View File

@ -198,6 +198,8 @@ class PayChannelService extends BaseAdminService
'pay_explain_title' => $data[ 'pay_explain_title' ] ?? get_lang('dict_pay_config.pay_explain_title'),// 帮付说明标题 'pay_explain_title' => $data[ 'pay_explain_title' ] ?? get_lang('dict_pay_config.pay_explain_title'),// 帮付说明标题
'pay_explain_content' => $data[ 'pay_explain_content' ] ?? get_lang('dict_pay_config.pay_explain_content'),// 帮付说明内容 'pay_explain_content' => $data[ 'pay_explain_content' ] ?? get_lang('dict_pay_config.pay_explain_content'),// 帮付说明内容
'pay_info_switch' => $data[ 'pay_info_switch' ] ?? 1,// 订单信息, 1开启0关闭 'pay_info_switch' => $data[ 'pay_info_switch' ] ?? 1,// 订单信息, 1开启0关闭
'pay_wechat_share_image' => $data[ 'pay_wechat_share_image' ] ?? '/static/resource/images/pay/pay_wechat_share_image.png',// 默认分享图片(公众号)
'pay_weapp_share_image' => $data[ 'pay_weapp_share_image' ] ?? '/static/resource/images/pay/pay_weapp_share_image.png'// 默认分享图片(小程序)
]; ];
break; break;
default: default:

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -119,7 +119,7 @@ class RoleService extends BaseAdminService
} }
/** /**
* 删除权限(saas应该不允许删除) * 删除权限
* @param int $role_id * @param int $role_id
* @return mixed * @return mixed
* @throws DbException * @throws DbException

View File

@ -150,9 +150,10 @@ class UpgradeService extends BaseAdminService
dir_mkdir($upgrade_dir); dir_mkdir($upgrade_dir);
} }
$upgrade_tsak = [ $upgrade_task = [
'key' => $key, 'key' => $key,
'upgrade' => $upgrade, 'upgrade' => $upgrade,
'steps' => $this->steps,
'step' => 'requestUpgrade', 'step' => 'requestUpgrade',
'executed' => ['requestUpgrade'], 'executed' => ['requestUpgrade'],
'log' => [ $this->steps['requestUpgrade']['title'] ], 'log' => [ $this->steps['requestUpgrade']['title'] ],
@ -160,8 +161,8 @@ class UpgradeService extends BaseAdminService
'upgrade_content' => $this->getUpgradeContent($addon) 'upgrade_content' => $this->getUpgradeContent($addon)
]; ];
Cache::set($this->cache_key, $upgrade_tsak); Cache::set($this->cache_key, $upgrade_task);
return $upgrade_tsak; return $upgrade_task;
} catch (\Exception $e) { } catch (\Exception $e) {
throw new CommonException($e->getMessage()); throw new CommonException($e->getMessage());
} }
@ -174,7 +175,7 @@ class UpgradeService extends BaseAdminService
public function execute() { public function execute() {
if (!$this->upgrade_task) return true; if (!$this->upgrade_task) return true;
$steps = array_keys($this->steps); $steps = isset($this->upgrade_task['steps']) ? array_keys($this->upgrade_task['steps']) : array_keys($this->steps);
$index = array_search($this->upgrade_task['step'], $steps); $index = array_search($this->upgrade_task['step'], $steps);
$step = $steps[ $index + 1 ] ?? ''; $step = $steps[ $index + 1 ] ?? '';
$params = $this->upgrade_task['params'] ?? []; $params = $this->upgrade_task['params'] ?? [];
@ -194,7 +195,8 @@ class UpgradeService extends BaseAdminService
Cache::set($this->cache_key, $this->upgrade_task); Cache::set($this->cache_key, $this->upgrade_task);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->upgrade_task['step'] = $step; $this->upgrade_task['step'] = $step;
$this->upgrade_task['error'] = $e->getMessage(); $this->upgrade_task['error'][] = '升级失败,失败原因:' . $e->getMessage().$e->getFile().$e->getLine();
Cache::set($this->cache_key, $this->upgrade_task);
$this->upgradeErrorHandle(); $this->upgradeErrorHandle();
} }
return true; return true;
@ -269,7 +271,9 @@ class UpgradeService extends BaseAdminService
// 覆盖文件 // 覆盖文件
if (is_dir($code_dir . $version_no)) { if (is_dir($code_dir . $version_no)) {
dir_copy($code_dir . $version_no, $to_dir); // 忽略环境变量文件
$exclude_files = ['.env.development', '.env.production', '.env', '.env.dev', '.env.product'];
dir_copy($code_dir . $version_no, $to_dir, exclude_files:$exclude_files);
if ($addon != AddonDict::FRAMEWORK_KEY) { if ($addon != AddonDict::FRAMEWORK_KEY) {
(new CoreAddonInstallService($addon))->installDir(); (new CoreAddonInstallService($addon))->installDir();
} }
@ -367,7 +371,8 @@ class UpgradeService extends BaseAdminService
*/ */
public function handleUniapp() { public function handleUniapp() {
$code_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'download' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR; $code_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'download' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR;
dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app'); $exclude_files = ['.env.development', '.env.production', 'manifest.json'];
dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app', exclude_files:$exclude_files);
$addon_list = (new CoreAddonService())->getInstallAddonList(); $addon_list = (new CoreAddonService())->getInstallAddonList();
$depend_service = new CoreDependService(); $depend_service = new CoreDependService();
@ -380,9 +385,6 @@ class UpgradeService extends BaseAdminService
// 编译 diy-group 自定义组件代码文件 // 编译 diy-group 自定义组件代码文件
$this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon); $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon);
// 编译 fixed-group 固定模板组件代码文件
$this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon);
// 编译 pages.json 页面路由代码文件 // 编译 pages.json 页面路由代码文件
$this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); $this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
@ -481,20 +483,53 @@ class UpgradeService extends BaseAdminService
* @return true|void * @return true|void
*/ */
public function upgradeErrorHandle() { public function upgradeErrorHandle() {
$steps = [];
$steps[$this->upgrade_task['step']] = [];
if (isset($this->upgrade_task['is_cover'])) {
$steps['restoreCode'] = ['step' => 'restoreCode', 'title' => '恢复源码备份'];
$steps['restoreSql'] = ['step' => 'restoreSql', 'title' => '恢复数据库备份'];
}
$steps['restoreComplete'] = ['step' => 'restoreComplete', 'title' => '备份恢复完成'];
$this->upgrade_task['steps'] = $steps;
Cache::set($this->cache_key, $this->upgrade_task);
}
/**
* 恢复源码
* @return void
*/
public function restoreCode() {
try { try {
if (isset($this->upgrade_task['is_cover'])) { (new RestoreService())->restoreCode();
$restore_service = (new RestoreService());
$restore_service->restoreCode();
$restore_service->restoreSql();
}
$this->clearUpgradeTask(5);
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->clearUpgradeTask(5); $this->upgrade_task['error'][] = '源码备份恢复失败稍后请手动恢复,失败原因:' . $e->getMessage().$e->getFile().$e->getLine();
Cache::set($this->cache_key, $this->upgrade_task);
return true; return true;
} }
} }
/**
* 恢复数据库
* @return void
*/
public function restoreSql() {
try {
(new RestoreService())->restoreSql();
return true;
} catch (\Exception $e) {
$this->upgrade_task['error'][] = '数据库备份恢复失败稍后请手动恢复,失败原因:' . $e->getMessage().$e->getFile().$e->getLine();
Cache::set($this->cache_key, $this->upgrade_task);
return true;
}
}
public function restoreComplete() {
$this->clearUpgradeTask(5);
return true;
}
/** /**
* 获取升级内容 * 获取升级内容
* @param string $addon * @param string $addon

View File

@ -14,6 +14,9 @@ namespace app\service\api\diy;
use app\dict\diy\PagesDict; use app\dict\diy\PagesDict;
use app\dict\diy\TemplateDict; use app\dict\diy\TemplateDict;
use app\model\diy\Diy; use app\model\diy\Diy;
use app\model\diy\DiyTheme;
use app\service\core\addon\CoreAddonService;
use app\service\core\diy\CoreDiyService;
use core\base\BaseApiService; use core\base\BaseApiService;
/** /**
@ -108,4 +111,68 @@ class DiyService extends BaseApiService
return []; return [];
} }
// todo 使用缩略图
public function handleThumbImgs($data)
{
$data = json_decode($data, true);
// todo $data['global']
foreach ($data[ 'value' ] as $k => $v) {
// 图片广告
if ($v[ 'componentName' ] == 'ImageAds') {
foreach ($v[ 'list' ] as $ck => $cv) {
if (!empty($cv[ 'imageUrlThumbMid' ])) {
$data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrl' ] = $cv[ 'imageUrlThumbMid' ];
}
}
}
// 图文导航
if ($v[ 'componentName' ] == 'GraphicNav') {
foreach ($v[ 'list' ] as $ck => $cv) {
if (!empty($cv[ 'imageUrlThumbMid' ])) {
$data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrl' ] = $cv[ 'imageUrlThumbMid' ];
}
}
}
}
$data = json_encode($data);
return $data;
}
/**
* 获取自定义主题配色
* @return array
*/
public function getDiyTheme()
{
$addon_list = (new CoreAddonService())->getInstallAddonList();
$theme_data = (new DiyTheme())->where([ ['id', '>', 0] ])->column('id,color_name,color_mark,value,diy_value,title','addon');
$defaultColor = ( new CoreDiyService() )->getDefaultColor();
$app_theme['app'] = [
'color_name' => $theme_data['app']['color_name'] ?? $defaultColor['name'],
'color_mark' => $theme_data['app']['color_mark'] ?? $defaultColor['title'],
'value' => $theme_data['app']['value'] ?? $defaultColor['theme'],
'diy_value' => $theme_data['app']['diy_value'] ?? '',
];
$data = [];
foreach ($addon_list as $key=>$value){
if (isset($value['support_app']) && empty($value['support_app']) && $value['type'] == 'addon'){
continue;
}
$default_theme_data = array_values(array_filter(event('ThemeColor', [ 'key' => $value['key']])))[0] ?? [];
$data[$value['key']]['color_mark'] = $theme_data[$value['key']]['color_mark'] ?? ($default_theme_data ? $default_theme_data[ 'name' ] : $defaultColor['name']);
$data[$value['key']]['color_name'] = $theme_data[$value['key']]['color_name'] ?? ($default_theme_data ? $default_theme_data[ 'title' ] : $defaultColor['title']);
$data[$value['key']]['value'] = $theme_data[$value['key']]['value'] ?? ($default_theme_data ? $default_theme_data[ 'theme' ] : $defaultColor['theme']);
$data[$value['key']]['diy_value'] = $theme_data[$value['key']]['diy_value'] ?? '';
}
$data = array_merge($app_theme,$data);
return $data;
}
} }

View File

@ -0,0 +1,315 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\api\diy_form;
use app\model\diy_form\DiyForm;
use app\model\diy_form\DiyFormRecords;
use app\model\diy_form\DiyFormWriteConfig;
use app\model\member\Member;
use app\model\member\MemberLabel;
use app\model\member\MemberLevel;
use app\service\core\diy_form\CoreDiyFormRecordsService;
use core\base\BaseApiService;
use core\exception\ApiException;
/**
* 万能表单服务层
* Class DiyFormService
* @package app\service\api\diy
*/
class DiyFormService extends BaseApiService
{
public function __construct()
{
parent::__construct();
$this->model = new DiyForm();
}
/**
* 获取万能表单信息
* @param int $form_id
* @param string $field
* @return mixed
*/
public function getInfo(int $form_id, $field = 'form_id, page_title, title, type, status, value, share, remark')
{
$write_config = ( new DiyFormWriteConfig() )->where([
[ 'form_id', '=', $form_id ]
])->findOrEmpty()->toArray();
$error = [];
$info = $this->model->field($field)->where([ [ 'form_id', '=', $form_id ], [ 'status', '=', 1 ] ])->findOrEmpty()->toArray();
if (!empty($info)) {
if (!empty($info[ 'value' ][ 'value' ])) {
foreach ($info[ 'value' ][ 'value' ] as $k => $v) {
if ($v[ 'isHidden' ]) {
unset($info[ 'value' ][ 'value' ][ $k ]); // 过滤隐藏的组件
}
}
$info[ 'value' ][ 'value' ] = array_values($info[ 'value' ][ 'value' ]);
}
if (!empty($write_config) && !empty($this->member_id)) {
if ($error_msg = $this->checkMemberCanJoinOrNot($this->member_id, $write_config)) {
$error[] = $error_msg;
}
if ($error_msg = $this->checkFormWriteTime($write_config)) {
$error[] = $error_msg;
}
if ($error_msg = $this->checkFormWriteLimitNum($form_id, $write_config)) {
$error[] = $error_msg;
}
if ($error_msg = $this->checkMemberWriteLimitNum($this->member_id, $form_id, $write_config)) {
$error[] = $error_msg;
}
}
} else {
$error[] = [
'title' => '当前表单无法查看',
'type' => '表单状态',
'desc' => '该表单已关闭'
];
}
$info[ 'error' ] = $error;
return $info;
}
/**
* 判断当前会员是否可以填写表单
* @param int $member_id
* @param array $config
* @return array
*/
public function checkMemberCanJoinOrNot($member_id, $config)
{
$member_info = ( new Member() )->where([ [ 'member_id', '=', $member_id ] ])->field('member_level,member_label')->findOrEmpty()->toArray();
if (empty($member_info)) throw new ApiException('MEMBER_NOT_EXIST');
$error = [];
switch ($config[ 'join_member_type' ]) {
case 'all_member':
break;
case 'selected_member_level':
if (!in_array($member_info[ 'member_level' ], $config[ 'level_ids' ])) {
$level_names = ( new MemberLevel() )->where([ [ 'level_id', 'in', $config[ 'level_ids' ] ] ])->column('level_name');
$error = [
'title' => '当前表单无法查看',
'type' => '允许填写用户',
'desc' => '该表单已设置仅限“' . implode('、', $level_names) . '等级”的用户填写'
];
}
break;
case 'selected_member_label':
if (empty($member_info[ 'member_label' ])) $member_info[ 'member_label' ] = [];
if (empty(array_intersect($member_info[ 'member_label' ], $config[ 'label_ids' ]))) {
$label_names = ( new MemberLabel() )->where([ [ 'label_id', 'in', $config[ 'label_ids' ] ] ])->column('label_name');
$error = [
'title' => '当前表单无法查看',
'type' => '允许填写用户',
'desc' => '该表单已设置仅限“' . implode('、', $label_names) . '标签”的用户填写'
];
}
break;
}
return $error;
}
/**
* 检查会员填写表单次数限制
* @return array
*/
public function checkMemberWriteLimitNum($member_id, $form_id, $config)
{
$form_records_model = new DiyFormRecords();
$error = [];
switch ($config[ 'member_write_type' ]) {
case 'no_limit':
break;
case 'diy':
$member_write_rule = $config[ 'member_write_rule' ];
switch ($member_write_rule[ 'time_unit' ]) {
case 'day':
$time_text = '天';
break;
case 'week':
$time_text = '周';
break;
case 'month':
$time_text = '月';
break;
case 'year':
$time_text = '年';
break;
}
$count = $form_records_model->where([
[ 'form_id', '=', $form_id ],
[ 'member_id', '=', $member_id ]
])->whereTime('create_time', '-' . $member_write_rule[ 'time_value' ] . ' ' . $member_write_rule[ 'time_unit' ])->count();
if ($count >= $member_write_rule[ 'num' ]) {
$error = [
'title' => '您的填写次数已达上限',
'type' => '允许填写次数(每人)',
'desc' => '该表单已设置“每人每' . $member_write_rule[ 'time_value' ] . $time_text . '可填写' . $member_write_rule[ 'num' ] . '次”'
];
}
break;
}
return $error;
}
/**
* 检查表单填写次数限制
* @return array
*/
public function checkFormWriteLimitNum($form_id, $config)
{
$form_records_model = new DiyFormRecords();
$error = [];
switch ($config[ 'form_write_type' ]) {
case 'no_limit':
break;
case 'diy':
$form_write_rule = $config[ 'form_write_rule' ];
switch ($form_write_rule[ 'time_unit' ]) {
case 'day':
$time_text = '天';
break;
case 'week':
$time_text = '周';
break;
case 'month':
$time_text = '月';
break;
case 'year':
$time_text = '年';
break;
}
$count = $form_records_model->where([
[ 'form_id', '=', $form_id ]
])->whereTime('create_time', '-' . $form_write_rule[ 'time_value' ] . ' ' . $form_write_rule[ 'time_unit' ])->count();
if ($count >= $form_write_rule[ 'num' ]) {
$error = [
'title' => '表单总填写次数已达上限',
'type' => '允许填写次数(总)',
'desc' => '该表单已设置“每' . $form_write_rule[ 'time_value' ] . $time_text . '可填写' . $form_write_rule[ 'num' ] . '次”'
];
}
break;
}
return $error;
}
/**
* 检查表单填写时间限制
* @param array $config
* @return array
*/
public function checkFormWriteTime($config)
{
$error = [];
switch ($config[ 'time_limit_type' ]) {
case 'no_limit':
break;
case 'specify_time':
$specify_time = $config[ 'time_limit_rule' ][ 'specify_time' ] ?? [];
if (!empty($specify_time)) {
if (time() < $specify_time[ 0 ] || time() > $specify_time[ 1 ]) {
$error = [
'title' => '当前时间无法查看',
'type' => '允许查看时间',
'desc' => '该表单已设置“' . date('Y-m-d H:i:s', $specify_time[ 0 ]) . '-' . date('Y-m-d H:i:s', $specify_time[ 1 ]) . '”可查看'
];
}
}
break;
case 'open_day_time':
$open_day_time = $config[ 'time_limit_rule' ][ 'open_day_time' ] ?? [];
if (!empty($open_day_time)) {
$start_time = strtotime(date('Y-m-d', time())) + $open_day_time[ 0 ];
$end_time = strtotime(date('Y-m-d', time())) + $open_day_time[ 1 ];
if (time() < $start_time || time() > $end_time) {
$error = [
'title' => '当前时间无法查看',
'type' => '允许查看时间',
'desc' => '该表单已设置“每天' . date('H:i', $start_time) . '-' . date('H:i', $end_time) . '”可查看'
];
}
}
break;
}
return $error;
}
/**
* 提交填表记录
* @param array $data
* @return array
*/
public function addRecord(array $data = [])
{
$data[ 'member_id' ] = $this->member_id;
$info = $this->model->field('status')->where([ [ 'form_id', '=', $data[ 'form_id' ] ] ])->findOrEmpty()->toArray();
if (empty($info)) throw new ApiException('DIY_FORM_NOT_EXIST');
if ($info[ 'status' ] == 0) throw new ApiException('DIY_FORM_NOT_OPEN');
$write_config = ( new DiyFormWriteConfig() )->where([
[ 'form_id', '=', $data[ 'form_id' ] ]
])->findOrEmpty()->toArray();
if (!empty($write_config)) {
if ($error_msg = $this->checkMemberCanJoinOrNot($this->member_id, $write_config)) {
throw new ApiException($error_msg[ 'desc' ]);
}
if ($error_msg = $this->checkFormWriteTime($write_config)) {
throw new ApiException($error_msg[ 'desc' ]);
}
if ($error_msg = $this->checkFormWriteLimitNum($data[ 'form_id' ], $write_config)) {
throw new ApiException($error_msg[ 'desc' ]);
}
if ($error_msg = $this->checkMemberWriteLimitNum($this->member_id, $data[ 'form_id' ], $write_config)) {
throw new ApiException($error_msg[ 'desc' ]);
}
}
return ( new CoreDiyFormRecordsService() )->add($data);
}
/**
* 获取表单填写结果信息
* @param array $params
* @return mixed
*/
public function getResult($params = [])
{
$diy_form_records_model = new DiyFormRecords();
$field = 'record_id,form_id,create_time';
return $diy_form_records_model->field($field)->where([ [ 'record_id', '=', $params[ 'record_id' ] ], [ 'member_id', '=', $this->member_id ] ])->with([ 'submitConfig' ])->findOrEmpty()->toArray();
}
/**
* 获取表单填写记录循环diy-group每个表单组件实现各自的渲染处理
* @param array $params
* @return mixed
*/
public function getFormRecordInfo($params = [])
{
$diy_form_records_model = new DiyFormRecords();
$field = 'record_id,form_id,create_time';
$info = $diy_form_records_model->field($field)->where([ [ 'record_id', '=', $params[ 'record_id' ] ], [ 'member_id', '=', $this->member_id ] ])
->with([
// 关联填写字段列表
'recordsFieldList' => function($query) {
$query->field('id, form_id, form_field_id, record_id, field_key, field_type, field_name, field_value, field_required, field_unique, privacy_protection, update_num, update_time')->append([ 'handle_field_value', 'render_value' ]);
}
])->findOrEmpty()->toArray();
return $info;
}
}

View File

@ -109,4 +109,29 @@ class AuthService extends BaseApiService
]; ];
} }
/**
* 获取手机号
* @param string $mobile_code
* @return array
*/
public function getMobile(string $mobile_code)
{
$result = ( new CoreWeappAuthService() )->getUserPhoneNumber($mobile_code);
if (empty($result)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
if ($result[ 'errcode' ] != 0) throw new ApiException($result[ 'errmsg' ]);
$phone_info = $result[ 'phone_info' ];
$mobile = $phone_info[ 'purePhoneNumber' ];
if (empty($mobile)) throw new ApiException('WECHAT_EMPOWER_NOT_EXIST');
$member_service = new MemberService();
$mobile_member = $member_service->findMemberInfo([ 'mobile' => $mobile ]);
if (!$mobile_member->isEmpty()) throw new AuthException('MOBILE_IS_EXIST');
return [
'mobile' => $mobile
];
}
} }

View File

@ -75,8 +75,8 @@ class LoginService extends BaseApiService
$token_info = $this->createToken($member_info); $token_info = $this->createToken($member_info);
event("MemberLogin", $member_info); event("MemberLogin", $member_info);
return [ return [
'token' => $token_info['token'], 'token' => $token_info[ 'token' ],
'expires_time' => $token_info['params']['exp'], 'expires_time' => $token_info[ 'params' ][ 'exp' ],
'mobile' => $member_info->mobile 'mobile' => $member_info->mobile
]; ];
} }
@ -90,7 +90,7 @@ class LoginService extends BaseApiService
public function account(string $username, string $password) public function account(string $username, string $password)
{ {
$member_service = new MemberService(); $member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['username|mobile' => $username]); $member_info = $member_service->findMemberInfo([ 'username|mobile' => $username ]);
if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在 if ($member_info->isEmpty()) throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
if (!check_password($password, $member_info->password)) return false;//密码与账号不匹配 if (!check_password($password, $member_info->password)) return false;//密码与账号不匹配
return $this->login($member_info, MemberLoginTypeDict::USERNAME); return $this->login($member_info, MemberLoginTypeDict::USERNAME);
@ -98,26 +98,29 @@ class LoginService extends BaseApiService
/** /**
* 手机号登录 * 手机号登录
* @param string $mobile * @param array $params
* @return array * @return array
*/ */
public function mobile(string $mobile){ public function mobile($params)
{
//校验手机验证码 //校验手机验证码
$this->checkMobileCode($mobile); $this->checkMobileCode($params[ 'mobile' ]);
//登录注册配置 //登录注册配置
$config = (new MemberConfigService())->getLoginConfig(); $config = ( new MemberConfigService() )->getLoginConfig();
$is_mobile = $config['is_mobile']; $is_mobile = $config[ 'is_mobile' ];
$is_bind_mobile = $config[ 'is_bind_mobile' ]; $is_bind_mobile = $config[ 'is_bind_mobile' ];
if ($is_mobile != 1 && $is_bind_mobile != 1) throw new AuthException('MOBILE_LOGIN_UNOPENED'); if ($is_mobile != 1 && $is_bind_mobile != 1) throw new AuthException('MOBILE_LOGIN_UNOPENED');
$member_service = new MemberService(); $member_service = new MemberService();
$member_info = $member_service->findMemberInfo(['mobile' => $mobile]); $member_info = $member_service->findMemberInfo([ 'mobile' => $params[ 'mobile' ] ]);
if ($member_info->isEmpty()) { if ($member_info->isEmpty()) {
//开启强制绑定手机号,登录会自动注册并绑定手机号 //开启强制绑定手机号,登录会自动注册并绑定手机号
if ($is_bind_mobile == 1) { if ($is_bind_mobile == 1) {
$data = array ( $data = array(
'mobile' => $mobile, 'mobile' => $params[ 'mobile' ],
'nickname' => $params[ 'nickname' ],
'headimg' => $params[ 'headimg' ]
); );
return (new RegisterService())->register($mobile, $data, MemberRegisterTypeDict::MOBILE, false); return ( new RegisterService() )->register($params[ 'mobile' ], $data, MemberRegisterTypeDict::MOBILE, false);
} else { } else {
throw new AuthException('MEMBER_NOT_EXIST');//账号不存在 throw new AuthException('MEMBER_NOT_EXIST');//账号不存在
} }
@ -130,16 +133,16 @@ class LoginService extends BaseApiService
* @param $member_info * @param $member_info
* @return array|null * @return array|null
*/ */
public function createToken($member_info): ?array public function createToken($member_info) : ?array
{ {
$expire_time = env('system.api_token_expire_time') ?? 3600;//todo 不一定和管理端合用这个token时限 $expire_time = env('system.api_token_expire_time') ?? 3600;//todo 不一定和管理端合用这个token时限
return TokenAuth::createToken($member_info->member_id, AppTypeDict::API, ['member_id' => $member_info->member_id, 'username' => $member_info->username], $expire_time); return TokenAuth::createToken($member_info->member_id, AppTypeDict::API, [ 'member_id' => $member_info->member_id, 'username' => $member_info->username ], $expire_time);
} }
/** /**
* 登陆退出(当前账户) * 登陆退出(当前账户)
*/ */
public function logout(): ?bool public function logout() : ?bool
{ {
self::clearToken($this->member_id, $this->request->apiToken()); self::clearToken($this->member_id, $this->request->apiToken());
return true; return true;
@ -151,7 +154,7 @@ class LoginService extends BaseApiService
* @param string|null $token * @param string|null $token
* @return bool|null * @return bool|null
*/ */
public static function clearToken(int $member_id, ?string $token = ''): ?bool public static function clearToken(int $member_id, ?string $token = '') : ?bool
{ {
TokenAuth::clearToken($member_id, AppTypeDict::API, $token); TokenAuth::clearToken($member_id, AppTypeDict::API, $token);
return true; return true;
@ -162,24 +165,23 @@ class LoginService extends BaseApiService
* @param string|null $token * @param string|null $token
* @return array * @return array
*/ */
public function parseToken(?string $token){ public function parseToken(?string $token)
if(empty($token)) {
{ if (empty($token)) {
//定义专属于授权认证机制的错误响应, 定义专属语言包 //定义专属于授权认证机制的错误响应, 定义专属语言包
throw new AuthException('MUST_LOGIN', 401); throw new AuthException('MUST_LOGIN', 401);
} }
try { try {
$token_info = TokenAuth::parseToken($token, AppTypeDict::API); $token_info = TokenAuth::parseToken($token, AppTypeDict::API);
} catch ( Throwable $e ) { } catch (Throwable $e) {
// if(env('app_debug', false)){ // if(env('app_debug', false)){
// throw new AuthException($e->getMessage(), 401); // throw new AuthException($e->getMessage(), 401);
// }else{ // }else{
throw new AuthException('LOGIN_EXPIRE', 401); throw new AuthException('LOGIN_EXPIRE', 401);
// } // }
} }
if(!$token_info) if (!$token_info) {
{
throw new AuthException('MUST_LOGIN', 401); throw new AuthException('MUST_LOGIN', 401);
} }
//验证有效次数或过期时间 //验证有效次数或过期时间
@ -189,31 +191,34 @@ class LoginService extends BaseApiService
/** /**
* 手机发送验证码 * 手机发送验证码
* @param $mobile * @param $mobile
* @param string $type 发送短信的业务场景 * @param string $type 发送短信的业务场景
* @return array * @return array
* @throws Exception * @throws Exception
*/ */
public function sendMobileCode($mobile, string $type = ''){ public function sendMobileCode($mobile, string $type = '')
(new CaptchaService())->check(); {
if(empty($mobile)) throw new AuthException('MOBILE_NEEDED'); ( new CaptchaService() )->check();
if (empty($mobile)) throw new AuthException('MOBILE_NEEDED');
//发送 //发送
if(!in_array($type, SmsDict::SCENE_TYPE)) throw new AuthException('MEMBER_MOBILE_CAPTCHA_ERROR'); if (!in_array($type, SmsDict::SCENE_TYPE)) throw new AuthException('MEMBER_MOBILE_CAPTCHA_ERROR');
$code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);// 生成4位随机数左侧补0 $code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);// 生成4位随机数左侧补0
(new NoticeService())->send('member_verify_code', ['code' => $code, 'mobile' => $mobile]); ( new NoticeService() )->send('member_verify_code', [ 'code' => $code, 'mobile' => $mobile ]);
//将验证码存入缓存 //将验证码存入缓存
$key = md5(uniqid('', true)); $key = md5(uniqid('', true));
$cache_tag_name = "mobile_key".$mobile.$type; $cache_tag_name = "mobile_key" . $mobile . $type;
$this->clearMobileCode($mobile, $type); $this->clearMobileCode($mobile, $type);
Cache::tag($cache_tag_name)->set($key, [ 'mobile' => $mobile, 'code' => $code, 'type' => $type], 600); Cache::tag($cache_tag_name)->set($key, [ 'mobile' => $mobile, 'code' => $code, 'type' => $type ], 600);
return ['key' => $key]; return [ 'key' => $key ];
} }
public function getMobileCodeCacheName(){ public function getMobileCodeCacheName()
{
} }
public function clearMobileCode($mobile, $type){ public function clearMobileCode($mobile, $type)
$cache_tag_name = "mobile_key".$mobile.$type; {
$cache_tag_name = "mobile_key" . $mobile . $type;
Cache::tag($cache_tag_name)->clear(); Cache::tag($cache_tag_name)->clear();
} }
@ -222,17 +227,18 @@ class LoginService extends BaseApiService
* @param string $mobile * @param string $mobile
* @return true * @return true
*/ */
public function checkMobileCode(string $mobile){ public function checkMobileCode(string $mobile)
if(empty($mobile)) throw new AuthException('MOBILE_NEEDED'); {
if (empty($mobile)) throw new AuthException('MOBILE_NEEDED');
$mobile_key = request()->param('mobile_key', ''); $mobile_key = request()->param('mobile_key', '');
$mobile_code = request()->param('mobile_code', ''); $mobile_code = request()->param('mobile_code', '');
if(empty($mobile_key) || empty($mobile_code)) throw new AuthException('MOBILE_CAPTCHA_ERROR'); if (empty($mobile_key) || empty($mobile_code)) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$cache = Cache::get($mobile_key); $cache = Cache::get($mobile_key);
if(empty($cache)) throw new AuthException('MOBILE_CAPTCHA_ERROR'); if (empty($cache)) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$temp_mobile = $cache['mobile']; $temp_mobile = $cache[ 'mobile' ];
$temp_code = $cache['code']; $temp_code = $cache[ 'code' ];
$temp_type = $cache['type']; $temp_type = $cache[ 'type' ];
if($temp_mobile != $mobile || $temp_code != $mobile_code) throw new AuthException('MOBILE_CAPTCHA_ERROR'); if ($temp_mobile != $mobile || $temp_code != $mobile_code) throw new AuthException('MOBILE_CAPTCHA_ERROR');
$this->clearMobileCode($temp_mobile, $temp_type); $this->clearMobileCode($temp_mobile, $temp_type);
return true; return true;
@ -243,27 +249,28 @@ class LoginService extends BaseApiService
* @param $member * @param $member
* @return true * @return true
*/ */
public function bingOpenid($member){ public function bingOpenid($member)
{
$open_id = $this->request->param('openid'); $open_id = $this->request->param('openid');
if(!empty($open_id)){ if (!empty($open_id)) {
Log::write('channel_1'.$this->channel); Log::write('channel_1' . $this->channel);
if(!empty($this->channel)){ if (!empty($this->channel)) {
$openid_field = match($this->channel){ $openid_field = match($this->channel){
'wechat' => 'wx_openid', 'wechat' => 'wx_openid',
'weapp' => 'weapp_openid', 'weapp' => 'weapp_openid',
default => '' default => ''
}; };
if(!empty($openid_field)){ if (!empty($openid_field)) {
if(!$member->isEmpty()){ if (!$member->isEmpty()) {
if(empty($member->$openid_field)){ if (empty($member->$openid_field)) {
//todo 定义当前第三方授权方没有退出登录功能,故这儿不做openid是否存在账号验证 //todo 定义当前第三方授权方没有退出登录功能,故这儿不做openid是否存在账号验证
// $member_service = new MemberService(); // $member_service = new MemberService();
// $open_member = $member_service->findMemberInfo([$openid_field => $open_id]); // $open_member = $member_service->findMemberInfo([$openid_field => $open_id]);
$member->$openid_field = $open_id; $member->$openid_field = $open_id;
$member->save(); $member->save();
}else{ } else {
if( $member->$openid_field != $open_id){ if ($member->$openid_field != $open_id) {
throw new AuthException('MEMBER_IS_BIND_AUTH'); throw new AuthException('MEMBER_IS_BIND_AUTH');
} }
} }
@ -279,11 +286,12 @@ class LoginService extends BaseApiService
* @param string $mobile * @param string $mobile
* @param string $password * @param string $password
*/ */
public function resetPassword(string $mobile, string $password){ public function resetPassword(string $mobile, string $password)
{
$member_service = new MemberService(); $member_service = new MemberService();
//校验手机验证码 //校验手机验证码
$this->checkMobileCode($mobile); $this->checkMobileCode($mobile);
$member_info = $member_service->findMemberInfo(['mobile' => $mobile]); $member_info = $member_service->findMemberInfo([ 'mobile' => $mobile ]);
if ($member_info->isEmpty()) throw new AuthException('MOBILE_NOT_EXIST_MEMBER');//账号不存在 if ($member_info->isEmpty()) throw new AuthException('MOBILE_NOT_EXIST_MEMBER');//账号不存在
//todo 需要考虑一下,新的密码和原密码一样能否通过验证 //todo 需要考虑一下,新的密码和原密码一样能否通过验证
$password_hash = create_password($password); $password_hash = create_password($password);
@ -291,19 +299,22 @@ class LoginService extends BaseApiService
'password' => $password_hash, 'password' => $password_hash,
); );
$member_service->editByFind($member_info, $data); $member_service->editByFind($member_info, $data);
self::clearToken($member_info['member_id'], $this->request->apiToken()); self::clearToken($member_info[ 'member_id' ], $this->request->apiToken());
return true; return true;
} }
public function loginScanCode(){ public function loginScanCode()
{
} }
public function loginByScanCode(){ public function loginByScanCode()
{
} }
public function checkScanCode(){ public function checkScanCode()
{
} }

View File

@ -11,6 +11,7 @@
namespace app\service\api\login; namespace app\service\api\login;
use app\dict\common\ChannelDict;
use app\dict\member\MemberLoginTypeDict; use app\dict\member\MemberLoginTypeDict;
use app\dict\member\MemberRegisterTypeDict; use app\dict\member\MemberRegisterTypeDict;
use app\job\member\SetMemberNoJob; use app\job\member\SetMemberNoJob;

View File

@ -40,7 +40,7 @@ class MemberAccountService extends BaseApiService
{ {
$where[ 'member_id' ] = $this->member_id; $where[ 'member_id' ] = $this->member_id;
$field = 'id, member_id, account_type, account_data, from_type, related_id, create_time, memo'; $field = 'id, member_id, account_type, account_data, from_type, related_id, create_time, memo';
$search_model = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt', 'keyword' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt', 'keyword' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]);
return $this->pageQuery($search_model); return $this->pageQuery($search_model);
} }
@ -68,7 +68,7 @@ class MemberAccountService extends BaseApiService
} }
$where[ 'member_id' ] = $this->member_id; $where[ 'member_id' ] = $this->member_id;
$field = 'id, member_id, account_type, account_data, from_type, related_id, create_time, memo'; $field = 'id, member_id, account_type, account_data, from_type, related_id, create_time, memo';
$search_model = $this->model->where([ [ 'id', '>', 0 ] ])->where($type_where)->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->where($type_where)->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]);
$list = $this->pageQuery($search_model); $list = $this->pageQuery($search_model);
$list[ 'data' ] = $this->monthlyGrouping($list[ 'data' ]); $list[ 'data' ] = $this->monthlyGrouping($list[ 'data' ]);
return $list; return $list;
@ -200,4 +200,4 @@ class MemberAccountService extends BaseApiService
return $arr_return_data; return $arr_return_data;
} }
} }

View File

@ -46,7 +46,7 @@ class MemberCashOutAccountService extends BaseApiService
*/ */
public function getInfo(int $account_id) public function getInfo(int $account_id)
{ {
$field = 'account_id,member_id,account_type,bank_name,realname,account_no'; $field = 'account_id,member_id,account_type,bank_name,realname,account_no, transfer_payment_code';
return $this->model->where([['account_id', '=', $account_id], ['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->toArray(); return $this->model->where([['account_id', '=', $account_id], ['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->toArray();
} }
@ -103,4 +103,4 @@ class MemberCashOutAccountService extends BaseApiService
$this->model->where($where)->delete(); $this->model->where($where)->delete();
return true; return true;
} }
} }

View File

@ -51,7 +51,7 @@ class MemberCashOutService extends BaseApiService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,cash_out_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason'; $field = 'id,cash_out_no,member_id,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason, transfer_no, transfer_payee, transfer_payment_code';
return $this->model->where([['id', '=', $id], ['member_id', '=', $this->member_id]])->with(['memberInfo', 'transfer'])->field($field)->append(['account_type_name', 'transfer_type_name', 'status_name', 'transfer_status_name'])->findOrEmpty()->toArray(); return $this->model->where([['id', '=', $id], ['member_id', '=', $this->member_id]])->with(['memberInfo', 'transfer'])->field($field)->append(['account_type_name', 'transfer_type_name', 'status_name', 'transfer_status_name'])->findOrEmpty()->toArray();
} }
@ -99,4 +99,4 @@ class MemberCashOutService extends BaseApiService
return (new CoreMemberConfigService())->getCashOutConfig(); return (new CoreMemberConfigService())->getCashOutConfig();
} }
} }

View File

@ -37,6 +37,7 @@ class MemberConfigService extends BaseApiService
} catch (\Exception $e) { } catch (\Exception $e) {
$res[ 'is_auth_register' ] = 0; $res[ 'is_auth_register' ] = 0;
$res[ 'is_force_access_user_info' ] = 0; $res[ 'is_force_access_user_info' ] = 0;
$res[ 'is_bind_mobile' ] = 0;
} }
} }
return $res; return $res;

View File

@ -62,6 +62,15 @@ class MemberService extends BaseApiService
return $this->model->where([['member_id', '=', $this->member_id]])->with(['member_level_name_bind'])->field($field)->append(['sex_name'])->findOrEmpty()->toArray(); return $this->model->where([['member_id', '=', $this->member_id]])->with(['member_level_name_bind'])->field($field)->append(['sex_name'])->findOrEmpty()->toArray();
} }
/**
* 检测会员信息是否存在
* @return int
*/
public function getCount($condition)
{
return $this->model->where($condition)->count();
}
/** /**
* 会员中心信息 * 会员中心信息
*/ */

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -562,4 +562,4 @@ class MemberSignService extends BaseApiService
} }
} }
} }

View File

@ -22,11 +22,9 @@ use core\base\BaseApiService;
use core\exception\ApiException; use core\exception\ApiException;
use core\exception\AuthException; use core\exception\AuthException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use GuzzleHttp\Exception\GuzzleException;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException; use think\db\exception\ModelNotFoundException;
use think\Model;
/** /**
@ -76,10 +74,16 @@ class WeappAuthService extends BaseApiService
/** /**
* 登录 * 登录
* @param string $code * @param $data
* @return array * @return array
* @throws DataNotFoundException
* @throws DbException
* @throws InvalidConfigException
* @throws ModelNotFoundException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
*/ */
public function login(string $code) public function login($data)
{ {
[ [
@ -88,7 +92,7 @@ class WeappAuthService extends BaseApiService
// $avatar, // $avatar,
// $nickname, // $nickname,
// $sex // $sex
] = $this->getUserInfoByCode($code); ] = $this->getUserInfoByCode($data[ 'code' ]);
$member_service = new MemberService(); $member_service = new MemberService();
$member_info = $member_service->findMemberInfo([ 'weapp_openid' => $openid ]); $member_info = $member_service->findMemberInfo([ 'weapp_openid' => $openid ]);
@ -98,23 +102,81 @@ class WeappAuthService extends BaseApiService
$member_info->weapp_openid = $openid; $member_info->weapp_openid = $openid;
} }
} }
$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' ];
$is_mobile = $config[ 'is_mobile' ];
if ($member_info->isEmpty()) { if ($member_info->isEmpty()) {
// $config = ( new MemberConfigService() )->getLoginConfig();
// $is_auth_register = $config[ 'is_auth_register' ]; // 开启自动注册会员
// 去掉强制绑定手机号判断,否则开启强制绑定的情况下小程序第三方注册无法注册 if ($is_auth_register) {
// 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册
return $this->register($openid, wx_unionid: $unionid); // 开启强制获取会员信息并且开启强制绑定手机号,必须获取全部信息才能进行注册
// if ($is_auth_register == 1) { if ($is_force_access_user_info && $is_bind_mobile) {
// } else { if (!empty($data[ 'nickname' ]) && !empty($data[ 'headimg' ]) && !empty($data[ 'mobile' ])) {
// return [ 'openid' => $openid, 'unionid' => $unionid ]; return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid, $data[ 'nickname' ], $data[ 'headimg' ]);
// } } else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
} else if ($is_force_access_user_info) {
// 开启强制获取会员信息时,必须获取到昵称和头像才能进行注册
if (!empty($data[ 'nickname' ]) && !empty($data[ 'headimg' ])) {
return $this->register($openid, '', '', $unionid, $data[ 'nickname' ], $data[ 'headimg' ]);
} else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
} else if ($is_bind_mobile) {
// 开启强制绑定手机号,必须获取手机号才能进行注册
if (!empty($data[ 'mobile' ]) || !empty($data[ 'mobile_code' ])) {
return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid);
} else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
} else if (!$is_force_access_user_info && !$is_bind_mobile) {
// 关闭强制获取用户信息、并且关闭强制绑定手机号的情况下允许注册
return $this->register($openid, '', '', $unionid);
}
} else {
// 关闭自动注册,但是开启了强制绑定手机号,必须获取手机号才能进行注册
if ($is_bind_mobile) {
if (!empty($data[ 'mobile' ]) || !empty($data[ 'mobile_code' ])) {
return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid);
} else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
} else if($is_mobile) {
if (!empty($data[ 'mobile' ]) || !empty($data[ 'mobile_code' ])) {
return $this->register($openid, $data[ 'mobile' ], $data[ 'mobile_code' ], $unionid);
} else {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // 将重要信息返回给前端保存
}
}
}
} else { } else {
//可能会更新用户和粉丝表 // 可能会更新用户和粉丝表
$login_service = new LoginService(); $login_service = new LoginService();
// 开启自动注册会员,获取到昵称和头像进行修改
if ($is_auth_register) {
if ($is_force_access_user_info) {
if (!empty($data[ 'nickname' ])) {
$member_info[ 'nickname' ] = $data[ 'nickname' ];
}
if (!empty($data[ 'headimg' ])) {
$member_info[ 'headimg' ] = $data[ 'headimg' ];
}
}
if ($is_bind_mobile) {
// if (!empty($data[ 'mobile' ])) {
// $member_info[ 'mobile' ] = $data[ 'mobile' ];
// }
}
}
return $login_service->login($member_info, MemberLoginTypeDict::WEAPP); return $login_service->login($member_info, MemberLoginTypeDict::WEAPP);
} }
//todo 业务落地
} }
/** /**
@ -122,14 +184,17 @@ class WeappAuthService extends BaseApiService
* @param string $openid * @param string $openid
* @param string $mobile * @param string $mobile
* @param string $mobile_code * @param string $mobile_code
* @param string $wx_unionid
* @param string $nickname
* @param string $headimg
* @return array * @return array
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws GuzzleException
* @throws InvalidConfigException
* @throws ModelNotFoundException * @throws ModelNotFoundException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
*/ */
public function register(string $openid, string $mobile = '', string $mobile_code = '', string $wx_unionid = '') public function register(string $openid, string $mobile = '', string $mobile_code = '', string $wx_unionid = '', $nickname = '', $headimg = '')
{ {
if (empty($openid)) throw new AuthException('AUTH_LOGIN_TAG_NOT_EXIST'); if (empty($openid)) throw new AuthException('AUTH_LOGIN_TAG_NOT_EXIST');
@ -158,7 +223,9 @@ class WeappAuthService extends BaseApiService
return $register_service->register($mobile ?? '', return $register_service->register($mobile ?? '',
[ [
'weapp_openid' => $openid, 'weapp_openid' => $openid,
'wx_unionid' => $wx_unionid 'wx_unionid' => $wx_unionid,
'nickname' => $nickname,
'headimg' => $headimg,
], ],
MemberRegisterTypeDict::WEAPP, MemberRegisterTypeDict::WEAPP,
$is_verify_mobile ?? false $is_verify_mobile ?? false

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------

View File

@ -122,22 +122,40 @@ class WechatAuthService extends BaseApiService
} }
} }
if ($member_info->isEmpty()) { if ($member_info->isEmpty()) {
// $config = ( new MemberConfigService() )->getLoginConfig(); $config = ( new MemberConfigService() )->getLoginConfig();
// $is_auth_register = $config[ 'is_auth_register' ]; $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' ];
return $this->register($openid, '', $nickname, $avatar, $unionid);
// if ($is_auth_register == 1) { // 开启自动注册会员
// } else { if ($is_auth_register) {
// return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ];
// } // 开启强制获取会员信息并且开启强制绑定手机号,必须获取手机号才能进行注册,由于公众号无法主动获取,所以不能注册
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)) {
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 { } else {
//可能会更新用户和粉丝表 // 可能会更新用户和粉丝表
$login_service = new LoginService(); $login_service = new LoginService();
// 若用户头像为空,那么从微信获取头像和昵称,然后进行更新 // 若用户头像为空,那么从微信获取头像和昵称,然后进行更新
if (empty($member_info->headimg)) { if (empty($member_info->headimg)) {
$member_info->headimg = $avatar; if (!empty($avatar)) $member_info->headimg = $avatar;
$member_info->nickname = $nickname; if (!empty($nickname)) $member_info->nickname = $nickname;
} }
return $login_service->login($member_info, MemberLoginTypeDict::WECHAT); return $login_service->login($member_info, MemberLoginTypeDict::WECHAT);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台 // | Niucloud-admin 企业快速开发的多应用管理平台
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com // | 官方网址https://www.niucloud.com
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -34,4 +34,4 @@ class WechatConfigService extends BaseApiService
return true; return true;
} }
} }
} }

View File

@ -645,9 +645,6 @@ class CoreAddonInstallService extends CoreAddonBaseService
// 编译 diy-group 自定义组件代码文件 // 编译 diy-group 自定义组件代码文件
$this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon);
// 编译 fixed-group 固定模板组件代码文件
$this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon);
// 编译 pages.json 页面路由代码文件 // 编译 pages.json 页面路由代码文件
$this->uninstallPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); $this->uninstallPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
@ -677,9 +674,6 @@ class CoreAddonInstallService extends CoreAddonBaseService
// 编译 diy-group 自定义组件代码文件 // 编译 diy-group 自定义组件代码文件
$this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon); $this->compileDiyComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon);
// 编译 fixed-group 固定模板组件代码文件
$this->compileFixedComponentsCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $this->addon);
// 编译 pages.json 页面路由代码文件 // 编译 pages.json 页面路由代码文件
$this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR); $this->installPageCode($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);

View File

@ -63,7 +63,7 @@ trait WapTrait
$file_name = 'diy-' . $path; $file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n"; $content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name :component=\"component\" :global=\"data.global\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\" :scrollBool=\"diyGroup.componentsScrollBool.{$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>\n";
} }
} }
@ -101,7 +101,7 @@ trait WapTrait
$file_name = 'diy-' . $path; $file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n"; $content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name :component=\"component\" :global=\"data.global\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\" :scrollBool=\"diyGroup.componentsScrollBool.{$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>\n";
$addon_import_content .= " import diy{$name} from '@/addon/" . $v . "/components/diy/{$path}/index.vue';\n"; $addon_import_content .= " import diy{$name} from '@/addon/" . $v . "/components/diy/{$path}/index.vue';\n";
@ -113,7 +113,7 @@ trait WapTrait
$content .= " </view>\n"; $content .= " </view>\n";
$content .= " </view>\n"; $content .= " </view>\n";
$content .= " <template v-if=\"diyStore.mode == '' && data.global.bottomTabBarSwitch\">\n"; $content .= " <template v-if=\"diyStore.mode == '' && data.global && data.global.bottomTabBarSwitch\">\n";
$content .= " <view class=\"pt-[20rpx]\"></view>\n"; $content .= " <view class=\"pt-[20rpx]\"></view>\n";
$content .= " <tabbar />\n"; $content .= " <tabbar />\n";
$content .= " </template>\n"; $content .= " </template>\n";
@ -129,19 +129,22 @@ trait WapTrait
$content .= " import topTabbar from '@/components/top-tabbar/top-tabbar.vue'\n"; $content .= " import topTabbar from '@/components/top-tabbar/top-tabbar.vue'\n";
$content .= " import useDiyStore from '@/app/stores/diy';\n"; $content .= " import useDiyStore from '@/app/stores/diy';\n";
$content .= " import { useDiyGroup } from './useDiyGroup';\n"; $content .= " import { useDiyGroup } from './useDiyGroup';\n";
$content .= " import { ref } from 'vue';\n\n"; $content .= " import { ref,getCurrentInstance } from 'vue';\n\n";
$content .= " const props = defineProps(['data']);\n";
$content .= " const instance: any = getCurrentInstance();\n";
$content .= " const getFormRef = () => {\n";
$content .= " return {\n";
$content .= " componentRefs: instance.refs\n";
$content .= " }\n";
$content .= " }\n";
$content .= " const props = defineProps(['data','pullDownRefreshCount']);\n";
$content .= " const topTabbarRef = ref(null);\n";
$content .= " const diyStore = useDiyStore();\n"; $content .= " const diyStore = useDiyStore();\n";
$content .= " const diyGroup = useDiyGroup({\n"; $content .= " const diyGroup = useDiyGroup({\n";
$content .= " ...props,\n"; $content .= " ...props,\n";
$content .= " getFormRef() {\n"; $content .= " getFormRef\n";
$content .= " return {\n";
$content .= " topTabbarRef: topTabbarRef.value\n";
$content .= " }\n";
$content .= " }\n";
$content .= " });\n"; $content .= " });\n";
$content .= " const data = ref(diyGroup.data);\n\n"; $content .= " const data = ref(diyGroup.data);\n\n";
$content .= " // 监听页面加载完成\n"; $content .= " // 监听页面加载完成\n";
@ -151,7 +154,8 @@ trait WapTrait
$content .= " diyGroup.onPageScroll();\n"; $content .= " diyGroup.onPageScroll();\n";
$content .= " defineExpose({\n"; $content .= " defineExpose({\n";
$content .= " refresh: diyGroup.refresh\n"; $content .= " refresh: diyGroup.refresh,\n";
$content .= " getFormRef\n";
$content .= " })\n"; $content .= " })\n";
$content .= "</script>\n"; $content .= "</script>\n";
@ -163,98 +167,6 @@ trait WapTrait
return file_put_contents($compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'addon/components/diy/group/index.vue'), $content); return file_put_contents($compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'addon/components/diy/group/index.vue'), $content);
} }
/**
* 编译 fixed-group 固定模板组件代码文件
* @param $compile_path
* @param $addon
* @return false|int
*/
public function compileFixedComponentsCode($compile_path, $addon)
{
$content = "<template>\n";
$content .= " <view class=\"fixed-group\">\n";
$root_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'app/components/fixed'); // 系统固定模板组件根目录
$file_arr = getFileMap($root_path);
if (!empty($file_arr)) {
foreach ($file_arr as $ck => $cv) {
if (str_contains($cv, 'index.vue')) {
$path = str_replace($root_path . '/', '', $ck);
$path = str_replace('/index.vue', '', $path);
if ($path == 'group') {
continue;
}
$file_name = 'fixed-' . $path;
$content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n";
$content .= " <$file_name :data=\"props.data\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n";
}
}
}
// 查询已安装的插件
$addon_import_content = "";
$addon_service = new CoreAddonService();
$addon_list = $addon_service->getInstallAddonList();
$addon_arr = [];
if (!empty($addon_list)) {
foreach ($addon_list as $k => $v) {
$addon_arr[] = $v[ 'key' ];
}
}
$addon_arr[] = $addon; // 追加新装插件
$addon_arr = array_unique($addon_arr);
foreach ($addon_arr as $k => $v) {
$addon_path = $compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'addon/' . $v . '/components/fixed'); // 插件固定模板组件根目录
$addon_file_arr = getFileMap($addon_path);
if (!empty($addon_file_arr)) {
foreach ($addon_file_arr as $ck => $cv) {
if (str_contains($cv, 'index.vue')) {
$path = str_replace($addon_path . '/', '', $ck);
$path = str_replace('/index.vue', '', $path);
// 获取自定义组件 key 关键词
$name_arr = explode('-', $path);
foreach ($name_arr as $nk => $nv) {
// 首字母大写
$name_arr[ $nk ] = strtoupper($nv[ 0 ] ?? '') . substr($nv, 1);
}
$name = implode('', $name_arr);
$file_name = 'fixed-' . $path;
$content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n";
$content .= " <$file_name :data=\"props.data\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n";
$addon_import_content .= " import fixed{$name} from '@/addon/" . $v . "/components/fixed/{$path}/index.vue';\n";
}
}
}
}
$content .= " </view>\n";
$content .= "</template>\n";
$content .= "<script lang=\"ts\" setup>\n";
if (!empty($addon_import_content)) {
$content .= $addon_import_content;
}
$content .= " const props = defineProps(['data','pullDownRefreshCount']);\n";
$content .= "</script>\n";
$content .= "<style lang=\"scss\" scoped>\n";
$content .= " @import './index.scss';\n";
$content .= "</style>\n";
return file_put_contents($compile_path . str_replace('/', DIRECTORY_SEPARATOR, 'addon/components/fixed/group/index.vue'), $content);
}
/** /**
* 编译 pages.json 页面路由代码文件,// {{PAGE}} * 编译 pages.json 页面路由代码文件,// {{PAGE}}
* @param $compile_path * @param $compile_path

View File

@ -1,14 +1,19 @@
<?php <?php
return [ return [
'pages' => <<<EOT 'pages' => <<<EOT
// PAGE_BEGIN // PAGE_BEGIN
// *********************************** hello world *********************************** // *********************************** {{addon_name}} ***********************************
{ {
"path": "{{addon_name}}/pages/hello_world/index", "root": "addon/{{addon_name}}",
"style": { "pages": [
"navigationBarTitleText": "%{{addon_name}}.pages.hello_world.index%" {
"path": "pages/hello_world/index",
"style": {
"navigationBarTitleText": "%{{addon_name}}.pages.hello_world.index%"
}
} }
}, ]
// PAGE_END },
// PAGE_END
EOT EOT
]; ];

View File

@ -15,7 +15,7 @@ use app\model\diy\Diy;
use core\base\BaseCoreService; use core\base\BaseCoreService;
/** /**
* 自定义页面相关 * 自定义页面服务层
* Class CoreDiyService * Class CoreDiyService
* @package app\service\core\diy * @package app\service\core\diy
*/ */
@ -30,4 +30,78 @@ class CoreDiyService extends BaseCoreService
{ {
return ( new Diy() )->where($condition)->delete(); return ( new Diy() )->where($condition)->delete();
} }
/**
* 获取系统默认主题配色
* @return array
*/
public function getDefaultColor()
{
return [
'title' => '商务蓝',
'name' => 'blue',
'theme' => [
'--primary-color' => '#007aff', // 主色
'--primary-help-color' => '#007aff', // 辅色
'--price-text-color' => '#FF4142',// 价格颜色
'--primary-color-dark' => '#398ade', // 灰色
'--primary-color-disabled' => '#9acafc', // 禁用色
'--primary-color-light' => '#ecf5ff', // 边框色(深)
'--primary-color-light2' => '#fff7f7', // 边框色(淡)
'--page-bg-color' => '#f6f6f6', // 页面背景色
],
];
}
/**
* 获取默认主题配色
* @return array
*/
public function getDefaultThemeColor()
{
return [
[
'title' => '商务蓝',
'name' => 'blue',
'theme' => [
'--primary-color' => '#007aff', // 主色
'--primary-help-color' => '#007aff', // 辅色
'--price-text-color' => '#FF4142',// 价格颜色
'--primary-color-dark' => '#398ade', // 灰色
'--primary-color-disabled' => '#9acafc', // 禁用色
'--primary-color-light' => '#ecf5ff', // 边框色(深)
'--primary-color-light2' => '#fff7f7', // 边框色(淡)
'--page-bg-color' => '#f6f6f6', // 页面背景色
],
],
[
'title' => '热情红',
'name' => 'red',
'theme' => [
'--primary-color' => '#FF4142', // 主色
'--primary-help-color' => '#FB7939', // 辅色
'--price-text-color' => '#FF4142',// 价格颜色
'--primary-color-dark' => '#F26F3E', // 灰色
'--primary-color-disabled' => '#FFB397', // 禁用色
'--primary-color-light' => '#FFEAEA', // 边框色(深)
'--primary-color-light2' => '#fff7f7', // 边框色(淡)
'--page-bg-color' => '#f6f6f6', // 页面背景色
],
],
[
'title' => '活力橙',
'name' => 'orange',
'theme' => [
'--primary-color' => '#FA6400', // 主色
'--primary-help-color' => '#FA6400', // 辅色
'--price-text-color' => '#FF2525',// 价格颜色
'--primary-color-dark' => '#F48032', // 灰色
'--primary-color-disabled' => '#FFC29A', // 禁用色
'--primary-color-light' => '#FFF4ED', // 边框色(深)
'--primary-color-light2' => '#FFF4ED', // 边框色(淡)
'--page-bg-color' => '#f6f6f6', // 页面背景色
],
]
];
}
} }

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