This commit is contained in:
全栈小学生 2024-08-17 09:40:17 +08:00
parent bf224633d5
commit 58d6348768
98 changed files with 1037 additions and 1154 deletions

View File

@ -2,7 +2,6 @@
namespace app; namespace app;
use app\dict\sys\AppTypeDict; use app\dict\sys\AppTypeDict;
use core\exception\AdminException;
use core\exception\AuthException; use core\exception\AuthException;
use core\exception\ServerException; use core\exception\ServerException;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;

View File

@ -13,7 +13,6 @@ namespace app\adminapi\controller\login;
use app\service\admin\auth\ConfigService; use app\service\admin\auth\ConfigService;
use app\service\admin\auth\LoginService; use app\service\admin\auth\LoginService;
use app\service\admin\upgrade\UpgradeService;
use app\service\core\addon\WapTrait; use app\service\core\addon\WapTrait;
use core\base\BaseAdminController; use core\base\BaseAdminController;
use think\Response; use think\Response;
@ -62,14 +61,4 @@ class Login extends BaseAdminController
{ {
return success(( new ConfigService() )->getConfig()); return success(( new ConfigService() )->getConfig());
} }
public function test()
{
( new UpgradeService() )->executeSql(root_path() . 'app/upgrade/v011/upgrade.sql');
}
public function geAddonPackagePath(string $addon)
{
return root_path() . 'addon' . DIRECTORY_SEPARATOR . $addon . DIRECTORY_SEPARATOR . 'package' . DIRECTORY_SEPARATOR;
}
} }

View File

@ -38,7 +38,9 @@ class Config extends BaseAdminController
[ 'is_mobile', 0 ], [ 'is_mobile', 0 ],
[ 'is_auth_register', 1 ], [ 'is_auth_register', 1 ],
[ 'is_bind_mobile', 0 ], [ 'is_bind_mobile', 0 ],
['agreement_show', 0] [ 'agreement_show', 0 ],
[ 'bg_url', '' ],
[ 'desc', '' ]
]); ]);
$this->validate($data, 'app\validate\member\LoginConfig.set'); $this->validate($data, 'app\validate\member\LoginConfig.set');
( new MemberConfigService() )->setLoginConfig($data); ( new MemberConfigService() )->setLoginConfig($data);

View File

