update niucloud

This commit is contained in:
全栈小学生 2024-06-15 15:36:09 +08:00
parent 7e5030ae3b
commit a4ed423b4c
160 changed files with 5169 additions and 802 deletions

View File

@ -114,6 +114,8 @@ class Diy extends BaseAdminController
[ "page_title", "" ],
[ "title", "" ],
[ "name", "" ],
[ 'template', '' ],
[ 'mode', 'diy' ], // 页面展示模式diy自定义fixed固定
[ "value", "", false ],
[ 'is_change', '' ]
]);

View File

@ -34,7 +34,7 @@ class DiyRoute extends BaseAdminController
[ 'url', '' ], // 路由地址,格式:/app/pages/index/index
[ 'addon_name', '' ] // 插件标识
]);
return success((new DiyRouteService())->getList($data));
return success(( new DiyRouteService() )->getList($data));
}
/**
@ -44,7 +44,7 @@ class DiyRoute extends BaseAdminController
*/
public function info(int $id)
{
return success((new DiyRouteService())->getInfo($id));
return success(( new DiyRouteService() )->getInfo($id));
}
/**
@ -54,7 +54,7 @@ class DiyRoute extends BaseAdminController
*/
public function getInfoByName(string $name)
{
return success((new DiyRouteService())->getInfoByName($name));
return success(( new DiyRouteService() )->getInfoByName($name));
}
/**
@ -71,7 +71,7 @@ class DiyRoute extends BaseAdminController
[ "is_share", "" ]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.add');
$id = (new DiyRouteService())->add($data);
$id = ( new DiyRouteService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
}
@ -90,7 +90,7 @@ class DiyRoute extends BaseAdminController
[ "is_share", "" ]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.edit');
(new DiyRouteService())->edit($id, $data);
( new DiyRouteService() )->edit($id, $data);
return success('MODIFY_SUCCESS');
}
@ -101,7 +101,7 @@ class DiyRoute extends BaseAdminController
*/
public function del(int $id)
{
(new DiyRouteService())->del($id);
( new DiyRouteService() )->del($id);
return success('DELETE_SUCCESS');
}
@ -118,7 +118,7 @@ class DiyRoute extends BaseAdminController
[ 'is_share', 0 ],
[ 'sort', 0 ]
]);
(new DiyRouteService())->modifyShare($data);
( new DiyRouteService() )->modifyShare($data);
return success('MODIFY_SUCCESS');
}
@ -129,7 +129,7 @@ class DiyRoute extends BaseAdminController
*/
public function getApps()
{
return success((new DiyRouteService())->getApps());
return success(( new DiyRouteService() )->getApps());
}
}

View File

@ -73,4 +73,19 @@ class Site extends BaseAdminController
return success('MODIFY_SUCCESS');
}
public function getSiteGroup() {
return success((new AuthSiteService())->getSiteGroup());
}
/**
* 创建站点
* @return Response
*/
public function create() {
$data = $this->request->params([
['site_name', ''],
['group_id', 0]
]);
return success((new AuthSiteService())->createSite($data));
}
}

View File

@ -72,9 +72,7 @@ class Login extends BaseAdminController
}
public function test(){
$res = event("MemberAccount", ['account_type' => MemberAccountTypeDict::GROWTH, 'site_id' => 166,
'member_id' => 10143]);
dd($res);
(new UpgradeService())->executeSql(root_path().'app/upgrade/v011/upgrade.sql');
}
public function geAddonPackagePath(string $addon)

View File

@ -82,7 +82,7 @@ class MemberLevel extends BaseAdminController
[ 'growth', 0 ],
[ 'remark', '' ],
[ 'level_benefits', [] ],
[ 'level_gifts', [] ]
[ 'level_gifts', [] ],
]);
$this->validate($data, 'app\validate\member\MemberLevel.edit');
( new MemberLevelService() )->edit($id, $data);

View File

@ -93,4 +93,12 @@ class PayChannel extends BaseAdminController
(new PayChannelService())->setAll($data['config']);
return success('SET_SUCCESS');
}
/**
* 获取全部支付方式
* @return Response
*/
public function getPayTypeList() {
return success(data:PayDict::getPayType());
}
}

View File

@ -104,4 +104,15 @@ class SiteGroup extends BaseAdminController
return success((new SiteGroupService())->getAll($data));
}
/**
* 所有分组
* @return Response
*/
public function getUserSiteGroupAll()
{
$data = $this->request->params([
['uid', 0],
]);
return success((new SiteGroupService())->getUserSiteGroupAll($data['uid']));
}
}

View File

@ -29,10 +29,6 @@ class User extends BaseAdminController
{
$data = $this->request->params([
['username', ''],
['realname', ''],
['role', ''],
['create_time', []],
['last_time', []],
]);
$list = (new SiteUserService())->getPage($data);
return success($list);
@ -121,7 +117,6 @@ class User extends BaseAdminController
*/
public function lock($uid)
{
(new SiteUserService())->lock($uid);
return success('MODIFY_SUCCESS');
}
@ -135,6 +130,4 @@ class User extends BaseAdminController
(new SiteUserService())->unlock($uid);
return success('MODIFY_SUCCESS');
}
}

View File

@ -200,4 +200,26 @@ class Config extends BaseAdminController
return success(data: ( new ConfigService() )->getLayout());
}
/**
* 设置布局设置
* @return Response
*/
public function setThemeColor()
{
$data = $this->request->params([
[ 'key', '' ],
[ 'value', '' ],
]);
( new ConfigService() )->setThemeColor($data);
return success();
}
/**
* 获取布局设置
* @return Response
*/
public function getThemeColor()
{
return success(data: ( new ConfigService() )->getThemeColor());
}
}

View File

@ -76,28 +76,6 @@ class System extends BaseAdminController
return success(data: (new SystemService())->checkSchedule());
}
/**
* 获取布局
* @return Response
*/
public function layout() {
$layouts = event('SiteLayout');
if (count($layouts) > 1) {
array_multisort(array_column($layouts, 'sort'), SORT_ASC, $layouts);
}
return success($layouts);
}
/**
*
* 设置布局
* @return Response
*/
public function setLayout(){
$key = input('key', '');
return success(data: (new SystemService())->setLayout($key));
}
/**
* 环境变量查询
* @return Response

View File

@ -11,6 +11,7 @@
namespace app\adminapi\controller\user;
use app\dict\sys\UserDict;
use app\service\admin\user\UserService;
use core\base\BaseAdminController;
use think\Response;
@ -21,12 +22,12 @@ class User extends BaseAdminController
{
$data = $this->request->params([
['username', ''],
['real_name', '']
['real_name', ''],
['last_time', []]
]);
$list = (new UserService())->getUserAdminPage($data);
$list = (new UserService())->getPage($data);
return success($list);
}
/**
@ -36,17 +37,17 @@ class User extends BaseAdminController
*/
public function info($uid)
{
return success((new UserService())->getUserAdminInfo($uid));
return success((new UserService())->getInfo($uid));
}
public function pages()
public function getUserAll()
{
$data = $this->request->params([
['username', ''],
['realname', ''],
['create_time', []],
]);
$list = (new UserService())->getUserAllPage($data);
$list = (new UserService())->getUserAll($data);
return success($list);
}
@ -57,4 +58,80 @@ class User extends BaseAdminController
$is_exist = (new UserService())->checkUsername($data['username']);
return success(data:$is_exist);
}
/**
* 添加用户
* @return Response
* @throws \Exception
*/
public function add() {
$data = $this->request->params([
['username', ''],
['password', ''],
['real_name', ''],
['status', UserDict::ON],
['head_img', ''],
['create_site_limit', []]
]);
(new UserService())->add($data);
return success();
}
/**
* 获取用户站点创建限制
* @param $uid
* @return Response
*/
public function getUserCreateSiteLimit($uid){
return success(data:(new UserService())->getUserCreateSiteLimit($uid));
}
/**
* 获取用户站点创建限制
* @param $uid
* @return Response
*/
public function getUserCreateSiteLimitInfo($id){
return success(data:(new UserService())->getUserCreateSiteLimitInfo($id));
}
/**
* 添加用户站点创建限制
* @param $uid
* @return Response
*/
public function addUserCreateSiteLimit($uid){
$data = $this->request->params([
['uid', 0],
['group_id', 0],
['num', 1],
['month', 1],
]);
(new UserService())->addUserCreateSiteLimit($data);
return success('SUCCESS');
}
/**
* 编辑用户站点创建限制
* @param $uid
* @return Response
*/
public function editUserCreateSiteLimit($id){
$data = $this->request->params([
['num', 1],
['month', 1],
]);
(new UserService())->editUserCreateSiteLimit($id, $data);
return success('SUCCESS');
}
/**
* 删除用户站点创建限制
* @param $uid
* @return Response
*/
public function delUserCreateSiteLimit($id){
(new UserService())->delUserCreateSiteLimit($id);
return success('SUCCESS');
}
}

View File

@ -27,6 +27,15 @@ class Verifier extends BaseAdminController
return success(data:(new VerifierService())->getPage());
}
/**
* 核销人员列表
* @return Response
*/
public function select()
{
return success(data:(new VerifierService())->getList());
}
/**
* 添加核销员
* @param int $order_id

View File

@ -27,6 +27,7 @@ class Verify extends BaseAdminController
['relate_tag', 0],
['type', ''],
['code', ''],
['verifier_member_id', ''],
['create_time', []]
]);
return success((new VerifyService())->getPage($data));

View File

@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\wxoplatform;
use app\service\admin\wechat\WechatConfigService;
use app\service\admin\wxoplatform\OplatformConfigService;
use core\base\BaseAdminController;
use think\Response;
class Config extends BaseAdminController
{
/**
* 获取微信开放平台开放平台配置信息
* @return Response
*/
public function get()
{
return success((new OplatformConfigService())->getConfig());
}
/**
* 设置微信开放平台配置信息
* @return Response
*/
public function set()
{
$data = $this->request->params([
['app_id', ''],
['app_secret', ''],
['token', ''],
['aes_key', ''],
['develop_app_id', ''],
['develop_upload_private_key', '']
]);
(new OplatformConfigService())->setConfig($data);
return success('SET_SUCCESS');
}
/**
* 获取微信开放平台静态资源
* @return Response
*/
public function static()
{
return success((new OplatformConfigService())->getStaticInfo());
}
}

View File

