diff --git a/niucloud/app/adminapi/controller/web/Adv.php b/niucloud/app/adminapi/controller/web/Adv.php new file mode 100644 index 000000000..4a6a6f6ba --- /dev/null +++ b/niucloud/app/adminapi/controller/web/Adv.php @@ -0,0 +1,133 @@ +request->params([ + [ 'adv_key', '' ] + ]); + return success(( new AdvService() )->getPage($data)); + } + + /** + * 获取广告列表 + * @return \think\Response + */ + public function lists() + { + $data = $this->request->params([ + [ 'adv_key', '' ] + ]); + return success(( new AdvService() )->getList($data)); + } + + /** + * 广告详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id) + { + return success(( new AdvService() )->getInfo($id)); + } + + /** + * 添加广告 + * @return \think\Response + */ + public function add() + { + $data = $this->request->params([ + [ 'adv_key', '' ], + [ 'adv_title', '' ], + [ 'adv_url', '' ], + [ 'adv_image', '' ], + [ 'sort', 0 ], + [ 'background', '#FFFFFF' ], + ]); + $id = ( new AdvService() )->add($data); + return success('ADD_SUCCESS', [ 'id' => $id ]); + } + + /** + * 广告编辑 + * @param $id 广告id + * @return \think\Response + */ + public function edit($id) + { + $data = $this->request->params([ + [ 'adv_key', '' ], + [ 'adv_title', '' ], + [ 'adv_url', '' ], + [ 'adv_image', '' ], + [ 'sort', 0 ], + [ 'background', '#FFFFFF' ], + ]); + ( new AdvService() )->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 广告删除 + * @param int $id + * @return Response + */ + public function del(int $id) + { + ( new AdvService() )->del($id); + return success('DELETE_SUCCESS'); + } + + /** + * 修改广告位排序号 + * @return \think\Response + */ + public function editSort() + { + $data = $this->request->params([ + [ 'id', '' ], + [ 'sort', '' ], + ]); + ( new AdvService() )->editSort($data); + return success('SUCCESS'); + } + +} diff --git a/niucloud/app/adminapi/controller/web/Config.php b/niucloud/app/adminapi/controller/web/Config.php new file mode 100644 index 000000000..5379394b2 --- /dev/null +++ b/niucloud/app/adminapi/controller/web/Config.php @@ -0,0 +1,34 @@ +getLink()); + } +} diff --git a/niucloud/app/adminapi/controller/web/FriendlyLink.php b/niucloud/app/adminapi/controller/web/FriendlyLink.php new file mode 100644 index 000000000..168077b80 --- /dev/null +++ b/niucloud/app/adminapi/controller/web/FriendlyLink.php @@ -0,0 +1,110 @@ +request->params([ + [ 'link_title', '' ] + ]); + return success(( new FriendlyLinkService() )->getPage($data)); + } + + /** + * 友情链接详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id) + { + return success(( new FriendlyLinkService() )->getInfo($id)); + } + + /** + * 添加友情链接 + * @return \think\Response + */ + public function add() + { + $data = $this->request->params([ + [ 'link_pic', '' ], + [ 'link_title', '' ], + [ 'link_url', '' ], + [ 'sort', 0 ], + [ 'is_show', 0 ] + ]); + $this->validate($data, 'app\validate\web\FriendlyLink.add'); + $id = ( new FriendlyLinkService() )->add($data); + return success('ADD_SUCCESS', [ 'id' => $id ]); + } + + /** + * 友情链接编辑 + * @param int $id 友情链接id + * @return Response + */ + public function edit(int $id) + { + $data = $this->request->params([ + [ 'link_pic', '' ], + [ 'link_title', '' ], + [ 'link_url', '' ], + [ 'sort', 0 ], + [ 'is_show', 0 ] + ]); + $this->validate($data, 'app\validate\web\FriendlyLink.edit'); + ( new FriendlyLinkService() )->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 友情链接删除 + * @param int $id 友情链接id + * @return Response + */ + public function del(int $id) + { + ( new FriendlyLinkService() )->del($id); + return success('DELETE_SUCCESS'); + } + + /** + * 修改友情链接排序号 + * @return \think\Response + */ + public function editSort() + { + $data = $this->request->params([ + [ 'id', '' ], + [ 'sort', '' ], + ]); + ( new FriendlyLinkService() )->editSort($data); + return success('SUCCESS'); + } + +} diff --git a/niucloud/app/adminapi/controller/web/Nav.php b/niucloud/app/adminapi/controller/web/Nav.php new file mode 100644 index 000000000..deb9c1b1a --- /dev/null +++ b/niucloud/app/adminapi/controller/web/Nav.php @@ -0,0 +1,121 @@ +request->params([ + [ "nav_title", "" ], + ]); + return success(( new NavService() )->getPage($data)); + } + + /** + * 获取首页导航列表 + * @return \think\Response + */ + public function lists() + { + $data = $this->request->params([ + [ "nav_title", "" ] + ]); + return success(( new NavService() )->getList($data)); + } + + /** + * 首页导航详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id) + { + return success(( new NavService() )->getInfo($id)); + } + + /** + * 添加首页导航 + * @return \think\Response + */ + public function add() + { + $data = $this->request->params([ + [ "nav_title", "" ], + [ "nav_url", "" ], + [ "sort", "" ], + [ "is_blank", "" ], + [ "is_show", "" ], + ]); + $id = ( new NavService() )->add($data); + return success('ADD_SUCCESS', [ 'id' => $id ]); + } + + /** + * 首页导航编辑 + * @param $id 首页导航id + * @return \think\Response + */ + public function edit($id) + { + $data = $this->request->params([ + [ "nav_title", "" ], + [ "nav_url", "" ], + [ "sort", "" ], + [ "is_blank", "" ], + [ "is_show", "" ], + ]); + ( new NavService() )->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 首页导航删除 + * @param int $id 首页导航id + * @return Response + */ + public function del(int $id) + { + ( new NavService() )->del($id); + return success('DELETE_SUCCESS'); + } + + /** + * 修改首页导航排序号 + * @return \think\Response + */ + public function editSort() + { + $data = $this->request->params([ + [ 'id', '' ], + [ 'sort', '' ], + ]); + ( new NavService() )->editSort($data); + return success('SUCCESS'); + } + +} diff --git a/niucloud/app/adminapi/route/diy.php b/niucloud/app/adminapi/route/diy.php index d6ecef716..8ef020ca7 100644 --- a/niucloud/app/adminapi/route/diy.php +++ b/niucloud/app/adminapi/route/diy.php @@ -95,4 +95,4 @@ Route::group('diy', function() { AdminCheckToken::class, AdminCheckRole::class, AdminLog::class -]); \ No newline at end of file +]); diff --git a/niucloud/app/adminapi/route/web.php b/niucloud/app/adminapi/route/web.php new file mode 100644 index 000000000..57be30b2a --- /dev/null +++ b/niucloud/app/adminapi/route/web.php @@ -0,0 +1,89 @@ +middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); diff --git a/niucloud/app/api/controller/sys/Config.php b/niucloud/app/api/controller/sys/Config.php index f3118c628..ca971bec5 100644 --- a/niucloud/app/api/controller/sys/Config.php +++ b/niucloud/app/api/controller/sys/Config.php @@ -15,9 +15,7 @@ use app\service\api\diy\DiyConfigService; use app\service\api\member\MemberConfigService; use app\service\api\member\MemberLevelService; use app\service\api\member\MemberService; -use app\service\api\site\SiteService; use app\service\api\sys\ConfigService; -use app\service\api\wechat\WechatAuthService; use core\base\BaseApiController; use think\Response; @@ -90,6 +88,8 @@ class Config extends BaseApiController $res[ 'login_config' ] = ( new MemberConfigService() )->getLoginConfig($data[ 'url' ]); ( new MemberService() )->initMemberData(); + + event('initWap'); return success($res); } } diff --git a/niucloud/app/api/controller/sys/Verify.php b/niucloud/app/api/controller/sys/Verify.php index c19835535..67e68251c 100644 --- a/niucloud/app/api/controller/sys/Verify.php +++ b/niucloud/app/api/controller/sys/Verify.php @@ -32,11 +32,13 @@ class Verify extends BaseApiController /** * 获取核销码信息 - * @param $code * @return Response */ - public function getInfoByCode($code){ - return success(data:(new VerifyService())->getInfoByCode($code)); + public function getInfoByCode(){ + $data = $this->request->params([ + ['code', ''], + ]); + return success(data:(new VerifyService())->getInfoByCode($data['code'])); } /** * 核销 diff --git a/niucloud/app/api/controller/web/Adv.php b/niucloud/app/api/controller/web/Adv.php new file mode 100644 index 000000000..d0ba6ef7c --- /dev/null +++ b/niucloud/app/api/controller/web/Adv.php @@ -0,0 +1,28 @@ +request->params([ + [ 'adv_key', '' ] + ]); + return success(( new AdvService() )->getInfo($data[ 'adv_key' ])); + } + +} diff --git a/niucloud/app/api/controller/web/FriendlyLink.php b/niucloud/app/api/controller/web/FriendlyLink.php new file mode 100644 index 000000000..bc3a4bc5c --- /dev/null +++ b/niucloud/app/api/controller/web/FriendlyLink.php @@ -0,0 +1,29 @@ +getList()); + } + +} diff --git a/niucloud/app/api/controller/web/Nav.php b/niucloud/app/api/controller/web/Nav.php new file mode 100644 index 000000000..58e334e97 --- /dev/null +++ b/niucloud/app/api/controller/web/Nav.php @@ -0,0 +1,29 @@ +getList()); + } + +} diff --git a/niucloud/app/api/controller/wechat/Wechat.php b/niucloud/app/api/controller/wechat/Wechat.php index 9375de9be..ad69883e4 100644 --- a/niucloud/app/api/controller/wechat/Wechat.php +++ b/niucloud/app/api/controller/wechat/Wechat.php @@ -11,6 +11,7 @@ namespace app\api\controller\wechat; +use app\service\api\wechat\WechatConfigService; use app\service\api\wechat\WechatAuthService; use core\base\BaseController; use think\db\exception\DataNotFoundException; @@ -135,6 +136,15 @@ class Wechat extends BaseController return success($wechat_auth_service->scanLogin()); } + /** + * 检查微信公众号是否配置 + * @return Response + */ + public function checkWechatConfig() + { + return success('SUCCESS', (new WechatConfigService())->checkWechatConfig()); + } + /** * 更新openid * @return Response diff --git a/niucloud/app/api/middleware/ApiCheckToken.php b/niucloud/app/api/middleware/ApiCheckToken.php index 3839096a4..f00d926a9 100644 --- a/niucloud/app/api/middleware/ApiCheckToken.php +++ b/niucloud/app/api/middleware/ApiCheckToken.php @@ -37,7 +37,8 @@ class ApiCheckToken public function handle(Request $request, Closure $next, bool $is_throw_exception = false) { $request->appType(AppTypeDict::API); - + // 校验渠道 + ( new AuthService() )->checkChannel($request); //通过配置来设置系统header参数 try { $token = $request->apiToken(); @@ -47,8 +48,6 @@ class ApiCheckToken } //校验会员和站点 ( new AuthService() )->checkMember($request); - // 校验渠道 - ( new AuthService() )->checkChannel($request); } catch (AuthException $e) { //是否将登录错误抛出 if ($is_throw_exception) diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index b00f0c493..2b371fd48 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -46,6 +46,8 @@ Route::group(function() { Route::get('wechat/user', 'wechat.Wechat/getWechatUser'); //公众号通过授权信息登录 Route::post('wechat/userlogin', 'wechat.Wechat/wechatLogin'); + //检查微信公众号是否配置 + Route::get('wechat/check', 'wechat.Wechat/checkWechatConfig'); //公众号通过code登录 Route::post('wechat/login', 'wechat.Wechat/login'); @@ -132,7 +134,7 @@ Route::group(function() { //核销详情 Route::get('verify_detail/:code', 'sys.Verify/detail'); //通过code码获取核销信息 - Route::get('get_verify_by_code/:code', 'sys.Verify/getInfoByCode'); + Route::get('get_verify_by_code', 'sys.Verify/getInfoByCode'); //核销操作 Route::post('verify/:code', 'sys.Verify/verify'); diff --git a/niucloud/app/api/route/web.php b/niucloud/app/api/route/web.php new file mode 100644 index 000000000..524594a06 --- /dev/null +++ b/niucloud/app/api/route/web.php @@ -0,0 +1,36 @@ +middleware(ApiChannel::class) + ->middleware(ApiCheckToken::class)//false表示不验证登录 + ->middleware(ApiLog::class); diff --git a/niucloud/app/dict/diy/ComponentDict.php b/niucloud/app/dict/diy/ComponentDict.php index 2f4d431b2..83e51c1d4 100644 --- a/niucloud/app/dict/diy/ComponentDict.php +++ b/niucloud/app/dict/diy/ComponentDict.php @@ -95,6 +95,7 @@ class ComponentDict 'sort' => 10002, 'value' => [ "imageHeight" => 180, + "isSameScreen"=> false, "list" => [ [ "link" => [ @@ -485,8 +486,8 @@ class ComponentDict "topRounded" => 12, // 组件上圆角 "bottomRounded" => 12, // 组件下圆角 "elementBgColor" => '#FFFAF5', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 + "topElementRounded" => 10,// 元素上圆角 + "bottomElementRounded" => 10, // 元素下圆角 "margin" => [ "top" => 10, // 上边距 "bottom" => 10, // 下边距 diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index b16c345e1..3b49c5fc2 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -288,7 +288,211 @@ return [ 'sort' => '0', 'status' => '1', 'is_show' => '0', - ] + ], + [ + 'menu_name' => '电脑端', + 'menu_key' => 'diy_web', + 'menu_short_name' => '电脑端', + 'menu_type' => '0', + 'icon' => 'iconfont icondesktop', + 'api_url' => '', + 'router_path' => 'web', + 'view_path' => '', + 'methods' => '', + 'sort' => '93', + 'status' => '1', + 'is_show' => '1', + 'children' =>[ + [ + 'menu_name' => '首页导航', + 'menu_key' => 'diy_web_nav', + 'menu_short_name' => '首页导航', + 'menu_type' => '1', + 'icon' => 'iconfont-iconshouye1', + 'api_url' => '', + 'router_path' => 'web/nav', + 'view_path' => 'web/nav', + 'methods' => '', + 'sort' => '100', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '首页导航添加', + 'menu_key' => 'diy_web_nav_add', + 'menu_short_name' => '首页导航添加', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/nav', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '首页导航编辑', + 'menu_key' => 'diy_web_nav_edit', + 'menu_short_name' => '首页导航编辑', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/nav/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '首页导航删除', + 'menu_key' => 'diy_web_nav_delete', + 'menu_short_name' => '首页导航删除', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/nav/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + [ + 'menu_name' => '广告位', + 'menu_key' => 'web_adv_position', + 'menu_short_name' => '广告位', + 'menu_type' => '1', + 'icon' => 'iconfont-icontupianguanggao1', + 'api_url' => '', + 'router_path' => 'web/adv_position', + 'view_path' => 'web/adv_position', + 'methods' => 'get', + 'sort' => '99', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '广告管理', + 'menu_key' => 'web_adv', + 'menu_short_name' => '广告', + 'menu_type' => '1', + 'icon' => 'element-House', + 'api_url' => '', + 'router_path' => 'web/adv', + 'view_path' => 'web/adv', + 'methods' => '', + 'sort' => '0', + 'status' => '1', + 'is_show' => '0', + 'children' => [ + [ + 'menu_name' => '广告添加', + 'menu_key' => 'web_adv_add', + 'menu_short_name' => '广告添加', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/adv', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '广告编辑', + 'menu_key' => 'web_adv_edit', + 'menu_short_name' => '广告编辑', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/adv/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '广告删除', + 'menu_key' => 'web_adv_delete', + 'menu_short_name' => '广告删除', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/adv/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + [ + 'menu_name' => '友情链接', + 'menu_key' => 'diy_web_friendly_link', + 'menu_short_name' => '友情链接', + 'menu_type' => '1', + 'icon' => 'iconfont-iconyouqinglianjie1', + 'api_url' => '', + 'router_path' => 'web/friendly_link', + 'view_path' => 'web/friendly_link', + 'methods' => '', + 'sort' => '98', + 'status' => '1', + 'is_show' => '1', + 'children' => [ + [ + 'menu_name' => '友情链接添加', + 'menu_key' => 'diy_web_friendly_link_add', + 'menu_short_name' => '友情链接添加', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/friendly_link', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'post', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '友情链接编辑', + 'menu_key' => 'diy_web_friendly_link_edit', + 'menu_short_name' => '友情链接编辑', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/friendly_link/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'put', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ], + [ + 'menu_name' => '友情链接删除', + 'menu_key' => 'diy_web_friendly_link_delete', + 'menu_short_name' => '友情链接删除', + 'menu_type' => '2', + 'icon' => '', + 'api_url' => 'web/friendly_link/', + 'router_path' => '', + 'view_path' => '', + 'methods' => 'delete', + 'sort' => '1', + 'status' => '1', + 'is_show' => '1', + ] + ] + ], + ], + ], ], ], [ diff --git a/niucloud/app/dict/web/AdvPositionDict.php b/niucloud/app/dict/web/AdvPositionDict.php new file mode 100644 index 000000000..c5dc969c0 --- /dev/null +++ b/niucloud/app/dict/web/AdvPositionDict.php @@ -0,0 +1,38 @@ + '', //关键字不能重复 +// 'ap_name' => '', //广告位名称 +// 'ap_desc' => '', //广告位简介 +// 'default_content' => [], //默认数据 +// 'ap_bg_color' => '', //背景色,默认白色 +// ] + ]; + return ( new DictLoader("AdvPosition") )->load($system_adv_position); + } + +} diff --git a/niucloud/app/dict/web/WebLinkDict.php b/niucloud/app/dict/web/WebLinkDict.php new file mode 100644 index 000000000..4c660f62c --- /dev/null +++ b/niucloud/app/dict/web/WebLinkDict.php @@ -0,0 +1,132 @@ + 'addon' + * 查询插件的链接列表,包括系统的链接 addon 格式:'addon' => 'shop' + * @param array $params + * @return array|null + */ + public static function getLink($params = []) + { + $system_links = [ + 'SYSTEM_LINK' => [ + 'title' => get_lang('dict_diy.system_link'), + 'addon_info' => [ + 'title' => '系统', + 'key' => 'app' + ], + 'child_list' => [ + [ + 'name' => 'INDEX', + 'title' => get_lang('dict_diy.system_web_index'), + 'url' => '/app/index', + 'is_share' => 1, + 'action' => '' // 默认空,decorate 表示支持装修 + ], + ] + ], + 'MEMBER_LINK' => [ + 'title' => get_lang('dict_diy.member_link'), + 'addon_info' => [ + 'title' => '系统', + 'key' => 'app' + ], + 'child_list' => [ + [ + 'name' => 'AUTH_LOGIN', + 'title' => get_lang('dict_diy.auth_login'), + 'url' => '/auth/login', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'AUTH_REGISTER', + 'title' => get_lang('dict_diy.auth_register'), + 'url' => '/auth/register', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'AUTH_BIND', + 'title' => get_lang('dict_diy.auth_bind'), + 'url' => '/auth/bind', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'MEMBER_CENTER', + 'title' => get_lang('dict_diy.member_my_personal'), + 'url' => '/member/center', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'MEMBER_BALANCE', + 'title' => get_lang('dict_diy.member_my_balance'), + 'url' => '/member/balance', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'MEMBER_POINT', + 'title' => get_lang('dict_diy.member_my_point'), + 'url' => '/member/point', + 'is_share' => 1, + 'action' => '' + ], + [ + 'name' => 'MEMBER_ADDRESS', + 'title' => get_lang('dict_diy.member_my_address'), + 'url' => '/member/address_list', + 'is_share' => 1, + 'action' => '' + ] + ] + ], + 'DIY_LINK' => [ + 'title' => get_lang('dict_diy.diy_link'), + 'addon_info' => [ + 'title' => '系统', + 'key' => 'app' + ], + 'child_list' => [] + ] + ]; + + // 查询存在页面路由的应用插件列表 + if (!empty($params[ 'query' ]) && $params[ 'query' ] == 'addon') { + $system = [ + 'app' => [ + 'title' => '系统', + 'key' => 'app' + ] + ]; + $addons = (new DictLoader("WebLink"))->load([ 'data' => $system, 'params' => $params ]); + $app = array_merge($system, $addons); + return $app; + } else { + return (new DictLoader("WebLink"))->load([ 'data' => $system_links, 'params' => $params ]); + } + } + +} diff --git a/niucloud/app/install/source/database.sql b/niucloud/app/install/source/database.sql index 02a550258..082906bb5 100644 --- a/niucloud/app/install/source/database.sql +++ b/niucloud/app/install/source/database.sql @@ -75,6 +75,19 @@ CREATE TABLE `applet_version` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本表' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `web_adv`; +CREATE TABLE `web_adv` ( + `adv_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `adv_key` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '广告位key', + `adv_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容描述', + `adv_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告链接', + `adv_image` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容图片', + `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', + `background` VARCHAR(255) NOT NULL DEFAULT '#FFFFFF' COMMENT '背景色', + PRIMARY KEY (`adv_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='广告表'; + + DROP TABLE IF EXISTS `diy_page`; CREATE TABLE `diy_page` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -878,6 +891,32 @@ CREATE TABLE `weapp_version` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小程序版本' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `web_friendly_link`; +CREATE TABLE `web_friendly_link` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '索引id', + `link_title` VARCHAR(100) NOT NULL COMMENT '标题', + `link_url` VARCHAR(100) NOT NULL COMMENT '链接', + `link_pic` VARCHAR(100) NOT NULL COMMENT '图片', + `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', + `is_show` INT(11) NOT NULL DEFAULT 1 COMMENT '是否显示 1.是 2.否', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='电脑端友情链接表'; + + +DROP TABLE IF EXISTS `web_nav`; +CREATE TABLE `web_nav` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', + `nav_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '导航名称', + `nav_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '链接地址', + `sort` INT(11) NOT NULL COMMENT '排序号', + `is_blank` INT(11) DEFAULT 0 COMMENT '是否新打开', + `create_time` INT(11) DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) DEFAULT 0 COMMENT '修改时间', + `is_show` SMALLINT(6) NOT NULL DEFAULT 1 COMMENT '是否显示 1显示 0不显示', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='PC导航管理'; + + DROP TABLE IF EXISTS `wechat_fans`; CREATE TABLE `wechat_fans` ( `fans_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '粉丝ID', diff --git a/niucloud/app/install/view/index/step-5.html b/niucloud/app/install/view/index/step-5.html index 55c0cb248..41f5a02df 100644 --- a/niucloud/app/install/view/index/step-5.html +++ b/niucloud/app/install/view/index/step-5.html @@ -25,7 +25,6 @@ } .pop-link-wrap .link-text:nth-child(2){ margin-top: 10px; - } .pop-link-wrap .link-text:nth-child(2) a{ color: var(--base-color); @@ -46,7 +45,7 @@
- +
{if $is_build == 1} @@ -127,7 +126,7 @@ // 页面跳转 function pageToLink(type,flag = false){ if(flag){ - window.localStorage.setItem('pageToLinkTips', true) + window.localStorage.setItem('pageToLinkTips', true) } if(type == 'admin'){ layer.closeAll() diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php index 7f771d0ba..c933c369b 100644 --- a/niucloud/app/lang/zh-cn/api.php +++ b/niucloud/app/lang/zh-cn/api.php @@ -131,6 +131,8 @@ return [ 'NOTICE_SMS_NOT_OPEN' => '短信未启用', 'NOTICE_TEMPLATE_IS_NOT_EXIST' => '消息不存在', + 'WEB_ADV_POSITION_NOT_EXIST' => '广告位不存在', + //会员相关 'MOBILE_IS_EXIST' => '当前手机号已绑定账号', 'ACCOUNT_INSUFFICIENT' => '账户余额不足', @@ -238,6 +240,8 @@ return [ 'REFUND_HAD_APPLIED' => '订单已申请退款', 'ORDER_UNPAID_NOT_ALLOW_APPLY_REFUND' => '订单尚未支付不能进行退款', + //会员套餐 + 'RECHARGE_NOT_EXIST' => '充值套餐不存在', // 缓存相关 'CLEAR_MYSQL_CACHE_SUCCESS' => '数据表缓存清除成功', diff --git a/niucloud/app/lang/zh-cn/dict.php b/niucloud/app/lang/zh-cn/dict.php index 2fdf11dda..3e23a58b5 100644 --- a/niucloud/app/lang/zh-cn/dict.php +++ b/niucloud/app/lang/zh-cn/dict.php @@ -227,6 +227,11 @@ return [ 'member_verify_index' => '核销台', 'member_contact' => '客服', + 'system_web_index' => '系统首页', + 'auth_login' => '登录', + 'auth_register' => '注册', + 'auth_bind' => '手机号绑定', + 'diy_page' => '自定义页面', 'diy_link' => '自定义链接', 'diy_jump_other_applet' => '小程序跳转', diff --git a/niucloud/app/model/web/Adv.php b/niucloud/app/model/web/Adv.php new file mode 100644 index 000000000..61d20ef53 --- /dev/null +++ b/niucloud/app/model/web/Adv.php @@ -0,0 +1,70 @@ +where("adv_key", "=", $value); + } + } + + /** + * 获取广告位名称 + * @param $value + * @param $data + * @return mixed|string + */ + public function getApNameAttr($value, $data) + { + if (empty($data[ 'adv_key' ])) + return ''; + $adv_position = AdvPositionDict::getAdvPosition(); + $position_list = array_column($adv_position, null, 'keywords'); + return $position_list[ $data[ 'adv_key' ] ][ 'ap_name' ] ?? ''; + } + +} diff --git a/niucloud/app/model/web/FriendlyLink.php b/niucloud/app/model/web/FriendlyLink.php new file mode 100644 index 000000000..d258fac7a --- /dev/null +++ b/niucloud/app/model/web/FriendlyLink.php @@ -0,0 +1,51 @@ +where("link_title", 'like', '%' . $value . '%'); + } + } + + +} diff --git a/niucloud/app/model/web/Nav.php b/niucloud/app/model/web/Nav.php new file mode 100644 index 000000000..279899474 --- /dev/null +++ b/niucloud/app/model/web/Nav.php @@ -0,0 +1,55 @@ +where('nav_title', 'like', '%' . $value . '%'); + } + } + +} diff --git a/niucloud/app/service/admin/upgrade/BackupService.php b/niucloud/app/service/admin/upgrade/BackupService.php index cc549837f..69d82757f 100644 --- a/niucloud/app/service/admin/upgrade/BackupService.php +++ b/niucloud/app/service/admin/upgrade/BackupService.php @@ -87,7 +87,7 @@ class BackupService extends UpgradeService $prefix = config('database.connections.' . config('database.default'))[ 'prefix' ]; if ($this->upgrade_task[ 'upgrade' ][ 'app_key' ] == AddonDict::FRAMEWORK_KEY) { // 不需要备份的表 - $noot_need_backup = [ "{$prefix}sys_user_log", "{$prefix}jobs", "{$prefix}jobs_failed" ]; + $noot_need_backup = [ "{$prefix}sys_schedule_log", "{$prefix}sys_user_log", "{$prefix}jobs", "{$prefix}jobs_failed" ]; $sys_models = ( new GenerateService() )->getModels([ 'addon' => 'system' ]); foreach ($sys_models as $model) { $name = "\\$model"; @@ -101,9 +101,14 @@ class BackupService extends UpgradeService $addon_models = ( new GenerateService() )->getModels([ 'addon' => $this->upgrade_task[ 'upgrade' ][ 'app_key' ] ]); foreach ($addon_models as $model) { try { + // 不需要备份的表 + $noot_need_backup = [ "{$prefix}shop_stat", "{$prefix}shop_goods_stat", "{$prefix}shop_goods_browse" ]; $name = "\\$model"; $class = new $name(); - $tables[] = $class->getTable(); + + if (!in_array($class->getTable(), $noot_need_backup)) { + $tables[] = $class->getTable(); + } } catch (\Exception $e) { } } diff --git a/niucloud/app/service/admin/web/AdvService.php b/niucloud/app/service/admin/web/AdvService.php new file mode 100644 index 000000000..781d324a1 --- /dev/null +++ b/niucloud/app/service/admin/web/AdvService.php @@ -0,0 +1,121 @@ +model = new Adv(); + } + + /** + * 获取广告列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'adv_id, adv_key, adv_title, adv_url, adv_image, sort, background'; + $order = 'adv_id desc'; + + $search_model = $this->model->withSearch([ 'adv_key' ], $where)->field($field)->append([ 'ap_name' ])->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 获取广告列表 + * @param array $where + * @param string $field + * @return array + */ + public function getList(array $where = [], $field = 'adv_id, adv_key, adv_title, adv_url, adv_image, sort, background') + { + $order = 'adv_id desc'; + return $this->model->withSearch([ 'adv_key' ], $where)->field($field)->append([ "ap_name" ])->order($order)->select()->toArray(); + } + + /** + * 获取广告信息 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $field = 'adv_id, adv_key, adv_title, adv_url, adv_image, sort, background'; + $info = $this->model->field($field)->where([ [ 'adv_id', '=', $id ] ])->append([ "ap_name" ])->findOrEmpty()->toArray(); + return $info; + } + + /** + * 添加广告 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + $adv_position = AdvPositionDict::getAdvPosition(); + $position_list = array_column($adv_position, null, 'keywords'); + if (!array_key_exists($data[ 'adv_key' ], $position_list)) throw new AdminException("WEB_ADV_POSITION_NOT_EXIST"); + $res = $this->model->create($data); + return $res->adv_id; + } + + /** + * 广告编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + $adv_position = AdvPositionDict::getAdvPosition(); + $position_list = array_column($adv_position, null, 'keywords'); + if (!array_key_exists($data[ 'adv_key' ], $position_list)) throw new AdminException("WEB_ADV_POSITION_NOT_EXIST"); + $this->model->where([ [ 'adv_id', '=', $id ] ])->update($data); + return true; + } + + /** + * 删除广告 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $model = $this->model->where([ [ 'adv_id', '=', $id ] ])->find(); + $res = $model->delete(); + return $res; + } + + /** + * 修改广告位排序号 + * @param array $data + * @return Adv|bool + */ + public function editSort($data) + { + return $this->model->where([ [ 'adv_id', '=', $data[ 'id' ] ] ])->update([ 'sort' => $data[ 'sort' ] ]); + } + +} diff --git a/niucloud/app/service/admin/web/FriendlyLinkService.php b/niucloud/app/service/admin/web/FriendlyLinkService.php new file mode 100644 index 000000000..dcd98b302 --- /dev/null +++ b/niucloud/app/service/admin/web/FriendlyLinkService.php @@ -0,0 +1,106 @@ +model = new FriendlyLink(); + } + + /** + * 获取友情链接列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'id,link_pic,link_title,link_url,sort,is_show'; + $order = 'id desc'; + + $search_model = $this->model->withSearch([ 'link_title' ], $where)->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 获取友情链接信息 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $field = 'id,link_pic,link_title,link_url,sort,is_show'; + + $info = $this->model->field($field)->where([ [ 'id', "=", $id ] ])->findOrEmpty()->toArray(); + return $info; + } + + /** + * 添加友情链接 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 友情链接编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + + $this->model->where([ [ 'id', '=', $id ] ])->update($data); + return true; + } + + /** + * 删除友情链接 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $model = $this->model->where([ [ 'id', '=', $id ] ])->find(); + $res = $model->delete(); + return $res; + } + + /** + * 修改友情链接排序号 + * @param array $data + * @return FriendlyLink|bool + */ + public function editSort($data) + { + return $this->model->where([ [ 'id', '=', $data[ 'id' ] ] ])->update([ 'sort' => $data[ 'sort' ] ]); + } + +} diff --git a/niucloud/app/service/admin/web/NavService.php b/niucloud/app/service/admin/web/NavService.php new file mode 100644 index 000000000..fce2ee86d --- /dev/null +++ b/niucloud/app/service/admin/web/NavService.php @@ -0,0 +1,118 @@ +model = new Nav(); + } + + + /** + * 获取首页导航列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'id, nav_title, nav_url, sort, is_blank, create_time, update_time, is_show'; + $order = 'create_time desc'; + + $search_model = $this->model->withSearch([ "nav_title" ], $where)->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 获取首页导航列表 + * @param array $where + * @param string $field + * @return array + */ + public function getList(array $where = [], $field = 'id, nav_title, nav_url, sort, is_blank, create_time, update_time, is_show') + { + $order = "create_time desc"; + return $this->model->withSearch([ "nav_title" ], $where)->field($field)->select()->order($order)->toArray(); + } + + /** + * 获取首页导航信息 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $field = 'id, nav_title, nav_url, sort, is_blank, create_time, update_time, is_show'; + $info = $this->model->field($field)->where([ [ 'id', '=', $id ] ])->findOrEmpty()->toArray(); + return $info; + } + + /** + * 添加首页导航 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + $data[ 'create_time' ] = time(); + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 首页导航编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + $data[ 'update_time' ] = time(); + $this->model->where([ [ 'id', '=', $id ] ])->update($data); + return true; + } + + /** + * 删除首页导航 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $model = $this->model->where([ [ 'id', '=', $id ] ])->find(); + $res = $model->delete(); + return $res; + } + + /** + * 修改首页导航排序号 + * @param array $data + * @return Nav|bool + */ + public function editSort($data) + { + return $this->model->where([ [ 'id', '=', $data[ 'id' ] ] ])->update([ 'sort' => $data[ 'sort' ] ]); + } +} diff --git a/niucloud/app/service/admin/web/WebService.php b/niucloud/app/service/admin/web/WebService.php new file mode 100644 index 000000000..5235140b0 --- /dev/null +++ b/niucloud/app/service/admin/web/WebService.php @@ -0,0 +1,44 @@ + $v) { + $link[ $k ][ 'name' ] = $k; + if (!empty($v[ 'child_list' ])) { + foreach ($v[ 'child_list' ] as $ck => $cv) { + $link[ $k ][ 'child_list' ][ $ck ][ 'parent' ] = $k; + } + } + + } + return $link; + } +} diff --git a/niucloud/app/service/admin/wechat/WechatConfigService.php b/niucloud/app/service/admin/wechat/WechatConfigService.php index 5bdf19d74..b8e047ba3 100644 --- a/niucloud/app/service/admin/wechat/WechatConfigService.php +++ b/niucloud/app/service/admin/wechat/WechatConfigService.php @@ -61,4 +61,5 @@ class WechatConfigService extends BaseAdminService public function getWechatStaticInfo(){ return (new CoreWechatConfigService())->getWechatStaticInfo(); } + } diff --git a/niucloud/app/service/api/member/MemberAccountService.php b/niucloud/app/service/api/member/MemberAccountService.php index 2b20445e7..1aba9ab76 100644 --- a/niucloud/app/service/api/member/MemberAccountService.php +++ b/niucloud/app/service/api/member/MemberAccountService.php @@ -112,7 +112,7 @@ class MemberAccountService extends BaseApiService $where[ 'member_id' ] = $this->member_id; $where[ 'create_time' ] = $data[ 'create_time' ]; $field = 'id, member_id, account_type, account_data, account_sum, from_type, related_id, create_time, memo'; - $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->where($type_where)->withSearch([ 'member_id', 'create_time' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); + $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->where($type_where)->withSearch([ 'member_id', 'create_time' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]); return $this->pageQuery($search_model); } @@ -200,4 +200,4 @@ class MemberAccountService extends BaseApiService return $arr_return_data; } -} \ No newline at end of file +} diff --git a/niucloud/app/service/api/web/AdvService.php b/niucloud/app/service/api/web/AdvService.php new file mode 100644 index 000000000..efbcfd838 --- /dev/null +++ b/niucloud/app/service/api/web/AdvService.php @@ -0,0 +1,48 @@ +model = new Adv(); + } + + /** + * 获取广告信息 + * @param string $adv_key + * @return mixed + */ + public function getInfo(string $adv_key) + { + $adv_position = AdvPositionDict::getAdvPosition(); + $position_list = array_column($adv_position, null, 'keywords'); + if (!array_key_exists($adv_key, $position_list)) throw new ApiException("WEB_ADV_POSITION_NOT_EXIST"); + $info = $position_list[ $adv_key ]; + $info[ 'adv_list' ] = $this->model->where([ [ 'adv_key', '=', $adv_key ] ])->order('sort desc')->select()->toArray(); + return $info; + } + +} diff --git a/niucloud/app/service/api/web/FriendlyLinkService.php b/niucloud/app/service/api/web/FriendlyLinkService.php new file mode 100644 index 000000000..ff14af12b --- /dev/null +++ b/niucloud/app/service/api/web/FriendlyLinkService.php @@ -0,0 +1,44 @@ +model = new FriendlyLink(); + } + + /** + * 获取友情链接 + * @param array $where + * @return array + */ + public function getList() + { + $field = 'id,link_title,link_url,link_pic,sort'; + $order = 'sort desc'; + $list = $this->model->field($field)->where([['is_show', '=', 1]])->order($order)->select()->toArray(); + return $list; + } + +} diff --git a/niucloud/app/service/api/web/NavService.php b/niucloud/app/service/api/web/NavService.php new file mode 100644 index 000000000..7251feb39 --- /dev/null +++ b/niucloud/app/service/api/web/NavService.php @@ -0,0 +1,44 @@ +model = new Nav(); + } + + /** + * 获取导航列表 + * @param array $where + * @return array + */ + public function getList() + { + $field = 'id,nav_title,nav_url,sort,is_blank'; + $order = 'sort desc'; + $list = $this->model->field($field)->where([ [ 'is_show', '=', 1 ] ])->order($order)->select()->toArray(); + return $list; + } + +} diff --git a/niucloud/app/service/api/wechat/WechatConfigService.php b/niucloud/app/service/api/wechat/WechatConfigService.php new file mode 100644 index 000000000..c05f25d08 --- /dev/null +++ b/niucloud/app/service/api/wechat/WechatConfigService.php @@ -0,0 +1,37 @@ +getWechatConfig(); + if ( empty($config['app_id']) ) { + return false; + } else { + return true; + } + } +} \ No newline at end of file diff --git a/niucloud/app/service/core/member/CoreMemberCashOutService.php b/niucloud/app/service/core/member/CoreMemberCashOutService.php index 6509987a0..16d414024 100644 --- a/niucloud/app/service/core/member/CoreMemberCashOutService.php +++ b/niucloud/app/service/core/member/CoreMemberCashOutService.php @@ -75,7 +75,6 @@ class CoreMemberCashOutService extends BaseCoreService /** * 审核通过 - * @param MemberCashOut $cash_out * @param array $data * @return true @@ -98,7 +97,6 @@ class CoreMemberCashOutService extends BaseCoreService /** * 拒绝 - * @param MemberCashOut $cash_out * @param array $data * @return true @@ -143,7 +141,15 @@ class CoreMemberCashOutService extends BaseCoreService $data['transfer_account'] = $cash_out['transfer_account']; $transfer_type = $cash_out['transfer_type']; if($transfer_type == TransferDict::WECHAT){ + //根据转账方式和会员的授权信息来判断可以使用的转账方式 $member = (new CoreMemberService())->find($cash_out['member_id']); + if(!empty($member['wx_openid'])){ + $data['openid'] = $member['wx_openid']; + } else if(!empty($member['weapp_openid'])){ + $data['openid'] = $member['wweapp_openid']; + }else{ + $data['openid'] = ''; + } $data['openid'] = $member['wx_openid']; } }else{ @@ -263,7 +269,6 @@ class CoreMemberCashOutService extends BaseCoreService /** * 返还用户的对应账户 - * @param MemberCashOut $cash_out * @return true */ diff --git a/niucloud/app/service/core/member/CoreMemberService.php b/niucloud/app/service/core/member/CoreMemberService.php index 44c5b897c..1e7974381 100644 --- a/niucloud/app/service/core/member/CoreMemberService.php +++ b/niucloud/app/service/core/member/CoreMemberService.php @@ -171,7 +171,7 @@ class CoreMemberService extends BaseCoreService */ public static function sendGrowth(int $member_id, string $key, array $param = []) { $config = (new CoreMemberConfigService())->getGrowthRuleConfig(); - if (!isset($config[$key]) || empty($config[$key]) || !$config[$key]['is_use']) return true; + if (!isset($config[$key]) || empty($config[$key]) || empty($config[$key]['is_use'])) return true; $config = $config[$key]; @@ -204,7 +204,7 @@ class CoreMemberService extends BaseCoreService */ public static function sendPoint(int $member_id, string $key, array $param = []) { $config = (new CoreMemberConfigService())->getPointRuleConfig()['grant'] ?? []; - if (!isset($config[$key]) || empty($config[$key]) || !$config[$key]['is_use']) return true; + if (!isset($config[$key]) || empty($config[$key]) || empty($config[$key]['is_use'])) return true; $config = $config[$key]; diff --git a/niucloud/app/service/core/wechat/CoreWechatServeService.php b/niucloud/app/service/core/wechat/CoreWechatServeService.php index efa828cf1..60ce350c2 100644 --- a/niucloud/app/service/core/wechat/CoreWechatServeService.php +++ b/niucloud/app/service/core/wechat/CoreWechatServeService.php @@ -138,7 +138,7 @@ class CoreWechatServeService extends BaseCoreService } $scene = [ $sceneKey => $key ]; $param = [ - 'expire_seconds' => $expire_seconds, + 'expire_seconds' => $expire_seconds, // 二维码的有效时间 'action_name' => $type, 'action_info' => [ 'scene' => $scene diff --git a/niucloud/app/upgrade/v143/Upgrade.php b/niucloud/app/upgrade/v143/Upgrade.php new file mode 100644 index 000000000..fcace9edc --- /dev/null +++ b/niucloud/app/upgrade/v143/Upgrade.php @@ -0,0 +1,54 @@ +handleDiyData(); + } + + /** + * 处理自定义数据 + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + private function handleDiyData() + { + $diy_model = new Diy(); + $where = [ + [ 'value', '<>', '' ] + ]; + $field = 'id,name,title,template,value'; + $list = $diy_model->where($where)->field($field)->select()->toArray(); + + if (!empty($list)) { + foreach ($list as $k => $v) { + $diy_data = json_decode($v[ 'value' ], true); + + foreach ($diy_data[ 'value' ] as $ck => $cv) { + + // 图片广告 组件 + if ($cv[ 'componentName' ] == 'ImageAds') { + + if (!isset($diy_data[ 'value' ][ $ck ][ 'isSameScreen' ])) { + $diy_data[ 'value' ][ $ck ][ 'isSameScreen' ] = false; + } + + } + + } + + $diy_data = json_encode($diy_data); + $diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]); + } + } + + } + +} diff --git a/niucloud/app/upgrade/v143/upgrade.sql b/niucloud/app/upgrade/v143/upgrade.sql new file mode 100644 index 000000000..5dfd74447 --- /dev/null +++ b/niucloud/app/upgrade/v143/upgrade.sql @@ -0,0 +1,38 @@ + +DROP TABLE IF EXISTS `web_nav`; +CREATE TABLE `web_nav` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', + `nav_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '导航名称', + `nav_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '链接地址', + `sort` INT(11) NOT NULL COMMENT '排序号', + `is_blank` INT(11) DEFAULT 0 COMMENT '是否新打开', + `create_time` INT(11) DEFAULT 0 COMMENT '创建时间', + `update_time` INT(11) DEFAULT 0 COMMENT '修改时间', + `is_show` SMALLINT(6) NOT NULL DEFAULT 1 COMMENT '是否显示 1显示 0不显示', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='PC导航管理'; + + +DROP TABLE IF EXISTS `web_friendly_link`; +CREATE TABLE `web_friendly_link` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '索引id', + `link_title` VARCHAR(100) NOT NULL COMMENT '标题', + `link_url` VARCHAR(100) NOT NULL COMMENT '链接', + `link_pic` VARCHAR(100) NOT NULL COMMENT '图片', + `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', + `is_show` INT(11) NOT NULL DEFAULT 1 COMMENT '是否显示 1.是 2.否', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='电脑端友情链接表'; + + +DROP TABLE IF EXISTS `web_adv`; +CREATE TABLE `web_adv` ( + `adv_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `adv_key` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '广告位key', + `adv_title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容描述', + `adv_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告链接', + `adv_image` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '广告内容图片', + `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', + `background` VARCHAR(255) NOT NULL DEFAULT '#FFFFFF' COMMENT '背景色', + PRIMARY KEY (`adv_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='广告表'; diff --git a/niucloud/app/validate/article/Article.php b/niucloud/app/validate/article/Article.php deleted file mode 100644 index 4a6b27f86..000000000 --- a/niucloud/app/validate/article/Article.php +++ /dev/null @@ -1,57 +0,0 @@ - 'require|max:20', - 'intro' => 'max:50', - 'summary' => 'max:50', - 'image' => 'max:100', - 'author' => 'max:20', - 'is_show' => 'number|between:0,1', - 'sort' => 'number|between:0,10000', - 'category_id' => 'number|require', - 'content' => 'require', - ]; - - protected $message = [ - 'title.require' => 'validate_article.title_require', - 'title.max' => 'validate_article.title_max', - 'intro.max' => 'validate_article.intro_max', - 'summary.max' => 'validate_article.summary_max', - 'image.max' => 'validate_article.image_max', - 'author.max' => 'validate_article.author_max', - 'is_show.number' => 'validate_article.is_show_number', - 'is_show.between' => 'validate_article.is_show_between', - 'sort.number' => 'validate_article.sort_number', - 'sort.between' => 'validate_article.sort_between', - 'category_id.require' => 'validate_article.category_id_require', - 'category_id.number' => 'validate_article.category_id_number', - 'content.require' => 'validate_article.content_require', - ]; - - protected $scene = [ - 'add' => ['title', 'intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'], - 'edit' => ['title', 'intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'], - ]; -} diff --git a/niucloud/app/validate/article/ArticleCategory.php b/niucloud/app/validate/article/ArticleCategory.php deleted file mode 100644 index ac5102f6b..000000000 --- a/niucloud/app/validate/article/ArticleCategory.php +++ /dev/null @@ -1,45 +0,0 @@ - 'require|max:20', - 'is_show' => 'number|between:0,1', - 'sort' => 'number|between:0,10000' - ]; - - protected $message = [ - 'name.require' => 'validate_article.cate_name_require', - 'name.max' => 'validate_article.cate_name_max', - 'is_show.number' => 'validate_article.is_show_number', - 'is_show.between' => 'validate_article.is_show_between', - 'sort.number' => 'validate_article.sort_number', - 'sort.between' => 'validate_article.sort_between', - ]; - - protected $scene = [ - 'add' => ['name', 'is_show', 'sort'], - 'edit' => ['name', 'is_show', 'sort'], - ]; -} diff --git a/niucloud/app/validate/web/FriendlyLink.php b/niucloud/app/validate/web/FriendlyLink.php new file mode 100644 index 000000000..8e2e81265 --- /dev/null +++ b/niucloud/app/validate/web/FriendlyLink.php @@ -0,0 +1,39 @@ + 'require', + 'link_url' => 'require', + ]; + + protected $message = [ + 'link_title.require' => [ 'common_validate.require', [ 'link_title' ] ], + 'link_url.require' => [ 'common_validate.require', [ 'link_url' ] ], + ]; + + protected $scene = [ + "add" => [ 'link_pic', 'link_title', 'link_url', 'is_show' ], + "edit" => [ 'link_pic', 'link_title', 'link_url', 'is_show' ] + ]; + +} diff --git a/niucloud/config/version.php b/niucloud/config/version.php index b313d2e32..c03c5082f 100644 --- a/niucloud/config/version.php +++ b/niucloud/config/version.php @@ -1,6 +1,7 @@ '1.4.2', - 'code' => '202411210001' + 'version' => '1.4.3', + 'code' => '202412120001' ]; + \ No newline at end of file diff --git a/niucloud/core/dict/AdvPosition.php b/niucloud/core/dict/AdvPosition.php new file mode 100644 index 000000000..a4a1fc305 --- /dev/null +++ b/niucloud/core/dict/AdvPosition.php @@ -0,0 +1,38 @@ +getLocalAddons(); + $adv_position_files = []; + foreach ($addons as $v) { + $adv_position_path = $this->getAddonDictPath($v) . "web" . DIRECTORY_SEPARATOR . "adv_position.php"; + if (is_file($adv_position_path)) { + $adv_position_files[] = $adv_position_path; + } + } + $adv_position_file_data = $this->loadFiles($adv_position_files); + $adv_position = $data; + foreach ($adv_position_file_data as $file_data) { + $adv_position = empty($adv_position) ? $file_data : array_merge($adv_position, $file_data); + } + return $adv_position; + } +} diff --git a/niucloud/core/dict/PackageGift.php b/niucloud/core/dict/PackageGift.php new file mode 100644 index 000000000..f790da461 --- /dev/null +++ b/niucloud/core/dict/PackageGift.php @@ -0,0 +1 @@ +// | 官方网址:https://www.niucloud.com diff --git a/niucloud/core/dict/WebLink.php b/niucloud/core/dict/WebLink.php new file mode 100644 index 000000000..629ccca7e --- /dev/null +++ b/niucloud/core/dict/WebLink.php @@ -0,0 +1,75 @@ +getLocalAddons(); + } + + $link_files = []; + + foreach ($addons as $v) { + $link_path = $this->getAddonDictPath($v) . "web" . DIRECTORY_SEPARATOR . "web_links.php"; + if (is_file($link_path)) { + $link_files[ $v ] = $link_path; + } + } + + $addon_service = new AddonService(); + $addon_info_list = $addon_service->getAddonListByKeys(array_keys($link_files)); + + if (!empty($params[ 'params' ][ 'query' ]) && $params[ 'params' ][ 'query' ] == 'addon') { + $list_key = array_column($addon_info_list, 'key'); + $addon_info_list = array_combine($list_key, $addon_info_list); + return $addon_info_list; + } else { + + $links = $params[ 'data' ]; + + foreach ($link_files as $k => $v) { + $addon_link = include $v; + if (!empty($addon_link)) { + $addon_info = []; + foreach ($addon_info_list as $ck => $cv) { + if ($cv[ 'key' ] == $k) { + $addon_info = $cv; + break; + } + } + + foreach ($addon_link as $ck => $cv) { + $addon_link[ $ck ][ 'addon_info' ] = $addon_info; + } + $links = array_merge($links, $addon_link); + } + } + + return $links; + } + } +}