@ -94,21 +94,6 @@ class Notice extends BaseAdminController
return success(); return success();
} }
/**
* 消息列表
* @return Response
*/
public function getLogList()
{
$data = $this->request->params([
['key', ''],
['receiver', ''],
]);
$res = (new NoticeService())->getLogPage($data);
return success($res);
}
/** /**
* 消息修改 * 消息修改
* @return Response * @return Response

View File

@ -25,6 +25,9 @@ class Stat extends BaseAdminController
/** /**
* 首页数据 * 首页数据
* @return Response * @return Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function index() public function index()
{ {

View File

@ -86,6 +86,16 @@ class User extends BaseAdminController
return success(); return success();
} }
/**
* 删除用户
* @param $uid
* @return Response
*/
public function del($uid) {
(new UserService())->del($uid);
return success("DELETE_SUCCESS");
}
/** /**
* 获取用户站点创建限制 * 获取用户站点创建限制
* @param $uid * @param $uid

View File

@ -16,7 +16,6 @@ use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog; use app\adminapi\middleware\AdminLog;
// USER_CODE_BEGIN -- sys_dict
Route::group('dict', function () { Route::group('dict', function () {
//数据字典列表 //数据字典列表
@ -40,4 +39,3 @@ Route::group('dict', function () {
AdminCheckRole::class, AdminCheckRole::class,
AdminLog::class AdminLog::class
]); ]);
// USER_CODE_END -- sys_dict

View File

@ -32,8 +32,6 @@ Route::group('notice', function () {
Route::get('notice/sms/:sms_type', 'notice.Notice/smsConfig'); Route::get('notice/sms/:sms_type', 'notice.Notice/smsConfig');
//短信配置修改 //短信配置修改
Route::put('notice/sms/:sms_type', 'notice.Notice/editSms'); Route::put('notice/sms/:sms_type', 'notice.Notice/editSms');
//消息发送记录
Route::get('notice/log', 'notice.Notice/getLogList');
//消息修改 //消息修改
Route::post('notice/edit', 'notice.Notice/edit'); Route::post('notice/edit', 'notice.Notice/edit');

View File

@ -26,8 +26,6 @@ Route::group(function () {
Route::get('captcha/create', 'login.Captcha/create'); Route::get('captcha/create', 'login.Captcha/create');
//一次校验验证码 //一次校验验证码
Route::get('captcha/check', 'login.Captcha/check'); Route::get('captcha/check', 'login.Captcha/check');
Route::get('test', 'login.Login/test');
}); });
//加载插件路由 //加载插件路由

View File

@ -28,6 +28,8 @@ Route::group('user', function () {
Route::get('user_select', 'user.User/getUserSelect'); Route::get('user_select', 'user.User/getUserSelect');
//用户详情 //用户详情
Route::get('user/:uid', 'user.User/info'); Route::get('user/:uid', 'user.User/info');
// 删除用户
Route::delete('user/:uid', 'user.User/del');
// 查询账号是否存在 // 查询账号是否存在
Route::get('isexist', 'user.User/checkUserIsExist'); Route::get('isexist', 'user.User/checkUserIsExist');
//添加用户 //添加用户

View File

@ -62,6 +62,7 @@ class Account extends BaseApiController
{ {
$data = $this->request->params([ $data = $this->request->params([
['from_type', ''], ['from_type', ''],
['trade_type', ''],
['create_time', []] ['create_time', []]
]); ]);
return success((new MemberAccountService())->getBalancePage($data)); return success((new MemberAccountService())->getBalancePage($data));

View File

@ -550,7 +550,7 @@ class ComponentDict
'sort' => 10014, 'sort' => 10014,
'position' => 'fixed', 'position' => 'fixed',
'value' => [ 'value' => [
"imageSize" => 80, "imageSize" => 40,
"aroundRadius" => 0, "aroundRadius" => 0,
'style' => 'style-1', 'style' => 'style-1',
"styleName" => "风格一", "styleName" => "风格一",

View File

@ -63,63 +63,63 @@ class LinkDict
'name' => 'MEMBER_PERSONAL', 'name' => 'MEMBER_PERSONAL',
'title' => get_lang('dict_diy.member_my_personal'), 'title' => get_lang('dict_diy.member_my_personal'),
'url' => '/app/pages/member/personal', 'url' => '/app/pages/member/personal',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_BALANCE', 'name' => 'MEMBER_BALANCE',
'title' => get_lang('dict_diy.member_my_balance'), 'title' => get_lang('dict_diy.member_my_balance'),
'url' => '/app/pages/member/balance', 'url' => '/app/pages/member/balance',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_POINT', 'name' => 'MEMBER_POINT',
'title' => get_lang('dict_diy.member_my_point'), 'title' => get_lang('dict_diy.member_my_point'),
'url' => '/app/pages/member/point', 'url' => '/app/pages/member/point',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_COMMISSION', 'name' => 'MEMBER_COMMISSION',
'title' => get_lang('dict_diy.member_my_commission'), 'title' => get_lang('dict_diy.member_my_commission'),
'url' => '/app/pages/member/commission', 'url' => '/app/pages/member/commission',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_ADDRESS', 'name' => 'MEMBER_ADDRESS',
'title' => get_lang('dict_diy.member_my_address'), 'title' => get_lang('dict_diy.member_my_address'),
'url' => '/app/pages/member/address', 'url' => '/app/pages/member/address',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_MY_LEVEL', 'name' => 'MEMBER_MY_LEVEL',
'title' => get_lang('dict_diy.member_my_level'), 'title' => get_lang('dict_diy.member_my_level'),
'url' => '/app/pages/member/level', 'url' => '/app/pages/member/level',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_MY_SIGN_IN', 'name' => 'MEMBER_MY_SIGN_IN',
'title' => get_lang('dict_diy.member_my_sign_in'), 'title' => get_lang('dict_diy.member_my_sign_in'),
'url' => '/app/pages/member/sign_in', 'url' => '/app/pages/member/sign_in',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_VERIFY_INDEX', 'name' => 'MEMBER_VERIFY_INDEX',
'title' => get_lang('dict_diy.member_verify_index'), 'title' => get_lang('dict_diy.member_verify_index'),
'url' => '/app/pages/verify/index', 'url' => '/app/pages/verify/index',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
[ [
'name' => 'MEMBER_CONTACT', 'name' => 'MEMBER_CONTACT',
'title' => get_lang('dict_diy.member_contact'), 'title' => get_lang('dict_diy.member_contact'),
'url' => '/app/pages/member/contact', 'url' => '/app/pages/member/contact',
'is_share' => 1, 'is_share' => 0,
'action' => '' 'action' => ''
], ],
] ]

View File

@ -68,7 +68,9 @@ class PagesDict
"list" => [] "list" => []
]; ];
$wap_index_list = ( new ConfigService() )->getWapIndexList(); $wap_index_list = ( new ConfigService() )->getWapIndexList([
'site_id' => $params[ 'site_id' ] ?? 0
]);
if (!empty($wap_index_list)) { if (!empty($wap_index_list)) {
foreach ($wap_index_list as $k => $v) { foreach ($wap_index_list as $k => $v) {

View File

@ -11,8 +11,6 @@
namespace app\dict\member; namespace app\dict\member;
use app\dict\common\ChannelDict;
/** /**
* 会员签到状态枚举类 * 会员签到状态枚举类
* Class MemberDict * Class MemberDict

View File

@ -11,8 +11,6 @@
namespace app\dict\member; namespace app\dict\member;
use app\dict\common\ChannelDict;
/** /**
* 会员签到类型枚举类 * 会员签到类型枚举类
* Class MemberDict * Class MemberDict

View File

@ -132,7 +132,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '40', 'sort' => '75',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -320,7 +320,7 @@ return [
'router_path' => 'setting/storage', 'router_path' => 'setting/storage',
'view_path' => 'setting/storage', 'view_path' => 'setting/storage',
'methods' => 'get', 'methods' => 'get',
'sort' => '30', 'sort' => '70',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -364,7 +364,7 @@ return [
'router_path' => 'setting/adminlogin', 'router_path' => 'setting/adminlogin',
'view_path' => 'setting/adminlogin', 'view_path' => 'setting/adminlogin',
'methods' => 'get', 'methods' => 'get',
'sort' => '20', 'sort' => '65',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -394,7 +394,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'get', 'methods' => 'get',
'sort' => '20', 'sort' => '60',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -408,7 +408,7 @@ return [
'router_path' => 'setting/oplatform', 'router_path' => 'setting/oplatform',
'view_path' => 'wxoplatform/setting', 'view_path' => 'wxoplatform/setting',
'methods' => 'get', 'methods' => 'get',
'sort' => '20', 'sort' => '100',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -438,7 +438,7 @@ return [
'router_path' => 'wxoplatform/weapp_version', 'router_path' => 'wxoplatform/weapp_version',
'view_path' => 'wxoplatform/weapp_version', 'view_path' => 'wxoplatform/weapp_version',
'methods' => 'get', 'methods' => 'get',
'sort' => '10', 'sort' => '99',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -470,7 +470,7 @@ return [
'router_path' => 'setting/attachment', 'router_path' => 'setting/attachment',
'view_path' => 'tools/attachment', 'view_path' => 'tools/attachment',
'methods' => 'get', 'methods' => 'get',
'sort' => '10', 'sort' => '55',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -570,7 +570,7 @@ return [
'router_path' => 'setting/map', 'router_path' => 'setting/map',
'view_path' => 'setting/map', 'view_path' => 'setting/map',
'methods' => 'get', 'methods' => 'get',
'sort' => '9', 'sort' => '50',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -600,7 +600,7 @@ return [
'router_path' => 'setting/layout', 'router_path' => 'setting/layout',
'view_path' => 'setting/layout', 'view_path' => 'setting/layout',
'methods' => 'get', 'methods' => 'get',
'sort' => '8', 'sort' => '45',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -855,6 +855,20 @@ return [
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
], ],
[
'menu_name' => '删除站点用户',
'menu_key' => 'add_user',
'menu_short_name' => '',
'menu_type' => '2',
'icon' => '',
'api_url' => 'user/user/<uid>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '100',
'status' => '1',
'is_show' => '1',
],
[ [
'menu_name' => '获取用户套餐权限', 'menu_name' => '获取用户套餐权限',
'menu_key' => 'get_user_create_site_limit', 'menu_key' => 'get_user_create_site_limit',
@ -938,7 +952,7 @@ return [
'router_path' => 'app_manage/app_store', 'router_path' => 'app_manage/app_store',
'view_path' => 'index/store', 'view_path' => 'index/store',
'methods' => 'get', 'methods' => 'get',
'sort' => '70', 'sort' => '78',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1038,7 +1052,7 @@ return [
'router_path' => 'app_manage/tools', 'router_path' => 'app_manage/tools',
'view_path' => 'index/tools', 'view_path' => 'index/tools',
'methods' => 'get', 'methods' => 'get',
'sort' => '70', 'sort' => '77',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
], ],
@ -1053,7 +1067,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '60', 'sort' => '76',
'status' => '1', 'status' => '1',
'is_show' => '0', 'is_show' => '0',
'children' => [ 'children' => [

View File

@ -302,7 +302,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '70', 'sort' => '89',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -715,7 +715,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '60', 'sort' => '88',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -801,7 +801,7 @@ return [
'router_path' => 'finance/refund', 'router_path' => 'finance/refund',
'view_path' => 'finance/pay_refund', 'view_path' => 'finance/pay_refund',
'methods' => 'get', 'methods' => 'get',
'sort' => '9', 'sort' => '96',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -831,7 +831,7 @@ return [
'router_path' => 'finance/refund/detail', 'router_path' => 'finance/refund/detail',
'view_path' => 'finance/refund_detail', 'view_path' => 'finance/refund_detail',
'methods' => 'get', 'methods' => 'get',
'sort' => '9', 'sort' => '95',
'status' => '1', 'status' => '1',
'is_show' => '0', 'is_show' => '0',
], ],
@ -848,7 +848,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '56', 'sort' => '87',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1013,7 +1013,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '55', 'sort' => '86',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1044,7 +1044,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '50', 'sort' => '85',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1517,7 +1517,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '40', 'sort' => '84',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1631,7 +1631,7 @@ return [
'router_path' => 'setting/auth/role', 'router_path' => 'setting/auth/role',
'view_path' => 'auth/role', 'view_path' => 'auth/role',
'methods' => 'get', 'methods' => 'get',
'sort' => '70', 'sort' => '99',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1689,7 +1689,7 @@ return [
'router_path' => 'setting/auth/log', 'router_path' => 'setting/auth/log',
'view_path' => 'auth/log', 'view_path' => 'auth/log',
'methods' => 'get', 'methods' => 'get',
'sort' => '60', 'sort' => '98',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
], ],
@ -1706,7 +1706,7 @@ return [
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => '30', 'sort' => '83',
'status' => '1', 'status' => '1',
'is_show' => '1', 'is_show' => '1',
'children' => [ 'children' => [
@ -1786,7 +1786,6 @@ return [
], ],
] ]
], ],
[ [
'menu_name' => '会员设置', 'menu_name' => '会员设置',
'menu_key' => 'setting_member', 'menu_key' => 'setting_member',

View File

@ -16,7 +16,6 @@ use app\dict\common\ChannelDict;
class PayChannelDict class PayChannelDict
{ {
/** /**
* 支付渠道类型 * 支付渠道类型
* @return array * @return array
@ -43,5 +42,4 @@ class PayChannelDict
return $list; return $list;
} }
} }

View File

@ -25,15 +25,15 @@ return [
'class' => 'app\job\schedule\SiteExpireClose', 'class' => 'app\job\schedule\SiteExpireClose',
'function' => '' 'function' => ''
], ],
[ // [
'key' => 'site_stat', // 'key' => 'site_stat',
'name' => '站点统计', // 'name' => '站点统计',
'desc' => '', // 'desc' => '',
'time' => [ // 'time' => [
'type' => 'hour', // 'type' => 'hour',
'hour' => 1, // 'hour' => 1,
], // ],
'class' => 'app\job\schedule\SiteStatJob', // 'class' => 'app\job\schedule\SiteStatJob',
'function' => '' // 'function' => ''
] // ]
]; ];

View File

@ -32,8 +32,8 @@ class AgreementDict
'privacy' => get_lang('dict_agreement.privacy'),//隐私协议 'privacy' => get_lang('dict_agreement.privacy'),//隐私协议
]; ];
$addon_data = event("AgreementType"); $addon_data = event("AgreementType");
Log::write("检测数据"); // Log::write("检测数据");
Log::write($addon_data); // Log::write($addon_data);
foreach ($addon_data as $k => $v) foreach ($addon_data as $k => $v)
{ {
$data = array_merge($data, $v); $data = array_merge($data, $v);

View File

@ -27,7 +27,6 @@ $system_event = [
'MemberAccount' => [ 'app\listener\member\MemberAccountListener' ], 'MemberAccount' => [ 'app\listener\member\MemberAccountListener' ],
//扫码事件 //扫码事件
'Scan' => [ 'app\listener\scan\ScanListener' ], 'Scan' => [ 'app\listener\scan\ScanListener' ],
'AddSiteAfter' => [ 'app\listener\site\AddSiteAfterListener' ],
/** /**
* 支付相关事件 * 支付相关事件
*/ */
@ -89,12 +88,12 @@ $system_event = [
//导出数据类型 //导出数据类型
'ExportDataType' => [ 'ExportDataType' => [
//会员导出 //会员导出
'app\listener\member\MemberExportTypeListener', 'app\listener\member_export\MemberExportTypeListener',
], ],
//导出数据源 //导出数据源
'ExportData' => [ 'ExportData' => [
//会员导出 //会员导出
'app\listener\member\MemberExportDataListener', 'app\listener\member_export\MemberExportDataListener',
], ],
//统计执行 //统计执行
'StatExecute' => [], 'StatExecute' => [],

View File

@ -6,8 +6,6 @@ namespace app\install\controller;
use app\model\site\Site; use app\model\site\Site;
use app\model\sys\SysUser; use app\model\sys\SysUser;
use app\service\admin\install\InstallSystemService; use app\service\admin\install\InstallSystemService;
use app\service\admin\site\SiteGroupService;
use app\service\admin\site\SiteService;
use app\service\core\schedule\CoreScheduleInstallService; use app\service\core\schedule\CoreScheduleInstallService;
use Exception; use Exception;
use think\facade\Cache; use think\facade\Cache;
@ -337,7 +335,6 @@ class Index extends BaseInstall
return fail('计划任务初始化失败'); return fail('计划任务初始化失败');
} }
$user = ( new SysUser() )->where([ [ 'uid', '=', 1 ] ])->findOrEmpty(); $user = ( new SysUser() )->where([ [ 'uid', '=', 1 ] ])->findOrEmpty();
if (!$user->isEmpty()) { if (!$user->isEmpty()) {
$user->save([ $user->save([

View File

@ -78,12 +78,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;
@ -458,91 +458,6 @@ CREATE TABLE `pay_transfer` (
) 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 `recharge_order`;
CREATE TABLE `recharge_order` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`site_id` int(11) NOT NULL DEFAULT 0 COMMENT '站点id',
`order_no` varchar(50) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_from` varchar(55) NOT NULL DEFAULT '' COMMENT '订单来源',
`order_type` varchar(50) NOT NULL DEFAULT '' COMMENT '订单类型',
`out_trade_no` varchar(50) NOT NULL DEFAULT '' COMMENT '支付流水号',
`order_status` int(11) NOT NULL DEFAULT 0 COMMENT '订单状态',
`refund_status` int(11) NOT NULL DEFAULT 0 COMMENT '退款状态',
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
`ip` varchar(20) NOT NULL DEFAULT '' COMMENT '会员ip',
`member_message` varchar(50) NOT NULL DEFAULT '' COMMENT '会员留言信息',
`order_item_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '订单项目金额',
`order_discount_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '订单优惠金额',
`order_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '订单金额',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`pay_time` int(11) NOT NULL DEFAULT 0 COMMENT '订单支付时间',
`close_time` int(11) NOT NULL DEFAULT 0 COMMENT '订单关闭时间',
`is_delete` int(11) NOT NULL DEFAULT 0 COMMENT '是否删除(针对后台)',
`is_enable_refund` int(11) NOT NULL DEFAULT 0 COMMENT '是否允许退款',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '商家留言',
`invoice_id` int(11) NOT NULL DEFAULT 0 COMMENT '发票id0表示不开发票',
`close_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '关闭原因',
PRIMARY KEY (`order_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `recharge_order_item`;
CREATE TABLE `recharge_order_item` (
`order_item_id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
`site_id` int(11) NOT NULL DEFAULT 0 COMMENT '站点id',
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '购买会员id',
`item_id` int(11) NOT NULL DEFAULT 0 COMMENT '项目id',
`item_type` varchar(255) NOT NULL DEFAULT '' COMMENT '项目类型',
`item_name` varchar(400) NOT NULL DEFAULT '' COMMENT '项目名称',
`item_image` varchar(2000) NOT NULL DEFAULT '' COMMENT '项目图片',
`price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '项目单价',
`num` decimal(10, 3) NOT NULL DEFAULT 0.000 COMMENT '购买数量',
`item_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '项目总价',
`is_refund` int(11) NOT NULL DEFAULT 0 COMMENT '是否退款',
`refund_no` varchar(255) NOT NULL DEFAULT '' COMMENT '退款编号',
`refund_status` int(11) NOT NULL DEFAULT 0 COMMENT '退款状态',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`order_item_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单商品表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `recharge_order_item_refund`;
CREATE TABLE `recharge_order_item_refund` (
`refund_id` int(11) NOT NULL AUTO_INCREMENT,
`order_item_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
`order_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
`order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '订单编号',
`refund_no` varchar(255) NOT NULL DEFAULT '0' COMMENT '退款单号',
`site_id` int(11) NOT NULL DEFAULT 0 COMMENT '站点id',
`member_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
`num` decimal(10, 3) NOT NULL DEFAULT 0.000 COMMENT '退货数量',
`money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '总退款',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '退款状态',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`audit_time` int(11) NOT NULL DEFAULT 0 COMMENT '审核时间',
`transfer_time` int(11) NOT NULL DEFAULT 0 COMMENT '转账时间',
`item_type` varchar(255) NOT NULL DEFAULT '' COMMENT '项目类型',
PRIMARY KEY (`refund_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单退款表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `recharge_order_log`;
CREATE TABLE `recharge_order_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
`site_id` int(11) NOT NULL DEFAULT 0 COMMENT '站点id',
`action` varchar(255) NOT NULL DEFAULT '' COMMENT '操作内容',
`uid` int(11) NOT NULL DEFAULT 0 COMMENT '操作人id',
`nick_name` varchar(50) NOT NULL DEFAULT '' COMMENT '操作人名称',
`order_status` int(11) NOT NULL DEFAULT 0 COMMENT '订单状态,操作后',
`action_way` bigint(20) NOT NULL DEFAULT 2 COMMENT '操作类型1买家2卖家 3 系统任务',
`order_status_name` varchar(255) NOT NULL DEFAULT '' COMMENT '订单状态名称,操作后',
`action_time` int(11) NOT NULL DEFAULT 0 COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单操作记录表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `site`; DROP TABLE IF EXISTS `site`;
CREATE TABLE `site` ( CREATE TABLE `site` (
`site_id` int(11) NOT NULL AUTO_INCREMENT, `site_id` int(11) NOT NULL AUTO_INCREMENT,
@ -1119,7 +1034,7 @@ INSERT INTO `site`(site_id, site_name, group_id, keywords, app_type, logo, `desc
UPDATE `site` SET site_id = 0 WHERE site_id = 1; UPDATE `site` SET site_id = 0 WHERE site_id = 1;
INSERT INTO `sys_user` VALUES ('1', '', '', '', '', '', '0', '0', '0', '1', '0', '0', '0'); -- INSERT INTO `sys_user` VALUES ('1', '', '', '', '', '', '0', '0', '0', '1', '0', '0', '0');
INSERT INTO `sys_user_role` VALUES ('1', '1', '0', '', '0', '1', '1'); INSERT INTO `sys_user_role` VALUES ('1', '1', '0', '', '0', '1', '1');

View File

@ -4,7 +4,6 @@
<meta name="renderer" content="webkit" /> <meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1" /> <meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1" />
<title>安装程序 - NiuCloud-Admin</title> <title>安装程序 - NiuCloud-Admin</title>
<!-- <script src="INSTALL_JS/jquery-2.2.js"></script>-->
<link rel="icon" type="image/x-icon" href="INSTALL_IMG/shop_bitbug_favicon.ico" /> <link rel="icon" type="image/x-icon" href="INSTALL_IMG/shop_bitbug_favicon.ico" />
<link rel="stylesheet" type="text/css" href="INSTALL_CSS/style.css" /> <link rel="stylesheet" type="text/css" href="INSTALL_CSS/style.css" />
<link rel="stylesheet" type="text/css" href="INSTALL_CSS/layui.css" /> <link rel="stylesheet" type="text/css" href="INSTALL_CSS/layui.css" />

View File

@ -165,7 +165,7 @@
{/block} {/block}
{block name='script'} {block name='script'}
<script language="javascript" type="text/javascript"> <script type="text/javascript">
ControlContent(2); ControlContent(2);
var is_existdb = 1;//数据库是否存在 var is_existdb = 1;//数据库是否存在
var message = '数据库账号或密码不能为空'; var message = '数据库账号或密码不能为空';

View File

@ -21,8 +21,8 @@ class SiteStatJob extends BaseJob
{ {
public function doJob() public function doJob()
{ {
event('Stat'); // event('Stat');
Log::write('站点统计' . date('Y-m-d h:i:s')); // Log::write('站点统计' . date('Y-m-d h:i:s'));
return true; return true;
} }
} }

View File

@ -28,7 +28,7 @@ return [
'DOWNLOAD_FAIL' => 'download fail', 'DOWNLOAD_FAIL' => 'download fail',
'SET_SUCCESS' => 'set success', 'SET_SUCCESS' => 'set success',
'AGREEMENT_TYPE_NOT_EXIST' => 'agreement type is not exit', 'AGREEMENT_TYPE_NOT_EXIST' => 'agreement type is not exit',
'FIELD_NOT_FOUND' => 'cloumn is not exit', 'FIELD_NOT_FOUND' => 'column is not exit',
'REFRESH_SUCCESS' => 'refresh success', 'REFRESH_SUCCESS' => 'refresh success',
'CAPTCHA_ERROR' => 'captcha fail', 'CAPTCHA_ERROR' => 'captcha fail',
@ -101,7 +101,7 @@ return [
'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在', 'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在',
'MEMBER_IS_EXIST' => '账号已存在', 'MEMBER_IS_EXIST' => '账号已存在',
'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道', 'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道',
'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开账号登录注册', 'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开账号登录注册',
'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册', 'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册',
'MOBILE_NEEDED' => '手机号必须填写', 'MOBILE_NEEDED' => '手机号必须填写',
'MOBILE_CAPTCHA_ERROR' => '手机验证码有误', 'MOBILE_CAPTCHA_ERROR' => '手机验证码有误',

View File

@ -46,7 +46,7 @@ return [
'ZIP_FILE_NOT_FOUND' => '找不到可用的压缩文件', 'ZIP_FILE_NOT_FOUND' => '找不到可用的压缩文件',
'ZIP_ARCHIVE_NOT_INSTALL' => 'ZipArchive扩展未安装', 'ZIP_ARCHIVE_NOT_INSTALL' => 'ZipArchive扩展未安装',
'DOWNLOAD_SUCCESS' => '下载成功', 'DOWNLOAD_SUCCESS' => '下载成功',
'APP_NOT_ALLOW_UNINSTALL' => '该应用下存在站点卸载前请先删除相关站点', 'APP_NOT_ALLOW_UNINSTALL' => '该插件有站点正在使用中,卸载前请先删除相关站点',
'ADDON_INSTALL_FAIL' => '插件安装失败', 'ADDON_INSTALL_FAIL' => '插件安装失败',
'ADMIN_DIR_NOT_EXIST' => '未找到admin源码所在目录, <a style="text-decoration: underline;" href="https://www.kancloud.cn/niucloud/niucloud-admin-develop/3213544" target="blank">点击查看相关手册</a>', 'ADMIN_DIR_NOT_EXIST' => '未找到admin源码所在目录, <a style="text-decoration: underline;" href="https://www.kancloud.cn/niucloud/niucloud-admin-develop/3213544" target="blank">点击查看相关手册</a>',
'WEB_DIR_NOT_EXIST' => '未找到web源码所在目录, <a style="text-decoration: underline;" href="https://www.kancloud.cn/niucloud/niucloud-admin-develop/3213544" target="blank">点击查看相关手册</a>', 'WEB_DIR_NOT_EXIST' => '未找到web源码所在目录, <a style="text-decoration: underline;" href="https://www.kancloud.cn/niucloud/niucloud-admin-develop/3213544" target="blank">点击查看相关手册</a>',
@ -74,6 +74,8 @@ return [
'SITE_USER_CAN_NOT_LOGIN_IN_ADMIN' => '站点用户无法在平台端进行登录', 'SITE_USER_CAN_NOT_LOGIN_IN_ADMIN' => '站点用户无法在平台端进行登录',
'ADMIN_USER_CAN_NOT_LOGIN_IN_SITE' => '平台用户无法在站点端进行登录', 'ADMIN_USER_CAN_NOT_LOGIN_IN_SITE' => '平台用户无法在站点端进行登录',
'APP_TYPE_NOT_EXIST' => '无效的登录端口', 'APP_TYPE_NOT_EXIST' => '无效的登录端口',
"USER_NOT_ALLOW_DEL" => "该用户是一些站点的管理员不允许删除",
"SUPER_ADMIN_NOT_ALLOW_DEL" => "超级管理员不允许删除",
//用户组权限 //用户组权限
@ -110,7 +112,7 @@ return [
'OSS_FILE_URL_NOT_EXIST' => '远程资源文件地址不能为空', 'OSS_FILE_URL_NOT_EXIST' => '远程资源文件地址不能为空',
'BASE_IMAGE_FILE_NOT_EXIST' => 'base图片资源不能为空', 'BASE_IMAGE_FILE_NOT_EXIST' => 'base图片资源不能为空',
'UPLOAD_TYPE_NOT_SUPPORT' => '不支持的上传类型', 'UPLOAD_TYPE_NOT_SUPPORT' => '不支持的上传类型',
'FILE_ERROE' => '无效的资源', 'FILE_ERROR' => '无效的资源',
'UPLOAD_STORAGE_TYPE_ALL_CLOSE' => '至少要有一个启用的存储方式', 'UPLOAD_STORAGE_TYPE_ALL_CLOSE' => '至少要有一个启用的存储方式',
'STORAGE_NOT_HAS_HTTP_OR_HTTPS' => '空间域名请补全http://或https://', 'STORAGE_NOT_HAS_HTTP_OR_HTTPS' => '空间域名请补全http://或https://',
@ -143,7 +145,7 @@ return [
'MEMBER_IS_EXIST' => '账号已存在', 'MEMBER_IS_EXIST' => '账号已存在',
'MEMBER_NO_IS_EXIST' => '会员编号已存在', 'MEMBER_NO_IS_EXIST' => '会员编号已存在',
'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道', 'REG_CHANNEL_NOT_EXIST' => '无效的注册渠道',
'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开账号登录注册', 'MEMBER_USERNAME_LOGIN_NOT_OPEN' => '未开账号登录注册',
'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册', 'AUTH_LOGIN_NOT_OPEN' => '未开启第三方登录注册',
'MOBILE_NEEDED' => '手机号必须填写', 'MOBILE_NEEDED' => '手机号必须填写',
'MOBILE_CAPTCHA_ERROR' => '手机验证码有误', 'MOBILE_CAPTCHA_ERROR' => '手机验证码有误',
@ -185,7 +187,7 @@ return [
'WEAPP_NOT_EXIST' => '微信小程序未配置完善', 'WEAPP_NOT_EXIST' => '微信小程序未配置完善',
'WEAPP_EMPOWER_NOT_EXIST' => '微信小程序授信信息不存在', 'WEAPP_EMPOWER_NOT_EXIST' => '微信小程序授信信息不存在',
'WEAPP_EMPOWER_TEL_NOT_EXIST' => '微信小程序授信手机号不存在', 'WEAPP_EMPOWER_TEL_NOT_EXIST' => '微信小程序授信手机号不存在',
'CURR_SITE_IS_NOT_OPEN_SSL' => '微信小程序请求域名只支持https请先配置ssl', 'CURR_SITE_IS_NOT_OPEN_SSL' => '微信小程序请求地址只支持https请先配置ssl',
'WECHAT_MINI_PROGRAM_CODE_GENERATION_FAILED' => '微信小程序码生成失败', 'WECHAT_MINI_PROGRAM_CODE_GENERATION_FAILED' => '微信小程序码生成失败',
//站点相关 //站点相关

View File

@ -9,14 +9,14 @@
// | Author: Niucloud Team // | Author: Niucloud Team
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\listener\member; namespace app\listener\member_export;
use app\model\member\Member; use app\model\member\Member;
/** /**
* 会员导出数据源查询 * 会员导出数据源查询
* Class MemberExportTypeListener * Class MemberExportDataListener
* @package app\listener\member * @package app\listener\member_export
*/ */
class MemberExportDataListener class MemberExportDataListener
{ {
@ -26,7 +26,7 @@ class MemberExportDataListener
$data = []; $data = [];
if ($param['type'] == 'member') { if ($param['type'] == 'member') {
$model = new Member(); $model = new Member();
$field = 'member_id, member_no, username, mobile, nickname, birthday, member_level, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time'; $field = 'member_id, member_no, mobile, nickname, birthday, member_level, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time';
//查询导出数据 //查询导出数据
$search_model = $model->where([['site_id', '=', $param['site_id']]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'], $param['where']) $search_model = $model->where([['site_id', '=', $param['site_id']]])->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'], $param['where'])
->with(['memberLevelNameBind'])->field($field)->append(['register_channel_name', 'sex_name', 'status_name']); ->with(['memberLevelNameBind'])->field($field)->append(['register_channel_name', 'sex_name', 'status_name']);
@ -36,10 +36,9 @@ class MemberExportDataListener
$data = $search_model->select()->toArray(); $data = $search_model->select()->toArray();
} }
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
$data[$key]['username'] = !empty($value['username']) ? $value['username'] : '-';
$data[$key]['mobile'] = $value['mobile']."\t"; $data[$key]['mobile'] = $value['mobile']."\t";
$data[$key]['create_time'] = !empty($value['create_time']) ? $value['create_time'] : '0000-00-00 00:00:00'; $data[$key]['create_time'] = !empty($value['create_time']) ? $value['create_time'] : '';
$data[$key]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '0000-00-00 00:00:00'; $data[$key]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '';
} }
} }
return $data; return $data;

View File

@ -9,7 +9,7 @@
// | Author: Niucloud Team // | Author: Niucloud Team
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\listener\member; namespace app\listener\member_export;
/** /**
* 会员导出数据类型查询 * 会员导出数据类型查询
@ -25,7 +25,6 @@ class MemberExportTypeListener
'member' => [ 'member' => [
'name' => '会员列表', 'name' => '会员列表',
'column' => [ 'column' => [
'username' => [ 'name' => '真实姓名'],
'nickname' => [ 'name' => '会员昵称'], 'nickname' => [ 'name' => '会员昵称'],
'mobile' => [ 'name' => '手机号'], 'mobile' => [ 'name' => '手机号'],
'member_level_name' => [ 'name' => '会员等级'], 'member_level_name' => [ 'name' => '会员等级'],

View File

@ -1,151 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\site;
use app\dict\diy\TemplateDict;
use app\service\admin\diy\DiyRouteService;
use app\service\admin\diy\DiyService;
/**
* 添加站点成功后事件
*/
class AddSiteAfterListener
{
/**
* 初始化站点
* @param array $params
*/
public function handle($params = [])
{
$site_id = $params[ 'site_id' ];
request()->siteId($site_id);
$count = count($params[ 'main_app' ]);
$addon = array_merge([ '' ], $params[ 'main_app' ]);
foreach ($addon as $k => $v) {
if ($count > 1) {
// 站点多应用,使用系统的页面
if ($k == 0) {
$is_start = 1;
} else {
$is_start = 0;
}
} else {
// 站点单应用,将应用的设为使用中
if ($k == 0) {
$is_start = 0;
} else {
$is_start = 1;
}
}
// 设置 首页 默认模板
$this->setDiyData([
'key' => 'DIY_INDEX',
'type' => 'index',
'addon' => $v,
'is_start' => $is_start,
'site_id' => $site_id
]);
// 设置 个人中心 默认模板
$this->setDiyData([
'key' => 'DIY_MEMBER_INDEX',
'type' => 'member_index',
'addon' => $v,
'is_start' => $is_start,
'site_id' => $site_id
]);
}
}
/**
* 设置 首页/个人中心 的第一个模板 设置为启动页
* @param $params
*/
private function setDiyData($params)
{
$addon = $params[ 'addon' ] ?? '';
$addon_flag = $params[ 'key' ];
// 默认
$default_template = TemplateDict::getTemplate([
'key' => [ $params[ 'key' ] ]
]);
$addon_template_info = array_shift($default_template);
// 查询插件定义的页面类型
$addon_template = TemplateDict::getTemplate([
'type' => $params[ 'type' ],
'addon' => $addon
]);
if (!empty($addon_template)) {
$addon_flag = array_keys($addon_template)[ 0 ];
$addon_template_info = array_shift($addon_template);
}
$diy_service = new DiyService();
$addon_index_template = $diy_service->getFirstPageData($addon_flag, $addon);
if (!empty($addon_index_template)) {
$diy_service->add([
'page_title' => $addon_index_template[ 'title' ],
"title" => $addon_index_template[ 'title' ],
"name" => $addon_flag,
"type" => $addon_flag,
"template" => $addon_index_template[ 'template' ],
"mode" => $addon_index_template[ 'mode' ],
"value" => json_encode($addon_index_template[ 'data' ]),
"is_default" => 1,
"is_change" => 0
]);
$diy_page_list = $diy_service->getList([
[ 'site_id', '=', $params[ 'site_id' ] ],
[ 'type', '=', $params[ 'key' ] ]
], 'id,name,type');
// 多应用时,将首页和个人中心设为系统的
foreach ($diy_page_list as $k => $v) {
if ($v[ 'name' ] == $params[ 'key' ]) {
$diy_service->setUse($v[ 'id' ]);
break;
}
}
if ($params[ 'is_start' ] == 1) {
// 查询链接,设置启动页
$other_page = ( new DiyRouteService() )->getList([ 'url' => $addon_template_info[ 'page' ], 'addon' => $addon ]);
if (!empty($other_page)) {
$diy_service->changeTemplate([
'type' => $params[ 'key' ], // 页面类型
'name' => $other_page[ 0 ][ 'name' ], // 链接名称标识
'parent' => $other_page[ 0 ][ 'parent' ], // 链接父级名称标识
'page' => $other_page[ 0 ][ 'page' ], // 链接路由
'title' => $other_page[ 0 ][ 'title' ], // 链接标题
'action' => $other_page[ 0 ][ 'action' ] // 是否存在操作decorate 表示支持装修
]);
}
}
}
}
}

View File

@ -12,9 +12,6 @@
namespace app\model\dict; namespace app\model\dict;
use core\base\BaseModel; use core\base\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
/** /**
* 数据字典模型 * 数据字典模型
@ -24,8 +21,6 @@ use think\model\relation\HasOne;
class Dict extends BaseModel class Dict extends BaseModel
{ {
/** /**
* 数据表主键 * 数据表主键
* @var string * @var string
@ -71,7 +66,4 @@ class Dict extends BaseModel
} }
} }
} }

View File

@ -11,7 +11,6 @@
namespace app\model\member; namespace app\model\member;
use app\service\core\member\CoreMemberService;
use core\base\BaseModel; use core\base\BaseModel;
/** /**

View File

@ -45,20 +45,6 @@ class SysNoticeLog extends BaseModel
// 设置JSON数据返回数组 // 设置JSON数据返回数组
protected $jsonAssoc = true; protected $jsonAssoc = true;
/**
* 名称
* @param $value
* @param $data
* @return string
*/
public function getContentAttr($value, $data)
{
if ($value) {
$temp = json_decode($value, true);
}
return $temp ?? $value;
}
/** /**
* 名称 * 名称
* @param $value * @param $value

View File

@ -13,9 +13,6 @@ namespace app\model\sys;
use app\dict\sys\PrinterDict; use app\dict\sys\PrinterDict;
use core\base\BaseModel; use core\base\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
/** /**
* 小票打印模板模型 * 小票打印模板模型

View File

@ -11,7 +11,6 @@
namespace app\model\sys; namespace app\model\sys;
use app\dict\sys\RoleStatusDict;
use app\dict\sys\UserDict; use app\dict\sys\UserDict;
use core\base\BaseModel; use core\base\BaseModel;
use think\model\concern\SoftDelete; use think\model\concern\SoftDelete;
@ -108,7 +107,7 @@ class SysUser extends BaseModel
public function getStatusNameAttr($value, $data) public function getStatusNameAttr($value, $data)
{ {
if (empty($data['status'])) return ''; if (empty($data['status'])) return '';
return RoleStatusDict::getStatus()[$data['status']] ?? ''; return UserDict::getStatus()[$data['status']] ?? '';
} }
/** /**

View File

@ -11,7 +11,6 @@
namespace app\model\verify; namespace app\model\verify;
use app\dict\verify\VerifyDict;
use app\model\member\Member; use app\model\member\Member;
use core\base\BaseModel; use core\base\BaseModel;

View File

@ -18,9 +18,7 @@ use app\model\site\Site;
use app\model\sys\SysMenu; use app\model\sys\SysMenu;
use app\service\admin\addon\AddonService; use app\service\admin\addon\AddonService;
use app\service\admin\site\SiteService; use app\service\admin\site\SiteService;
use app\service\core\addon\CoreAddonService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use think\Collection;
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;
@ -41,7 +39,8 @@ class AuthSiteService extends BaseAdminService
/** /**
* 获取授权当前的站点信息 * 获取授权当前的站点信息
*/ */
public function getSiteInfo(){ public function getSiteInfo()
{
//通过用户id获取 //通过用户id获取
return ( new SiteService() )->getSiteCache($this->site_id); return ( new SiteService() )->getSiteCache($this->site_id);
} }
@ -53,7 +52,8 @@ class AuthSiteService extends BaseAdminService
* @param int|string $status * @param int|string $status
* @return mixed * @return mixed
*/ */
public function getMenuList(int $is_tree, int|string $status, $addon = 'all', int $is_button = 1){ public function getMenuList(int $is_tree, $status, $addon = 'all', int $is_button = 1)
{
return ( new SiteService() )->getMenuList($this->site_id, $is_tree, $status, $addon, $is_button); return ( new SiteService() )->getMenuList($this->site_id, $is_tree, $status, $addon, $is_button);
} }
@ -62,7 +62,8 @@ class AuthSiteService extends BaseAdminService
* @param int|string $status * @param int|string $status
* @return mixed * @return mixed
*/ */
public function getApiList(int|string $status){ public function getApiList($status)
{
return ( new SiteService() )->getApiList($this->site_id, $status); return ( new SiteService() )->getApiList($this->site_id, $status);
} }
@ -73,7 +74,8 @@ class AuthSiteService extends BaseAdminService
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
*/ */
public function getShowMenuList(){ public function getShowMenuList()
{
$menu_keys = ( new SiteService() )->getMenuIdsBySiteId($this->site_id, 1); $menu_keys = ( new SiteService() )->getMenuIdsBySiteId($this->site_id, 1);
return ( new SysMenu() )->where([ [ 'menu_key', 'in', $menu_keys ], [ 'menu_type', '=', MenuTypeDict::MENU ], [ 'app_type', '=', AppTypeDict::SITE ], [ 'is_show', '=', 1 ] ])->select()->toArray(); return ( new SysMenu() )->where([ [ 'menu_key', 'in', $menu_keys ], [ 'menu_type', '=', MenuTypeDict::MENU ], [ 'app_type', '=', AppTypeDict::SITE ], [ 'is_show', '=', 1 ] ])->select()->toArray();
} }
@ -85,7 +87,8 @@ class AuthSiteService extends BaseAdminService
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
*/ */
public function getAuthAddonList(){ public function getAuthAddonList()
{
return ( new AddonService() )->getAddonListBySiteId($this->site_id); return ( new AddonService() )->getAddonListBySiteId($this->site_id);
} }
} }

View File

@ -73,13 +73,18 @@ class LoginService extends BaseAdminService
$this->request->uid($userinfo->uid); $this->request->uid($userinfo->uid);
$auth_site_service = (new HomeAuthSiteService()); $auth_site_service = (new HomeAuthSiteService());
$user_role_service = new UserRoleService();
$default_site_id = 0; $default_site_id = 0;
if($app_type == AppTypeDict::ADMIN){ if($app_type == AppTypeDict::ADMIN){
$default_site_id = $this->request->defaultSiteId(); $default_site_id = $this->request->defaultSiteId();
$userrole = (new UserRoleService())->getUserRole($default_site_id, $userinfo->uid); $userrole = $user_role_service->getUserRole($default_site_id, $userinfo->uid);
if (!empty($userrole)) { if (!empty($userrole)) {
if (!$userrole['status']) throw new AuthException('USER_LOCK'); if (!$userrole['status']) throw new AuthException('USER_LOCK');
if (!$userrole['is_admin']) {
$rules = $user_role_service->getRoleByUserRoleIds($userrole['role_ids'], $default_site_id);
if (empty($rules) || count($rules) == 0) throw new AuthException('USER_LOCK');
}
} else { } else {
$app_type = AppTypeDict::SITE; $app_type = AppTypeDict::SITE;
} }
@ -88,6 +93,16 @@ class LoginService extends BaseAdminService
if(!empty($site_ids)){ if(!empty($site_ids)){
$default_site_id = in_array($this->site_id, $site_ids) || AuthService::isSuperAdmin() ? $this->site_id : $site_ids[0]; $default_site_id = in_array($this->site_id, $site_ids) || AuthService::isSuperAdmin() ? $this->site_id : $site_ids[0];
} }
if (!empty($default_site_id)) {
$userrole = $user_role_service->getUserRole($default_site_id, $userinfo->uid);
if (!empty($userrole)) {
if (!$userrole['status']) throw new AuthException('USER_LOCK');
if (!$userrole['is_admin']) {
$rules = $user_role_service->getRoleByUserRoleIds($userrole['role_ids'], $default_site_id);
if (empty($rules) || count($rules) == 0) throw new AuthException('USER_LOCK');
}
}
}
} else { } else {
throw new AuthException('APP_TYPE_NOT_EXIST'); throw new AuthException('APP_TYPE_NOT_EXIST');
} }

View File

@ -17,6 +17,7 @@ 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\service\admin\sys\SystemService; use app\service\admin\sys\SystemService;
use app\service\core\diy\CoreDiyConfigService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\AdminException; use core\exception\AdminException;
use Exception; use Exception;
@ -158,7 +159,10 @@ class DiyService extends BaseAdminService
public function edit(int $id, array $data) public function edit(int $id, array $data)
{ {
$data[ 'update_time' ] = time(); $data[ 'update_time' ] = time();
$this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ])->update($data); if (empty($data[ 'site_id' ])) {
$data[ 'site_id' ] = $this->site_id;
}
$this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $data[ 'site_id' ] ] ])->update($data);
return true; return true;
} }
@ -446,11 +450,12 @@ class DiyService extends BaseAdminService
* 获取默认页面数据 * 获取默认页面数据
* @param $type * @param $type
* @param string $addon * @param string $addon
* @param int $site_id
* @return array|mixed * @return array|mixed
*/ */
public function getFirstPageData($type, $addon = '') public function getFirstPageData($type, $addon = '', $site_id = 0)
{ {
$pages = PagesDict::getPages([ 'type' => $type, 'addon' => $addon ]); $pages = PagesDict::getPages([ 'type' => $type, 'addon' => $addon, 'site_id' => $site_id ]);
if (!empty($pages)) { if (!empty($pages)) {
$template = array_key_first($pages); $template = array_key_first($pages);
$page = array_shift($pages); $page = array_shift($pages);
@ -576,4 +581,148 @@ class DiyService extends BaseAdminService
return $page_template; return $page_template;
} }
/**
* 更新微页面数据
* @param $params
* @throws Exception
*/
public function loadDiyData($params)
{
$count = count($params[ 'main_app' ]);
$addon = array_merge([ '' ], $params[ 'main_app' ]);
foreach ($addon as $k => $v) {
if ($count > 1) {
// 站点多应用,使用系统的页面
if ($k == 0) {
$is_start = 1;
} else {
$is_start = 0;
}
} else {
// 站点单应用,将应用的设为使用中
if ($k == 0) {
$is_start = 0;
} else {
$is_start = 1;
}
}
// 设置 首页 默认模板
$this->setDiyData([
'key' => 'DIY_INDEX',
'type' => 'index',
'addon' => $v,
'is_start' => $is_start,
'site_id' => $params[ 'site_id' ],
'main_app' => $addon
]);
// 设置 个人中心 默认模板
$this->setDiyData([
'key' => 'DIY_MEMBER_INDEX',
'type' => 'member_index',
'addon' => $v,
'is_start' => $is_start,
'site_id' => $params[ 'site_id' ],
'main_app' => $addon
]);
}
}
/**
* 设置 首页/个人中心 的第一个模板 设置为启动页
* @param $params
* @throws Exception
*/
private function setDiyData($params)
{
$addon = $params[ 'addon' ] ?? '';
$addon_flag = $params[ 'key' ];
// 默认
$default_template = TemplateDict::getTemplate([
'key' => [ $params[ 'key' ] ]
]);
$addon_template_info = array_shift($default_template);
// 查询插件定义的页面类型
$addon_template = TemplateDict::getTemplate([
'type' => $params[ 'type' ],
'addon' => $addon
]);
if (!empty($addon_template)) {
$addon_flag = array_keys($addon_template)[ 0 ];
$addon_template_info = array_shift($addon_template);
}
$addon_index_template = $this->getFirstPageData($addon_flag, $addon, $params[ 'site_id' ]);
$field = 'id,title,page_title,name,template,type,mode,value,is_default,is_change';
$info = $this->model->field($field)->where([ [ 'name', '=', $addon_flag ], [ 'site_id', '=', $params[ 'site_id' ] ], [ 'is_default', '=', 1 ] ])->findOrEmpty()->toArray();
if (!empty($addon_index_template)) {
if (empty($info)) {
$this->add([
'site_id' => $params[ 'site_id' ],
'page_title' => $addon_index_template[ 'title' ],
"title" => $addon_index_template[ 'title' ],
"name" => $addon_flag,
"type" => $addon_flag,
"template" => $addon_index_template[ 'template' ],
"mode" => $addon_index_template[ 'mode' ],
"value" => json_encode($addon_index_template[ 'data' ]),
"is_default" => 1,
"is_change" => 0
]);
} else {
// 针对 多应用首页的数据更新
if ($info[ 'name' ] == 'DIY_INDEX' && $info[ 'type' ] == 'DIY_INDEX') {
$this->edit($info[ 'id' ], [
'site_id' => $params[ 'site_id' ],
"value" => json_encode($addon_index_template[ 'data' ])
]);
}
}
$diy_page_list = $this->model->where([
[ 'site_id', '=', $params[ 'site_id' ] ],
[ 'type', '=', $params[ 'key' ] ] ])->field('id,name,type')->order('update_time desc')->select()->toArray();
// 多应用时,将首页和个人中心设为系统的
foreach ($diy_page_list as $k => $v) {
if ($v[ 'name' ] == $params[ 'key' ]) {
$this->model->where([ [ 'name', '=', $v[ 'name' ] ], [ 'site_id', '=', $params[ 'site_id' ] ] ])->update([ 'is_default' => 0 ]);
$this->model->where([ [ 'id', '=', $v[ 'id' ] ], [ 'site_id', '=', $params[ 'site_id' ] ] ])->update([ 'is_default' => 1, 'update_time' => time() ]);
break;
}
}
if ($params[ 'is_start' ] == 1) {
// 查询链接,设置启动页
$other_page = ( new DiyRouteService() )->getList([ 'url' => $addon_template_info[ 'page' ], 'addon' => $addon ]);
if (!empty($other_page)) {
( new CoreDiyConfigService() )->setStartUpPageConfig($params[ 'site_id' ], [
'type' => $params[ 'key' ], // 页面类型
'name' => $other_page[ 0 ][ 'name' ], // 链接名称标识
'parent' => $other_page[ 0 ][ 'parent' ], // 链接父级名称标识
'page' => $other_page[ 0 ][ 'page' ], // 链接路由
'title' => $other_page[ 0 ][ 'title' ], // 链接标题
'action' => $other_page[ 0 ][ 'action' ] // 是否存在操作decorate 表示支持装修
]);
}
}
}
}
} }

View File

@ -11,7 +11,6 @@
namespace app\service\admin\generator; namespace app\service\admin\generator;
use app\model\addon\Addon;
use app\model\generator\GenerateColumn; use app\model\generator\GenerateColumn;
use app\model\generator\GenerateTable; use app\model\generator\GenerateTable;
use core\base\BaseAdminService; use core\base\BaseAdminService;
@ -23,7 +22,6 @@ use think\db\exception\ModelNotFoundException;
use think\facade\Db; use think\facade\Db;
use think\helper\Str; use think\helper\Str;
use think\Model; use think\Model;
use think\model\relation\HasOne;
/** /**

View File

@ -11,9 +11,6 @@
namespace app\service\admin\generator\core; namespace app\service\admin\generator\core;
use app\dict\sys\MenuDict;
use app\model\sys\SysMenu;
use think\facade\Cache;
use think\helper\Str; use think\helper\Str;
/** /**

View File

@ -15,7 +15,6 @@ namespace app\service\admin\generator\core;
use app\service\core\menu\CoreMenuService;
use think\helper\Str; use think\helper\Str;
/** /**

View File

@ -0,0 +1,3 @@
<el-form-item :label="t('{LCASE_COLUMN_NAME}')">
<upload-file v-model="formData.{COLUMN_NAME}" />
</el-form-item>

View File

@ -0,0 +1,3 @@
<el-form-item :label="t('{LCASE_COLUMN_NAME}')">
<upload-video v-model="formData.{COLUMN_NAME}" />
</el-form-item>

View File

@ -16,7 +16,6 @@ use app\dict\member\MemberRegisterTypeDict;
use app\model\member\Member; use app\model\member\Member;
use app\service\admin\sys\ExportService; use app\service\admin\sys\ExportService;
use app\service\core\member\CoreMemberService; use app\service\core\member\CoreMemberService;
use app\service\core\sys\CoreExportService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\dict\DictLoader; use core\dict\DictLoader;
use core\exception\AdminException; use core\exception\AdminException;

View File

@ -36,8 +36,7 @@ class MemberSignService extends BaseAdminService
public function getPage(array $where = []) public function getPage(array $where = [])
{ {
$member_where = []; $member_where = [];
if(isset($where['keywords']) && $where['keywords'] != '') if (isset($where[ 'keywords' ]) && $where[ 'keywords' ] != '') {
{
$member_where = [ [ 'member.member_no|member.nickname|member.mobile', 'like', '%' . $this->model->handelSpecialCharacter($where[ 'keywords' ]) . '%' ] ]; $member_where = [ [ 'member.member_no|member.nickname|member.mobile', 'like', '%' . $this->model->handelSpecialCharacter($where[ 'keywords' ]) . '%' ] ];
} }
$field = 'sign_id, member_sign.site_id, member_sign.member_id, days, day_award, continue_award, continue_tag, member_sign.create_time, is_sign'; $field = 'sign_id, member_sign.site_id, member_sign.member_id, days, day_award, continue_award, continue_tag, member_sign.create_time, is_sign';
@ -51,7 +50,8 @@ class MemberSignService extends BaseAdminService
* 组合整理数据 * 组合整理数据
* @param $data * @param $data
*/ */
public function makeUp($data){ public function makeUp($data)
{
//日签奖励 //日签奖励
if (!empty($data[ 'day_award' ])) { if (!empty($data[ 'day_award' ])) {
$data[ 'day_award' ] = ( new CoreMemberService() )->getGiftContent($this->site_id, $data[ 'day_award' ]); $data[ 'day_award' ] = ( new CoreMemberService() )->getGiftContent($this->site_id, $data[ 'day_award' ]);
@ -109,6 +109,9 @@ class MemberSignService extends BaseAdminService
'rule_explain' => '' 'rule_explain' => ''
]; ];
} }
if (empty($info[ 'value' ][ 'continue_award' ]) && gettype($info[ 'value' ][ 'continue_award' ]) == 'string') {
$info[ 'value' ][ 'continue_award' ] = [];
}
return $info[ 'value' ]; return $info[ 'value' ];
} }
} }

View File

@ -12,10 +12,8 @@
namespace app\service\admin\pay; namespace app\service\admin\pay;
use app\dict\pay\PayDict; use app\dict\pay\PayDict;
use app\model\pay\Pay;
use app\model\pay\Refund; use app\model\pay\Refund;
use app\service\core\pay\CoreRefundService; use app\service\core\pay\CoreRefundService;
use app\service\core\paytype\CoreOfflineService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
/** /**

View File

@ -15,6 +15,8 @@ use app\model\addon\Addon;
use app\model\site\Site; use app\model\site\Site;
use app\model\site\SiteGroup; use app\model\site\SiteGroup;
use app\model\sys\SysMenu; use app\model\sys\SysMenu;
use app\service\admin\diy\DiyService;
use app\service\admin\sys\ConfigService;
use app\service\admin\sys\MenuService; use app\service\admin\sys\MenuService;
use app\service\core\addon\CoreAddonService; use app\service\core\addon\CoreAddonService;
use app\service\core\site\CoreSiteService; use app\service\core\site\CoreSiteService;
@ -36,6 +38,7 @@ class SiteGroupService extends BaseAdminService
{ {
public static $cache_tag_name = 'site_group_cache'; public static $cache_tag_name = 'site_group_cache';
public static $cache_name = 'site_group_menu_ids'; public static $cache_name = 'site_group_menu_ids';
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
@ -65,7 +68,7 @@ class SiteGroupService extends BaseAdminService
public function getAll() public function getAll()
{ {
$field = 'group_id, group_name, group_desc, create_time, update_time, app'; $field = 'group_id, group_name, group_desc, create_time, update_time, app';
return $this->model->field($field)->select()->toArray(); return $this->model->field($field)->order('create_time desc')->select()->toArray();
} }
/** /**
@ -99,7 +102,8 @@ class SiteGroupService extends BaseAdminService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function edit(int $group_id, array $data){ public function edit(int $group_id, array $data)
{
$group = $this->model->where([ [ 'group_id', '=', $group_id ] ])->findOrEmpty()->toArray(); $group = $this->model->where([ [ 'group_id', '=', $group_id ] ])->findOrEmpty()->toArray();
//判断应用是否全部是有效的已安装应用 //判断应用是否全部是有效的已安装应用
@ -111,12 +115,19 @@ class SiteGroupService extends BaseAdminService
$site_list = ( new Site() )->field('site_id,initalled_addon')->where([ [ 'group_id', '=', $group_id ] ])->select()->toArray(); $site_list = ( new Site() )->field('site_id,initalled_addon')->where([ [ 'group_id', '=', $group_id ] ])->select()->toArray();
if (!empty($site_list)) { if (!empty($site_list)) {
sort($data['app']); sort($group['app']); sort($data['addon']); sort($group['addon']); sort($data[ 'app' ]);
sort($group[ 'app' ]);
sort($data[ 'addon' ]);
sort($group[ 'addon' ]);
if (json_encode($data[ 'app' ]) != json_encode($group[ 'app' ]) || json_encode($data[ 'addon' ]) != json_encode($group[ 'addon' ])) { if (json_encode($data[ 'app' ]) != json_encode($group[ 'app' ]) || json_encode($data[ 'addon' ]) != json_encode($group[ 'addon' ])) {
foreach ($site_list as $site) { foreach ($site_list as $site) {
$this->siteAddonsChange($site, $group, $data); $this->siteAddonsChange($site, $group, $data);
Cache::tag(CoreSiteService::$cache_tag_name . $site[ 'site_id' ])->clear(); Cache::tag(CoreSiteService::$cache_tag_name . $site[ 'site_id' ])->clear();
// 更新微页面数据
$diy_service = new DiyService();
$diy_service->loadDiyData([ 'site_id' => $site[ 'site_id' ], 'main_app' => $data[ 'app' ] ]);
} }
} }
} }
@ -131,7 +142,8 @@ class SiteGroupService extends BaseAdminService
* @param $new_group * @param $new_group
* @return void * @return void
*/ */
public function siteAddonsChange($site_info, $old_group, $new_group) { public function siteAddonsChange($site_info, $old_group, $new_group)
{
$initalled_addon = $site_info[ 'initalled_addon' ]; $initalled_addon = $site_info[ 'initalled_addon' ];
if (empty($initalled_addon)) { if (empty($initalled_addon)) {
$initalled_addon = array_merge($old_group[ 'app' ], $old_group[ 'addon' ]); $initalled_addon = array_merge($old_group[ 'app' ], $old_group[ 'addon' ]);
@ -144,12 +156,14 @@ class SiteGroupService extends BaseAdminService
( new Site() )->update([ 'app' => $new_group[ 'app' ], 'initalled_addon' => $initalled_addon ], [ [ 'site_id', '=', $site_info[ 'site_id' ] ] ]); ( new Site() )->update([ 'app' => $new_group[ 'app' ], 'initalled_addon' => $initalled_addon ], [ [ 'site_id', '=', $site_info[ 'site_id' ] ] ]);
} }
public function checkAddon($group_roles){ public function checkAddon($group_roles)
{
$install_addon_list = ( new CoreAddonService() )->getInstallAddonList(); $install_addon_list = ( new CoreAddonService() )->getInstallAddonList();
$install_addon_keys = array_column($install_addon_list, 'key'); $install_addon_keys = array_column($install_addon_list, 'key');
if (count(array_intersect($install_addon_keys, $group_roles)) != count($group_roles)) throw new AdminException('SITE_GROUP_APP_NOT_EXIST'); if (count(array_intersect($install_addon_keys, $group_roles)) != count($group_roles)) throw new AdminException('SITE_GROUP_APP_NOT_EXIST');
return true; return true;
} }
/** /**
* 删除分组 * 删除分组
* @param int $group_id * @param int $group_id
@ -159,8 +173,7 @@ class SiteGroupService extends BaseAdminService
public function del(int $group_id) public function del(int $group_id)
{ {
$count = ( new Site() )->where([ [ 'group_id', '=', $group_id ] ])->count(); $count = ( new Site() )->where([ [ 'group_id', '=', $group_id ] ])->count();
if($count > 0) if ($count > 0) {
{
throw new CommonException('SITE_GROUP_IS_EXIST'); throw new CommonException('SITE_GROUP_IS_EXIST');
} }
$res = $this->model->where([ [ 'group_id', '=', $group_id ] ])->delete(); $res = $this->model->where([ [ 'group_id', '=', $group_id ] ])->delete();
@ -175,7 +188,8 @@ class SiteGroupService extends BaseAdminService
* @param $group_id * @param $group_id
* @return void * @return void
*/ */
public function getGroupAddon($group_id){ public function getGroupAddon($group_id)
{
$cache_name = self::$cache_name . $group_id; $cache_name = self::$cache_name . $group_id;
return cache_remember( return cache_remember(
$cache_name, $cache_name,
@ -214,7 +228,8 @@ class SiteGroupService extends BaseAdminService
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
*/ */
public function getUserSiteGroupAll($uid) { public function getUserSiteGroupAll($uid)
{
$field = 'group_id, group_name, group_desc, create_time, update_time, app'; $field = 'group_id, group_name, group_desc, create_time, update_time, app';
$list = $this->model->field($field)->select()->toArray(); $list = $this->model->field($field)->select()->toArray();
foreach ($list as &$item) { foreach ($list as &$item) {
@ -229,7 +244,8 @@ class SiteGroupService extends BaseAdminService
* @param $group_id * @param $group_id
* @return void * @return void
*/ */
public static function getUserSiteGroupSiteNum($uid, $group_id) { public static function getUserSiteGroupSiteNum($uid, $group_id)
{
return Db::name("sys_user_role")->alias('sur') return Db::name("sys_user_role")->alias('sur')
->join('site s', 'sur.site_id = s.site_id') ->join('site s', 'sur.site_id = s.site_id')
->where([ ->where([

View File

@ -20,6 +20,7 @@ use app\model\site\SiteGroup;
use app\model\sys\SysUserRole; use app\model\sys\SysUserRole;
use app\service\admin\addon\AddonService; use app\service\admin\addon\AddonService;
use app\service\admin\auth\AuthService; use app\service\admin\auth\AuthService;
use app\service\admin\diy\DiyService;
use app\service\admin\generator\GenerateService; use app\service\admin\generator\GenerateService;
use app\service\admin\sys\MenuService; use app\service\admin\sys\MenuService;
use app\service\admin\sys\RoleService; use app\service\admin\sys\RoleService;
@ -138,6 +139,10 @@ class SiteService extends BaseAdminService
//添加站点成功事件 //添加站点成功事件
event("AddSiteAfter", [ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ], 'site_addons' => $site_group[ 'addon' ] ]); event("AddSiteAfter", [ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ], 'site_addons' => $site_group[ 'addon' ] ]);
// 更新微页面数据
$diy_service = new DiyService();
$diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ] ]);
Cache::delete('user_role_list_' . $data[ 'uid' ]); Cache::delete('user_role_list_' . $data[ 'uid' ]);
Db::commit(); Db::commit();
@ -176,7 +181,7 @@ class SiteService extends BaseAdminService
$data[ 'initalled_addon' ] = array_values(array_unique(array_merge($site->initalled_addon, $site_group[ 'app' ], $site_group[ 'addon' ]))); $data[ 'initalled_addon' ] = array_values(array_unique(array_merge($site->initalled_addon, $site_group[ 'app' ], $site_group[ 'addon' ])));
} }
if (isset($data['expire_time']) && $site['status'] != SiteDict::CLOSE) { if (isset($data[ 'expire_time' ]) && !empty($data[ 'expire_time' ])) {
$data[ 'status' ] = strtotime($data[ 'expire_time' ]) > time() ? SiteDict::ON : SiteDict::EXPIRE; $data[ 'status' ] = strtotime($data[ 'expire_time' ]) > time() ? SiteDict::ON : SiteDict::EXPIRE;
} }
$site->save($data); $site->save($data);
@ -194,7 +199,8 @@ class SiteService extends BaseAdminService
* 删除站点 * 删除站点
* @param int $site_id * @param int $site_id
*/ */
public function del(int $site_id) { public function del(int $site_id)
{
Db::startTrans(); Db::startTrans();
try { try {
$site = $this->model->where([ [ 'site_id', '=', $site_id ] ])->findOrEmpty()->toArray(); $site = $this->model->where([ [ 'site_id', '=', $site_id ] ])->findOrEmpty()->toArray();
@ -342,7 +348,8 @@ class SiteService extends BaseAdminService
* 获取站点的插件 * 获取站点的插件
* @return array * @return array
*/ */
public function getSiteAddons(array $where) { public function getSiteAddons(array $where)
{
$site_addon = ( new CoreSiteService() )->getAddonKeysBySiteId($this->site_id); $site_addon = ( new CoreSiteService() )->getAddonKeysBySiteId($this->site_id);
return ( new Addon() )->where([ [ 'type', '=', AddonDict::ADDON ], [ 'status', '=', AddonDict::ON ], [ 'key', 'in', $site_addon ] ])->withSearch([ 'title' ], $where)->append([ 'status_name' ])->field('title, icon, key, desc, status, type, support_app')->select()->toArray(); return ( new Addon() )->where([ [ 'type', '=', AddonDict::ADDON ], [ 'status', '=', AddonDict::ON ], [ 'key', 'in', $site_addon ] ])->withSearch([ 'title' ], $where)->append([ 'status_name' ])->field('title, icon, key, desc, status, type, support_app')->select()->toArray();
} }
@ -351,7 +358,8 @@ class SiteService extends BaseAdminService
* 获取站点支持的应用插件 * 获取站点支持的应用插件
* @return array * @return array
*/ */
public function getAddonKeysBySiteId() { public function getAddonKeysBySiteId()
{
$site_addon = ( new CoreSiteService() )->getAddonKeysBySiteId($this->site_id); $site_addon = ( new CoreSiteService() )->getAddonKeysBySiteId($this->site_id);
return $site_addon; return $site_addon;
} }

View File

@ -51,7 +51,7 @@ class SiteUserService extends BaseAdminService
$condition = []; $condition = [];
if (isset($where['username']) && $where['username'] !== '') $condition[] = ['username', 'like', "%{$this->model->handelSpecialCharacter($where['username'])}%"]; if (isset($where['username']) && $where['username'] !== '') $condition[] = ['username', 'like', "%{$this->model->handelSpecialCharacter($where['username'])}%"];
$query->where($condition); $query->where($condition);
})->where([ ['SysUserRole.site_id', '=', $this->site_id ], ['is_admin', '=', 0 ] ]); })->where([ ['SysUserRole.site_id', '=', $this->site_id ]]);
return $this->pageQuery($search_model, function ($item){ return $this->pageQuery($search_model, function ($item){
if (!empty($item['role_ids'])) { if (!empty($item['role_ids'])) {
$item['role_array'] = (new SysRole())->where([ ['role_id', 'in', $item['role_ids'] ] ])->column('role_name'); $item['role_array'] = (new SysRole())->where([ ['role_id', 'in', $item['role_ids'] ] ])->column('role_name');

View File

@ -11,10 +11,8 @@
namespace app\service\admin\stat; namespace app\service\admin\stat;
use app\model\order\RechargeOrder;
use app\service\admin\site\SiteService; use app\service\admin\site\SiteService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use think\db\exception\DbException;
/** /**
@ -34,7 +32,8 @@ class SiteStatService extends BaseAdminService
* 获取站点统计数据 * 获取站点统计数据
* @return int[] * @return int[]
*/ */
public function getIndexData(){ public function getIndexData()
{
$data = [ $data = [
'site_info' => '', 'site_info' => '',
@ -48,42 +47,4 @@ class SiteStatService extends BaseAdminService
return $data; return $data;
} }
/**
* 订单金额
* @param $start_time
* @param $end_time
* @return float
*/
public function orderMoney($start_time, $end_time)
{
$where[] = [
['site_id', '=', $this->site_id],
['order_status', '>', 0],
['create_time', 'between', [$start_time, $end_time]]
];
return (new RechargeOrder())->where($where)->sum('order_money');
}
/**
* 订单数量
* @param $start_time
* @param $end_time
* @return int
* @throws DbException
*/
public function orderCount($start_time, $end_time)
{
$where[] = [
['site_id', '=', $this->site_id],
['order_status', '>', 0],
['create_time', 'between', [$start_time, $end_time]]
];
return (new RechargeOrder())->where($where)->count('order_id');
}
} }

View File

@ -39,7 +39,7 @@ class StatService extends BaseAdminService
/** /**
* 获取统计数据 * 获取统计数据
* @return int[] * @return array
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException

View File

@ -34,6 +34,7 @@ class MenuService extends BaseAdminService
{ {
public static $cache_tag_name = 'menu_cache'; public static $cache_tag_name = 'menu_cache';
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
@ -81,7 +82,8 @@ class MenuService extends BaseAdminService
* @param string $menu_key * @param string $menu_key
* @return array * @return array
*/ */
public function get(string $app_type, string $menu_key){ public function get(string $app_type, string $menu_key)
{
return $this->model->where([ [ 'app_type', '=', $app_type ], [ 'menu_key', '=', $menu_key ] ])->findOrEmpty()->toArray(); return $this->model->where([ [ 'app_type', '=', $app_type ], [ 'menu_key', '=', $menu_key ] ])->findOrEmpty()->toArray();
} }
@ -90,7 +92,8 @@ class MenuService extends BaseAdminService
* @param string $app_type * @param string $app_type
* @return SysMenu|array|mixed|Model * @return SysMenu|array|mixed|Model
*/ */
public function find(string $menu_key, string $app_type = ''){ public function find(string $menu_key, string $app_type = '')
{
$where = array( $where = array(
[ 'menu_key', '=', $menu_key ] [ 'menu_key', '=', $menu_key ]
); );
@ -107,7 +110,8 @@ class MenuService extends BaseAdminService
* @return bool * @return bool
* @throws DbException * @throws DbException
*/ */
public function del(string $app_type, string $menu_key){ public function del(string $app_type, string $menu_key)
{
//查询是否有下级菜单或按钮 //查询是否有下级菜单或按钮
$menu = $this->find($menu_key, $app_type); $menu = $this->find($menu_key, $app_type);
if ($this->model->where([ [ 'parent_key', '=', $menu_key ], [ 'app_type', '=', $app_type ] ])->count() > 0) if ($this->model->where([ [ 'parent_key', '=', $menu_key ], [ 'app_type', '=', $app_type ] ])->count() > 0)
@ -174,13 +178,11 @@ class MenuService extends BaseAdminService
}, },
self::$cache_tag_name self::$cache_tag_name
); );
foreach ($menu_list as &$v) foreach ($menu_list as &$v) {
{
$lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]; $lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ];
$lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]); $lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]);
//语言已定义 //语言已定义
if($lang_menu_key != $lang_menu_name) if ($lang_menu_key != $lang_menu_name) {
{
$v[ 'menu_name' ] = $lang_menu_name; $v[ 'menu_name' ] = $lang_menu_name;
} }
} }
@ -225,13 +227,11 @@ class MenuService extends BaseAdminService
}, },
[ self::$cache_tag_name, SiteService::$cache_tag_name ] [ self::$cache_tag_name, SiteService::$cache_tag_name ]
); );
foreach ($menu_list as &$v) foreach ($menu_list as &$v) {
{
$lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]; $lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ];
$lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]); $lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]);
//语言已定义 //语言已定义
if($lang_menu_key != $lang_menu_name) if ($lang_menu_key != $lang_menu_name) {
{
$v[ 'menu_name' ] = $lang_menu_name; $v[ 'menu_name' ] = $lang_menu_name;
} }
} }
@ -331,7 +331,8 @@ class MenuService extends BaseAdminService
* @param $status * @param $status
* @return mixed|string * @return mixed|string
*/ */
public function getAllMenuIdsByAppType(string $app_type, $status = 'all'){ public function getAllMenuIdsByAppType(string $app_type, $status = 'all')
{
$cache_name = 'menu_id_by_app_type_' . $app_type; $cache_name = 'menu_id_by_app_type_' . $app_type;
return cache_remember( return cache_remember(
$cache_name, $cache_name,
@ -350,7 +351,6 @@ class MenuService extends BaseAdminService
} }
/** /**
* 获取所有按钮菜单 * 获取所有按钮菜单
*/ */
@ -419,7 +419,8 @@ class MenuService extends BaseAdminService
* @param $menu_key * @param $menu_key
* @return string * @return string
*/ */
public function getFullRouterPath($menu_key){ public function getFullRouterPath($menu_key)
{
$menu = $this->model->where([ [ 'menu_key', '=', $menu_key ] ])->findOrEmpty($menu_key); $menu = $this->model->where([ [ 'menu_key', '=', $menu_key ] ])->findOrEmpty($menu_key);
if ($menu->isEmpty()) return ''; if ($menu->isEmpty()) return '';
$parents = []; $parents = [];
@ -440,7 +441,8 @@ class MenuService extends BaseAdminService
* @param $parents * @param $parents
* @return void * @return void
*/ */
public function getParentDirectory(SysMenu $menu, &$parents){ public function getParentDirectory(SysMenu $menu, &$parents)
{
if (!$menu->isEmpty() && !empty($menu[ 'parent_key' ])) { if (!$menu->isEmpty() && !empty($menu[ 'parent_key' ])) {
$parent_menu = $this->model->where([ [ 'menu_key', '=', $menu[ 'parent_key' ] ] ])->findOrEmpty(); $parent_menu = $this->model->where([ [ 'menu_key', '=', $menu[ 'parent_key' ] ] ])->findOrEmpty();
if (!empty($parent_menu)) { if (!empty($parent_menu)) {
@ -523,13 +525,11 @@ class MenuService extends BaseAdminService
self::$cache_tag_name self::$cache_tag_name
); );
foreach ($menu_list as &$v) foreach ($menu_list as &$v) {
{
$lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]; $lang_menu_key = "dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ];
$lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]); $lang_menu_name = get_lang("dict_menu_" . $v[ 'app_type' ] . '.' . $v[ 'menu_key' ]);
//语言已定义 //语言已定义
if($lang_menu_key != $lang_menu_name) if ($lang_menu_key != $lang_menu_name) {
{
$v[ 'menu_name' ] = $lang_menu_name; $v[ 'menu_name' ] = $lang_menu_name;
} }
} }
@ -543,7 +543,8 @@ class MenuService extends BaseAdminService
* @param array $addons * @param array $addons
* @return mixed|string * @return mixed|string
*/ */
public function getMenuKeysBySystem(string $app_type, array $addons){ public function getMenuKeysBySystem(string $app_type, array $addons)
{
sort($addons); sort($addons);
$cache_name = 'menu_keys_' . $app_type . implode("_", $addons); $cache_name = 'menu_keys_' . $app_type . implode("_", $addons);
return cache_remember( return cache_remember(
@ -565,8 +566,7 @@ class MenuService extends BaseAdminService
public function getSystemMenu($status = 'all', $is_tree = 0, $is_button = 0) public function getSystemMenu($status = 'all', $is_tree = 0, $is_button = 0)
{ {
if($is_button == 0) if ($is_button == 0) {
{
$where = [ $where = [
[ 'menu_type', 'in', [ 0, 1 ] ] [ 'menu_type', 'in', [ 0, 1 ] ]
]; ];
@ -577,13 +577,11 @@ class MenuService extends BaseAdminService
} }
$where[] = [ 'addon', '=', '' ]; $where[] = [ 'addon', '=', '' ];
$menu_list = ( new SysMenu() )->where($where)->order('sort desc')->select()->toArray(); $menu_list = ( new SysMenu() )->where($where)->order('sort desc')->select()->toArray();
foreach ($menu_list as &$v) foreach ($menu_list as &$v) {
{
$lang_menu_key = 'dict_menu_admin' . '.' . $v[ 'menu_key' ]; $lang_menu_key = 'dict_menu_admin' . '.' . $v[ 'menu_key' ];
$lang_menu_name = get_lang($lang_menu_key); $lang_menu_name = get_lang($lang_menu_key);
//语言已定义 //语言已定义
if($lang_menu_key != $lang_menu_name) if ($lang_menu_key != $lang_menu_name) {
{
$v[ 'menu_name' ] = $lang_menu_name; $v[ 'menu_name' ] = $lang_menu_name;
} }
} }
@ -593,8 +591,7 @@ class MenuService extends BaseAdminService
public function getAddonMenu($app_key, $status = 'all', $is_tree = 0, $is_button = 0) public function getAddonMenu($app_key, $status = 'all', $is_tree = 0, $is_button = 0)
{ {
if($is_button == 0) if ($is_button == 0) {
{
$where = [ $where = [
[ 'menu_type', 'in', [ 0, 1 ] ] [ 'menu_type', 'in', [ 0, 1 ] ]
]; ];
@ -612,7 +609,8 @@ class MenuService extends BaseAdminService
* 查询菜单类型为目录的菜单 * 查询菜单类型为目录的菜单
* @param string $addon * @param string $addon
*/ */
public function getMenuByTypeDir(string $addon = 'system') { public function getMenuByTypeDir(string $addon = 'system')
{
$cache_name = 'menu_api_by_type_dir' . $addon; $cache_name = 'menu_api_by_type_dir' . $addon;
$menu_list = cache_remember( $menu_list = cache_remember(
$cache_name, $cache_name,
@ -627,13 +625,11 @@ class MenuService extends BaseAdminService
}, },
self::$cache_tag_name self::$cache_tag_name
); );
foreach ($menu_list as &$v) foreach ($menu_list as &$v) {
{
$lang_menu_key = 'dict_menu_admin' . '.' . $v[ 'menu_key' ]; $lang_menu_key = 'dict_menu_admin' . '.' . $v[ 'menu_key' ];
$lang_menu_name = get_lang($lang_menu_key); $lang_menu_name = get_lang($lang_menu_key);
//语言已定义 //语言已定义
if($lang_menu_key != $lang_menu_name) if ($lang_menu_key != $lang_menu_name) {
{
$v[ 'menu_name' ] = $lang_menu_name; $v[ 'menu_name' ] = $lang_menu_name;
} }
} }

View File

@ -13,9 +13,7 @@ namespace app\service\admin\sys;
use app\job\sys\CheckJob; use app\job\sys\CheckJob;
use app\service\core\site\CoreSiteService; use app\service\core\site\CoreSiteService;
use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\CommonException;
use think\facade\Db; use think\facade\Db;
use Throwable; use Throwable;

View File

@ -28,10 +28,9 @@ class RestoreService extends UpgradeService
$backup_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR; $backup_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR;
if (is_dir($backup_dir)) { if (is_dir($backup_dir)) {
// 删除前端文件 // 删除前端文件
if (is_dir(public_path() . 'admin')) del_target_dir(public_path() . 'admin', true); // if (is_dir(public_path() . 'admin')) del_target_dir(public_path() . 'admin', true);
if (is_dir(public_path() . 'wap')) del_target_dir(public_path() . 'wap', true); // if (is_dir(public_path() . 'wap')) del_target_dir(public_path() . 'wap', true);
if (is_dir(public_path() . 'web')) del_target_dir(public_path() . 'web', true); // if (is_dir(public_path() . 'web')) del_target_dir(public_path() . 'web', true);
dir_copy($backup_dir, rtrim($this->root_path, DIRECTORY_SEPARATOR)); dir_copy($backup_dir, rtrim($this->root_path, DIRECTORY_SEPARATOR));
} }
return true; return true;

View File

@ -12,6 +12,7 @@
namespace app\service\admin\user; namespace app\service\admin\user;
use app\dict\sys\RoleStatusDict;
use app\dict\sys\UserDict; use app\dict\sys\UserDict;
use app\model\sys\SysRole; use app\model\sys\SysRole;
use app\model\sys\SysUserRole; use app\model\sys\SysUserRole;
@ -139,11 +140,12 @@ class UserRoleService extends BaseAdminService
function() use($role_ids, $site_id) { function() use($role_ids, $site_id) {
$where = array( $where = array(
['role_id', 'in', $role_ids], ['role_id', 'in', $role_ids],
['site_id', '=', $site_id] ['site_id', '=', $site_id],
['status', '=', RoleStatusDict::ON ]
); );
return SysRole::where($where)->column('role_name'); return SysRole::where($where)->column('role_name');
}, },
[self::$role_cache_name, RoleService::$cache_tag_name.$this->site_id] [self::$role_cache_name, RoleService::$cache_tag_name.$site_id]
); );
} }

View File

@ -250,13 +250,15 @@ class UserService extends BaseAdminService
* @return true * @return true
*/ */
public function del(int $uid){ public function del(int $uid){
$where = [ AuthService::isSuperAdmin();
['uid', '=', $uid], $super_admin_uid = Cache::get('super_admin_uid');
['site_id', '=', $this->site_id] if ($super_admin_uid == $uid) throw new CommonException("SUPER_ADMIN_NOT_ALLOW_DEL");
];
(new SysUserRole())->where($where)->delete();
return true;
$site_num = (new SysUserRole())->where([['uid', '=', $uid], ['site_id', '<>', request()->defaultSiteId() ] ])->count();
if ($site_num) throw new CommonException("USER_NOT_ALLOW_DEL");
$this->model->where([ ['uid', '=', $uid] ])->delete();
return true;
} }
/** /**

View File

@ -16,7 +16,6 @@ use app\service\core\sys\CoreConfigService;
use app\service\core\wechat\CoreWechatApiService; use app\service\core\wechat\CoreWechatApiService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\WechatException; use core\exception\WechatException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use think\Model; use think\Model;

View File

@ -95,7 +95,7 @@ class AuthService extends BaseApiService
* 绑定手机号 * 绑定手机号
* @param string $mobile * @param string $mobile
* @param string $mobile_code * @param string $mobile_code
* @return true * @return array
*/ */
public function bindMobile(string $mobile, string $mobile_code) public function bindMobile(string $mobile, string $mobile_code)
{ {
@ -125,7 +125,9 @@ class AuthService extends BaseApiService
$member->save([ $member->save([
'mobile' => $mobile 'mobile' => $mobile
]); ]);
return true; return [
'mobile' => $mobile
];
} }
} }

View File

@ -11,7 +11,6 @@
namespace app\service\api\member; namespace app\service\api\member;
use app\dict\member\MemberAccountChangeTypeDict;
use app\dict\member\MemberAccountTypeDict; use app\dict\member\MemberAccountTypeDict;
use app\model\member\Member; use app\model\member\Member;
use app\model\member\MemberAccountLog; use app\model\member\MemberAccountLog;
@ -82,8 +81,7 @@ class MemberAccountService extends BaseApiService
*/ */
public function getBalancePage(array $data = []) public function getBalancePage(array $data = [])
{ {
switch ($data[ 'trade_type' ]) {
switch ($data['from_type']){
case 'income': case 'income':
$type_where = [ $type_where = [
[ 'account_type', 'in', [ MemberAccountTypeDict::BALANCE, MemberAccountTypeDict::MONEY ] ], [ 'account_type', 'in', [ MemberAccountTypeDict::BALANCE, MemberAccountTypeDict::MONEY ] ],
@ -101,10 +99,9 @@ class MemberAccountService extends BaseApiService
case 'cash_out': case 'cash_out':
$type_where = [ $type_where = [
[ 'account_type', '=', MemberAccountTypeDict::MONEY ], [ 'account_type', '=', MemberAccountTypeDict::MONEY ],
['from_type', '=', $data['from_type']] [ 'from_type', '=', 'cash_out' ]
]; ];
break; break;
default: default:
$type_where = [ $type_where = [
[ 'account_type', 'in', [ MemberAccountTypeDict::BALANCE, MemberAccountTypeDict::MONEY ] ], [ 'account_type', 'in', [ MemberAccountTypeDict::BALANCE, MemberAccountTypeDict::MONEY ] ],
@ -112,7 +109,6 @@ class MemberAccountService extends BaseApiService
break; break;
} }
$where[ 'member_id' ] = $this->member_id; $where[ 'member_id' ] = $this->member_id;
$where[ 'create_time' ] = $data[ 'create_time' ]; $where[ 'create_time' ] = $data[ 'create_time' ];
$field = 'id, member_id, site_id, account_type, account_data, account_sum, from_type, related_id, create_time, memo'; $field = 'id, member_id, site_id, account_type, account_data, account_sum, from_type, related_id, create_time, memo';
@ -137,7 +133,8 @@ class MemberAccountService extends BaseApiService
* @return int * @return int
* @throws DbException * @throws DbException
*/ */
public function getCount(array $where = []){ public function getCount(array $where = [])
{
$where[ 'member_id' ] = $this->member_id; $where[ 'member_id' ] = $this->member_id;
return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time' ], $where)->count(); return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time' ], $where)->count();
@ -149,7 +146,8 @@ class MemberAccountService extends BaseApiService
* @return int * @return int
* @throws DbException * @throws DbException
*/ */
public function getPointCount(){ public function getPointCount()
{
$data = [ $data = [
'point' => 0, 'point' => 0,
'point_get' => 0, 'point_get' => 0,
@ -189,8 +187,7 @@ class MemberAccountService extends BaseApiService
$arr_month[ $year_month ][ 'month_data' ][] = $data; $arr_month[ $year_month ][ 'month_data' ][] = $data;
if (!isset($arr_month[$year_month]['month_info'])) if (!isset($arr_month[ $year_month ][ 'month_info' ])) {
{
$arr_month[ $year_month ][ 'month_info' ] = $arr_month[ $year_month ][ 'month_info' ] =
[ [
'year' => mb_substr($year_month, 0, 4), 'year' => mb_substr($year_month, 0, 4),

View File

@ -51,6 +51,7 @@ class MemberLevelService extends BaseApiService
$length = empty($item['level_benefits']) ? 0 : count($item['level_benefits']); $length = empty($item['level_benefits']) ? 0 : count($item['level_benefits']);
if ($length < 4) { if ($length < 4) {
if (empty($item['level_benefits'])) $list[$k]['level_benefits'] = [];
foreach ($filling as $key => $content) { foreach ($filling as $key => $content) {
if (count($list[$k]['level_benefits']) == 4) break; if (count($list[$k]['level_benefits']) == 4) break;
$list[$k]['level_benefits'][$key] = [ $list[$k]['level_benefits'][$key] = [

View File

@ -16,9 +16,6 @@ use app\service\core\member\CoreMemberService;
use core\base\BaseApiService; use core\base\BaseApiService;
use core\exception\ApiException; use core\exception\ApiException;
use core\util\Barcode; use core\util\Barcode;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Model; use think\Model;
/** /**

View File

@ -29,8 +29,6 @@ class SiteService extends BaseApiService
$this->model = new Site(); $this->model = new Site();
} }
/** /**
* 获取授权当前站点信息(用做缓存) * 获取授权当前站点信息(用做缓存)
* @return mixed * @return mixed

View File

@ -13,9 +13,7 @@ namespace app\service\api\sys;
use app\service\core\member\CoreMemberConfigService; use app\service\core\member\CoreMemberConfigService;
use app\service\core\member\CoreMemberService; use app\service\core\member\CoreMemberService;
use app\service\core\scan\CoreScanService;
use core\base\BaseApiService; use core\base\BaseApiService;
use core\dict\DictLoader;
/** /**
* Class BaseService * Class BaseService

View File

@ -29,7 +29,7 @@ class VerifyService extends BaseApiService
* @param $data = ['order_id' => , 'goods_id' => ] * @param $data = ['order_id' => , 'goods_id' => ]
* @return string * @return string
*/ */
public function getVerifyCode(string|int $type, array $data) public function getVerifyCode($type, array $data)
{ {
$list = ( new CoreVerifyService() )->create($this->site_id, $this->member_id, $type, $data); $list = ( new CoreVerifyService() )->create($this->site_id, $this->member_id, $type, $data);
$temp = []; $temp = [];
@ -47,7 +47,8 @@ class VerifyService extends BaseApiService
* @param $code * @param $code
* @return bool * @return bool
*/ */
public function getInfoByCode($code){ public function getInfoByCode($code)
{
return ( new CoreVerifyService() )->getInfoByCode($this->site_id, $code); return ( new CoreVerifyService() )->getInfoByCode($this->site_id, $code);
} }
@ -56,7 +57,8 @@ class VerifyService extends BaseApiService
* @param $code * @param $code
* @return bool * @return bool
*/ */
public function verify($code){ public function verify($code)
{
return ( new CoreVerifyService() )->verify($this->site_id, $code, $this->member_id); return ( new CoreVerifyService() )->verify($this->site_id, $code, $this->member_id);
} }
@ -64,7 +66,8 @@ class VerifyService extends BaseApiService
* 校验是否是核销员 * 校验是否是核销员
* @return bool * @return bool
*/ */
public function checkVerifier(){ public function checkVerifier()
{
$verifier = ( new Verifier() )->where([ [ 'member_id', '=', $this->member_id ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty(); $verifier = ( new Verifier() )->where([ [ 'member_id', '=', $this->member_id ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty();
if (!$verifier->isEmpty()) return true; if (!$verifier->isEmpty()) return true;
return false; return false;
@ -76,13 +79,13 @@ class VerifyService extends BaseApiService
* @return array * @return array
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
*/ */
public function getRecordsPageByVerifier(array $data){ public function getRecordsPageByVerifier(array $data)
{
$field = '*'; $field = '*';
$search_model = ( new Verify() )->where([ $search_model = ( new Verify() )->where([
[ 'site_id', '=', $this->site_id ], [ 'site_id', '=', $this->site_id ],
[ 'verifier_member_id', '=', $this->member_id ] [ 'verifier_member_id', '=', $this->member_id ]
]) ])->withSearch([ 'code', 'type', 'create_time', 'relate_tag', 'keyword' ], $data)
->withSearch(['code', 'type', 'create_time', 'relate_tag', 'keyword'], $data)
->with([ ->with([
'member' => function($query) { 'member' => function($query) {
$query->field('member_id, nickname, mobile, headimg'); $query->field('member_id, nickname, mobile, headimg');
@ -99,20 +102,18 @@ class VerifyService extends BaseApiService
* @param int $id * @param int $id
* @return array * @return array
*/ */
public function getRecordsDetailByVerifier(string|int $code){ public function getRecordsDetailByVerifier($code)
{
$field = '*'; $field = '*';
return ( new Verify() )->where([ return ( new Verify() )->where([
[ 'site_id', '=', $this->site_id ], [ 'site_id', '=', $this->site_id ],
[ 'verifier_member_id', '=', $this->member_id ], [ 'verifier_member_id', '=', $this->member_id ],
[ 'code', '=', $code ] [ 'code', '=', $code ]
]) ])->with([
->with([
'member' => function($query) { 'member' => function($query) {
$query->field('member_id, nickname, mobile, headimg'); $query->field('member_id, nickname, mobile, headimg');
} }
]) ])->field($field)->append([ 'type_name' ])->findOrEmpty()->toArray();
->field($field)
->append(['type_name'])->findOrEmpty()->toArray();
} }
} }

View File

@ -100,13 +100,14 @@ class WeappAuthService 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' ];
// 去掉强制绑定手机号判断,否则开启强制绑定的情况下小程序第三方注册无法注册 // 去掉强制绑定手机号判断,否则开启强制绑定的情况下小程序第三方注册无法注册
if ($is_auth_register == 1) { // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册
return $this->register($openid, wx_unionid: $unionid); return $this->register($openid, wx_unionid: $unionid);
} else { // if ($is_auth_register == 1) {
return [ 'openid' => $openid, 'unionid' => $unionid ]; // } else {
} // return [ 'openid' => $openid, 'unionid' => $unionid ];
// }
} else { } else {
//可能会更新用户和粉丝表 //可能会更新用户和粉丝表
$login_service = new LoginService(); $login_service = new LoginService();

View File

@ -121,13 +121,14 @@ 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' ];
// 去掉强制绑定手机号判断,否则开启强制绑定的情况下公众号第三方注册无法注册 // 去掉强制绑定手机号判断,否则开启强制绑定的情况下公众号第三方注册无法注册
if ($is_auth_register == 1) { // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册
return $this->register($openid, '', $nickname, $avatar, $unionid); return $this->register($openid, '', $nickname, $avatar, $unionid);
} else { // if ($is_auth_register == 1) {
return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ]; // } else {
} // return [ 'avatar' => $avatar, 'nickname' => $nickname, 'openid' => $openid, 'unionid' => $unionid ];
// }
} else { } else {
//可能会更新用户和粉丝表 //可能会更新用户和粉丝表
$login_service = new LoginService(); $login_service = new LoginService();

View File

@ -15,8 +15,6 @@ use app\service\core\wechat\CoreWechatServeService;
use core\base\BaseApiService; use core\base\BaseApiService;
use EasyWeChat\Kernel\Exceptions\BadRequestException; use EasyWeChat\Kernel\Exceptions\BadRequestException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
use Psr\Http\Message\ResponseInterface;
use ReflectionException; use ReflectionException;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Throwable; use Throwable;

View File

@ -13,7 +13,6 @@ namespace app\service\core\addon;
use app\dict\sys\MenuDict; use app\dict\sys\MenuDict;
use app\model\sys\SysMenu; use app\model\sys\SysMenu;
use app\service\admin\sys\MenuService;
use core\base\BaseCoreService; use core\base\BaseCoreService;
use core\exception\AddonException; use core\exception\AddonException;

View File

@ -11,11 +11,9 @@
namespace app\service\core\addon; namespace app\service\core\addon;
use app\dict\addon\AddonDict;
use app\job\sys\AddonInstall;
use app\model\site\Site; use app\model\site\Site;
use app\model\site\SiteGroup;
use app\service\admin\sys\MenuService; use app\service\admin\sys\MenuService;
use app\service\admin\sys\SystemService;
use app\service\core\menu\CoreMenuService; use app\service\core\menu\CoreMenuService;
use app\service\core\schedule\CoreScheduleInstallService; use app\service\core\schedule\CoreScheduleInstallService;
use core\exception\AddonException; use core\exception\AddonException;
@ -25,7 +23,6 @@ use think\db\exception\DbException;
use think\db\exception\PDOException; use think\db\exception\PDOException;
use think\facade\Cache; use think\facade\Cache;
use think\facade\Db; use think\facade\Db;
use think\Response;
/** /**
* 安装服务层 * 安装服务层
@ -525,8 +522,11 @@ class CoreAddonInstallService extends CoreAddonBaseService
*/ */
public function uninstall() public function uninstall()
{ {
$site_num = (new Site())->where([ ['app', 'like', "%$this->addon%"] ])->count('site_id'); $site_groups = (new SiteGroup())->where([ ['app|addon', 'like', "%\"$this->addon\"%"] ])->column("group_id");
if (!empty($site_groups)) {
$site_num = (new Site())->where([ ['group_id', 'in', $site_groups] ])->count('site_id');
if ($site_num) throw new CommonException('APP_NOT_ALLOW_UNINSTALL'); if ($site_num) throw new CommonException('APP_NOT_ALLOW_UNINSTALL');
}
(new CoreAddonDevelopBuildService())->build($this->addon); (new CoreAddonDevelopBuildService())->build($this->addon);

View File

@ -12,9 +12,7 @@
namespace app\service\core\addon; namespace app\service\core\addon;
use app\dict\addon\AddonDict; use app\dict\addon\AddonDict;
use app\dict\sys\AppTypeDict;
use app\model\addon\Addon; use app\model\addon\Addon;
use app\service\admin\site\SiteGroupService;
use app\service\core\niucloud\CoreModuleService; use app\service\core\niucloud\CoreModuleService;
use think\db\exception\DbException; use think\db\exception\DbException;
use Throwable; use Throwable;
@ -50,7 +48,7 @@ class CoreAddonService extends CoreAddonBaseService
'desc' => $v['app']['app_desc'], 'desc' => $v['app']['app_desc'],
'key' => $v['app']['app_key'] ?? '', 'key' => $v['app']['app_key'] ?? '',
'version' => $v['version'] ?? '', 'version' => $v['version'] ?? '',
'author' => $v['app']['app_name'], 'author' => $v['site_name'],
'type' => $v['app']['app_type'], 'type' => $v['app']['app_type'],
'support_app' => $v['app']['support_channel'] ?? [], 'support_app' => $v['app']['support_channel'] ?? [],
'is_download' => false, 'is_download' => false,
@ -266,7 +264,7 @@ class CoreAddonService extends CoreAddonBaseService
$data = $core_addon_service->getAddonConfig($key); $data = $core_addon_service->getAddonConfig($key);
if (isset($data['key'])) { if (isset($data['key'])) {
$data['icon'] = is_file($data['icon']) ? image_to_base64($data['icon']) : ''; $data['icon'] = is_file($data['icon']) ? image_to_base64($data['icon']) : '';
$data['cover'] = is_file($data['icon']) ? image_to_base64($data['cover']) : ''; $data['cover'] = is_file($data['cover']) ? image_to_base64($data['cover']) : '';
$data['type_name'] = empty($data['type']) ? '' : AddonDict::getType()[$data['type']] ?? ''; $data['type_name'] = empty($data['type']) ? '' : AddonDict::getType()[$data['type']] ?? '';
} }
if(isset($data['support_app']) && !empty($data['support_app'])) if(isset($data['support_app']) && !empty($data['support_app']))

View File

@ -63,8 +63,7 @@ class CoreMemberAccountService extends BaseCoreService
$res = $member_account_log_model->create($data); $res = $member_account_log_model->create($data);
//账户更新 //账户更新
if($account_data > 0) if ($account_data > 0) {
{
if ($account_type == MemberAccountTypeDict::GROWTH) { if ($account_type == MemberAccountTypeDict::GROWTH) {
$account_type_get = $member_info[ $account_type . "_get" ] + $account_data; $account_type_get = $member_info[ $account_type . "_get" ] + $account_data;
} else { } else {

View File

@ -13,11 +13,9 @@ namespace app\service\core\member;
use app\dict\pay\TransferDict; use app\dict\pay\TransferDict;
use app\dict\sys\ConfigKeyDict; use app\dict\sys\ConfigKeyDict;
use app\model\sys\SysConfig;
use app\service\core\sys\CoreConfigService; use app\service\core\sys\CoreConfigService;
use core\base\BaseCoreService; use core\base\BaseCoreService;
use core\exception\CommonException; use core\exception\CommonException;
use think\Model;
/** /**
* 会员相关设置 * 会员相关设置
@ -31,14 +29,17 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getLoginConfig(int $site_id){ public function getLoginConfig(int $site_id)
{
$info = ( new CoreConfigService() )->getConfig($site_id, 'LOGIN')[ 'value' ] ?? []; $info = ( new CoreConfigService() )->getConfig($site_id, 'LOGIN')[ 'value' ] ?? [];
return [ return [
'is_username' => $info[ 'is_username' ] ?? 1, // 是否用户名密码登录 'is_username' => $info[ 'is_username' ] ?? 1, // 是否用户名密码登录
'is_mobile' => $info[ 'is_mobile' ] ?? 0, // 是否手机验证码登录 'is_mobile' => $info[ 'is_mobile' ] ?? 0, // 是否手机验证码登录
'is_auth_register' => $info[ 'is_auth_register' ] ?? 1, // 是否第三方自动注册 'is_auth_register' => $info[ 'is_auth_register' ] ?? 1, // 是否第三方自动注册
'is_bind_mobile' => $info[ 'is_bind_mobile' ] ?? 0, // 是否强制绑定手机 'is_bind_mobile' => $info[ 'is_bind_mobile' ] ?? 0, // 是否强制绑定手机
'agreement_show' => $info['agreement_show'] ?? 0 // 政策协议是否展示 'agreement_show' => $info[ 'agreement_show' ] ?? 0, // 政策协议是否展示
'bg_url' => $info[ 'bg_url' ] ?? '', // 背景图片
'desc' => $info[ 'desc' ] ?? '精选好物,购物优惠的省钱平台' // 描述
]; ];
} }
@ -48,13 +49,16 @@ class CoreMemberConfigService extends BaseCoreService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function setLoginConfig(int $site_id, array $data){ public function setLoginConfig(int $site_id, array $data)
{
$config = [ $config = [
'is_username' => $data[ 'is_username' ] ?? 1,//是否用户名密码登录 'is_username' => $data[ 'is_username' ] ?? 1,//是否用户名密码登录
'is_mobile' => $data[ 'is_mobile' ] ?? 0,//是否手机验证码登录 'is_mobile' => $data[ 'is_mobile' ] ?? 0,//是否手机验证码登录
'is_auth_register' => $data[ 'is_auth_register' ] ?? 1,//是否第三方自动注册 'is_auth_register' => $data[ 'is_auth_register' ] ?? 1,//是否第三方自动注册
'is_bind_mobile' => $data[ 'is_bind_mobile' ] ?? 0,//是否强制绑定手机 'is_bind_mobile' => $data[ 'is_bind_mobile' ] ?? 0,//是否强制绑定手机
'agreement_show' => $data['agreement_show'] ?? 0 // 政策协议是否展示 'agreement_show' => $data[ 'agreement_show' ] ?? 0, // 政策协议是否展示
'bg_url' => $data[ 'bg_url' ] ?? '', // 背景图片
'desc' => $data[ 'desc' ] ?? '' // 描述
]; ];
( new CoreConfigService() )->setConfig($site_id, 'LOGIN', $config); ( new CoreConfigService() )->setConfig($site_id, 'LOGIN', $config);
return true; return true;
@ -65,7 +69,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getMemberConfig(int $site_id){ public function getMemberConfig(int $site_id)
{
$info = ( new CoreConfigService() )->getConfig($site_id, 'MEMBER')[ 'value' ] ?? []; $info = ( new CoreConfigService() )->getConfig($site_id, 'MEMBER')[ 'value' ] ?? [];
return [ return [
'prefix' => $info[ 'prefix' ] ?? '',// 会员编码前缀 'prefix' => $info[ 'prefix' ] ?? '',// 会员编码前缀
@ -79,7 +84,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function setMemberConfig(int $site_id, array $data){ public function setMemberConfig(int $site_id, array $data)
{
$config = [ $config = [
'prefix' => $data[ 'prefix' ] ?? '',// 会员编码前缀 'prefix' => $data[ 'prefix' ] ?? '',// 会员编码前缀
'length' => $data[ 'length' ] ?? 4,// 会员编码长度 'length' => $data[ 'length' ] ?? 4,// 会员编码长度
@ -93,7 +99,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getGrowthRuleConfig(int $site_id){ public function getGrowthRuleConfig(int $site_id)
{
return ( new CoreConfigService() )->getConfigValue($site_id, 'GROWTH_RULE'); return ( new CoreConfigService() )->getConfigValue($site_id, 'GROWTH_RULE');
} }
@ -103,7 +110,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function setGrowthRuleConfig(int $site_id, array $data){ public function setGrowthRuleConfig(int $site_id, array $data)
{
( new CoreConfigService() )->setConfig($site_id, 'GROWTH_RULE', $data); ( new CoreConfigService() )->setConfig($site_id, 'GROWTH_RULE', $data);
return true; return true;
} }
@ -113,7 +121,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getPointRuleConfig(int $site_id){ public function getPointRuleConfig(int $site_id)
{
return ( new CoreConfigService() )->getConfigValue($site_id, 'POINT_RULE'); return ( new CoreConfigService() )->getConfigValue($site_id, 'POINT_RULE');
} }
@ -123,7 +132,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function setPointRuleConfig(int $site_id, array $data){ public function setPointRuleConfig(int $site_id, array $data)
{
( new CoreConfigService() )->setConfig($site_id, 'POINT_RULE', $data); ( new CoreConfigService() )->setConfig($site_id, 'POINT_RULE', $data);
return true; return true;
} }
@ -133,7 +143,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getCashOutConfig(int $site_id){ public function getCashOutConfig(int $site_id)
{
$config = ( new CoreConfigService() )->getConfig($site_id, ConfigKeyDict::MEMBER_CASH_OUT)[ 'value' ] ?? []; $config = ( new CoreConfigService() )->getConfig($site_id, ConfigKeyDict::MEMBER_CASH_OUT)[ 'value' ] ?? [];
return [ return [
'is_open' => $config[ 'is_open' ] ?? '0',//是否启用提现 'is_open' => $config[ 'is_open' ] ?? '0',//是否启用提现
@ -152,7 +163,8 @@ class CoreMemberConfigService extends BaseCoreService
* @param array $data * @param array $data
* @return true * @return true
*/ */
public function setCashOutConfig(int $site_id, array $data){ public function setCashOutConfig(int $site_id, array $data)
{
//校验转账方式是否合法 //校验转账方式是否合法
$transfer_type_list = array_keys(TransferDict::getTransferType()); $transfer_type_list = array_keys(TransferDict::getTransferType());
if (array_diff(array_diff($data[ 'transfer_type' ], $transfer_type_list), $transfer_type_list)) throw new CommonException('TRANSFER_TYPE_NOT_EXIST'); if (array_diff(array_diff($data[ 'transfer_type' ], $transfer_type_list), $transfer_type_list)) throw new CommonException('TRANSFER_TYPE_NOT_EXIST');

View File

@ -11,12 +11,10 @@
namespace app\service\core\niucloud; namespace app\service\core\niucloud;
use app\service\admin\niucloud\NiucloudService;
use core\util\niucloud\BaseNiucloudClient; use core\util\niucloud\BaseNiucloudClient;
use core\util\niucloud\http\Response; use core\util\niucloud\http\Response;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use RuntimeException;
/** /**
* 官网授权管理服务层 * 官网授权管理服务层

View File

@ -14,7 +14,6 @@ namespace app\service\core\niucloud;
use app\model\addon\Addon; use app\model\addon\Addon;
use app\service\core\addon\CoreAddonBaseService; use app\service\core\addon\CoreAddonBaseService;
use app\service\core\addon\CoreAddonDevelopDownloadService; use app\service\core\addon\CoreAddonDevelopDownloadService;
use app\service\core\addon\CoreAddonInstallService;
use core\base\BaseCoreService; use core\base\BaseCoreService;
use core\exception\CommonException; use core\exception\CommonException;
use core\util\niucloud\BaseNiucloudClient; use core\util\niucloud\BaseNiucloudClient;

View File

@ -11,7 +11,6 @@
namespace app\service\core\niucloud; namespace app\service\core\niucloud;
use app\service\admin\niucloud\NiucloudService;
use core\util\niucloud\BaseNiucloudClient; use core\util\niucloud\BaseNiucloudClient;
use core\util\niucloud\http\Response; use core\util\niucloud\http\Response;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;

View File

@ -11,11 +11,7 @@
namespace app\service\core\niucloud; namespace app\service\core\niucloud;
use app\service\admin\niucloud\NiucloudService;
use core\util\niucloud\BaseNiucloudClient; use core\util\niucloud\BaseNiucloudClient;
use core\util\niucloud\http\Response;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
/** /**
* 官网授权管理服务层 * 官网授权管理服务层
@ -40,6 +36,4 @@ class CoreNotifyService extends BaseNiucloudClient
return success(); return success();
} }
} }

View File

@ -174,7 +174,7 @@ class CorePayEventService extends BaseCoreService
$transfer_type = TransferDict::getPayTypeByTransfer($this->type); $transfer_type = TransferDict::getPayTypeByTransfer($this->type);
switch ($transfer_type) { switch ($transfer_type) {
case PayDict::WECHATPAY: case PayDict::WECHATPAY:
$money *= 100; $money = (int) bcmul($money, 100);
break; break;
case PayDict::ALIPAY: case PayDict::ALIPAY:
break; break;
@ -218,8 +218,8 @@ class CorePayEventService extends BaseCoreService
public function refund(string $out_trade_no, float $money, float $total, string $refund_no, $voucher = '') public function refund(string $out_trade_no, float $money, float $total, string $refund_no, $voucher = '')
{ {
if ($this->type == PayDict::WECHATPAY) { if ($this->type == PayDict::WECHATPAY) {
$money *= 100; $money = (int) bcmul($money, 100);
$total *= 100; $total = (int) bcmul($total, 100);
} }
return $this->app('refund')->refund([ return $this->app('refund')->refund([
'site_id' => $this->site_id, 'site_id' => $this->site_id,

View File

@ -274,7 +274,8 @@ class CorePayService extends BaseCoreService
* @param $trade_id * @param $trade_id
* @return Pay|array|mixed|Model * @return Pay|array|mixed|Model
*/ */
public function createByTrade($site_id, $trade_type, $trade_id){ public function createByTrade($site_id, $trade_type, $trade_id)
{
//创建新的支付单据 //创建新的支付单据
$data = array_values(array_filter(event('PayCreate', [ 'site_id' => $site_id, 'trade_type' => $trade_type, 'trade_id' => $trade_id ])))[ 0 ] ?? []; $data = array_values(array_filter(event('PayCreate', [ 'site_id' => $site_id, 'trade_type' => $trade_type, 'trade_id' => $trade_id ])))[ 0 ] ?? [];
if (empty($data)) throw new PayException('PAY_NOT_FOUND_TRADE');//找不到可支付的交易 if (empty($data)) throw new PayException('PAY_NOT_FOUND_TRADE');//找不到可支付的交易

View File

@ -61,6 +61,7 @@ class CoreScheduleInstallService extends BaseCoreService
$this->model->where([['addon', '=', $addon]])->delete(); $this->model->where([['addon', '=', $addon]])->delete();
return true; return true;
} }
/** /**
* 安装计划任务 * 安装计划任务
* @param array $data * @param array $data
@ -70,6 +71,8 @@ class CoreScheduleInstallService extends BaseCoreService
public function install(array $data, string $addon = ''){ public function install(array $data, string $addon = ''){
$schedule_list = []; $schedule_list = [];
foreach($data as $v){ foreach($data as $v){
$isExist = $this->model->where([["key", "=", $v['key']], ['addon', '=', $addon]])->count();
if (!$isExist) {
$schedule_list[] = array( $schedule_list[] = array(
'key' => $v['key'], 'key' => $v['key'],
'status' => ScheduleDict::ON, 'status' => ScheduleDict::ON,
@ -77,7 +80,8 @@ class CoreScheduleInstallService extends BaseCoreService
'addon' => $addon 'addon' => $addon
); );
} }
$this->model->replace()->insertAll($schedule_list); }
if (!empty($schedule_list)) $this->model->replace()->insertAll($schedule_list);
return true; return true;
} }

View File

@ -17,8 +17,6 @@ use app\dict\sys\AppTypeDict;
use app\model\addon\Addon; use app\model\addon\Addon;
use app\model\site\Site; use app\model\site\Site;
use app\model\site\SiteGroup; use app\model\site\SiteGroup;
use app\service\admin\site\SiteGroupService;
use app\service\admin\site\SiteService;
use core\base\BaseCoreService; use core\base\BaseCoreService;
use core\exception\CommonException; use core\exception\CommonException;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
@ -55,7 +53,7 @@ class CoreSiteService extends BaseCoreService
$where = [ $where = [
[ 'site_id', '=', $site_id ], [ 'site_id', '=', $site_id ],
]; ];
$info = $this->model->where($where)->field('site_id, site_name, front_end_name, front_end_logo, app_type, keywords, logo, icon, `desc`, status, latitude, longitude, province_id, city_id, district_id, address, full_address, phone, business_hours, create_time, expire_time, group_id, app, addons, site_domain')->append([ 'status_name' ])->findOrEmpty()->toArray(); $info = $this->model->where($where)->field('site_id, site_name, front_end_name, front_end_logo,front_end_icon, app_type, keywords, logo, icon, `desc`, status, latitude, longitude, province_id, city_id, district_id, address, full_address, phone, business_hours, create_time, expire_time, group_id, app, addons, site_domain')->append([ 'status_name' ])->findOrEmpty()->toArray();
if (!empty($info)) { if (!empty($info)) {
$site_addons = ( new CoreSiteService() )->getAddonKeysBySiteId((int) $site_id); $site_addons = ( new CoreSiteService() )->getAddonKeysBySiteId((int) $site_id);
$info[ 'apps' ] = ( new Addon() )->where([ [ 'key', 'in', $site_addons ], [ 'type', '=', AddonDict::APP ] ])->field('key,title,desc,icon,type')->select()->toArray(); $info[ 'apps' ] = ( new Addon() )->where([ [ 'key', 'in', $site_addons ], [ 'type', '=', AddonDict::APP ] ])->field('key,title,desc,icon,type')->select()->toArray();
@ -72,7 +70,8 @@ class CoreSiteService extends BaseCoreService
* @param string $domain * @param string $domain
* @return mixed|string * @return mixed|string
*/ */
public function getSiteIdByDomain(string $domain) { public function getSiteIdByDomain(string $domain)
{
if (empty($domain)) return; if (empty($domain)) return;
$cache_name = 'site_domain'; $cache_name = 'site_domain';
@ -135,7 +134,8 @@ class CoreSiteService extends BaseCoreService
* @param int $site_id * @param int $site_id
* @return array * @return array
*/ */
public function getAddonKeysBySiteId(int $site_id){ public function getAddonKeysBySiteId(int $site_id)
{
$cache_name = 'site_addon_key_cache'; $cache_name = 'site_addon_key_cache';
return cache_remember( return cache_remember(
$cache_name . $site_id, $cache_name . $site_id,

View File

@ -74,7 +74,7 @@ class CoreSysConfigService extends BaseCoreService
*/ */
public function getWapIndexList($data = []) public function getWapIndexList($data = [])
{ {
$result = array_filter(event("WapIndex")); $result = array_filter(event("WapIndex", [ 'site_id' => $data[ 'site_id' ] ?? 0 ]));
if (empty($result)) return []; if (empty($result)) return [];
$index_list = []; $index_list = [];

View File

@ -75,8 +75,10 @@ class CoreWeappAuthService extends BaseCoreService
public function getUserPhoneNumber(int $site_id, string $code) public function getUserPhoneNumber(int $site_id, string $code)
{ {
$api = CoreWeappService::appApiClient($site_id); $api = CoreWeappService::appApiClient($site_id);
CoreWeappService::refreshToken($site_id); // 为防止多次拒绝手机号的情况需要刷新token
return $api->postJson('wxa/business/getuserphonenumber', [ return $api->postJson('wxa/business/getuserphonenumber', [
'code' => (string) $code 'code' => (string) $code
]); ]);
} }
} }

View File

@ -171,12 +171,13 @@ class CoreWeappDeliveryService extends BaseCoreService
* 2、平台会在路径后面增加支付单的 transaction_id、merchant_id、merchant_trade_no 作为query参数如果存在二级商户号则还会再增加 sub_merchant_id 参数,开发者可以在小程序中通过onLaunch等方式获取。 * 2、平台会在路径后面增加支付单的 transaction_id、merchant_id、merchant_trade_no 作为query参数如果存在二级商户号则还会再增加 sub_merchant_id 参数,开发者可以在小程序中通过onLaunch等方式获取。
* 3、如你需要在path中携带自定义的query参数请注意与上面的参数进行区分 * 3、如你需要在path中携带自定义的query参数请注意与上面的参数进行区分
* @param int $site_id * @param int $site_id
* @param string $type
* @return mixed * @return mixed
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function setMsgJumpPath(int $site_id) public function setMsgJumpPath(int $site_id, $type)
{ {
$config_data = $this->getConfig($site_id); $config_data = $this->getConfig($site_id, $type);
if (true || empty($config_data) || ( !empty($config_data[ 'value' ]) && empty($config_data[ 'value' ][ 'path' ]) )) { if (true || empty($config_data) || ( !empty($config_data[ 'value' ]) && empty($config_data[ 'value' ][ 'path' ]) )) {
try { try {
$path = 'app/pages/weapp/order_shipping'; $path = 'app/pages/weapp/order_shipping';
@ -186,7 +187,7 @@ class CoreWeappDeliveryService extends BaseCoreService
$data = [ $data = [
'path' => $path 'path' => $path
]; ];
$this->setConfig($site_id, $data); $this->setConfig($site_id, $type, $data);
} }
return $result; return $result;
@ -248,25 +249,27 @@ class CoreWeappDeliveryService extends BaseCoreService
/** /**
* 获取配置信息 * 获取配置信息
* @param int $site_id * @param int $site_id
* @param string $type
* @return array * @return array
*/ */
public function getConfig(int $site_id) public function getConfig(int $site_id, $type)
{ {
$config_service = new CoreConfigService(); $config_service = new CoreConfigService();
$res = $config_service->getConfig($site_id, 'WEAPP_ORDER_SHIPPING_CONFIG'); $res = $config_service->getConfig($site_id, 'WEAPP_ORDER_SHIPPING_CONFIG_' . $type);
return $res; return $res;
} }
/** /**
* 设置配置 * 设置配置
* @param int $site_id * @param int $site_id
* @param string $type
* @param array $value * @param array $value
* @return SysConfig|bool|Model * @return SysConfig|bool|Model
*/ */
public function setConfig(int $site_id, array $value) public function setConfig(int $site_id, $type, array $value)
{ {
$config_service = new CoreConfigService(); $config_service = new CoreConfigService();
$res = $config_service->setConfig($site_id, 'WEAPP_ORDER_SHIPPING_CONFIG', $value); $res = $config_service->setConfig($site_id, 'WEAPP_ORDER_SHIPPING_CONFIG_' . $type, $value);
return $res; return $res;
} }

View File

@ -70,6 +70,17 @@ class CoreWeappService extends BaseCoreService
return self::app($site_id)->getClient(); return self::app($site_id)->getClient();
} }
/**
* 刷新token
* @param int $site_id
* @return \EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient
* @throws InvalidArgumentException
*/
public static function refreshToken(int $site_id)
{
self::app($site_id)->getAccessToken()->refresh();
}
/** /**
* 生成小程序码 * 生成小程序码
* @param int $site_id * @param int $site_id
@ -80,7 +91,8 @@ class CoreWeappService extends BaseCoreService
* @return mixed * @return mixed
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function qrcode(int $site_id, $page, $data, $filepath, $width = 430){ public function qrcode(int $site_id, $page, $data, $filepath, $width = 430)
{
$scene = []; $scene = [];
foreach ($data as $v) { foreach ($data as $v) {
$scene[] = $v[ 'key' ] . '-' . $v[ 'value' ]; $scene[] = $v[ 'key' ] . '-' . $v[ 'value' ];
@ -105,7 +117,8 @@ class CoreWeappService extends BaseCoreService
* @param $site_id * @param $site_id
* @return void * @return void
*/ */
public function getWeappPreviewImage($site_id) { public function getWeappPreviewImage($site_id)
{
$app = self::appApiClient($site_id); $app = self::appApiClient($site_id);
$response = $app->get('/wxa/get_qrcode'); $response = $app->get('/wxa/get_qrcode');
if ($response->isFailed()) { if ($response->isFailed()) {

View File

@ -1,6 +1,6 @@
<?php <?php
return [ return [
'version' => '0.5.0', 'version' => '0.5.1',
'code' => '202407250001' 'code' => '202408160001'
]; ];

View File

@ -15,7 +15,6 @@ use app\service\core\weapp\CoreWeappService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use EasyWeChat\Kernel\Support\Collection; use EasyWeChat\Kernel\Support\Collection;
use EasyWeChat\MiniProgram\SubscribeMessage\Client;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;

View File

@ -15,7 +15,6 @@ use app\service\core\wechat\CoreWechatService;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException; use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use EasyWeChat\Kernel\Support\Collection; use EasyWeChat\Kernel\Support\Collection;
use EasyWeChat\OfficialAccount\TemplateMessage\Client;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;

View File

@ -62,7 +62,7 @@ class Aliyun extends BaseUpload
$bucket = $this->config['bucket']; $bucket = $this->config['bucket'];
try { try {
$base64_file = base64_decode($base64_data); $base64_file = base64_decode($base64_data);
if (!$base64_file) throw new UploadFileException('FILE_ERROE'); if (!$base64_file) throw new UploadFileException('FILE_ERROR');
$this->client()->putObject( $this->client()->putObject(
$bucket, $bucket,
$key, $key,

View File

@ -101,7 +101,7 @@ class Qiniu extends BaseUpload
$upload_mgr = new UploadManager(); $upload_mgr = new UploadManager();
//将 base64 编码的图片数据解码 //将 base64 编码的图片数据解码
$base64_file = base64_decode($base64_data); $base64_file = base64_decode($base64_data);
if (!$base64_file) throw new UploadFileException('FILE_ERROE'); if (!$base64_file) throw new UploadFileException('FILE_ERROR');
// 初始化 UpLoadManager 对象并进行文件的上传 // 初始化 UpLoadManager 对象并进行文件的上传
list($ret, $err) = $upload_mgr->put($up_token, $key, $base64_file); list($ret, $err) = $upload_mgr->put($up_token, $key, $base64_file);
if ($err !== null) throw new UploadFileException($err->message); if ($err !== null) throw new UploadFileException($err->message);

View File

@ -84,7 +84,7 @@ class Tencent extends BaseUpload
$bucket = $this->config['bucket']; $bucket = $this->config['bucket'];
try { try {
$base64_file = base64_decode($base64_data); $base64_file = base64_decode($base64_data);
if (!$base64_file) throw new UploadFileException('FILE_ERROE'); if (!$base64_file) throw new UploadFileException('FILE_ERROR');
$result = $this->client()->putObject(array( $result = $this->client()->putObject(array(
'Bucket' => $bucket, //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket 'Bucket' => $bucket, //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket
'Key' => $key, 'Key' => $key,

View File

@ -12,10 +12,7 @@
namespace core\util; namespace core\util;
use Exception; use Exception;
use think\cache\driver\Redis;
use think\facade\Cache;
use think\facade\Log; use think\facade\Log;
use think\facade\Queue as ThinkQueue;
/** /**
* Class Queue * Class Queue