@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\wxoplatform;
use app\service\admin\wxoplatform\OplatformService;
use core\base\BaseAdminController;
use think\Response;
class Oplatform extends BaseAdminController
{
/**
* 获取授权链接
* @return Response
*/
public function getAuthorizationUrl()
{
return success(data:(new OplatformService())->createPreAuthorizationUrl());
}
/**
* 授权
* @return Response
*/
public function authorization() {
$data = $this->request->params([
['auth_code', ''],
['expires_in', ''],
]);
return success((new OplatformService())->authorization($data));
}
}

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\wxoplatform;
use app\service\admin\wxoplatform\OplatformServerService;
use core\base\BaseAdminController;
use think\Response;
class Server extends BaseAdminController
{
/**
* 微信开放平台授权事件接收
* @return Response
*/
public function server()
{
ob_clean();
$result = (new OplatformServerService())->server();
return response($result->getBody())->header([
'Content-Type' => 'text/plain;charset=utf-8'
]);
}
/**
* 微信开放平台消息与事件接收
* @param string $appid
* @return Response
*/
public function message(string $appid) {
ob_clean();
$result = (new OplatformServerService())->message($appid);
return response($result->getBody())->header([
'Content-Type' => 'text/plain;charset=utf-8'
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use core\base\BaseAdminController;
use think\Response;
class WeappVersion extends BaseAdminController
{
/**
* 平台提交小程序版本
* @return Response
*/
public function weappCommit() {
(new WeappVersionService())->add();
return success();
}
/**
* 获取最后一次提交记录
* @return Response
*/
public function lastCommitRecord() {
return success(data:(new WeappVersionService())->getLastCommitRecord());
}
public function commitRecord() {
return success(data:(new WeappVersionService())->getPage());
}
/**
* 站点小程序提交
* @return Response
*/
public function siteWeappCommit() {
(new WeappVersionService())->siteWeappCommit();
return success();
}
}

View File

@ -28,6 +28,9 @@ Route::group('home', function () {
Route::get('site/:id', 'home.Site/info');
//更新站点信息
Route::put('site/:id', 'home.Site/edit');
// 获取可选择的店铺套餐
Route::get('site/group', 'home.Site/getSiteGroup');
// 获取可选择的店铺套餐
Route::post('site/create', 'home.Site/create');
})->middleware(AdminCheckToken::class, true)
->middleware(AdminLog::class);
->middleware(AdminLog::class);

View File

@ -48,6 +48,8 @@ Route::group('pay', function () {
Route::get('refund/type', 'pay.PayRefund/getRefundType');
//退款转账
Route::post('refund/transfer', 'pay.PayRefund/transfer');
// 获取全部支付方式
Route::get('type/all', 'pay.PayChannel/getPayTypeList');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -50,6 +50,8 @@ Route::group('site', function () {
Route::delete('group/:group_id', 'site.SiteGroup/del');
//获取所有分组
Route::get('group/all', 'site.SiteGroup/all');
//获取所有分组以及用户站点数
Route::get('group/user', 'site.SiteGroup/getUserSiteGroupAll');
/***************************************************** 当前站点用户 *************************************************/
//站点用户列表
Route::get('user', 'site.User/lists');

View File

@ -111,6 +111,11 @@ Route::group('sys', function() {
// 布局设置
Route::put('config/layout', 'sys.Config/setLayout');
// 色调设置
Route::get('config/themecolor', 'sys.Config/getThemeColor');
// 色调设置
Route::put('config/themecolor', 'sys.Config/setThemeColor');
/***************************************************** 图片上传 ****************************************************/
//附件图片上传
Route::post('image', 'upload.Upload/image');
@ -210,10 +215,6 @@ Route::group('sys', function() {
/***************************************************** 公共字典数据 ****************************************************/
Route::get('date/month', 'sys.Common/getMonth');
Route::get('date/week', 'sys.Common/getWeek');
/***************************************************** 获取布局 ****************************************************/
Route::get('layout', 'sys.System/layout');
Route::put('layout', 'sys.System/setLayout');
/***************************************************** 获取导出数据 ****************************************************/
//报表导出列表
Route::get('export', 'sys.Export/lists');

View File

@ -21,13 +21,25 @@ use think\facade\Route;
Route::group('user', function () {
/***************************************************** 用户 ****************************************************/
//用户列表
Route::get('user', 'user.user/lists');
Route::get('user', 'user.User/lists');
//全部用户列表
Route::get('user_all', 'user.user/pages');
Route::get('user_all', 'user.User/getUserAll');
//用户详情
Route::get('user/:uid', 'user.user/info');
Route::get('user/:uid', 'user.User/info');
// 查询账号是否存在
Route::get('isexist', 'user.user/checkUserIsExist');
Route::get('isexist', 'user.User/checkUserIsExist');
//添加用户
Route::post('user', 'user.User/add');
// 获取用户站点创建限制
Route::get('user/create_site_limit/:uid', 'user.User/getUserCreateSiteLimit');
// 获取用户站点创建限制
Route::get('user/create_site_limit/info/:id', 'user.User/getUserCreateSiteLimitInfo');
// 增加用户站点创建限制
Route::post('user/create_site_limit', 'user.User/addUserCreateSiteLimit');
// 编辑用户站点创建限制
Route::put('user/create_site_limit/:id', 'user.User/editUserCreateSiteLimit');
// 删除用户站点创建限制
Route::delete('user/create_site_limit/:id', 'user.User/delUserCreateSiteLimit');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -30,6 +30,8 @@ Route::group('verify', function () {
Route::post('verifier', 'verify.Verifier/add');
// 获取核销员列表
Route::get('verifier', 'verify.Verifier/lists');
// 获取核销员列表
Route::get('verifier/select', 'verify.Verifier/select');
// 获取核销类型
Route::get('verifier/type', 'verify.Verifier/getVerifyType');
// 删除核销员

View File

@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminCheckRole;
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;
/**
* 路由
*/
Route::group('wxoplatform', function () {
/***************************************************** 微信配置 ****************************************************/
Route::get('config', 'wxoplatform.Config/get');
//设置微信配置
Route::put('config', 'wxoplatform.Config/set');
//微信设置的静态信息
Route::get('static', 'wxoplatform.Config/static');
// 获取授权页地址
Route::get('authorizationUrl', 'wxoplatform.Oplatform/getAuthorizationUrl');
// 确认授权
Route::get('authorization', 'wxoplatform.Oplatform/authorization');
// 平台提交小程序版本
Route::post('weapp/version/commit', 'wxoplatform.WeappVersion/weappCommit');
// 获取最后一次提交记录
Route::get('weapp/commit/last', 'wxoplatform.WeappVersion/lastCommitRecord');
// 获取小程序提交记录
Route::get('weapp/commit', 'wxoplatform.WeappVersion/commitRecord');
// 站点小程序提交审核
Route::post('site/weapp/commit', 'wxoplatform.WeappVersion/siteWeappCommit');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
AdminLog::class
]);
Route::group('wxoplatform', function () {
// 第三方平台授权事件接收
Route::post('server', 'wxoplatform.Server/server');
// 第三方平台消息与事件接收
Route::post('message/:appid', 'wxoplatform.Server/message');
});
//系统环境(不效验登录状态)
Route::group('sys', function() {
Route::get('wxoplatform/config', 'wxoplatform.Config/get');
});

View File

@ -30,7 +30,19 @@ class Diy extends BaseApiController
[ 'id', '' ],
[ 'name', '' ]
]);
return success((new DiyService())->getInfo($params));
return success(( new DiyService() )->getInfo($params));
}
/**
* 底部菜单信息
* @return Response
*/
public function tabbarList()
{
$params = $this->request->params([
[ 'key', '' ],
]);
return success(( new DiyConfigService() )->getBottomList($params));
}
/**
@ -42,7 +54,7 @@ class Diy extends BaseApiController
$params = $this->request->params([
[ 'key', 'app' ],
]);
return success((new DiyConfigService())->getBottomConfig($params[ 'key' ]));
return success(( new DiyConfigService() )->getBottomConfig($params[ 'key' ]));
}
/**
@ -55,6 +67,6 @@ class Diy extends BaseApiController
[ 'route', '' ],
[ 'params', '' ]
]);
return success((new DiyRouteService())->getShare($data));
return success(( new DiyRouteService() )->getShare($data));
}
}

View File

@ -15,6 +15,7 @@ use app\dict\member\MemberAccountChangeTypeDict;
use app\dict\member\MemberAccountTypeDict;
use app\service\api\member\MemberAccountService;
use core\base\BaseApiController;
use core\exception\AdminException;
use think\db\exception\DbException;
use think\Response;
@ -51,6 +52,18 @@ class Account extends BaseApiController
return success((new MemberAccountService())->getPage($data));
}
/**
* 余额流水()
* @return Response
*/
public function balanceList(): Response
{
$data = $this->request->params([
['from_type', '']
]);
return success((new MemberAccountService())->getPages($data));
}
/**
* 零钱流水
* @return Response
@ -85,7 +98,9 @@ class Account extends BaseApiController
public function commission(): Response
{
$data = $this->request->params([
['from_type', '']
['from_type', ''],
['account_data_gt', ''],
['account_data_lt', ''],
]);
$data['account_type'] = MemberAccountTypeDict::COMMISSION;
return success((new MemberAccountService())->getPage($data));
@ -98,8 +113,13 @@ class Account extends BaseApiController
*/
public function getFromType($account_type): Response
{
if (!array_key_exists($account_type, MemberAccountTypeDict::getType())) throw new AdminException('MEMBER_TYPE_NOT_EXIST');
return success(MemberAccountChangeTypeDict::getType($account_type));
}
public function pointCount()
{
return success((new MemberAccountService())->getPointCount());
}
}

View File

@ -27,9 +27,7 @@ class Address extends BaseApiController
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["type",""]
]);
$data = $this->request->params([]);
return success((new AddressService())->getList($data));
}
@ -59,7 +57,6 @@ class Address extends BaseApiController
["lng",""],
["lat",""],
["is_default",0],
["type",'']
]);
$this->validate($data, 'app\validate\member\Address.add');
$id = (new AddressService())->add($data);
@ -84,7 +81,6 @@ class Address extends BaseApiController
["lng",""],
["lat",""],
["is_default",0],
["type",'']
]);
$this->validate($data, 'app\validate\member\Address.edit');
(new AddressService())->edit($id, $data);

View File

@ -47,10 +47,11 @@ class Pay extends BaseApiController
['quit_url', ''],
['buyer_id', ''],
['return_url', ''],
['voucher', '']
['voucher', ''],
['openid', '']
]);
return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher']));
return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher'], $data['openid']));
}
public function info($trade_type, $trade_id)

View File

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\api\controller\weapp;
use app\service\api\weapp\WeappServeService;
use core\base\BaseController;
use EasyWeChat\Kernel\Exceptions\BadRequestException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
use ReflectionException;
use Symfony\Component\HttpFoundation\Response;
use Throwable;
/**
* 微信服务端通信
*/
class Serve extends BaseController
{
/**
* 接收消息并推送
* @param $site_id
* @return Response
* @throws BadRequestException
* @throws InvalidArgumentException
* @throws RuntimeException
* @throws ReflectionException
* @throws Throwable
*/
public function serve($site_id){
ob_clean();
$result = (new WeappServeService())->serve();
return response($result->getBody())->header([
'Content-Type' => 'text/plain;charset=utf-8'
]);
}
}

View File

@ -37,6 +37,7 @@ class Serve extends BaseController
* @throws Throwable
*/
public function serve($site_id){
ob_clean();
$result = (new WechatServeService())->serve();
return response($result->getBody())->header([
'Content-Type' => 'text/plain;charset=utf-8'

View File

@ -37,7 +37,33 @@ class Wechat extends BaseController
}
/**
* 授权登录
* code获取微信信息
* @return Response
*/
public function getWechatUser(){
$data = $this->request->params([
['code', ''],
]);
$wechat_auth_service = new WechatAuthService();
$data = $wechat_auth_service->userFromCode($data['code']);
return success(['data'=> json_encode($data)]);
}
/**
* 授权信息登录
* @return Response
*/
public function wechatLogin(){
$data = $this->request->params([
['data', ''],
]);
$wechat_auth_service = new WechatAuthService();
[$avatar, $nickname, $openid, $unionid] = json_decode($data['data'], true);
return success($wechat_auth_service->login($openid, $nickname, $avatar, $unionid));
}
/**
* 授权code登录
* @return Response
* @throws DataNotFoundException
* @throws DbException

View File

@ -32,6 +32,7 @@ class ApiChannel
//微信或支付宝
$channel_rules = [
'wechat/serve/<site_id>',
'weapp/serve/<site_id>',
'pay/notify/<site_id>/<channel>/<type>/<action>'
];
if (in_array($request->rule()->getRule(), $channel_rules)) {

View File

@ -24,6 +24,8 @@ Route::group('diy', function() {
Route::get('tabbar', 'diy.Diy/tabbar');
Route::get('tabbar/list', 'diy.Diy/tabbarList');
Route::get('share', 'diy.Diy/share');
})->middleware(ApiLog::class)

View File

@ -39,6 +39,8 @@ Route::group('member', function () {
Route::get('account/point', 'member.Account/point');
//会员余额流水
Route::get('account/balance', 'member.Account/balance');
//会员余额流水(新)
Route::get('account/balance_list', 'member.Account/balanceList');
//会员零钱流水
Route::get('account/money', 'member.Account/money');
//会员零钱流水
@ -47,8 +49,11 @@ Route::group('member', function () {
Route::get('account/commission', 'member.Account/commission');
//账户来源
Route::get('account/fromtype/:account_type', 'member.Account/getFromType');
//积分数量
Route::get('account/pointcount', 'member.Account/pointCount');
/***************************************************** 会员提现 ****************************************************/
Route::get('account/point', 'member.Account/point');
//会员提现列表
Route::get('cash_out', 'member.MemberCashOut/lists');
//会员提现详情

View File

@ -23,6 +23,12 @@ Route::any('wechat/serve/:site_id', 'wechat.Serve/serve')
->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
// 微信小程序消息推送
Route::any('weapp/serve/:site_id', 'weapp.Serve/serve')
->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class)
->middleware(ApiLog::class);
Route::group(function() {
Route::post('niucloud/notify', function(){
return (new CoreNotifyService())->notify();
@ -36,6 +42,10 @@ Route::group(function() {
Route::group(function() {
//获取授权地址
Route::get('wechat/codeurl', 'wechat.Wechat/getCodeUrl');
//获取授权信息
Route::get('wechat/user', 'wechat.Wechat/getWechatUser');
//公众号通过授权信息登录
Route::post('wechat/userlogin', 'wechat.Wechat/wechatLogin');
//公众号通过code登录
Route::post('wechat/login', 'wechat.Wechat/login');

View File

@ -51,6 +51,7 @@ class Queue extends Command
'connect_timeout' => 10,
'max_attempts' => 3,
'retry_seconds' => 5,
'prefix' => md5(root_path())
];
if(!empty(env('redis.redis_password'))){
$redis_option['auth'] = env('redis.redis_password');

View File

@ -4,18 +4,14 @@ namespace app\command\schedule;
use app\command\WorkerCommand;
use app\dict\schedule\ScheduleDict;
use app\service\core\addon\CoreAddonService;
use app\service\core\schedule\CoreScheduleService;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\helper\Str;
use Workerman\Crontab\Crontab;
use Workerman\RedisQueue\Client;
use Workerman\Worker;
use yunwuxin\cron\Task;
class Schedule extends Command
{

View File

@ -878,7 +878,7 @@ function file_copy(string $source_file, string $to_file)
*/
function qrcode($url, $page, $data, $site_id, $dir = '', $channel = 'h5', $style = [ 'is_transparent' => true ], $outfile = true)
{
if($outfile){
if ($outfile) {
$dir = $dir ? : 'upload' . '/' . 'qrcode' . '/' . $site_id;//二维码默认存储位置
if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
@ -894,7 +894,7 @@ function qrcode($url, $page, $data, $site_id, $dir = '', $channel = 'h5', $style
'filepath' => $path ?? '',
'url' => $url,
'page' => $page,
'data' => $data ,
'data' => $data,
'site_id' => $site_id,
'channel' => $channel,
'outfile' => $outfile

View File

@ -19,25 +19,24 @@ namespace app\dict\common;
*/
class ChannelDict
{
//微信小程序
public const WEAPP = 'weapp';
//微信公众号
public const WECHAT = 'wechat';
//手机端H5
public const H5 = 'h5';
//电脑端PC
public const PC = 'pc';
//手机端H5
public const H5 = 'h5';
//app端
public const APP = 'app';
//微信公众号
public const WECHAT = 'wechat';
//微信小程序
public const WEAPP = 'weapp';
public static function getType($type = '')
{
$data = [
self::H5 => get_lang('dict_channel.channel_h5'),//'手机H5',
self::APP => get_lang('dict_channel.channel_app'),//'手机app',
self::PC => get_lang('dict_channel.channel_pc'),//'电脑PC',
self::WECHAT => get_lang('dict_channel.channel_wechat'),//'微信公众号',
self::PC => get_lang('dict_channel.channel_pc'),//'电脑PC'
self::H5 => get_lang('dict_channel.channel_h5'),//'手机H5'
self::APP => get_lang('dict_channel.channel_app'),//'手机app'
self::WECHAT => get_lang('dict_channel.channel_wechat'),//'微信公众号'
self::WEAPP => get_lang('dict_channel.channel_weapp'),//微信小程序
];
if (empty($type)) {

View File

@ -29,7 +29,7 @@ class ComponentDict
'list' => [
'Text' => [
'title' => '标题',
'icon' => 'iconfont-iconbiaoti',
'icon' => 'iconfont iconbiaotipc',
'path' => 'edit-text', // 编辑组件属性名称
'support_page' => [], // 支持页面
'uses' => 0, // 最大添加数量
@ -76,7 +76,7 @@ class ComponentDict
"fontWeight" => "normal"
],
"more" => [
"text" => "查看更多",
"text" => "更多",
"control" => false,
"isShow" => true,
"link" => [
@ -88,7 +88,7 @@ class ComponentDict
],
'ImageAds' => [
'title' => '图片广告',
'icon' => 'iconfont-icontupianguanggao1',
'icon' => 'iconfont icontupiandaohangpc',
'path' => 'edit-image-ads',
'support_page' => [],
'uses' => 0,
@ -109,7 +109,7 @@ class ComponentDict
],
'GraphicNav' => [
'title' => '图文导航',
'icon' => 'iconfont-icontuwendaohang2',
'icon' => 'iconfont icontuwendaohangpc',
'path' => 'edit-graphic-nav',
'support_page' => [],
'uses' => 0,
@ -194,7 +194,7 @@ class ComponentDict
],
'RubikCube' => [
'title' => '魔方',
'icon' => 'iconfont-iconmofang1',
'icon' => 'iconfont iconmofangpc',
'path' => 'edit-rubik-cube',
'support_page' => [],
'uses' => 0,
@ -224,7 +224,7 @@ class ComponentDict
],
'HotArea' => [
'title' => '热区',
'icon' => 'iconfont-iconrequ',
'icon' => 'iconfont iconrequpc',
'path' => 'edit-hot-area',
'support_page' => [],
'uses' => 0,
@ -238,7 +238,7 @@ class ComponentDict
],
'MemberInfo' => [
'title' => '会员信息',
'icon' => 'iconfont-iconhuiyuanzhongxin',
'icon' => 'iconfont iconhuiyuanqiandaopc',
'path' => 'edit-member-info',
'support_page' => [ 'DIY_MEMBER_INDEX' ],
'uses' => 1,
@ -253,7 +253,7 @@ class ComponentDict
],
'MemberLevel' => [
'title' => '会员等级',
'icon' => 'iconfont-iconhuangguan',
'icon' => 'iconfont iconhuiyuandengjipc',
'path' => 'edit-member-level',
'support_page' => [],
'uses' => 1,
@ -265,7 +265,7 @@ class ComponentDict
],
'Notice' => [
'title' => '公告',
'icon' => 'iconfont-icongonggao',
'icon' => 'iconfont icongonggaopc',
'path' => 'edit-notice',
'support_page' => [],
'uses' => 0,
@ -292,7 +292,7 @@ class ComponentDict
],
'RichText' => [
'title' => '富文本',
'icon' => 'iconfont-iconfuwenben1',
'icon' => 'iconfont iconfuwenbenpc',
'path' => 'edit-rich-text',
'support_page' => [],
'uses' => 0,
@ -303,7 +303,7 @@ class ComponentDict
],
'ActiveCube' => [
'title' => '活动魔方',
'icon' => 'iconfont-iconmofang1',
'icon' => 'iconfont iconmofangpc',
'path' => 'edit-active-cube',
'support_page' => [],
'uses' => 0,
@ -460,7 +460,7 @@ class ComponentDict
],
'CarouselSearch' => [
'title' => '轮播搜索',
'icon' => 'iconfont-iconsousuokuang',
'icon' => 'iconfont iconlunbosousuopc',
'path' => 'edit-carousel-search',
'support_page' => [],
'uses' => 1,
@ -543,7 +543,7 @@ class ComponentDict
],
'FloatBtn' => [
'title' => '浮动按钮',
'icon' => 'iconfont-iconfudonganniu1',
'icon' => 'iconfont iconfudonganniupc',
'path' => 'edit-float-btn',
'support_page' => [],
'uses' => 1,
@ -566,7 +566,7 @@ class ComponentDict
],
'HorzBlank' => [
'title' => '辅助空白',
'icon' => 'iconfont-iconfuzhukongbai1',
'icon' => 'iconfont iconfuzhukongbaipc',
'path' => 'edit-horz-blank',
'support_page' => [],
'uses' => 0,
@ -577,7 +577,7 @@ class ComponentDict
],
'HorzLine' => [
'title' => '辅助线',
'icon' => 'iconfont-iconfuzhuxian1',
'icon' => 'iconfont iconfuzhuxianpc',
'path' => 'edit-horz-line',
'support_page' => [],
'uses' => 0,

View File

@ -132,6 +132,22 @@ class LinkDict
'key' => 'app'
],
'child_list' => []
],
'DIY_JUMP_OTHER_APPLET' => [
'title' => get_lang('dict_diy.diy_jump_other_applet'),
'addon_info' => [
'title' => '系统',
'key' => 'app'
],
'child_list' => []
],
'DIY_MAKE_PHONE_CALL' => [
'title' => get_lang('dict_diy.diy_make_phone_call'),
'addon_info' => [
'title' => '系统',
'key' => 'app'
],
'child_list' => []
]
];

View File

@ -500,7 +500,7 @@ class PagesDict
"color" => "#FFFFFF"
],
"imageSize" => 25,
"aroundRadius" => 25,
"aroundRadius" => 0,
"font" => [
"size" => 13,
"weight" => "normal",
@ -943,7 +943,7 @@ class PagesDict
"color" => "#FFFFFF"
],
"imageSize" => 25,
"aroundRadius" => 25,
"aroundRadius" => 0,
"font" => [
"size" => 13,
"weight" => "normal",

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\member;
/**
* 会员等级样式枚举类
* Class MemberDict
*/
class MemberLevelDict
{
/**
* 样式
* @return array
*/
public static function getStyle()
{
return [
'level_1' => [
'bg_color' => '#414852',
'level_color' => '#666666',
'progress' => ['#999999','#666666'],
'gift'=> '#ECEBEB',
],
'level_2' => [
'bg_color' => '#354B54',
'level_color' => '#116787',
'progress' => ['#4BA5C7','#116787'],
'gift'=> '#F1FDFF',
],
'level_3' => [
'bg_color' => '#203B54',
'level_color' => '#286BAA',
'progress' => ['#529BDF','#286BAA'],
'gift'=> '#E3F2FF',
],
'level_4' => [
'bg_color' => '#403E32',
'level_color' => '#967600',
'progress' => ['#D1A400','#967600'],
'gift'=> '#FFFAE3',
],
'level_5' => [
'bg_color' => '#36354B',
'level_color' => '#4B3EF9',
'progress' => ['#8F87FF','#4B3EF9'],
'gift'=> '#E7EEFF',
],
'level_6' => [
'bg_color' => '#362F28',
'level_color' => '#9F5300',
'progress' => ['#EFA244','#9F5300'],
'gift'=> '#FFF5DC',
],
'level_7' => [
'bg_color' => '#322432',
'level_color' => '#DE43D6',
'progress' => ['#FFA0FA','#DE43D6'],
'gift'=> '#FFEAFF',
],
'level_8' => [
'bg_color' => '#301C1E',
'level_color' => '#DE000B',
'progress' => ['#FF8B36','#DE000B'],
'gift'=> '#FFE3E6',
],
];
}
}

View File

@ -23,6 +23,24 @@ return [
'background' => '/static/resource/images/member/gift/gift_balance_bg.png'
];
return $content;
},
// 会员签到(日签)
'member_sign' => function($site_id, $config) {
$content = [];
$content[] = [
'text' => "{$config['money']}",
'icon' => '/static/resource/images/member/sign/packet.png'
];
return $content;
},
// 会员签到(连签)
'member_sign_continue' => function($site_id, $config) {
$content = [];
$content[] = [
'text' => "{$config['money']}",
'icon' => '/static/resource/images/member/sign/packet01.png'
];
return $content;
}
]
],
@ -47,6 +65,24 @@ return [
'background' => '/static/resource/images/member/gift/gift_point_bg.png'
];
return $content;
},
// 会员签到(日签)
'member_sign' => function($site_id, $config) {
$content = [];
$content[] = [
'text' => "{$config['num']}积分",
'icon' => '/static/resource/images/member/sign/point.png'
];
return $content;
},
// 会员签到(连签)
'member_sign_continue' => function($site_id, $config) {
$content = [];
$content[] = [
'text' => "{$config['num']}积分",
'icon' => '/static/resource/images/member/sign/point01.png'
];
return $content;
}
]
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -57,32 +57,24 @@ class PayDict
'name' => get_lang('dict_pay.type_wechatpay'),
'key' => self::WECHATPAY,
'icon' => self::WECHATPAY_ICON,
'setting_component' => '/src/app/views/setting/components/pay-wechatpay.vue'
],//微信支付
self::ALIPAY => [
'name' => get_lang('dict_pay.type_alipay'),
'key' => self::ALIPAY,
'icon' => self::ALIPAY_ICON,
'setting_component' => '/src/app/views/setting/components/pay-alipay.vue'
],//支付宝支付
// self::UNIPAY => [
// 'name' => get_lang('dict_pay.type_unipay'),
// 'key' => self::UNIPAY,
// 'icon' => self::UNIPAY_ICON
// ],//银联支付
// self::OFFLINEPAY => [
// 'name' => get_lang('dict_pay.type_offline'),
// 'key' => self::OFFLINEPAY,
// 'icon' => self::OFFLINEPAY_ICON
// ],//线下支付
self::BALANCEPAY => [
'name' => get_lang('dict_pay.type_balancepay'),
'key' => self::BALANCEPAY,
'icon' => self::BALANCEPAY_ICON,
'setting_component' => ''
],//微信支付
// self::ALIPAY => get_lang('dict_pay.type_alipay'),//支付宝支付
// self::UNIPAY => get_lang('dict_pay.type_unipay'),//银联
// self::OFFLINEPAY => get_lang('dict_pay.type_offline'),//线下支付
// self::BALANCEPAY => get_lang('dict_pay.type_balancepay'),//余额支付
];
$list = array_merge($list, ...event('PayType'));
if (!empty($types)) {
foreach ($list as $k => $v) {
if (!in_array($k, $types)) {

View File

@ -31,7 +31,7 @@ class ComponentDict
'Text' => [
'title' => "文本", // 组件名称
'type' => 'text', // 组件类型文本textimage图片qrcode二维码
'icon' => "iconfont-iconbiaoti", // 组件图标
'icon' => "iconfont iconbiaoti", // 组件图标
'path' => "text", // 组件预览,前缀 edit-,编辑组件属性,前缀 preview-
'uses' => 0,
'sort' => 10000,
@ -41,7 +41,7 @@ class ComponentDict
'Image' => [
'title' => "图片",
'type' => 'image',
'icon' => "iconfont-icontupian1",
'icon' => "iconfont icontupian1",
'path' => "image",
'uses' => 0,
'sort' => 10001,
@ -51,7 +51,7 @@ class ComponentDict
'Qrcode' => [
'title' => "二维码",
'type' => 'qrcode',
'icon' => "iconfont-iconerweima",
'icon' => "iconfont iconerweima",
'path' => "qrcode",
'uses' => 1,
'sort' => 10002,
@ -61,7 +61,7 @@ class ComponentDict
'HeadImg' => [
'title' => "头像",
'type' => 'image',
'icon' => "iconfont-icongeren",
'icon' => "iconfont icongeren",
'path' => "headimg",
'uses' => 1,
'sort' => 10003,
@ -77,7 +77,7 @@ class ComponentDict
'NickName' => [
'title' => "昵称",
'type' => 'text',
'icon' => "iconfont-iconnicheng1",
'icon' => "iconfont iconnicheng1",
'path' => "nickname",
'uses' => 1,
'sort' => 10004,
@ -93,7 +93,7 @@ class ComponentDict
'Draw' => [
'title' => "绘画",
'type' => 'draw',
'icon' => "iconfont-iconhuihua1",
'icon' => "iconfont iconhuihua1",
'path' => "draw",
'uses' => 0,
'sort' => 10005,

View File

@ -20,14 +20,19 @@ class CloudDict
const APPLET_UPLOAD_SUCCESS = 1;
const APPLET_AUDITING = 2;
const APPLET_UPLOAD_FAIL = -1;
const APPLET_AUDIT_FAIL = -2;
public static function getAppletUploadSatus($status) {
$status_list = [
self::APPLET_UPLOADING => get_lang('dict_cloud_applet.uploading'),
self::APPLET_UPLOAD_SUCCESS => get_lang('dict_cloud_applet.upload_success'),
self::APPLET_UPLOAD_FAIL => get_lang('dict_cloud_applet.upload_fail')
self::APPLET_UPLOAD_FAIL => get_lang('dict_cloud_applet.upload_fail'),
self::APPLET_AUDITING => get_lang('dict_cloud_applet.auditing'),
self::APPLET_AUDIT_FAIL => get_lang('dict_cloud_applet.audit_fail'),
];
return $status_list[$status] ?? '';
}

View File

@ -30,4 +30,9 @@ class ConfigKeyDict
public const H5 = 'h5';//h5
}
public const WXOPLATFORM = 'WXOPLATFORM'; // 微信开放平台
public const WEAPP_AUTHORIZATION_INFO = 'weapp_authorization_info';
public const WECHAT_AUTHORIZATION_INFO = 'wechat_authorization_info';
}

View File

@ -38,7 +38,7 @@ class SmsDict
public static function getType()
{
return [
$system = [
self::ALISMS => [
'name' => '阿里云短信',
//配置参数
@ -46,7 +46,8 @@ class SmsDict
'sign' => '短信签名',
'app_key' => 'APP_KEY',
'secret_key' => 'SECRET_KEY'
]
],
'component' => '/src/app/views/setting/components/sms-ali.vue',
],
self::TENCENTSMS => [
'name' => '腾讯云短信',
@ -56,10 +57,12 @@ class SmsDict
'app_id' => 'APP_ID',
'secret_id' => 'SECRET_ID',
'secret_key' => 'SECRET_KEY'
]
],
'component' => '/src/app/views/setting/components/sms-tencent.vue',
],
];
$extend = event('SmsType');
return array_merge($system, ...$extend);
}
//支持的短信场景
@ -73,4 +76,4 @@ class SmsDict
];
}
}
}

View File

@ -36,12 +36,13 @@ class StorageDict
public static function getType()
{
return [
$system = [
self::LOCAL => [
'name' => '本地存储',
//配置参数
'params' => [
]
],
'component' => '/src/app/views/setting/components/storage-local.vue',
],
self::QINIU => [
'name' => '七牛云存储',
@ -52,7 +53,8 @@ class StorageDict
'access_key' => 'ACCESS_KEY',
'secret_key' => 'SECRET_KEY',
'domain' => '空间域名'
]
],
'component' => '/src/app/views/setting/components/storage-qiniu.vue',
],
self::ALI => [
@ -64,7 +66,8 @@ class StorageDict
'secret_key' => 'ACCESS_KEY_SECRET',
'endpoint' => 'Endpoint',
'domain' => '空间域名'
]
],
'component' => '/src/app/views/setting/components/storage-ali.vue',
],
self::TENCENT => [
@ -76,10 +79,13 @@ class StorageDict
'access_key' => 'SECRET_ID',
'secret_key' => 'SECRET_KEY',
'domain' => '空间域名'
]
],
'component' => '/src/app/views/setting/components/storage-tencent.vue',
],
];
$extend = event('StorageType');
return array_merge($system, ...$extend);
}
}
}

View File

@ -0,0 +1,132 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\sys;
class WxOplatform
{
/**
* 公众号必需权限
*/
public const WECHAT_MUST_AUTHORITY = [
1 => '消息管理',
2 => '用户管理',
3 => '账号服务',
4 => '网页服务',
6 => '微信多客服',
7 => '群发与通知',
8 => '微信卡券',
9 => '微信扫一扫',
11 => '素材管理',
15 => '菜单管理',
27 => '快速注册小程序',
33 => '小程序关联管理',
54 => '服务号对话管理',
89 => '服务号订阅通知'
];
/**
* 小程序必需权限
*/
public const WEAPP_MUST_AUTHORITY = [
17 => '获取小程序码',
18 => '小程序开发与数据分析',
19 => '小程序客服管理',
25 => '开放平台账号管理',
30 => '小程序基本信息管理',
31 => '小程序认证名称检测',
36 => '微信卡路里管理',
37 => '附近的小程序管理',
40 => '小程序插件管理',
45 => '微信物流服务',
48 => '微信财政电子票据管理',
49 => '小程序云开发管理',
51 => '小程序即时配送',
52 => '小程序直播管理',
65 => '小程序广告管理',
70 => '标准版交易组件商品管理',
71 => '标准版交易组件订单物流与售后管理',
73 => '标准版交易组件接入',
76 => '小程序违规与交易投诉管理',
81 => '试用小程序快速认证',
84 => '标准版交易组件优惠券管理',
85 => '自定义版交易组件管理',
88 => '小程序链接管理',
93 => '小程序联盟管理',
99 => '云开发短信服务',
105 => '城市服务',
116 => '获取自定义版交易组件数据',
118 => '硬件服务',
119 => '小程序支付管理服务',
120 => '小程序购物订单',
129 => '视频号小店商品管理',
130 => '视频号小店物流管理',
131 => '视频号小店订单与售后管理',
132 => '视频号小店优惠券管理',
135 => '流量主代运营权限集',
139 => '小程序运费险 ',
142 => '小程序发货管理服务',
144 => '小程序学生认证权限集',
151 => '小程序交易保障',
157 => '小程序虚拟支付管理权限',
161 => '微信客服管理',
];
/**
* 默认隐私协议内容
*/
public const SETTING_LIST = [
['privacy_key' => 'UserInfo', 'privacy_text' => '用户信息'],
['privacy_key' => 'Location', 'privacy_text' => '位置信息'],
['privacy_key' => 'Address', 'privacy_text' => '地址'],
['privacy_key' => 'Invoice', 'privacy_text' => '发票信息 '],
['privacy_key' => 'RunData', 'privacy_text' => '微信运动数据'],
['privacy_key' => 'Record', 'privacy_text' => '麦克风'],
['privacy_key' => 'Album', 'privacy_text' => '选中的照片或视频信息'],
['privacy_key' => 'Camera', 'privacy_text' => '摄像头'],
['privacy_key' => 'PhoneNumber', 'privacy_text' => '手机号码 '],
['privacy_key' => 'Contact', 'privacy_text' => '通讯录'],
['privacy_key' => 'DeviceInfo', 'privacy_text' => '设备信息'],
['privacy_key' => 'EXIDNumber', 'privacy_text' => '身份证号码'],
['privacy_key' => 'EXOrderInfo', 'privacy_text' => '订单信息 '],
['privacy_key' => 'EXUserPublishConten', 'privacy_text' => '发布内容 '],
['privacy_key' => 'EXUserFollowAcct', 'privacy_text' => '所关注账号'],
['privacy_key' => 'EXUserOpLog', 'privacy_text' => '操作日志 '],
['privacy_key' => 'AlbumWriteOnly', 'privacy_text' => '相册'],
['privacy_key' => 'LicensePlate ', 'privacy_text' => '车牌号'],
['privacy_key' => 'BlueTooth', 'privacy_text' => '蓝牙'],
['privacy_key' => 'CalendarWriteOnly', 'privacy_text' => '日历'],
['privacy_key' => 'Email', 'privacy_text' => '邮箱'],
['privacy_key' => 'MessageFile', 'privacy_text' => '选中的文件'],
['privacy_key' => 'ChooseLocation', 'privacy_text' => '选择的位置信息'],
['privacy_key' => 'Accelerometer', 'privacy_text' => '加速传感器 '],
['privacy_key' => 'Compass', 'privacy_text' => '磁场传感器'],
['privacy_key' => 'DeviceMotion ', 'privacy_text' => '方向传感器 '],
['privacy_key' => 'Gyroscope', 'privacy_text' => '陀螺仪传感器'],
['privacy_key' => 'Clipboard', 'privacy_text' => '剪切板'],
];
/**
* 默认隐私协议内容
*/
public const DEFAULT_SETTING_LIST = [
['privacy_key' => 'UserInfo', 'privacy_text' => '快捷维护用户信息'], // 用户信息
['privacy_key' => 'Location', 'privacy_text' => '用户获取附近门店'], // 位置信息
['privacy_key' => 'Address', 'privacy_text' => '快捷维护收货地址'], // 地址
['privacy_key' => 'Album', 'privacy_text' => '上传头像或者图片'], // 选中的照片或视频信息
['privacy_key' => 'Camera', 'privacy_text' => '调用摄像头扫描二维码'], // 摄像头
['privacy_key' => 'PhoneNumber', 'privacy_text' => '用户使用手机号注册'], // 手机号码
['privacy_key' => 'AlbumWriteOnly', 'privacy_text' => '获取相册中的图片'], // 相册
['privacy_key' => 'MessageFile', 'privacy_text' => '上传头像或者图片'], // 选中的文件
['privacy_key' => 'ChooseLocation', 'privacy_text' => '搜集您的位置信息'], // 选择的位置信息
['privacy_key' => 'Clipboard', 'privacy_text' => '快速获取订单号'], // 剪切板
];
}

View File

@ -103,6 +103,9 @@ $system_event = [
// 获取海报数据
'GetPosterData' => ['app\listener\system\Poster'],
// 小程序授权变更事件
'WeappAuthChangeAfter' => ['app\listener\system\WeappAuthChangeAfter']
],
'subscribe' => [
],

View File

@ -252,7 +252,6 @@ CREATE TABLE `member_address` (
lng varchar(255) NOT NULL DEFAULT '' COMMENT '经度',
lat varchar(255) NOT NULL DEFAULT '' COMMENT '纬度',
is_default tinyint NOT NULL DEFAULT 0 COMMENT '是否是默认地址',
type varchar(30) NOT NULL DEFAULT '' COMMENT '地址类型 address 普通地址 location_address 定位地址',
PRIMARY KEY (id)
)
ENGINE = INNODB,
@ -946,6 +945,8 @@ CREATE TABLE `weapp_version` (
`update_time` int(11) NOT NULL DEFAULT 0,
`fail_reason` text DEFAULT NULL,
`task_key` varchar(20) NOT NULL DEFAULT '' COMMENT '上传任务key',
`from_type` VARCHAR(255) NOT NULL DEFAULT 'cloud_build',
`auditid` VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
@ -1003,6 +1004,38 @@ CREATE TABLE `wechat_reply` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '公众号消息回调表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `wx_oplatfrom_weapp_version`;
CREATE TABLE `wx_oplatfrom_weapp_version` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`site_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT '站点套餐id',
`template_id` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '代码模板 ID',
`user_version` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '代码版本号',
`user_desc` VARCHAR(255) DEFAULT '' COMMENT '代码描述',
`task_key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '上传任务key',
`status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态',
`fail_reason` TEXT DEFAULT NULL COMMENT '失败原因',
`version_no` INT(11) NOT NULL DEFAULT 0,
`create_time` INT(11) NOT NULL DEFAULT 0,
`update_time` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
DROP TABLE IF EXISTS `user_create_site_limit`;
CREATE TABLE `user_create_site_limit` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`group_id` INT(11) NOT NULL DEFAULT 0,
`uid` INT(11) NOT NULL DEFAULT 0,
`num` INT(11) NOT NULL DEFAULT 0,
`month` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
INSERT INTO `site`(site_id, site_name, group_id, keywords, app_type, logo, `desc`, status, latitude, longitude, province_id, city_id, district_id, address, full_address, phone, business_hours, create_time, expire_time, front_end_name, front_end_logo, front_end_icon, icon, member_no, app, addons, initalled_addon, site_domain) VALUES
(1, 'niucloud-admin', 0, '', 'admin', '', '', 1, '', '', 0, 0, 0, '', '', '', '', 0, 0, '', '', '', '', '0', '', '', '', '');

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use core\base\BaseJob;
/**
* 队列异步调用支付定时未支付恢复
*/
class GetVersionUploadResult extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($task_key)
{
WeappVersionService::getVersionUploadResult($task_key);
return true;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use app\service\core\pay\CorePayService;
use core\base\BaseJob;
use think\facade\Log;
/**
* 小程序代码上传
*/
class SiteWeappCommit extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($site_id, $site_group_id)
{
WeappVersionService::weappCommit($site_id, $site_group_id);
return true;
}
}

View File

@ -9,3 +9,24 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use core\base\BaseJob;
/**
* 小程序提交审核
*/
class SubmitAudit extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($site_id, $id)
{
WeappVersionService::submitCommit($site_id, $id);
return true;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use core\base\BaseJob;
/**
* 队列异步调用支付定时未支付恢复
*/
class VersionUploadSuccess extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($task_key)
{
WeappVersionService::uploadSuccess($task_key);
return true;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use app\service\core\pay\CorePayService;
use core\base\BaseJob;
use think\facade\Log;
/**
* 小程序授权变更之后
*/
class WeappAuthChangeAfter extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($site_id, $event)
{
event('WeappAuthChangeAfter', ['site_id' => $site_id, 'event' => $event]);
return true;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use app\service\core\pay\CorePayService;
use core\base\BaseJob;
use think\facade\Log;
/**
* 小程序代码上传
*/
class WeappCommit extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($data)
{
(new WeappVersionService())->add($data);
return true;
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\job\wxoplatform;
use app\service\admin\wxoplatform\WeappVersionService;
use app\service\core\pay\CorePayService;
use core\base\BaseJob;
use think\facade\Log;
/**
* 公众号授权变更之后
*/
class WechatAuthChangeAfter extends BaseJob
{
/**
* 消费
* @param $data
* @return true
*/
protected function doJob($site_id, $event)
{
event('WechatAuthChangeAfter', ['site_id' => $site_id, 'event' => $event]);
return true;
}
}

View File

@ -44,6 +44,7 @@ return [
'ADDON_DIR_FAIL' => '插件文件操作失败',
'LAYOUT_NOT_EXIST' => '该布局不存在',
'ZIP_FILE_NOT_FOUND' => '找不到可用的压缩文件',
'ZIP_ARCHIVE_NOT_INSTALL' => 'ZipArchive扩展未安装',
'DOWNLOAD_SUCCESS' => '下载成功',
'APP_NOT_ALLOW_UNINSTALL' => '该应用下存在站点卸载前请先删除相关站点',
'ADDON_INSTALL_FAIL' => '插件安装失败',
@ -192,6 +193,9 @@ return [
'SITE_EXPIRE_NOT_ALLOW' => '站点已打烊,续费后可继续使用此项功能',
'SITE_CLOSE_NOT_ALLOW' => '站点已停止',
'SITE_GROUP_APP_NOT_EXIST' => '存在无效的应用',
'NO_PERMISSION_TO_CREATE_SITE_GROUP' => '没有创建该站点套餐的权限',
'SITE_GROUP_CREATE_SITE_EXCEEDS_LIMIT' => '该套餐的创建数量已达上限',
'SITE_GROUP_NOT_EXIST' => '站点套餐不存在',
//支付相关(todo 注意:7段不共享)
'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号',
@ -263,7 +267,7 @@ return [
//核销相关
'VERIFY_TYPE_ERROR' => '核销类型错误',
'VERIFY_CODE_EXPIRED' => '核销码已过期',
'VERIFY_CODE_EXPIRED' => '当前核销码已核销或已失效',
'VERIFIER_NOT_EXIST' => '核销员不存在',
//签到相关
@ -281,4 +285,10 @@ return [
'EXPORT_NO_DATA' => '暂无可导出数据',
'DIRECTORY' => '目录',
'WAS_NOT_CREATED' => '创建失败',
/********************************************************* 微信开放平台 **************************************/
'WECHAT_OPLATFORM_NOT_EXIST' => '未配置微信开放平台',
'WEAPP_EXIST' => '该小程序已经授权给其他站点',
'WECHAT_EXIST' => '该公众号已经授权给其他站点',
'PLEASE_ADD_FIRST_SITE_GROUP' => '请先添加站点套餐'
];

View File

@ -234,7 +234,9 @@ return [
'member_verify_index' => '核销台',
'diy_page' => '自定义页面',
'diy_link' => '自定义链接'
'diy_link' => '自定义链接',
'diy_jump_other_applet' => '小程序跳转',
'diy_make_phone_call' => '拨打电话'
],
// 自定义海报
'dict_diy_poster'=>[
@ -249,12 +251,11 @@ return [
//渠道
'dict_channel' => [
//渠道端口
'channel_wechat' => '公众号',
'channel_weapp' => '微信小程序',
'channel_pc' => 'PC',
'channel_h5' => 'H5',
'channel_pc' => '电脑端',
'channel_app' => 'APP',
'channel_wechat' => '微信公众号',
'channel_weapp' => '微信小程序',
],
//会员提现
'dict_member_cash_out' => [
@ -352,6 +353,9 @@ return [
'uploading' => '上传中',
'upload_success' => '上传成功',
'upload_fail' => '上传失败',
'auditing' => '审核中',
'audit_success' => '审核通过',
'audit_fail' => '审核失败'
],
'dict_wechat_media' => [
'type_image' => '图片',

View File

@ -26,14 +26,21 @@ class MemberExportDataListener
$data = [];
if ($param['type'] == 'member') {
$model = new Member();
$field = 'member_id, member_no, username, mobile, nickname, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time';
$field = 'member_id, member_no, username, 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'])->field($field)->append(['register_channel_name', 'status_name']);
$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']);
if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) {
$data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray();
} else {
$data = $search_model->select()->toArray();
}
foreach ($data as $key => $value) {
$data[$key]['username'] = !empty($value['username']) ? $value['username'] : '-';
$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]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '0000-00-00 00:00:00';
}
}
return $data;
}

View File

@ -25,16 +25,17 @@ class MemberExportTypeListener
'member' => [
'name' => '会员列表',
'column' => [
'member_id' => [ 'name' => '会员id'],
'member_no' => [ 'name' => '会员编码'],
'username' => [ 'name' => '用户名'],
'username' => [ 'name' => '真实姓名'],
'nickname' => [ 'name' => '会员昵称'],
'mobile' => [ 'name' => '手机号'],
'nickname' => [ 'name' => '昵称'],
'member_level_name' => [ 'name' => '会员等级'],
'sex_name' => [ 'name' => '性别'],
'birthday' => [ 'name' => '生日'],
'point' => [ 'name' => '积分'],
'balance' => [ 'name' => '余额'],
'money' => [ 'name' => '余额(可提现)'],
'money' => [ 'name' => '可提现余额'],
'growth' => [ 'name' => '成长值'],
'commission' => [ 'name' => '当前佣金'],
'commission' => [ 'name' => '佣金'],
'register_channel_name' => [ 'name' => '注册来源'],
'status_name' => [ 'name' => '用户状态'],
'create_time' => [ 'name' => '注册时间'],

View File

@ -22,7 +22,7 @@ class Sms
//完全信任消息的设置, 不再依赖support_type
if ($template['is_sms']) {
$sms_id = $template['sms_id'];//发送模板id
$content = $template['sms_content'];
$content = $template['sms']['content'];
$member_id = $to['member_id'] ?? 0;
$uid = $to['uid'] ?? 0;
if (!$mobile) {
@ -67,4 +67,4 @@ class Sms
return true;
}
}
}

View File

@ -25,7 +25,7 @@ class BottomNavigationListener
{
$key = 'app';
if (!empty($params) && $params[ 'key' ] != $key) return;
if (!empty($params) && !empty($params[ 'key' ]) && $params[ 'key' ] != $key) return;
$addon_info = [
'title' => '系统',

View File

@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\listener\system;
use app\service\admin\wxoplatform\WeappVersionService;
/**
*
* Class AppInit
* @package app\listener\system
*/
class WeappAuthChangeAfter
{
public function handle(array $data)
{
// 授权成功
if ($data['event'] == 'authorized') {
request()->siteId($data['site_id']);
$service = new WeappVersionService();
// 设置隐私协议
$service->setPrivacySetting();
// 设置服务器域名
$service->setDomain();
// 提交小程序代码
$service->siteWeappCommit();
} else if ($data['event'] == 'unauthorized') {
// 授权取消
}
}
}

View File

@ -56,7 +56,7 @@ class DiyRoute extends BaseModel
public function searchTitleAttr($query, $value, $data)
{
if ($value) {
$query->where("title", 'like','%'.$value.'%');
$query->where("title", 'like', '%' . $value . '%');
}
}

View File

@ -125,6 +125,32 @@ class MemberAccountLog extends BaseModel
}
}
/**
* 金额大于
* @param $query
* @param $value
* @param $data
*/
public function searchAccountDataGtAttr($query, $value, $data)
{
if ($value !== '' && $value !== null) {
$query->where('account_data', '>',$value);
}
}
/**
* 金额小于
* @param $query
* @param $value
* @param $data
*/
public function searchAccountDataLtAttr($query, $value, $data)
{
if ($value !== '' && $value !== null) {
$query->where('account_data', '<',$value);
}
}
/**
* 会员搜索(用于关联表查询)
* @param $query

View File

@ -33,15 +33,4 @@ class MemberAddress extends BaseModel
*/
protected $name = 'member_address';
/**
* 搜索器:会员收货地址地址类型 1 普通地址 2 定位地址
* @param $value
* @param $data
*/
public function searchTypeAttr($query, $value, $data)
{
if ($value) {
$query->where("type", $value);
}
}
}

View File

@ -145,7 +145,7 @@ class MemberCashOut extends BaseModel
public function searchStatusAttr($query, $value, $data)
{
if ($value) {
$query->where('status', $value);
$query->where('member_cash_out.status', $value);
}
}

View File

@ -35,7 +35,8 @@ class MemberLevel extends BaseModel
protected $type = [
'level_benefits' => 'json',
'level_gifts' => 'json'
'level_gifts' => 'json',
'style' => 'json'
];
/**

View File

@ -64,7 +64,7 @@ class SiteGroup extends BaseModel
*/
public function getAddonNameAttr($value, $data)
{
if (empty($data['app']))
if (empty($data['addon']))
return [];
return (new Addon())->where([['key', 'in', $data['addon']]])->column('title');
}

View File

@ -139,5 +139,22 @@ class SysUser extends BaseModel
}
}
/**
* 创建时间搜索器
* @param $query
* @param $value
* @param $data
*/
public function searchLastTimeAttr($query, $value, $data)
{
$start_time = empty($value[0]) ? 0 : strtotime($value[0]);
$end_time = empty($value[1]) ? 0 : strtotime($value[1]);
if ($start_time > 0 && $end_time > 0) {
$query->whereBetweenTime('sys_user.last_time', $start_time, $end_time);
} else if ($start_time > 0 && $end_time == 0) {
$query->where([['sys_user.last_time', '>=', $start_time]]);
} else if ($start_time == 0 && $end_time > 0) {
$query->where([['sys_user.last_time', '<=', $end_time]]);
}
}
}

View File

@ -47,7 +47,7 @@ class SysUserRole extends BaseModel
*/
public function userinfo()
{
return $this->hasOne(SysUser::class, 'uid', 'uid')->joinType('inner')
return $this->hasOne(SysUser::class, 'uid', 'uid')->joinType('right')
->withField('uid,username,head_img,real_name,last_ip,last_time,login_count,create_time')
->bind(['username', 'head_img', 'real_name', 'last_ip', 'last_time', 'login_count']);
}
@ -60,7 +60,7 @@ class SysUserRole extends BaseModel
{
return $this->hasOne(Site::class, 'site_id', 'site_id')->joinType('inner')
->withField('site_id, site_name, app_type, status, expire_time')
->bind(['site_name', 'app_type', 'status', 'expire_time', 'status_name', 'site_status_name'])->append(['status_name', 'site_status_name']);
->bind(['site_name', 'app_type', 'expire_time', 'status_name', 'site_status_name'])->append(['status_name', 'site_status_name']);
}
/**

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\sys;
use app\model\site\SiteGroup;
use core\base\BaseModel;
/**
* @package app\model\sys
*/
class UserCreateSiteLimit extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'user_create_site_limit';
public function siteGroup() {
return $this->hasOne(SiteGroup::class, 'group_id', 'group_id')->append(['app_name', 'addon_name']);
}
}

View File

@ -0,0 +1,51 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\sys;
use app\dict\sys\CloudDict;
use app\model\site\SiteGroup;
use core\base\BaseModel;
/**
* @package app\model\sys
*/
class WxOplatfromWeappVersion extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'wx_oplatfrom_weapp_version';
public function siteGroup() {
return $this->hasOne(SiteGroup::class, 'group_id', 'site_group_id')->bind(['site_group_name' => 'group_name']);
}
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getStatusNameAttr($value, $data)
{
if (!isset($data['status']) || empty($data['status'])) return '';
return CloudDict::getAppletUploadSatus($data['status']);
}
}

View File

@ -72,6 +72,19 @@ class Verify extends BaseModel
$query->where('relate_tag', '=', $value);
}
}
/**
* 核销员
* @param $query
* @param $value
* @param $data
* @return void
*/
public function searchVerifierMemberIdAttr($query, $value, $data)
{
if ($value) {
$query->where('verifier_member_id', '=', $value);
}
}
/**
* 核销类型搜索

View File

@ -12,6 +12,7 @@
namespace app\service\admin\auth;
use app\dict\site\SiteDict;
use app\dict\sys\AppTypeDict;
use app\model\sys\SysUserRole;
use app\Request;
use app\service\admin\site\SiteUserService;
@ -73,10 +74,18 @@ class AuthService extends BaseAdminService
$menu_service = new MenuService();
$all_menu_list = $menu_service->getAllApiList($this->app_type);
//先判断当前访问的接口是否收到权限的限制
$method_menu_list = $all_menu_list[$method] ?? [];
if(!in_array($rule, $method_menu_list))
return true;
if(!in_array($rule, $method_menu_list)) {
$other_menu_list = $menu_service->getAllApiList($this->app_type == AppTypeDict::ADMIN ? AppTypeDict::SITE : AppTypeDict::ADMIN);
$method_menu_list = $other_menu_list[$method] ?? [];
if(!in_array($rule, $method_menu_list)) {
return true;
} else {
throw new AuthException('NO_PERMISSION');
}
}
$auth_role_list = $this->getAuthApiList();
if(!empty($auth_role_list[$method]) && in_array($rule, $auth_role_list[$method]))

View File

@ -12,10 +12,8 @@
namespace app\service\admin\auth;
use app\dict\sys\ConfigKeyDict;
use app\model\sys\SysConfig;
use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService;
use think\Model;
/**
* 登录服务层

View File

@ -23,6 +23,7 @@ use core\exception\AuthException;
use core\util\TokenAuth;
use Exception;
use Throwable;
use app\service\admin\home\AuthSiteService as HomeAuthSiteService;
/**
* 登录服务层
@ -49,6 +50,8 @@ class LoginService extends BaseAdminService
{
if(!array_key_exists($app_type, AppTypeDict::getAppType())) throw new AuthException('APP_TYPE_NOT_EXIST');
$this->site_id = $this->request->adminSiteId();
$config = (new ConfigService())->getConfig();
switch($app_type){
case AppTypeDict::SITE:
@ -67,7 +70,11 @@ class LoginService extends BaseAdminService
if ($userinfo->isEmpty()) return false;
if (!check_password($password, $userinfo->password)) return false;
$this->request->uid($userinfo->uid);
$auth_site_service = (new HomeAuthSiteService());
$default_site_id = 0;
if($app_type == AppTypeDict::ADMIN){
$default_site_id = $this->request->defaultSiteId();
$userrole = (new UserRoleService())->getUserRole($default_site_id, $userinfo->uid);
@ -77,7 +84,10 @@ class LoginService extends BaseAdminService
$app_type = AppTypeDict::SITE;
}
} else if($app_type == AppTypeDict::SITE){
$default_site_id = $this->site_id;
$site_ids = $auth_site_service->getSiteIds();
if(!empty($site_ids)){
$default_site_id = in_array($this->site_id, $site_ids) || AuthService::isSuperAdmin() ? $this->site_id : $site_ids[0];
}
} else {
throw new AuthException('APP_TYPE_NOT_EXIST');
}
@ -98,22 +108,20 @@ class LoginService extends BaseAdminService
'userinfo' => [
'uid' => $userinfo->uid,
'username' => $userinfo->username,
'is_super_admin' => AuthService::isSuperAdmin()
'is_super_admin' => AuthService::isSuperAdmin(),
'head_img' => $userinfo->head_img
],
'site_id' => $default_site_id,
'site_info' => null,
'userrole' => $app_type == AppTypeDict::ADMIN ? $userrole : []
];
if ($app_type == AppTypeDict::ADMIN || ($app_type == AppTypeDict::SITE && $data['site_id']) ) {
$data['site_info'] = (new SiteService())->getInfo($data['site_id']);
$this->request->siteId($data['site_id']);
$data['site_info'] = (new AuthSiteService())->getSiteInfo();
}
if ($app_type == AppTypeDict::ADMIN && !$data['userinfo']['is_super_admin']) {
$data['userinfo']['site_ids'] = (new \app\service\admin\home\AuthSiteService())->getSiteIds();
$data['userinfo']['site_ids'] = $auth_site_service->getSiteIds();
}
// 获取站点布局
$layout_config = (new CoreConfigService())->getConfig($data['site_id'], 'SITE_LAYOUT');
$data['layout'] = empty($layout_config) ? 'default' : $layout_config['value']['key'];
return $data;
}

View File

@ -32,19 +32,19 @@ class DiyConfigService extends BaseAdminService
*/
public function getBottomList($params = [])
{
$list = (new CoreDiyConfigService())->getBottomList($params);
$list = ( new CoreDiyConfigService() )->getBottomList($params);
$site_addon = (new CoreSiteService())->getSiteCache($this->site_id);
$site_addon = ( new CoreSiteService() )->getSiteCache($this->site_id);
// 单应用,排除 系统 底部导航设置
if (count($site_addon[ 'apps' ]) == 1) {
foreach ($list as $k=>$v){
if($v['key'] = 'app'){
unset($list[$k]);
foreach ($list as $k => $v) {
if ($v[ 'key' ] = 'app') {
unset($list[ $k ]);
break;
}
}
$list = array_values($list);
$list = array_values($list);
}
return $list;
}
@ -56,7 +56,7 @@ class DiyConfigService extends BaseAdminService
*/
public function getBottomConfig($key)
{
return (new CoreDiyConfigService())->getBottomConfig($this->site_id, $key);
return ( new CoreDiyConfigService() )->getBottomConfig($this->site_id, $key);
}
/**
@ -67,7 +67,7 @@ class DiyConfigService extends BaseAdminService
*/
public function setBottomConfig($data, $key)
{
return (new CoreDiyConfigService())->setBottomConfig($this->site_id, $data, $key);
return ( new CoreDiyConfigService() )->setBottomConfig($this->site_id, $data, $key);
}
/**
@ -77,7 +77,7 @@ class DiyConfigService extends BaseAdminService
*/
public function setStartUpPageConfig($data)
{
return (new CoreDiyConfigService())->setStartUpPageConfig($this->site_id, $data);
return ( new CoreDiyConfigService() )->setStartUpPageConfig($this->site_id, $data);
}
/**
@ -87,7 +87,7 @@ class DiyConfigService extends BaseAdminService
*/
public function getStartUpPageConfig($name)
{
return (new CoreDiyConfigService())->getStartUpPageConfig($this->site_id, $name);
return ( new CoreDiyConfigService() )->getStartUpPageConfig($this->site_id, $name);
}
}

View File

@ -58,7 +58,7 @@ class DiyRouteService extends BaseAdminService
$is_add = false;
}
if (!empty($where[ 'addon_name' ]) && $where[ 'addon_name' ] != $v[ 'addon_info' ][ 'key' ]) {
if (!empty($v[ 'addon_info' ]) && !empty($where[ 'addon_name' ]) && $where[ 'addon_name' ] != $v[ 'addon_info' ][ 'key' ]) {
$is_add = false;
}

View File

@ -17,7 +17,6 @@ use app\dict\diy\PagesDict;
use app\dict\diy\TemplateDict;
use app\model\diy\Diy;
use app\service\admin\sys\SystemService;
use app\service\core\addon\CoreAddonService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use Exception;
@ -317,8 +316,6 @@ class DiyService extends BaseAdminService
$data[ 'component' ] = $this->getComponentList($data[ 'type' ]);
$data[ 'domain_url' ] = ( new SystemService() )->getUrl();
// 查询已安装的有效的应用
$data[ 'addon_list' ] = ( new CoreAddonService() )->getInstallAddonList();
return $data;
}
@ -487,8 +484,8 @@ class DiyService extends BaseAdminService
'type' => $params[ 'type' ], // 页面类型标识
'name' => '', // 链接标识
'parent' => '', // 链接标识
'title' => $default_page_data[ 'title' ], // 模板名称
'cover' => $default_page_data[ 'cover' ], // 封面图
'title' => $default_page_data[ 'title' ] ?? '', // 模板名称
'cover' => $default_page_data[ 'cover' ] ?? '', // 封面图
'url' => '', // 自定义页面链接,实时预览效果
'page' => $template[ 'page' ], // 页面地址
'action' => $template[ 'action' ] // 是否存在操作decorate 表示支持装修
@ -538,6 +535,8 @@ class DiyService extends BaseAdminService
// 如果没有预览图,并且没有地址,则赋值默认页面地址
if (empty($use_template[ 'cover' ]) && empty($use_template[ 'url' ])) {
$use_template[ 'url' ] = $template[ 'page' ];
} elseif (empty($use_template[ 'url' ])) {
$use_template[ 'url' ] = $template[ 'page' ];
}
$template[ 'use_template' ] = $use_template;

View File

@ -15,12 +15,17 @@ namespace app\service\admin\home;
use app\dict\sys\AppTypeDict;
use app\dict\sys\MenuTypeDict;
use app\model\site\Site;
use app\model\site\SiteGroup;
use app\model\sys\SysMenu;
use app\model\sys\SysUserRole;
use app\model\sys\UserCreateSiteLimit;
use app\service\admin\auth\AuthService;
use app\service\admin\site\SiteGroupService;
use app\service\admin\site\SiteService;
use app\service\admin\sys\ConfigService;
use app\service\admin\sys\RoleService;
use core\base\BaseAdminService;
use core\exception\CommonException;
use core\exception\HomeException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
@ -66,7 +71,16 @@ class AuthSiteService extends BaseAdminService
];
if (!AuthService::isSuperAdmin()) $condition[] = ['site_id', 'in', $this->getSiteIds()];
$search_model = $this->model->where($condition)->withSearch([ 'create_time', 'expire_time', 'keywords', 'status', 'group_id', 'app' ], $where)->with(['groupName'])->field($field)->append([ 'status_name' ])->order('create_time desc');
return $this->pageQuery($search_model);
$theme_color = (new ConfigService())->getThemeColor();
return $this->pageQuery($search_model, function ($item) use ($theme_color) {
if (is_array($item['app']) && count($item['app']) == 1) {
$item['theme_color'] = $theme_color[ $item['app'][0] ] ?? '';
} else {
$item['theme_color'] = $theme_color['system'] ?? '';
}
});
}
/**
@ -113,4 +127,52 @@ class AuthSiteService extends BaseAdminService
$site_ids = $this->getSiteIds();
if(!in_array($site_id, $site_ids)) throw new HomeException('USER_ROLE_NOT_HAS_SITE');//无效的站点
}
/**
* 获取可选择的店铺套餐
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getSiteGroup() {
if (AuthService::isSuperAdmin()) {
$site_group = (new SiteGroup())->field('group_id,group_name,app,addon')->append(['app_name', 'addon_name'])->select()->toArray();
return array_map(function ($item){
return [
'group_id' => $item['group_id'],
'site_group' => $item
];
}, $site_group);
} else {
return (new UserCreateSiteLimit())->where([ ['uid', '=', $this->uid] ])->with(['site_group' => function($query) {
$query->field('group_id,group_name,app,addon');
}])->select()->toArray();
}
}
/**
* 创建站点
* @param array $data
* @return void
*/
public function createSite(array $data) {
if (!AuthService::isSuperAdmin()) {
$limit = (new UserCreateSiteLimit())->where([ ['uid', '=', $this->uid], ['group_id', '=', $data['group_id'] ] ])->findOrEmpty();
if ($limit->isEmpty()) throw new CommonException('NO_PERMISSION_TO_CREATE_SITE_GROUP');
if (SiteGroupService::getUserSiteGroupSiteNum($this->uid, $data['group_id']) > ($limit['num'] - 1)) throw new CommonException('SITE_GROUP_CREATE_SITE_EXCEEDS_LIMIT');
} else {
$limit = ['month' => 1];
}
(new SiteService())->add([
'site_name' => $data['site_name'],
'uid' => $this->uid,
'group_id' => $data['group_id'],
'expire_time' => strtotime("+ {$limit['month']} month")
]);
return true;
}
}

View File

@ -54,6 +54,7 @@ class SmsService extends BaseAdminService
'value' => $config_type[$k][$k_param] ?? ''
];
}
$data['component'] = $v['component'] ?? '';
$list[] = $data;
}
return $list;
@ -125,4 +126,4 @@ class SmsService extends BaseAdminService
}
}
}

View File

@ -25,6 +25,7 @@ use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Cache;
use think\facade\Db;
/**
* 站点分组服务层
@ -182,7 +183,7 @@ class SiteGroupService extends BaseAdminService
$group = $this->model->findOrEmpty($group_id);
$addon = [];
if (!$group->isEmpty()) {
$addon = array_merge([ $group['app'] ], $group['addon']);
$addon = array_merge($group['app'], $group['addon']);
}
return $addon;
},
@ -204,4 +205,38 @@ class SiteGroupService extends BaseAdminService
];
return $this->add($data);
}
/**
* 查询店铺套餐以及用户创建的站点数量
* @param $uid
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getUserSiteGroupAll($uid) {
$field = 'group_id, group_name, group_desc, create_time, update_time, app';
$list = $this->model->field($field)->select()->toArray();
foreach ($list as &$item) {
$item['site_num'] = self::getUserSiteGroupSiteNum($uid, $item['group_id']);
}
return $list;
}
/**
* 查询用户某个站点套餐的站点数量
* @param $uid
* @param $group_id
* @return void
*/
public static function getUserSiteGroupSiteNum($uid, $group_id) {
return Db::name("sys_user_role")->alias('sur')
->join('site s', 'sur.site_id = s.site_id')
->where([
['sur.uid', '=', $uid],
['sur.is_admin', '=', 1],
['s.group_id', '=', $group_id]
])->count();
}
}

View File

@ -100,10 +100,8 @@ class SiteService extends BaseAdminService
*/
public function add(array $data)
{
$user_service = new UserService();
if ($user_service->checkUsername($data[ 'username' ])) throw new AdminException('USERNAME_REPEAT');
$site_group = (new SiteGroup())->where([ ['group_id', '=', $data[ 'group_id' ] ] ])->field('app,addon')->findOrEmpty();
if ($site_group->isEmpty()) throw new CommonException('SITE_GROUP_NOT_EXIST');
$data[ 'app_type' ] = 'site';
//添加站点
@ -276,7 +274,7 @@ class SiteService extends BaseAdminService
$is_admin = $user_role_info['is_admin'];//是否是超级管理员组
}
if ($app_type == AppTypeDict::ADMIN || $is_admin) {
if ($is_admin) {
return ( new MenuService() )->getAllMenuList($app_type, $status, $is_tree, $is_button);
} else {
$user_role_ids = $user_role_info['role_ids'];

View File

@ -12,12 +12,17 @@
namespace app\service\admin\site;
use app\dict\sys\UserDict;
use app\model\sys\SysRole;
use app\model\sys\SysUser;
use app\model\sys\SysUserRole;
use app\model\sys\UserCreateSiteLimit;
use app\service\admin\auth\LoginService;
use app\service\admin\user\UserRoleService;
use app\service\admin\user\UserService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use Exception;
use think\facade\Db;
/**
* 站点用户服务层
@ -40,38 +45,20 @@ class SiteUserService extends BaseAdminService
*/
public function getPage(array $where)
{
$site_id = $this->site_id;
$field = 'id,SysUserRole.uid,site_id,role_ids,SysUserRole.create_time,is_admin,SysUserRole.status,count(site_id) as site_num';
$order = 'SysUserRole.create_time desc';
$search_model = (new SysUserRole())
->field($field)
->order($order)
->with('userinfo')
->hasWhere('userinfo', function ($query) use ($where, $site_id) {
$condition = [
['SysUserRole.site_id', '>', 0 ]
];
$search_model = (new SysUserRole())->order('is_admin desc,id desc')
->with('userinfo')->append(['status_name'])
->hasWhere('userinfo', function ($query) use ($where) {
$condition = [];
if (!empty($where['username'])) $condition[] = ['username', 'like', "%{$where['username']}%"];
if (!empty($where['realname'])) $condition[] = ['realname', 'like', "%{$where['realname']}%"];
//最后登录时间
if (!empty($where['last_time'])) {
$start_time = empty($where['last_time'][0]) ? 0 : strtotime($where['last_time'][0]);
$end_time = empty($where['last_time'][1]) ? 0 : strtotime($where['last_time'][1]);
if ($start_time > 0 && $end_time > 0) {
$condition[] = ['last_time', 'between', [$start_time, $end_time]];
} else if ($start_time > 0 && $end_time == 0) {
$condition[] = ['last_time', '>=', $start_time];
} else if ($start_time == 0 && $end_time > 0) {
$condition[] = ['last_time', '<=', $end_time];
}
}
$query->where($condition);
})
->group('SysUserRole.uid')
->append(['status_name']);
return $this->pageQuery($search_model);
})->where([ ['SysUserRole.site_id', '=', $this->site_id ] ]);
return $this->pageQuery($search_model, function ($item){
if (!empty($item['role_ids'])) {
$item['role_array'] = (new SysRole())->where([ ['role_id', 'in', $item['role_ids'] ] ])->column('role_name');
} else {
$item['role_array'] = [];
}
});
}
/**
@ -81,15 +68,9 @@ class SiteUserService extends BaseAdminService
*/
public function getInfo(int $uid)
{
$field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, delete_time, update_time';
$info = $this->model->where([ ['uid', '=', $uid] ])->field($field)->with(['roles' => function($query) {
$query->field('uid, site_id, is_admin')->with('siteInfo');
}])->findOrEmpty()->toArray();
if (!empty($info)) {
$info['roles'] = array_values(array_filter(array_map(function ($item) {
if ($item['site_id']) return $item;
}, $info['roles'])));
}
$info = (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])
->with('userinfo')->append(['status_name'])
->findOrEmpty()->toArray();
return $info;
}
@ -111,7 +92,20 @@ class SiteUserService extends BaseAdminService
*/
public function edit(int $uid, array $data)
{
return (new UserService())->editSiteUser($uid, $data, $this->site_id);
Db::startTrans();
try {
(new UserService())->edit($uid, $data);
$role_ids = $data['role_ids'] ?? [];
//创建用户站点管理权限
(new UserRoleService())->edit($this->site_id, $uid, $role_ids, $data['status'] ?? UserDict::ON);
Db::commit();
return true;
} catch ( Exception $e) {
Db::rollback();
throw new AdminException($e->getMessage());
}
}
/**
@ -152,7 +146,9 @@ class SiteUserService extends BaseAdminService
* @return bool|true
*/
public function lock(int $uid){
return (new UserService())->statusChange($uid, UserDict::OFF);
(new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => UserDict::OFF]);
LoginService::clearToken($uid);
return true;
}
/**
@ -161,6 +157,8 @@ class SiteUserService extends BaseAdminService
* @return bool|true
*/
public function unlock(int $uid){
return (new UserService())->statusChange($uid, UserDict::ON);
(new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => UserDict::ON]);
LoginService::clearToken($uid);
return true;
}
}

View File

@ -11,6 +11,7 @@
namespace app\service\admin\stat;
use app\model\member\Member;
use app\model\site\Site;
use app\service\admin\site\SiteGroupService;
use app\service\admin\site\SiteService;
@ -83,7 +84,11 @@ class StatService extends BaseAdminService
'image' => 'static/resource/icon/index_icon/wework_qrcode.png',
'desc' => '更多内容请扫码加入'
]
]
],
'member_count_stat' => [
'date' => [],
'value' => []
],
];
$day_start_time = strtotime(date('Y-m-d'));
@ -95,6 +100,10 @@ class StatService extends BaseAdminService
$data['today_data']['today_site_count'] = (new SiteService())->getCount(['create_time' => [$day_start_time, $day_end_time]]);
$data['today_data']['norma_site_count'] = (new SiteService())->getCount(['status' => [1],'app_type' => ['site']]);
$data['today_data']['expire_site_count'] = (new SiteService())->getCount(['status' => [2]]);
$data['today_data']['week_expire_site_count'] = (new Site())->where([
['status', '=', 1],
['expire_time', 'BETWEEN', [time(), time() + 86400*7 ] ]
])->count();
$data['system'] = (new SystemService())->getInfo();
$data['version'] = $data['system']['version'] ?? [];
@ -103,6 +112,9 @@ class StatService extends BaseAdminService
$item_day = date('Y-m-d', strtotime('+' . $i - 7 . ' days', $time));
$data['site_stat']['date'][] = $item_day;
$data['site_stat']['value'][] = (new Site())->where([['create_time','between',get_start_and_end_time_by_day($item_day)]])->count();
$data['member_count_stat']['date'][] = $item_day;
$data['member_count_stat']['value'][] = (new Member())->where([['create_time','between',get_start_and_end_time_by_day($item_day)]])->count();
}
$man_count = (new CoreMemberService())->getCount(['sex' => '1']);
$woman_count = (new CoreMemberService())->getCount(['sex' => '2']);

View File

@ -291,7 +291,7 @@ class AttachmentService extends BaseAdminService
foreach ($icon as $ck => $cv) {
// 素材表中数据保持要一致
$icon[ $ck ][ 'att_id' ] = $cv[ 'icon_id' ];
$icon[ $ck ][ 'url' ] = $v[ 'font_family' ] . '-' . $v[ 'css_prefix_text' ] . $cv[ 'font_class' ];
$icon[ $ck ][ 'url' ] = $v[ 'font_family' ] . ' ' . $v[ 'css_prefix_text' ] . $cv[ 'font_class' ];
$icon[ $ck ][ 'real_name' ] = $cv[ 'name' ];
// 查询名称

View File

@ -240,7 +240,7 @@ class ConfigService extends BaseAdminService
}
/**
* 设置开发者key
* 设置布局风格
* @param array $data
* @return array
*/
@ -252,4 +252,27 @@ class ConfigService extends BaseAdminService
return ( new CoreConfigService() )->setConfig(0, "LAYOUT_SETTING", $config);
}
/**
* 获取色调设置
* @return array
*/
public function getThemeColor()
{
return ( new CoreConfigService() )->getConfigValue(0, "THEMECOLOR_SETTING");
}
/**
* 设置色调
* @param array $data
* @return array
*/
public function setThemeColor(array $data)
{
$config_service = new CoreConfigService();
$config = $config_service->getConfigValue(0, "THEMECOLOR_SETTING");
$config[ $data[ 'key' ] ] = $data[ 'value' ];
return ( new CoreConfigService() )->setConfig(0, "THEMECOLOR_SETTING", $config);
}
}

View File

@ -15,6 +15,7 @@ use app\dict\sys\MenuDict;
use app\dict\sys\MenuTypeDict;
use app\model\sys\SysMenu;
use app\service\admin\addon\AddonService;
use app\service\admin\site\SiteService;
use core\base\BaseAdminService;
use core\dict\DictLoader;
use core\exception\AdminException;
@ -193,20 +194,36 @@ class MenuService extends BaseAdminService
*/
public function getAllMenuList($app_type = '', $status = 'all', $is_tree = 0, $is_button = 0)
{
$cache_name = 'menu_api_' .$app_type.'_'. $status . '_' . $is_tree . '_' . $is_button;
$site_id = $this->site_id;
$cache_name = 'site_menu_api_' .$app_type.'_'. $status . '_' . $is_tree . '_' . $is_button . '_' . $this->site_id;
$menu_list = cache_remember(
$cache_name,
function () use ($status, $is_tree, $is_button, $app_type) {
function () use ($status, $is_tree, $is_button, $app_type, $site_id) {
$where = [
// ['menu_type', 'in', [0,1]]
['app_type', '=', $app_type],
['addon', 'in', array_merge([''], get_site_addons($site_id)) ]
];
if ($status != 'all') {
$where[] = ['status', '=', $status];
}
// 排除菜单
$delete_menu_addon = [];
$addon_loader = new DictLoader("Menu");
foreach (get_site_addons($site_id) as $addon) {
$delete_menu = $addon_loader->load(["addon" => $addon, "app_type" => $app_type])['delete'] ?? [];
if (!empty($delete_menu) && is_array($delete_menu)) $delete_menu_addon[] = $delete_menu;
}
if (!empty($delete_menu_addon)) {
$delete_intersect = array_intersect(...$delete_menu_addon);
if (!empty($delete_intersect)) {
$where[] = ['menu_key', 'not in', $delete_intersect];
}
}
return $this->model->where($where)->order('sort desc')->select()->toArray();
},
self::$cache_tag_name
[self::$cache_tag_name, SiteService::$cache_tag_name]
);
foreach ($menu_list as &$v)
{
@ -218,9 +235,7 @@ class MenuService extends BaseAdminService
$v['menu_name'] = $lang_menu_name;
}
}
return $is_tree ? $this->menuToTree($menu_list, 'menu_key', 'parent_key', 'children', 'auth', '', $is_button) : $menu_list;
}

View File

@ -179,15 +179,4 @@ class SystemService extends BaseAdminService
}
return false;
}
/**
* 设置布局
* @param string $key
*/
public function setLayout(string $key) {
$layouts = array_column(event('SiteLayout'), 'key');
if (!in_array($key, $layouts)) throw new CommonException('LAYOUT_NOT_EXIST');
(new CoreConfigService())->setConfig($this->site_id, 'SITE_LAYOUT', [ 'key' => $key ]);
return true;
}
}

View File

@ -368,6 +368,8 @@ class UpgradeService extends BaseAdminService
dir_copy($code_dir . 'uni-app', $this->root_path . 'uni-app');
$addon_list = (new CoreAddonService())->getInstallAddonList();
$depend_service = new CoreDependService();
if (!empty($addon_list)) {
foreach ($addon_list as $addon => $item) {
@ -384,6 +386,21 @@ class UpgradeService extends BaseAdminService
// 编译 加载插件标题语言包
$this->compileLocale($this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $addon);
// 合并插件依赖
$addon_uniapp_package = str_replace('/', DIRECTORY_SEPARATOR, project_path() . "niucloud/addon/{$addon}/package/uni-app-package.json");
if (file_exists($addon_uniapp_package)) {
$original = $depend_service->getNpmContent('uni-app');
$new = $depend_service->jsonFileToArray($addon_uniapp_package);
foreach ($new as $name => $value) {
$original[$name] = isset($original[$name]) && is_array($original[$name]) ? array_merge($original[$name], $new[$name]) : $new[$name];
}
$uniapp_package = $this->root_path . 'uni-app' . DIRECTORY_SEPARATOR . 'package.json';
$depend_service->writeArrayToJsonFile($original, $uniapp_package);
}
}
}
return true;

View File

@ -12,6 +12,7 @@
namespace app\service\admin\user;
use app\dict\sys\UserDict;
use app\model\sys\SysRole;
use app\model\sys\SysUserRole;
use app\service\admin\sys\RoleService;
@ -52,13 +53,16 @@ class UserRoleService extends BaseAdminService
$role_data = array(
'uid' => $uid,
'is_admin' => $is_admin,
'site_id' => $site_id == 0 ? $this->site_id : $site_id
'site_id' => $site_id == 0 ? $this->site_id : $site_id,
'status' => $data['status'] ?? UserDict::ON
);
if(!$is_admin){
//校验权限越界
$role_data['role_ids'] = $data['role_ids'] ?? [];
}
$user_role_model->save($role_data);
Cache::delete('user_role_'.$uid.'_'.$site_id);
Cache::delete('user_role_list_' .$uid);
return true;
}
@ -69,7 +73,7 @@ class UserRoleService extends BaseAdminService
* @param array $role_ids
* @return bool
*/
public function edit(int $site_id, int $uid, array $role_ids){
public function edit(int $site_id, int $uid, array $role_ids, $status = UserDict::ON){
$user_role = $this->model->where([['uid', '=', $uid], ['site_id', '=', $site_id]])->findOrEmpty();
if ($user_role->isEmpty())
throw new AdminException('NO_SITE_USER_ROLE');
@ -77,14 +81,15 @@ class UserRoleService extends BaseAdminService
$is_admin = $user_role->is_admin;
if($is_admin)//超级管理员不允许改动权限
throw new AdminException('ADMIN_NOT_ALLOW_EDIT_ROLE');
$user_role->status = $status;
if (!empty(array_diff_assoc($role_ids, $user_role->role_ids))) {
//校验权限越界
$user_role->save(['role_ids' => $role_ids]);
$cache_name = 'user_role_'.$uid.'_'.$site_id;
Cache::delete($cache_name);
return true;
$user_role->role_ids = $role_ids;
}
return false;
Cache::delete('user_role_'.$uid.'_'.$site_id);
Cache::delete('user_role_list_' .$uid);
$user_role->save();
return true;
}
/**

View File

@ -16,12 +16,15 @@ use app\dict\sys\AppTypeDict;
use app\dict\sys\UserDict;
use app\model\sys\SysUser;
use app\model\sys\SysUserRole;
use app\model\sys\UserCreateSiteLimit;
use app\service\admin\auth\AuthService;
use app\service\admin\auth\LoginService;
use core\base\BaseAdminService;
use core\exception\AdminException;
use core\exception\CommonException;
use Exception;
use think\db\exception\DbException;
use think\facade\Cache;
use think\facade\Db;
use think\Model;
@ -45,7 +48,15 @@ class UserService extends BaseAdminService
*/
public function getPage(array $where)
{
return $this->getPageList($this->model, $where, 'uid,username,head_img,real_name,last_ip,last_time,login_count,status', 'uid desc',['status_name']);
AuthService::isSuperAdmin();
$super_admin_uid = Cache::get('super_admin_uid');
$field = 'uid,username,head_img,real_name,last_ip,last_time,login_count,status';
$search_model = $this->model->withSearch([ 'username', 'real_name', 'last_time' ], $where)->field($field)->append([ 'status_name' ])->order('uid desc');
return $this->pageQuery($search_model, function ($item) use ($super_admin_uid) {
$item['site_num'] = (new SysUserRole())->where([['uid', '=', $item['uid']], ['site_id', '<>', request()->defaultSiteId() ] ])->count();
$item['is_super_admin'] = $super_admin_uid == $item['uid'];
});
}
@ -55,68 +66,26 @@ class UserService extends BaseAdminService
* @return array
*/
public function getInfo(int $uid){
AuthService::isSuperAdmin();
$super_admin_uid = Cache::get('super_admin_uid');
$where = array(
['uid', '=', $uid],
);
$field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time';
$user = $this->model->where($where)->field($field)->append(['status_name'])->findOrEmpty();
return $user->toArray();
}
/**
* 获取用户列表
* @param array $where
* @return array
*/
public function getUserAdminPage(array $where)
{
$site_id = $this->site_id;
$field = 'id,SysUserRole.uid,site_id,role_ids,SysUserRole.create_time,is_admin,SysUserRole.status';
$order = 'SysUserRole.create_time desc';
$search_model = (new SysUserRole())
->field($field)
->order($order)
->with('userinfo')
->hasWhere('userinfo', function ($query) use ($where, $site_id) {
$condition = [
['SysUserRole.site_id', '=', $site_id ]
];
if (!empty($where['username'])) $condition[] = ['username', 'like', "%{$where['username']}%"];
if (!empty($where['realname'])) $condition[] = ['realname', 'like', "%{$where['realname']}%"];
$query->where($condition);
})
->append(['status_name']);
return $this->pageQuery($search_model, function ($item, $key) {
if (!empty($item->role_ids)) {
$item->role_array = (new UserRoleService())->getRoleByUserRoleIds($item->role_ids, $this->site_id);
} else {
$item->role_array = [];
}
});
}
/**
* 获取用户信息
* @param int $uid
* @return array
*/
public function getUserAdminInfo(int $uid)
{
$field = 'id,uid,site_id,role_ids,create_time,is_admin,status';
$info = (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id ] ])
->field($field)
->with('userinfo')
->findOrEmpty()
->toArray();
$field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, delete_time, update_time';
$info = $this->model->where($where)->field($field)->findOrEmpty()->toArray();
if (!empty($info)) {
if (!empty($info['role_ids'])) {
$info['role_array'] = (new UserRoleService())->getRoleByUserRoleIds($info['role_ids'], $this->site_id);
} else {
$info['role_array'] = [];
}
$info['roles'] = (new SysUserRole())->where([['uid', '=', $info['uid']], ['site_id', '<>', request()->defaultSiteId() ] ])
->field('*')
->with(['site_info' => function($query) {
$query->field('site_id, site_name, app_type, status, expire_time');
}])
->select()
->toArray();
$info['is_super_admin'] = $super_admin_uid == $info['uid'];
}
return $info;
}
@ -127,15 +96,40 @@ class UserService extends BaseAdminService
* @throws Exception
*/
public function add(array $data){
$user_data = [
'username' => $data['username'],
'head_img' => $data['head_img'],
'status' => $data['status'],
'real_name' => $data['real_name'],
'password' => create_password($data['password'])
];
$user = $this->model->create($user_data);
return $user?->uid;
if ($this->checkUsername($data['username'])) throw new CommonException('USERNAME_REPEAT');
Db::startTrans();
try {
$user_data = [
'username' => $data['username'],
'head_img' => $data['head_img'],
'status' => $data['status'],
'real_name' => $data['real_name'],
'password' => create_password($data['password'])
];
$user = $this->model->create($user_data);
// 添加用户建站限制
$create_site_limit = $data['create_site_limit'] ?? [];
if (!empty($create_site_limit)) {
$create_site_limit_save = [];
foreach ($create_site_limit as $item) {
$create_site_limit_save[] = [
'group_id' => $item['group_id'],
'uid' => $user?->uid,
'num' => $item['num'],
'month' => $item['month']
];
}
(new UserCreateSiteLimit())->saveAll($create_site_limit_save);
}
Db::commit();
return $user?->uid;
} catch (\Exception $e) {
Db::rollback();
throw new AdminException($e->getMessage());
}
}
/**
@ -162,7 +156,7 @@ class UserService extends BaseAdminService
$role_ids = $data['role_ids'] ?? [];
$is_admin = $data['is_admin'] ?? 0;
//创建用户站点管理权限
(new UserRoleService())->add($uid, ['role_ids' => $role_ids, 'is_admin' => $is_admin], $site_id);
(new UserRoleService())->add($uid, ['role_ids' => $role_ids, 'is_admin' => $is_admin, 'status' => $data['status'] ], $site_id);
Db::commit();
return $uid;
} catch ( Exception $e) {
@ -171,31 +165,6 @@ class UserService extends BaseAdminService
}
}
/**
* 更新对应站点用户
* @param $uid
* @param $data
* @param $site_id
* @return true
*/
public function editSiteUser($uid, $data, $site_id)
{
Db::startTrans();
try {
//添加用户
$this->edit($uid, $data);
$role_ids = $data['role_ids'] ?? [];
$is_admin = $data['is_admin'] ?? 0;
//创建用户站点管理权限
(new UserRoleService())->edit($site_id, $uid, $role_ids);
Db::commit();
return true;
} catch ( Exception $e) {
Db::rollback();
throw new AdminException($e->getMessage());
}
}
/**
* 检测用户名是否重复
* @param $username
@ -237,7 +206,6 @@ class UserService extends BaseAdminService
];
$is_off_status = false;
if(isset($data['status'])){
$this->statusChange($uid, $data['status']);
if($data['status'] == UserDict::OFF)
$is_off_status = true;
}
@ -272,9 +240,7 @@ class UserService extends BaseAdminService
* @return true
*/
public function statusChange($uid, $status) {
(new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => $status]);
LoginService::clearToken($uid);
return true;
}
/**
@ -306,7 +272,7 @@ class UserService extends BaseAdminService
* @param array $where
* @return array
*/
public function getUserAllPage(array $where)
public function getUserAll(array $where)
{
$field = 'uid, username, head_img';
return $this->model->withSearch(['username', 'realname', 'create_time'], $where)
@ -315,4 +281,63 @@ class UserService extends BaseAdminService
->select()
->toArray();
}
/**
* 获取用户站点创建限制
* @param int $uid
* @return void
*/
public function getUserCreateSiteLimit(int $uid) {
return (new UserCreateSiteLimit())->where([ ['uid', '=', $uid] ])->select()->toArray();
}
/**
* 获取用户站点创建限制
* @param int $uid
* @return void
*/
public function getUserCreateSiteLimitInfo(int $id) {
return (new UserCreateSiteLimit())->where([ ['id', '=', $id] ])->findOrEmpty()->toArray();
}
/**
* 添加用户站点创建限制
* @param array $data
* @return void
*/
public function addUserCreateSiteLimit(array $data) {
(new UserCreateSiteLimit())->where(['uid' => $data['uid'], 'group_id' => $data['group_id']])->delete();
(new UserCreateSiteLimit())->save( [
'uid' => $data['uid'],
'group_id' => $data['group_id'],
'num' => $data['num'],
'month' => $data['month']
]);
return true;
}
/**
* 编辑用户站点创建限制
* @param $id
* @param array $data
* @return true
*/
public function editUserCreateSiteLimit($id, array $data) {
(new UserCreateSiteLimit())->update( [
'num' => $data['num'],
'month' => $data['month']
], ['id' => $id ]);
return true;
}
/**
* 删除用户站点创建限制
* @param $id
* @return true
*/
public function delUserCreateSiteLimit($id) {
(new UserCreateSiteLimit())->where(['id' => $id ])->delete();
return true;
}
}

View File

@ -45,6 +45,18 @@ class VerifierService extends BaseAdminService
});
}
/**
* 获取核销员表列表
* @param array $where
* @return array
*/
public function getList(array $where = [])
{
return $this->model->where([['site_id', '=', $this->site_id]])->with(['member' => function ($query) {
$query->field('member_id, nickname, mobile, headimg');
}])->field('*')->order('create_time desc')->select()->toArray();
}
/**
* 组合整理数据
* @param $data

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