update niucloud

This commit is contained in:
全栈小学生 2023-10-23 17:19:10 +08:00
parent 2f59c7d5f0
commit ffa375f219
42 changed files with 2092 additions and 1744 deletions

View File

@ -205,17 +205,4 @@ class Diy extends BaseAdminController
return success(( new DiyService() )->changeTemplate($data)); return success(( new DiyService() )->changeTemplate($data));
} }
/**
* 获取页面预览数据
*/
public function getPreviewData()
{
$data = $this->request->params([
[ "id", "" ],
[ 'name', '' ]
]);
$res = ( new DiyService() )->getPreviewData($data);
return success($res);
}
} }

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\pay;
use app\dict\pay\RefundDict;
use app\service\admin\pay\RefundService;
use core\base\BaseAdminController;
class PayRefund extends BaseAdminController
{
/**
* 退款列表
* @return \think\Response
*/
public function pages()
{
$data = $this->request->params([
['refund_no', ''],
['create_time', []],
['status', '']
]);
return success(data: (new RefundService())->getPage($data));
}
/**
* 退款详情
* @param $refund_no
* @return \think\Response
*/
public function detail($refund_no)
{
return success(data: (new RefundService())->getDetail($refund_no));
}
/**
* 获取退款方式
*/
public function getRefundType()
{
return success(data:(new RefundDict())->getType());
}
/**
* 转账
* @return \think\Response
*/
public function transfer()
{
$data = $this->request->params([
['refund_no', ''],
['refund_type', []],
['voucher', '']
]);
return success(data:(new RefundService())->refund($data));
}
}

View File

@ -99,4 +99,13 @@ class System extends BaseAdminController
$key = input('key', ''); $key = input('key', '');
return success(data: ( new SystemService() )->setLayout($key)); return success(data: ( new SystemService() )->setLayout($key));
} }
/**
* 环境变量查询
* @return Response
*/
public function getEnvInfo()
{
return success(['app_debug' => env('app_debug', false)]);
}
} }

View File

@ -68,9 +68,6 @@ Route::group('diy', function() {
// 编辑自定义页面分享内容 // 编辑自定义页面分享内容
Route::put('diy/share', 'diy.Diy/modifyShare'); Route::put('diy/share', 'diy.Diy/modifyShare');
// 获取页面预览数据
Route::put('preview', 'diy.Diy/getPreviewData');
/***************************************************** 配置相关 *****************************************************/ /***************************************************** 配置相关 *****************************************************/
// 底部导航查询 // 底部导航查询

View File

@ -48,6 +48,15 @@ Route::group('pay', function () {
Route::get('account/stat', 'pay.Account/stat'); Route::get('account/stat', 'pay.Account/stat');
//账单类型 //账单类型
Route::get('account/type', 'pay.Account/accountType'); Route::get('account/type', 'pay.Account/accountType');
/***************************************************** 退款 *************************************************/
//退款列表
Route::get('refund', 'pay.PayRefund/pages');
//退款详情
Route::get('refund/:refund_no', 'pay.PayRefund/detail');
//退款方式
Route::get('refund/type', 'pay.PayRefund/getRefundType');
//退款转账
Route::post('refund/transfer', 'pay.PayRefund/transfer');
})->middleware([ })->middleware([
AdminCheckToken::class, AdminCheckToken::class,
AdminCheckRole::class, AdminCheckRole::class,

View File

@ -158,8 +158,8 @@ Route::group('sys', function () {
Route::get('job', 'sys.System/checkJob'); Route::get('job', 'sys.System/checkJob');
//校验计划任务 //校验计划任务
Route::get('schedule', 'sys.System/checkSchedule'); Route::get('schedule', 'sys.System/checkSchedule');
//环境变量
Route::get('env', 'sys.System/getEnvInfo');
/***************************************************** 计划任务 ****************************************************/ /***************************************************** 计划任务 ****************************************************/
//计划任务列表 //计划任务列表
Route::get('schedule/list', 'sys.Schedule/lists'); Route::get('schedule/list', 'sys.Schedule/lists');

View File

@ -54,6 +54,7 @@ class Address extends BaseApiController
["city_id",0], ["city_id",0],
["district_id",0], ["district_id",0],
["address",""], ["address",""],
["address_name", ""],
["full_address",""], ["full_address",""],
["lng",""], ["lng",""],
["lat",""], ["lat",""],
@ -78,6 +79,7 @@ class Address extends BaseApiController
["city_id",0], ["city_id",0],
["district_id",0], ["district_id",0],
["address",""], ["address",""],
["address_name", ""],
["full_address",""], ["full_address",""],
["lng",""], ["lng",""],
["lat",""], ["lat",""],

View File

@ -256,24 +256,13 @@ class ComponentDict
'list' => [] 'list' => []
], ],
], ],
'GoodsList' => [
'title' => '商品列表',
'icon' => 'iconfont-iconshangpinliebiao',
'path' => 'edit-goods-list',
'support_page' => [],
'uses' => 0,
'sort' => 10009,
'value' => [
'list' => []
],
],
'Notice' => [ 'Notice' => [
'title' => '公告', 'title' => '公告',
'icon' => 'iconfont-icongonggao', 'icon' => 'iconfont-icongonggao',
'path' => 'edit-notice', 'path' => 'edit-notice',
'support_page' => [], 'support_page' => [],
'uses' => 0, 'uses' => 0,
'sort' => 10009, 'sort' => 10010,
'value' => [ 'value' => [
"list" => [ "list" => [
"link" => [ "link" => [
@ -284,7 +273,7 @@ class ComponentDict
"iconType" => "system", "iconType" => "system",
"systemIcon" => "style_01", "systemIcon" => "style_01",
"showType" => "popup", "showType" => "popup",
"imageUrld" => "" "imageUrl" => ""
], ],
] ]
], ],

View File

@ -33,7 +33,7 @@ class LinkDict
'title' => get_lang('dict_diy.system_link_index'), 'title' => get_lang('dict_diy.system_link_index'),
'url' => '/app/pages/index/index', 'url' => '/app/pages/index/index',
'is_share' => 1, 'is_share' => 1,
'action' => '' // 默认空decorate 表示支持装修 'action' => 'decorate' // 默认空decorate 表示支持装修
], ],
] ]
], ],
@ -47,7 +47,7 @@ class LinkDict
'title' => get_lang('dict_diy.member_index'), 'title' => get_lang('dict_diy.member_index'),
'url' => '/app/pages/member/index', 'url' => '/app/pages/member/index',
'is_share' => 1, 'is_share' => 1,
'action' => '' 'action' => 'decorate'
], ],
[ [
'name' => 'MEMBER_PERSONAL', 'name' => 'MEMBER_PERSONAL',
@ -76,6 +76,13 @@ class LinkDict
'url' => '/app/pages/member/commission', 'url' => '/app/pages/member/commission',
'is_share' => 1, 'is_share' => 1,
'action' => '' 'action' => ''
],
[
'name' => 'MEMBER_ADDRESS',
'title' => get_lang('dict_diy.member_my_address'),
'url' => '/app/pages/member/address',
'is_share' => 1,
'action' => ''
] ]
] ]
], ],

View File

@ -223,8 +223,12 @@ class PagesDict
"bottom" => 6, "bottom" => 6,
"both" => 16 "both" => 16
], ],
"style" => "style-1",
"styleName" => "风格1",
"textColor" => "#FFFFFF", "textColor" => "#FFFFFF",
"bgUrl" => "static/resource/images/diy/member_style1_bg.png" "bgUrl" => "static/resource/images/diy/member_style1_bg.png",
"bgColorStart" => "",
"bgColorEnd" => ""
], ],
[ [
"path" => "edit-graphic-nav", "path" => "edit-graphic-nav",
@ -558,7 +562,11 @@ class PagesDict
"both" => 0 "both" => 0
], ],
"textColor" => "#FFFFFF", "textColor" => "#FFFFFF",
"bgUrl" => "" "bgUrl" => "",
"style" => "style-1",
"styleName" => "风格1",
"bgColorStart" => "",
"bgColorEnd" => ""
], ],
[ [
"path" => "edit-graphic-nav", "path" => "edit-graphic-nav",
@ -822,18 +830,7 @@ class PagesDict
] ]
] ]
], ]
// 'recharge' => [
// "title" => "旅游", // 页面名称
// 'cover' => 'static/resource/images/diy/template/tourism_member_index_cover.png', // 页面封面图
// 'preview' => '', // 页面预览图
// 'desc' => '酒店旅游住宿门票景点', // 页面描述
// 'mode' => 'fixed', // 页面模式diy自定义fixed固定
// 'data' => [
// 'component' => 'recharge-member', // 模板组件名称
// 'link' => '' // 装修链接
// ]
// ]
] ]
]; ];

View File

@ -26,17 +26,17 @@ class TemplateDict
$system_pages = [ $system_pages = [
'DIY_INDEX' => [ 'DIY_INDEX' => [
'title' => get_lang('dict_diy.page_index'), 'title' => get_lang('dict_diy.page_index'),
'page' => 'app/pages/index/index', 'page' => '/app/pages/index/index',
'action' => 'decorate' // 页面是否装修标识为空标识不装修decorate装修 'action' => 'decorate' // 页面是否装修标识为空标识不装修decorate装修
], ],
'DIY_MEMBER_INDEX' => [ 'DIY_MEMBER_INDEX' => [
'title' => get_lang('dict_diy.page_member_index'), 'title' => get_lang('dict_diy.page_member_index'),
'page' => 'app/pages/member/index', 'page' => '/app/pages/member/index',
'action' => 'decorate' 'action' => 'decorate'
], ],
'DIY_PAGE' => [ 'DIY_PAGE' => [
'title' => get_lang('dict_diy.page_diy'), 'title' => get_lang('dict_diy.page_diy'),
'page' => 'app/pages/index/diy', 'page' => '/app/pages/index/diy',
'action' => '' 'action' => ''
] ]
]; ];

View File

@ -1,6 +1,44 @@
<?php <?php
return return [
[ [
'menu_name' => '应用管理',
'menu_key' => 'app_manage',
'menu_type' => 1,
'icon' => 'element-Monitor',
'api_url' => '',
'router_path' => 'app_manage',
'view_path' => '',
'methods' => '',
'sort' => 99,
'status' => 1,
'is_show' => 0,
'children' => [
[
'menu_name' => '应用管理',
'menu_key' => 'app_manage_index',
'menu_type' => 1,
'icon' => '',
'api_url' => '',
'router_path' => '',
'view_path' => 'index/app_manage',
'methods' => 'get',
'status' => 1,
],
[
'menu_name' => '插件管理',
'menu_key' => 'app_manage_store',
'menu_type' => 1,
'icon' => 'iconfont-iconchajian1',
'api_url' => 'addon/local',
'router_path' => 'app_store',
'view_path' => 'index/store',
'methods' => 'get',
'sort' => 20,
'status' => 1,
'is_show' => 1
]
]
],
[ [
'menu_name' => '概况', 'menu_name' => '概况',
'menu_key' => 'overview', 'menu_key' => 'overview',
@ -10,7 +48,7 @@ return
'router_path' => 'overview', 'router_path' => 'overview',
'view_path' => 'index/overview', 'view_path' => 'index/overview',
'methods' => '', 'methods' => '',
'sort' => 100, 'sort' => 80,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -51,7 +89,6 @@ return
'router_path' => 'concern', 'router_path' => 'concern',
'view_path' => 'index/concern', 'view_path' => 'index/concern',
'methods' => '', 'methods' => '',
'sort' => 100,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -64,7 +101,6 @@ return
'router_path' => 'history', 'router_path' => 'history',
'view_path' => 'index/history', 'view_path' => 'index/history',
'methods' => '', 'methods' => '',
'sort' => 100,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
] ]
@ -121,9 +157,8 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'post', 'methods' => 'post',
'sort' => 95,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 0,
], ],
[ [
'menu_name' => '微页面', 'menu_name' => '微页面',
@ -134,7 +169,7 @@ return
'router_path' => 'list', 'router_path' => 'list',
'view_path' => 'diy/list', 'view_path' => 'diy/list',
'methods' => 'get', 'methods' => 'get',
'sort' => 90, 'sort' => 99,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -147,7 +182,7 @@ return
'router_path' => 'route', 'router_path' => 'route',
'view_path' => 'diy/route', 'view_path' => 'diy/route',
'methods' => 'get', 'methods' => 'get',
'sort' => 85, 'sort' => 98,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -160,7 +195,7 @@ return
'router_path' => 'tabbar', 'router_path' => 'tabbar',
'view_path' => 'diy/tabbar', 'view_path' => 'diy/tabbar',
'methods' => 'get', 'methods' => 'get',
'sort' => 80, 'sort' => 97,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
'children' => [ 'children' => [
@ -173,14 +208,26 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'post', 'methods' => 'post',
'sort' => 100, 'status' => 1,
'is_show' => 0,
],
],
]
]
],
[
'menu_name' => '素材管理',
'menu_key' => 'attachment',
'menu_type' => 1,
'icon' => 'iconfont-iconsucaiguanli',
'api_url' => 'sys/attachment',
'router_path' => 'attachment',
'view_path' => 'tools/attachment',
'methods' => 'get',
'sort' => 98,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
],
]
]
],
[ [
'menu_name' => '渠道管理', 'menu_name' => '渠道管理',
'menu_short_name' => '渠道', 'menu_short_name' => '渠道',
@ -191,7 +238,7 @@ return
'router_path' => 'channel', 'router_path' => 'channel',
'view_path' => '', 'view_path' => '',
'methods' => '', 'methods' => '',
'sort' => 44, 'sort' => 97,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
'children' => [ 'children' => [
@ -243,7 +290,6 @@ return
'router_path' => 'wechat/course', 'router_path' => 'wechat/course',
'view_path' => 'channel/wechat/course', 'view_path' => 'channel/wechat/course',
'methods' => 'get', 'methods' => 'get',
'sort' => 100,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -256,7 +302,6 @@ return
'router_path' => 'wechat/config', 'router_path' => 'wechat/config',
'view_path' => 'channel/wechat/config', 'view_path' => 'channel/wechat/config',
'methods' => 'get', 'methods' => 'get',
'sort' => 90,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -269,7 +314,6 @@ return
'router_path' => 'wechat/menu', 'router_path' => 'wechat/menu',
'view_path' => 'channel/wechat/menu', 'view_path' => 'channel/wechat/menu',
'methods' => 'get', 'methods' => 'get',
'sort' => 80,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -282,7 +326,6 @@ return
'router_path' => 'wechat/message', 'router_path' => 'wechat/message',
'view_path' => 'channel/wechat/template', 'view_path' => 'channel/wechat/template',
'methods' => 'get', 'methods' => 'get',
'sort' => 70,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -308,7 +351,6 @@ return
'router_path' => 'weapp/course', 'router_path' => 'weapp/course',
'view_path' => 'channel/weapp/course', 'view_path' => 'channel/weapp/course',
'methods' => 'get', 'methods' => 'get',
'sort' => 100,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -321,7 +363,6 @@ return
'router_path' => 'weapp/config', 'router_path' => 'weapp/config',
'view_path' => 'channel/weapp/config', 'view_path' => 'channel/weapp/config',
'methods' => 'get', 'methods' => 'get',
'sort' => 90,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -334,7 +375,6 @@ return
'router_path' => 'weapp/message', 'router_path' => 'weapp/message',
'view_path' => 'channel/weapp/template', 'view_path' => 'channel/weapp/template',
'methods' => 'get', 'methods' => 'get',
'sort' => 80,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -347,7 +387,6 @@ return
'router_path' => 'weapp/code', 'router_path' => 'weapp/code',
'view_path' => 'channel/weapp/code', 'view_path' => 'channel/weapp/code',
'methods' => 'get', 'methods' => 'get',
'sort' => 70,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -360,7 +399,7 @@ return
'router_path' => 'aliapp', 'router_path' => 'aliapp',
'view_path' => 'channel/aliapp/access', 'view_path' => 'channel/aliapp/access',
'methods' => 'get', 'methods' => 'get',
'sort' => 50, 'sort' => 60,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -373,7 +412,6 @@ return
'router_path' => 'aliapp/config', 'router_path' => 'aliapp/config',
'view_path' => 'channel/aliapp/config', 'view_path' => 'channel/aliapp/config',
'methods' => 'put', 'methods' => 'put',
'sort' => 90,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
@ -386,25 +424,11 @@ return
'router_path' => 'aliapp/course', 'router_path' => 'aliapp/course',
'view_path' => 'channel/aliapp/course', 'view_path' => 'channel/aliapp/course',
'methods' => 'get', 'methods' => 'get',
'sort' => 100,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
], ],
] ]
], ],
[
'menu_name' => '素材管理',
'menu_key' => 'attachment',
'menu_type' => 1,
'icon' => 'iconfont-iconsucaiguanli',
'api_url' => 'sys/attachment',
'router_path' => 'attachment',
'view_path' => 'tools/attachment',
'methods' => 'get',
'sort' => 97,
'status' => 1,
'is_show' => 1,
],
] ]
], ],
[ [
@ -445,7 +469,6 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'put', 'methods' => 'put',
'sort' => 0,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -487,7 +510,6 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'put', 'methods' => 'put',
'sort' => 0,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -501,7 +523,6 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'post', 'methods' => 'post',
'sort' => 0,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -515,7 +536,6 @@ return
'router_path' => '', 'router_path' => '',
'view_path' => '', 'view_path' => '',
'methods' => 'delete', 'methods' => 'delete',
'sort' => 0,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
@ -640,11 +660,37 @@ return
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
], ],
[
'menu_name' => '会员退款',
'menu_key' => 'member_refund_list',
'menu_type' => 1,
'icon' => 'iconfont-iconhuiyuantixian',
'api_url' => 'pay/pay_refund',
'router_path' => 'refund',
'view_path' => 'finance/pay_refund',
'methods' => 'get',
'sort' => 9,
'status' => 1,
'is_show' => 1,
],
[
'menu_name' => '退款详情',
'menu_key' => 'member_refund_detail',
'menu_type' => 1,
'icon' => 'iconfont-iconhuiyuantixian',
'api_url' => 'pay/refund',
'router_path' => 'refund/detail',
'view_path' => 'finance/refund_detail',
'methods' => 'get',
'sort' => 9,
'status' => 1,
'is_show' => 0,
],
], ],
], ],
[ [
'menu_name' => '系统设置', 'menu_name' => '系统设置',
'menu_short_name' => '系统', 'menu_short_name' => '设置',
'menu_key' => 'setting', 'menu_key' => 'setting',
'menu_type' => 0, 'menu_type' => 0,
'icon' => 'iconfont-iconshezhi1', 'icon' => 'iconfont-iconshezhi1',
@ -1148,20 +1194,34 @@ return
'sort' => 0, 'sort' => 0,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
]
]
], ],
[ [
'menu_name' => '页面预览', 'menu_name' => '页面预览',
'menu_key' => 'page_preview', 'menu_key' => 'preview',
'menu_type' => 1, 'menu_type' => 0,
'icon' => '', 'icon' => '',
'api_url' => '', 'api_url' => '',
'router_path' => 'preview', 'router_path' => 'preview',
'view_path' => 'diy/preview', 'view_path' => '',
'methods' => '', 'methods' => 'get',
'sort' => 1,
'status' => 1, 'status' => 1,
'is_show' => 0, 'is_show' => 0,
] 'children' => [
[
'menu_name' => '页面预览',
'menu_key' => 'page_wap_preview',
'menu_type' => 1,
'icon' => '',
'api_url' => '',
'router_path' => 'wap',
'view_path' => 'index/preview',
'methods' => 'get',
'sort' => 0,
'status' => 1,
'is_show' => 0,
],
] ]
], ],
[ [
@ -1177,8 +1237,21 @@ return
'sort' => 10, 'sort' => 10,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 1,
'menu_attr' => 'common', 'menu_attr' => 'tools',
'children' => [ 'children' => [
[
'menu_name' => '工具管理',
'menu_key' => 'tool_index',
'menu_type' => 1,
'icon' => 'iconfont-iconchajiankaifa',
'api_url' => '',
'router_path' => 'index',
'view_path' => 'tools/index',
'methods' => '',
'sort' => 120,
'status' => 1,
'is_show' => 0,
],
[ [
'menu_name' => '插件开发', 'menu_name' => '插件开发',
'menu_key' => 'addon_develop', 'menu_key' => 'addon_develop',
@ -1456,7 +1529,7 @@ return
'methods' => 'get', 'methods' => 'get',
'sort' => 20, 'sort' => 20,
'status' => 1, 'status' => 1,
'is_show' => 1, 'is_show' => 0,
], ],
[ [
'menu_name' => '授权信息', 'menu_name' => '授权信息',
@ -1487,5 +1560,3 @@ return
] ]
] ]
]; ];

View File

@ -19,7 +19,7 @@ class PayDict
public const ALIPAY = 'alipay';//支付宝支付 public const ALIPAY = 'alipay';//支付宝支付
//const UNIPAY = 'unipay';//银联 //const UNIPAY = 'unipay';//银联
public const OFFLINEPAY = 'offlinepay';//线下支付 public const OFFLINEPAY = 'offlinepay';//线下支付
public const BALANCEPAY = 'balancepay';//线下支付 public const BALANCEPAY = 'balancepay';//余额支付
public const ON = '1'; public const ON = '1';
@ -38,13 +38,14 @@ class PayDict
//支付状态 //支付状态
public const STATUS_WAIT = '0';//待支付 public const STATUS_WAIT = '0';//待支付
public const STATUS_ING = '1';//支付中 public const STATUS_ING = '1';//支付中
public const STATUS_ED = '2';//已支付 public const STATUS_FINISH = '2';//已支付
public const STATUS_AUDIT = '3';//待审核 public const STATUS_AUDIT = '3';//待审核
public const STATUS_CALCLE = '-1';//已取消 public const STATUS_CALCLE = '-1';//已取消
//操作人类型
public const MEMBER = 'member'; public const MEMBER = 'member';
public const USER = 'user'; public const STORE = 'store';
/** /**
* 支付类型 * 支付类型
@ -102,7 +103,7 @@ class PayDict
return [ return [
self::STATUS_WAIT => get_lang('dict_pay.status_wait'), self::STATUS_WAIT => get_lang('dict_pay.status_wait'),
self::STATUS_ING => get_lang('dict_pay.status_ing'), self::STATUS_ING => get_lang('dict_pay.status_ing'),
self::STATUS_ED => get_lang('dict_pay.status_ed'), self::STATUS_FINISH => get_lang('dict_pay.status_finish'),
self::STATUS_CALCLE => get_lang('dict_pay.status_cancle'), self::STATUS_CALCLE => get_lang('dict_pay.status_cancle'),
self::STATUS_AUDIT => get_lang('dict_pay.status_audit') self::STATUS_AUDIT => get_lang('dict_pay.status_audit')
]; ];

View File

@ -20,11 +20,11 @@ class RefundDict
const FAIL = 'fail';//失败 const FAIL = 'fail';//失败
// 退款方式 // 退款方式
const WECHATPAY = 'wechatpay';//微信支付 const WECHATPAY = 'wechatpay';//微信退款
const ALIPAY = 'alipay';//支付宝支付 const ALIPAY = 'alipay';//支付宝退款
const OFFLINE = 'offline';//线下打款 const OFFLINE = 'offline';//线下打款
const BALANCE = 'balance';//线下支付 const BALANCE = 'balance';//余额退款
CONST BACK = 'back';//原路退款
/** /**
* 获取状态 * 获取状态
* @return array * @return array
@ -32,10 +32,10 @@ class RefundDict
public static function getStatus() public static function getStatus()
{ {
return [ return [
self::WAIT => get_lang('dict_pay_refund.status_wait'), self::WAIT => get_lang('dict_pay_refund.wait'),
self::DEALING => get_lang('dict_pay_refund.status_dealing'), self::DEALING => get_lang('dict_pay_refund.dealing'),
self::SUCCESS => get_lang('dict_pay_refund.status_success'), self::SUCCESS => get_lang('dict_pay_refund.success'),
self::FAIL => get_lang('dict_pay_refund.status_fail'), self::FAIL => get_lang('dict_pay_refund.fail'),
]; ];
} }
@ -46,10 +46,11 @@ class RefundDict
public static function getType() public static function getType()
{ {
return [ return [
self::WECHATPAY => get_lang('dict_pay_refund.wechatpay'), // self::WECHATPAY => get_lang('dict_pay_refund.wechatpay'),
self::ALIPAY => get_lang('dict_pay_refund.alipay'), // self::ALIPAY => get_lang('dict_pay_refund.alipay'),
self::OFFLINE => get_lang('dict_pay_refund.offline'), self::OFFLINE => get_lang('dict_pay_refund.offline'),
self::BALANCE => get_lang('dict_pay_refund.balance') // self::BALANCE => get_lang('dict_pay_refund.balance'),
self::BACK => get_lang('dict_pay_refund.back'),
]; ];
} }
} }

View File

@ -185,7 +185,7 @@ class Index extends BaseInstall
public function getSqlQuery($sql_data) public function getSqlQuery($sql_data)
{ {
$this->checkLock(); $this->checkLock();
$sql_data = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=utf8", $sql_data); $sql_data = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=utf8mb4", $sql_data);
$sql_data = str_replace("\r", "\n", $sql_data); $sql_data = str_replace("\r", "\n", $sql_data);
$sql_query = []; $sql_query = [];
@ -246,7 +246,7 @@ class Index extends BaseInstall
$this->setSuccessLog([ $res[ 'msg' ], 'error' ]); $this->setSuccessLog([ $res[ 'msg' ], 'error' ]);
return fail($res[ 'msg' ]); return fail($res[ 'msg' ]);
} }
//安装插件 //安装插件 todo
$this->installAddon(); $this->installAddon();
Cache::set('install_status', 1);//成功 Cache::set('install_status', 1);//成功
@ -484,7 +484,7 @@ class Index extends BaseInstall
if (!empty($addon_files)) { if (!empty($addon_files)) {
foreach ($addon_files as $addon) { foreach ($addon_files as $addon) {
$service = (new coreAddonInstallService($addon)); $service = (new CoreAddonInstallService($addon));
$service->installCheck(); $service->installCheck();
$service->install(); $service->install();
} }

View File

@ -7,7 +7,7 @@ CREATE TABLE `account_log` (
`trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '对应类型交易单号', `trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '对应类型交易单号',
`create_time` varchar(255) NOT NULL DEFAULT '' COMMENT '添加时间', `create_time` varchar(255) NOT NULL DEFAULT '' COMMENT '添加时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='站点账单记录'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='站点账单记录';
DROP TABLE IF EXISTS `addon`; DROP TABLE IF EXISTS `addon`;
@ -30,7 +30,7 @@ CREATE TABLE `addon` (
`compile` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '编译端口', `compile` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '编译端口',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `UK_title` (`title`) UNIQUE KEY `UK_title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='插件表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='插件表';
DROP TABLE IF EXISTS `addon_log`; DROP TABLE IF EXISTS `addon_log`;
@ -42,7 +42,7 @@ CREATE TABLE `addon_log` (
`to_version` varchar(20) NOT NULL DEFAULT '' COMMENT '升级后的版本号', `to_version` varchar(20) NOT NULL DEFAULT '' COMMENT '升级后的版本号',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='插件日志表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='插件日志表';
DROP TABLE IF EXISTS `diy_page`; DROP TABLE IF EXISTS `diy_page`;
@ -61,7 +61,7 @@ CREATE TABLE `diy_page` (
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义页面'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='自定义页面';
DROP TABLE IF EXISTS `diy_route`; DROP TABLE IF EXISTS `diy_route`;
@ -74,7 +74,7 @@ CREATE TABLE `diy_route` (
`is_share` int(11) NOT NULL DEFAULT '0' COMMENT '是否支持分享', `is_share` int(11) NOT NULL DEFAULT '0' COMMENT '是否支持分享',
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义路由'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='自定义路由';
DROP TABLE IF EXISTS `generate_column`; DROP TABLE IF EXISTS `generate_column`;
@ -100,7 +100,7 @@ CREATE TABLE `generate_column` (
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成表字段信息表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='代码生成表字段信息表';
DROP TABLE IF EXISTS `generate_table`; DROP TABLE IF EXISTS `generate_table`;
@ -118,7 +118,7 @@ CREATE TABLE `generate_table` (
`relations` text DEFAULT NULL COMMENT '关联配置', `relations` text DEFAULT NULL COMMENT '关联配置',
`synchronous_number` int NOT NULL DEFAULT 0 COMMENT '同步次数', `synchronous_number` int NOT NULL DEFAULT 0 COMMENT '同步次数',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='代码生成表';
DROP TABLE IF EXISTS `jobs`; DROP TABLE IF EXISTS `jobs`;
@ -132,7 +132,7 @@ CREATE TABLE `jobs` (
`create_time` int(11) unsigned DEFAULT '0', `create_time` int(11) unsigned DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `queue` (`queue`) KEY `queue` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息队列任务表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='消息队列任务表';
DROP TABLE IF EXISTS `jobs_failed`; DROP TABLE IF EXISTS `jobs_failed`;
@ -144,7 +144,7 @@ CREATE TABLE `jobs_failed` (
`exception` longtext NOT NULL, `exception` longtext NOT NULL,
`fail_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `fail_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息队列任务失败记录表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='消息队列任务失败记录表';
DROP TABLE IF EXISTS `member`; DROP TABLE IF EXISTS `member`;
@ -206,7 +206,7 @@ CREATE TABLE `member` (
KEY `weapp_openid` (`weapp_openid`), KEY `weapp_openid` (`weapp_openid`),
KEY `wx_openid` (`wx_openid`), KEY `wx_openid` (`wx_openid`),
KEY `wx_unionid` (`wx_unionid`) KEY `wx_unionid` (`wx_unionid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员表';
DROP TABLE IF EXISTS `member_account_log`; DROP TABLE IF EXISTS `member_account_log`;
@ -225,7 +225,7 @@ CREATE TABLE `member_account_log` (
KEY `create_time` (`create_time`), KEY `create_time` (`create_time`),
KEY `from_type` (`from_type`), KEY `from_type` (`from_type`),
KEY `member_id` (`member_id`) KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员账单表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员账单表';
DROP TABLE IF EXISTS `member_address`; DROP TABLE IF EXISTS `member_address`;
@ -238,6 +238,7 @@ CREATE TABLE `member_address` (
`city_id` int(11) NOT NULL DEFAULT '0' COMMENT '市id', `city_id` int(11) NOT NULL DEFAULT '0' COMMENT '市id',
`district_id` int(11) NOT NULL DEFAULT '0' COMMENT '区县id', `district_id` int(11) NOT NULL DEFAULT '0' COMMENT '区县id',
`address` varchar(255) NOT NULL DEFAULT '' COMMENT '地址信息', `address` varchar(255) NOT NULL DEFAULT '' COMMENT '地址信息',
`address_name` VARCHAR(255) NOT NULL DEFAULT '',
`full_address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址信息', `full_address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址信息',
`lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '经度', `lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '经度',
`lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '纬度', `lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '纬度',
@ -245,7 +246,7 @@ CREATE TABLE `member_address` (
`type` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '地址类型 address 普通地址 location_address 定位地址', `type` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '地址类型 address 普通地址 location_address 定位地址',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `IDX_member_address` (`member_id`) KEY `IDX_member_address` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员收货地址'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员收货地址';
DROP TABLE IF EXISTS `member_cash_out`; DROP TABLE IF EXISTS `member_cash_out`;
@ -281,7 +282,7 @@ CREATE TABLE `member_cash_out` (
KEY `member_withdraw_site_id` (`member_id`), KEY `member_withdraw_site_id` (`member_id`),
KEY `member_withdraw_status` (`status`), KEY `member_withdraw_status` (`status`),
KEY `member_withdraw_withdraw_no` (`cash_out_no`) KEY `member_withdraw_withdraw_no` (`cash_out_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员提现表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员提现表';
DROP TABLE IF EXISTS `member_cash_out_account`; DROP TABLE IF EXISTS `member_cash_out_account`;
@ -295,7 +296,7 @@ CREATE TABLE `member_cash_out_account` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`account_no` varchar(255) NOT NULL DEFAULT '' COMMENT '提现账户', `account_no` varchar(255) NOT NULL DEFAULT '' COMMENT '提现账户',
PRIMARY KEY (`account_id`) PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员提现账户'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员提现账户';
DROP TABLE IF EXISTS `member_collect`; DROP TABLE IF EXISTS `member_collect`;
@ -308,7 +309,7 @@ CREATE TABLE `member_collect` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `IDX_member_collect_goods` (`goods_id`), KEY `IDX_member_collect_goods` (`goods_id`),
KEY `IDX_member_collect_member` (`member_id`) KEY `IDX_member_collect_member` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
DROP TABLE IF EXISTS `member_label`; DROP TABLE IF EXISTS `member_label`;
@ -322,7 +323,7 @@ CREATE TABLE `member_label` (
PRIMARY KEY (`label_id`), PRIMARY KEY (`label_id`),
KEY `label_id` (`label_id`), KEY `label_id` (`label_id`),
KEY `sort` (`sort`) KEY `sort` (`sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员标签'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员标签';
DROP TABLE IF EXISTS `member_level`; DROP TABLE IF EXISTS `member_level`;
@ -336,7 +337,7 @@ CREATE TABLE `member_level` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`level_id`), PRIMARY KEY (`level_id`),
KEY `status` (`status`) KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员等级'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='会员等级';
DROP TABLE IF EXISTS `pay`; DROP TABLE IF EXISTS `pay`;
@ -362,7 +363,7 @@ CREATE TABLE `pay` (
`fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因', `fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `UK_ns_pay_out_trade_no` (`out_trade_no`) UNIQUE KEY `UK_ns_pay_out_trade_no` (`out_trade_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付记录表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='支付记录表';
DROP TABLE IF EXISTS `pay_channel`; DROP TABLE IF EXISTS `pay_channel`;
@ -376,7 +377,7 @@ CREATE TABLE `pay_channel` (
`status` int(11) NOT NULL DEFAULT '0' COMMENT '是否启用', `status` int(11) NOT NULL DEFAULT '0' COMMENT '是否启用',
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付渠道配置表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='支付渠道配置表';
DROP TABLE IF EXISTS `pay_refund`; DROP TABLE IF EXISTS `pay_refund`;
@ -386,17 +387,22 @@ CREATE TABLE `pay_refund` (
`out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号', `out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付方式', `type` varchar(255) NOT NULL DEFAULT '' COMMENT '支付方式',
`channel` varchar(50) NOT NULL DEFAULT '' COMMENT '支付渠道', `channel` varchar(50) NOT NULL DEFAULT '' COMMENT '支付渠道',
`money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额', `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '退款金额',
`reason` varchar(255) NOT NULL DEFAULT '' COMMENT '退款原因', `reason` varchar(255) NOT NULL DEFAULT '' COMMENT '退款原因',
`status` varchar(255) NOT NULL DEFAULT '0' COMMENT '支付状态0.待退款 1. 退款中 2. 已退款 -1已关闭', `status` varchar(255) NOT NULL DEFAULT '0' COMMENT '支付状态0.待退款 1. 退款中 2. 已退款 -1已关闭',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`refund_time` int(11) NOT NULL DEFAULT '0' COMMENT '支付时间', `refund_time` int(11) NOT NULL DEFAULT '0' COMMENT '支付时间',
`close_time` int(11) NOT NULL DEFAULT '0' COMMENT '关闭时间', `close_time` int(11) NOT NULL DEFAULT '0' COMMENT '关闭时间',
`fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因', `fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
`voucher` varchar(255) NOT NULL DEFAULT '' COMMENT '支付凭证', `voucher` varchar(255) NOT NULL DEFAULT '' COMMENT '退款凭证',
`trade_type` VARCHAR(255) NOT NULL COMMENT '业务类型',
`trade_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '业务关联id',
`refund_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '退款方式',
`main_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人类型',
`main_id` INT(11) NOT NULL DEFAULT 0 COMMENT '操作人',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `UK_ns_pay_refund_refund_no` (`refund_no`) UNIQUE KEY `UK_ns_pay_refund_refund_no` (`refund_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付记录表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='支付记录表';
DROP TABLE IF EXISTS `pay_transfer`; DROP TABLE IF EXISTS `pay_transfer`;
@ -428,7 +434,7 @@ CREATE TABLE `pay_transfer` (
KEY `member_withdraw_audit_time` (`transfer_time`), KEY `member_withdraw_audit_time` (`transfer_time`),
KEY `member_withdraw_site_id` (`main_id`), KEY `member_withdraw_site_id` (`main_id`),
KEY `member_withdraw_status` (`transfer_status`) KEY `member_withdraw_status` (`transfer_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转账表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='转账表';
DROP TABLE IF EXISTS `sys_agreement`; DROP TABLE IF EXISTS `sys_agreement`;
@ -441,7 +447,7 @@ CREATE TABLE `sys_agreement` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `agreement_key` (`agreement_key`) KEY `agreement_key` (`agreement_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='协议表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='协议表';
DROP TABLE IF EXISTS `sys_area`; DROP TABLE IF EXISTS `sys_area`;
@ -4127,7 +4133,7 @@ CREATE TABLE `sys_attachment` (
PRIMARY KEY (`att_id`), PRIMARY KEY (`att_id`),
KEY `cate_id` (`cate_id`), KEY `cate_id` (`cate_id`),
KEY `create_time` (`create_time`) KEY `create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='附件管理表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='附件管理表';
DROP TABLE IF EXISTS `sys_attachment_category`; DROP TABLE IF EXISTS `sys_attachment_category`;
@ -4142,7 +4148,7 @@ CREATE TABLE `sys_attachment_category` (
UNIQUE KEY `id` (`id`), UNIQUE KEY `id` (`id`),
KEY `pid` (`pid`), KEY `pid` (`pid`),
KEY `sort` (`sort`) KEY `sort` (`sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='附件分类表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='附件分类表';
DROP TABLE IF EXISTS `sys_config`; DROP TABLE IF EXISTS `sys_config`;
@ -4155,7 +4161,7 @@ CREATE TABLE `sys_config` (
`addon` varchar(255) NOT NULL DEFAULT '' COMMENT '所属插件', `addon` varchar(255) NOT NULL DEFAULT '' COMMENT '所属插件',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `config_key` (`config_key`) KEY `config_key` (`config_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统配置表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='系统配置表';
DROP TABLE IF EXISTS `sys_dict`; DROP TABLE IF EXISTS `sys_dict`;
@ -4168,7 +4174,7 @@ CREATE TABLE `sys_dict` (
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='数据字典表';
DROP TABLE IF EXISTS `sys_menu`; DROP TABLE IF EXISTS `sys_menu`;
@ -4196,7 +4202,7 @@ CREATE TABLE `sys_menu` (
KEY `is_show` (`is_show`), KEY `is_show` (`is_show`),
KEY `menu_key` (`menu_key`), KEY `menu_key` (`menu_key`),
KEY `parent_key` (`parent_key`) KEY `parent_key` (`parent_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='菜单表';
DROP TABLE IF EXISTS `sys_notice`; DROP TABLE IF EXISTS `sys_notice`;
@ -4215,7 +4221,7 @@ CREATE TABLE `sys_notice` (
`wechat_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '微信说明', `wechat_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '微信说明',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `message_key` (`key`) KEY `message_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知模型'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='通知模型';
DROP TABLE IF EXISTS `sys_notice_log`; DROP TABLE IF EXISTS `sys_notice_log`;
@ -4238,7 +4244,7 @@ CREATE TABLE `sys_notice_log` (
KEY `member_id` (`member_id`), KEY `member_id` (`member_id`),
KEY `message_key` (`key`), KEY `message_key` (`key`),
KEY `uid` (`uid`) KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知记录表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='通知记录表';
DROP TABLE IF EXISTS `sys_notice_sms_log`; DROP TABLE IF EXISTS `sys_notice_sms_log`;
@ -4257,7 +4263,7 @@ CREATE TABLE `sys_notice_sms_log` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
`delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间', `delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信发送表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='短信发送表';
DROP TABLE IF EXISTS `sys_role`; DROP TABLE IF EXISTS `sys_role`;
@ -4271,7 +4277,7 @@ CREATE TABLE `sys_role` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后修改时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后修改时间',
PRIMARY KEY (`role_id`), PRIMARY KEY (`role_id`),
KEY `status` (`status`) KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='角色表';
DROP TABLE IF EXISTS `sys_schedule`; DROP TABLE IF EXISTS `sys_schedule`;
@ -4289,7 +4295,7 @@ CREATE TABLE `sys_schedule` (
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统任务'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='系统任务';
DROP TABLE IF EXISTS `sys_user`; DROP TABLE IF EXISTS `sys_user`;
@ -4316,7 +4322,7 @@ CREATE TABLE `sys_user` (
KEY `password` (`password`), KEY `password` (`password`),
KEY `update_time` (`update_time`), KEY `update_time` (`update_time`),
KEY `username` (`username`) KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='后台管理员表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='后台管理员表';
DROP TABLE IF EXISTS `sys_user_log`; DROP TABLE IF EXISTS `sys_user_log`;
@ -4332,7 +4338,7 @@ CREATE TABLE `sys_user_log` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `create_time` (`create_time`), KEY `create_time` (`create_time`),
KEY `uid` (`uid`) KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员操作记录表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='管理员操作记录表';
DROP TABLE IF EXISTS `weapp_version`; DROP TABLE IF EXISTS `weapp_version`;
@ -4347,7 +4353,7 @@ CREATE TABLE `weapp_version` (
`fail_reason` VARCHAR(2000) NOT NULL DEFAULT '', `fail_reason` VARCHAR(2000) NOT NULL DEFAULT '',
`task_key` varchar(20) NOT NULL DEFAULT '' COMMENT '上传任务key', `task_key` varchar(20) NOT NULL DEFAULT '' COMMENT '上传任务key',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
DROP TABLE IF EXISTS `wechat_fans`; DROP TABLE IF EXISTS `wechat_fans`;
@ -4374,7 +4380,7 @@ CREATE TABLE `wechat_fans` (
PRIMARY KEY (`fans_id`), PRIMARY KEY (`fans_id`),
KEY `openid` (`openid`), KEY `openid` (`openid`),
KEY `unionid` (`unionid`) KEY `unionid` (`unionid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信粉丝列表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='微信粉丝列表';
DROP TABLE IF EXISTS `wechat_media`; DROP TABLE IF EXISTS `wechat_media`;
@ -4387,7 +4393,7 @@ CREATE TABLE `wechat_media` (
`media_id` varchar(70) NOT NULL DEFAULT '0' COMMENT '微信端返回的素材id', `media_id` varchar(70) NOT NULL DEFAULT '0' COMMENT '微信端返回的素材id',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `type` (`type`) KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信素材表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='微信素材表';
DROP TABLE IF EXISTS `wechat_reply`; DROP TABLE IF EXISTS `wechat_reply`;
@ -4406,4 +4412,4 @@ CREATE TABLE `wechat_reply` (
`delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间', `delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `keyword` (`keyword`,`reply_type`) KEY `keyword` (`keyword`,`reply_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公众号消息回调表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='公众号消息回调表';

View File

@ -177,11 +177,12 @@ return [
'SITE_CLOSE_NOT_ALLOW' => '站点已停止', 'SITE_CLOSE_NOT_ALLOW' => '站点已停止',
//支付相关(todo 注意:7段不共享) //支付相关(todo 注意:7段不共享)
'ALIPAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号', 'PAY_TRANSACTION_NO_NOT_EXIST' => '无效的支付交易号',
'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持', 'PAYMENT_METHOD_NOT_SUPPORT' => '您选择到支付方式不受业务支持',
'PAYMENT_LOCK' => '支付中,请稍后再试', 'PAYMENT_LOCK' => '支付中,请稍后再试',
'PAY_SUCCESS' => '当前支付已完成', 'PAY_SUCCESS' => '当前支付已完成',
'PAY_IS_REMOVE' => '当前支付已取消', 'PAY_IS_REMOVE' => '当前支付已取消',
'PAY_NOT_FOUND_TRADE' => '找不到可支付的交易',
'PAYMENT_METHOD_NOT_EXIST' => '你选择的支付方式未启用', 'PAYMENT_METHOD_NOT_EXIST' => '你选择的支付方式未启用',
'PAYMENT_METHOD_NOT_SCENE' => '你选择的支付方式不适用于当前场景', 'PAYMENT_METHOD_NOT_SCENE' => '你选择的支付方式不适用于当前场景',
'TREAT_PAYMENT_IS_OPEN' => '只有待支付时可以关闭', 'TREAT_PAYMENT_IS_OPEN' => '只有待支付时可以关闭',

View File

@ -158,7 +158,7 @@ return [
'status_wait' => '待支付', 'status_wait' => '待支付',
'status_ing' => '支付中', 'status_ing' => '支付中',
'status_ed' => '已支付', 'status_finish' => '已支付',
'status_cancle' => '已取消', 'status_cancle' => '已取消',
'status_audit' => '待审核', 'status_audit' => '待审核',
'pay' => '收款', 'pay' => '收款',
@ -211,6 +211,7 @@ return [
'member_my_point' => '我的积分', 'member_my_point' => '我的积分',
'member_my_commission' => '我的佣金', 'member_my_commission' => '我的佣金',
'member_my_personal' => '个人资料', 'member_my_personal' => '个人资料',
'member_my_address' => '收货地址',
'diy_page' => '自定义页面', 'diy_page' => '自定义页面',
'diy_link' => '自定义链接' 'diy_link' => '自定义链接'
@ -270,6 +271,7 @@ return [
'unipay' => '银联原路退款', 'unipay' => '银联原路退款',
'offline' => '线下退款', 'offline' => '线下退款',
'balance' => '退款到余额', 'balance' => '退款到余额',
'back' => '原路退款',
], ],
'dict_order_refund' => [ 'dict_order_refund' => [
'refunding' => '退款中', 'refunding' => '退款中',

View File

@ -41,6 +41,20 @@ class Diy extends BaseModel
*/ */
protected $name = 'diy_page'; protected $name = 'diy_page';
/**
* 状态字段转化
* @param $value
* @param $data
* @return mixed
*/
public function getTypePageAttr($value, $data)
{
if (!empty($data[ 'type' ])) {
return TemplateDict::getTemplate([ 'type' => [ $data[ 'type' ] ] ])[ $data[ 'type' ] ][ 'page' ] ?? '';
}
return '';
}
/** /**
* 状态字段转化 * 状态字段转化
* @param $value * @param $value

View File

@ -57,8 +57,8 @@ class AccountLog extends BaseModel
{ {
return match ($data['type']) { return match ($data['type']) {
'pay' => (new Pay())->where([['out_trade_no', '=', $data['trade_no']]])->append(['type_name'])->findOrEmpty()->toArray(), 'pay' => (new Pay())->where([['out_trade_no', '=', $data['trade_no']]])->append(['type_name'])->findOrEmpty()->toArray(),
'refund' => (new Refund())->where([['refund_no', '=', $data['trade_no']]])->findOrEmpty()->toArray(), 'refund' => (new Refund())->where([['refund_no', '=', $data['trade_no']]])->append(['type_name'])->findOrEmpty()->toArray(),
'transfer' => (new Transfer())->where([['transfer_no', '=', $data['trade_no']]])->findOrEmpty()->toArray(), 'transfer' => (new Transfer())->where([['transfer_no', '=', $data['trade_no']]])->append(['transfer_type_name'])->findOrEmpty()->toArray(),
default => [], default => [],
}; };
} }

View File

@ -11,6 +11,7 @@
namespace app\model\pay; namespace app\model\pay;
use app\dict\pay\PayDict;
use app\dict\pay\RefundDict; use app\dict\pay\RefundDict;
use core\base\BaseModel; use core\base\BaseModel;
@ -40,7 +41,7 @@ class Refund extends BaseModel
]; ];
/** /**
* 状态字段转化 * 支付状态字段转化
* @param $value * @param $value
* @param $data * @param $data
* @return mixed * @return mixed
@ -60,7 +61,76 @@ class Refund extends BaseModel
public function getTypeNameAttr($value, $data) public function getTypeNameAttr($value, $data)
{ {
if (empty($data['type'])) return ''; if (empty($data['type'])) return '';
return RefundDict::getType()[$data['type']] ?? ''; return PayDict::getPayType()[$data['type']]['name'] ?? '';
} }
/**
* 退款方式
* @param $value
* @param $data
* @return mixed|string
*
*/
public function getRefundTypeNameAttr($value, $data)
{
if (empty($data['refund_type'])) return '';
return RefundDict::getType()[$data['refund_type']] ?? '';
}
/**
* 创建时间搜索器
* @param $query
* @param $value
* @param $data
*/
public function searchCreateTimeAttr($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('create_time', $start_time, $end_time);
} else if ($start_time > 0 && $end_time == 0) {
$query->where([['create_time', '>=', $start_time]]);
} else if ($start_time == 0 && $end_time > 0) {
$query->where([['create_time', '<=', $end_time]]);
}
}
/**
* 查询交易流水号
* @param $query
* @param $value
* @return void
*/
public function searchOutTradeNoAttr($query, $value) {
if (!empty($value)) {
$query->whereLike([['out_trade_no', '%'.$value.'%']]);
}
}
/**
* 退款号查询
* @param $query
* @param $value
* @return void
*/
public function searchRefundNoAttr($query, $value) {
if (!empty($value)) {
$query->whereLike([['refund_no', '%'.$value.'%']]);
}
}
/**
* 查询交易状态
* @param $query
* @param $value
* @return void
*/
public function searchStatusAttr($query, $value) {
if ($value != '') {
$query->where([['status', '=', $value]]);
}
}
} }

View File

@ -50,7 +50,7 @@ class DiyService extends BaseAdminService
{ {
$field = 'id,title,name,template,type,mode,is_default,share,visit_count,create_time,update_time'; $field = 'id,title,name,template,type,mode,is_default,share,visit_count,create_time,update_time';
$order = "update_time desc"; $order = "update_time desc";
$search_model = $this->model->withSearch([ "title", "type", 'mode' ], $where)->field($field)->order($order)->append([ 'type_name' ]); $search_model = $this->model->withSearch([ "title", "type", 'mode' ], $where)->field($field)->order($order)->append([ 'type_name', 'type_page' ]);
return $this->pageQuery($search_model); return $this->pageQuery($search_model);
} }
@ -185,7 +185,8 @@ class DiyService extends BaseAdminService
$data = $this->getInfoByName($params[ 'name' ]); $data = $this->getInfoByName($params[ 'name' ]);
} elseif (!empty($params[ 'url' ])) { } elseif (!empty($params[ 'url' ])) {
foreach ($template as $k => $v) { foreach ($template as $k => $v) {
if ($params[ 'url' ] == '/' . $v[ 'page' ]) {
if ($params[ 'url' ] == $v[ 'page' ]) {
$params[ 'name' ] = $k; $params[ 'name' ] = $k;
$params[ 'type' ] = $k; $params[ 'type' ] = $k;
} }
@ -197,7 +198,11 @@ class DiyService extends BaseAdminService
if (isset($template[ $data[ 'type' ] ])) { if (isset($template[ $data[ 'type' ] ])) {
$page = $template[ $data[ 'type' ] ]; $page = $template[ $data[ 'type' ] ];
$data[ 'type_name' ] = $page[ 'title' ]; $data[ 'type_name' ] = $page[ 'title' ];
if ($data[ 'is_default' ] == 1) {
$data[ 'page' ] = $page[ 'page' ]; $data[ 'page' ] = $page[ 'page' ];
} else {
$data[ 'page' ] = $template[ 'DIY_PAGE' ][ 'page' ];
}
} }
} else { } else {
@ -473,12 +478,12 @@ class DiyService extends BaseAdminService
if (!empty($page_data)) { if (!empty($page_data)) {
if ($info[ 'is_change' ] == 1) { if ($info[ 'is_change' ] == 1) {
// 修改过模板,预览实际内容 // 修改过模板,预览实际内容
$use_template[ 'url' ] = '/' . $v[ 'page' ] . '?id=' . $info[ 'id' ]; $use_template[ 'url' ] = $v[ 'page' ] . '?id=' . $info[ 'id' ];
} else { } else {
$use_template[ 'cover' ] = $page_data[ 'cover' ]; // 默认图 $use_template[ 'cover' ] = $page_data[ 'cover' ]; // 默认图
$use_template[ 'desc' ] = $page_data[ 'desc' ]; $use_template[ 'desc' ] = $page_data[ 'desc' ];
if (empty($page_data[ 'cover' ])) { if (empty($page_data[ 'cover' ])) {
$use_template[ 'url' ] = '/' . $v[ 'page' ] . '?id=' . $info[ 'id' ]; $use_template[ 'url' ] = $v[ 'page' ] . '?id=' . $info[ 'id' ];
} }
} }
} else { } else {
@ -512,7 +517,7 @@ class DiyService extends BaseAdminService
// 如果没有预览图,并且没有地址,则赋值 // 如果没有预览图,并且没有地址,则赋值
if (empty($use_template[ 'cover' ]) && empty($use_template[ 'url' ])) { if (empty($use_template[ 'cover' ]) && empty($use_template[ 'url' ])) {
$use_template[ 'url' ] = '/' . $v[ 'page' ]; $use_template[ 'url' ] = $v[ 'page' ];
} }
$template[ $k ][ 'use_template' ] = $use_template; $template[ $k ][ 'use_template' ] = $use_template;
@ -525,7 +530,6 @@ class DiyService extends BaseAdminService
* 切换模板 * 切换模板
* @param array $params * @param array $params
* @return array * @return array
* @throws Exception
*/ */
public function changeTemplate(array $params = []) public function changeTemplate(array $params = [])
{ {
@ -634,38 +638,4 @@ class DiyService extends BaseAdminService
return $info; return $info;
} }
/**
* 获取页面预览数据
* @param array $params
* @return array
*/
public function getPreviewData(array $params = [])
{
$info = [];
if (!empty($params[ 'id' ])) {
$info = $this->getInfo($params[ 'id' ]);
} elseif (!empty($params[ 'name' ])) {
$info = $this->getInfoByName($params[ 'name' ]);
}
$res = [
'page' => $this->getTemplate([ 'type' => [ 'DIY_PAGE' ] ])[ 'DIY_PAGE' ][ 'page' ]
];
if (!empty($info)) {
if ($info[ 'is_default' ] == 1) {
$template = $this->getTemplate([ 'type' => [ $info[ 'type' ] ] ])[ $info[ 'type' ] ];
$res[ 'page' ] = $template[ 'page' ] . '?id=' . $info[ 'id' ];
} else {
$res[ 'page' ] .= '?id=' . $info[ 'id' ];
}
} elseif ($params[ 'name' ]) {
// 表里没有数据,查询默认页面数据
$template = $this->getTemplate([ 'type' => [ $params[ 'name' ] ] ])[ $params[ 'name' ] ];
$res[ 'page' ] = $template[ 'page' ];
}
return $res;
}
} }

View File

@ -368,9 +368,9 @@ abstract class BaseGenerator
} elseif (str_starts_with($type, 'timestamp')) { } elseif (str_starts_with($type, 'timestamp')) {
$result = time(); $result = time();
} elseif (str_starts_with($type, 'datetime')) { } elseif (str_starts_with($type, 'datetime')) {
$result = date('Y-m-d H:i:s'); $result = '"'.date('Y-m-d H:i:s').'"';
} elseif (str_starts_with($type, 'date')) { } elseif (str_starts_with($type, 'date')) {
$result = date('Y-m-d H:i:s'); $result = '"'.date('Y-m-d H:i:s').'"';
} else { } else {
$result = '""'; $result = '""';
} }

View File

@ -16,6 +16,7 @@ use app\service\core\niucloud\CoreAuthService;
use app\service\core\sys\CoreConfigService; use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
use core\exception\CommonException; use core\exception\CommonException;
use core\util\niucloud\BaseNiucloudClient;
/** /**
* 消息管理服务层 * 消息管理服务层
@ -44,6 +45,8 @@ class NiucloudService extends BaseAdminService
]; ];
$auth_info = (new CoreAuthService($data['auth_code'], $data['auth_secret']))->getAuthInfo()['data'] ?? []; $auth_info = (new CoreAuthService($data['auth_code'], $data['auth_secret']))->getAuthInfo()['data'] ?? [];
if (empty($auth_info)) throw new CommonException('AUTH_NOT_EXISTS'); if (empty($auth_info)) throw new CommonException('AUTH_NOT_EXISTS');
//清除access_token缓存
(new BaseNiucloudClient())->clearAccessToken();
return $this->core_config_service->setConfig(ConfigKeyDict::NIUCLOUD_CONFIG, $data); return $this->core_config_service->setConfig(ConfigKeyDict::NIUCLOUD_CONFIG, $data);
} }

View File

@ -39,7 +39,7 @@ class AccountLogService extends BaseAdminService
{ {
$field = 'id, type, money, trade_no, create_time'; $field = 'id, type, money, trade_no, create_time';
$search_model = $this->model->withSearch([ 'create_time', 'type' ], $where)->field($field)->append([ 'type_name', 'pay_info', 'money' ])->order('create_time desc'); $search_model = $this->model->withSearch([ 'create_time', 'type' ], $where)->field($field)->append([ 'type_name', 'money', 'pay_info' ])->order('create_time desc');
return $this->pageQuery($search_model); return $this->pageQuery($search_model);
} }
@ -52,7 +52,6 @@ class AccountLogService extends BaseAdminService
{ {
$field = 'id, type, money, trade_no, create_time'; $field = 'id, type, money, trade_no, create_time';
return $this->model->where([ [ 'id', '=', $id ] ])->field($field)->append([ 'type_name', 'pay_info' ])->findOrEmpty()->toArray(); return $this->model->where([ [ 'id', '=', $id ] ])->field($field)->append([ 'type_name', 'pay_info' ])->findOrEmpty()->toArray();
} }
/** /**

View File

@ -0,0 +1,67 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\pay;
use app\dict\pay\PayDict;
use app\model\pay\Pay;
use app\model\pay\Refund;
use app\service\core\pay\CoreRefundService;
use app\service\core\paytype\CoreOfflineService;
use core\base\BaseAdminService;
/**
* 退款服务层
*/
class RefundService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
$this->model = new Refund();
}
/**
* 退款账户记录
* @param array $where
* @return mixed
*/
public function getPage(array $where){
$field = 'id,refund_no,out_trade_no,type,channel,money,reason,status,create_time,refund_time,close_time,fail_reason,voucher,trade_type,trade_id,refund_type,main_type,main_id';
$search_model = $this->model->withSearch([ 'create_time', 'out_trade_no', 'refund_no', 'status' ], $where)->field($field)->append([ 'type_name', 'status_name' ])->order('create_time desc');
return $this->pageQuery($search_model);
}
/**
* 获取退款详情
* @param string $refund_no
* @return void
*/
public function getDetail(string $refund_no){
$field = 'id,refund_no,out_trade_no,type,channel,money,reason,status,create_time,refund_time,close_time,fail_reason,voucher,trade_type,trade_id,refund_type,main_type,main_id';
return $this->model->where([ ['refund_no', '=', $refund_no ] ])
->field($field)
->append([ 'type_name', 'status_name', 'refund_type_name' ])
->findOrEmpty()
->toArray();
}
/**
* 支付审核通过
* @param array $data
* @return null
*/
public function refund(array $data) {
return (new CoreRefundService())->refund($data['refund_no'], $data['voucher'], $data['refund_type'], PayDict::STORE, $this->uid);
}
}

View File

@ -62,9 +62,11 @@ class MenuService extends BaseAdminService
*/ */
public function edit(string $menu_key, array $data) public function edit(string $menu_key, array $data)
{ {
// $menu = $this->find($menu_key); // if($menu_key != $data['menu_key'])
// if($menu->isEmpty()) throw new AdminException(); // {
// if($menu['source'] != MenuDict::CREATE) throw new AdminException(''); // $menu = $this->find($data['menu_key']);
// if(!$menu->isEmpty()) throw new AdminException('validate_menu.exit_menu_key');//创建失败
// }
$where = array( $where = array(
['menu_key', '=', $menu_key] ['menu_key', '=', $menu_key]
); );
@ -107,10 +109,31 @@ class MenuService extends BaseAdminService
$menu = $this->find($menu_key); $menu = $this->find($menu_key);
if ($menu->isEmpty()) if ($menu->isEmpty())
throw new AdminException('MENU_NOT_EXIST'); throw new AdminException('MENU_NOT_EXIST');
if((new SysMenu())->where([['parent_key', '=', $menu_key]])->count() > 0)
throw new AdminException('MENU_NOT_ALLOW_DELETE');
$res = $menu->delete(); if($menu['addon'] != '')
{
$where[] = ['addon','=',$menu['addon']];
$count = (new SysMenu())->where([['addon','=',$menu['addon']]])->group('parent_key')->count();
}else{
$count = (new SysMenu())->where([['addon','=','']])->group('parent_key')->count();
}
if($count == 0)
{
$menu_where[] = ['menu_key','=',$menu_key];
}else{
for ($i = 0; $i<= $count; $i++)
{
$key[$i] = [$menu_key];
$where[] = ['parent_key','in',$key[$i]];
$chilren[$i] = (new SysMenu())->where($where)->field('menu_key')->select()->toArray();
$chilren_key[$i] = array_column($chilren[$i],'menu_key');
$key = array_merge($key[$i],$chilren_key[$i]);
$key = array_unique($key);
}
$menu_where[] = ['menu_key','in',$key];
}
$res = (new SysMenu())->where($menu_where)->delete();
Cache::tag(self::$cache_tag_name)->clear(); Cache::tag(self::$cache_tag_name)->clear();
return $res; return $res;
} }

View File

@ -35,7 +35,6 @@ class UserService extends BaseAdminService
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->model = new SysUser();
} }
/** /**
@ -54,7 +53,7 @@ class UserService extends BaseAdminService
if (!empty($where['role'])) { if (!empty($where['role'])) {
$search['role_ids'] = $where['role']; $search['role_ids'] = $where['role'];
} }
$search_model = $this->model->withSearch(['username', 'realname', 'create_time', 'role_ids'], $search)->field($field)->order('uid desc')->append(['status_name']); $search_model = (new SysUser())->withSearch(['username', 'realname', 'create_time', 'role_ids'], $search)->field($field)->order('uid desc')->append(['status_name']);
return $this->pageQuery($search_model, function ($item, $key) { return $this->pageQuery($search_model, function ($item, $key) {
$role_ids = $item['role_ids'] ?? []; $role_ids = $item['role_ids'] ?? [];
$item->role_data = $this->getRoleByUserRoleIds($role_ids); $item->role_data = $this->getRoleByUserRoleIds($role_ids);
@ -72,7 +71,7 @@ class UserService extends BaseAdminService
['uid', '=', $uid], ['uid', '=', $uid],
); );
$field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time, role_ids, is_admin'; $field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time, role_ids, is_admin';
$user = $this->model->where($where)->field($field)->findOrEmpty(); $user = (new SysUser())->where($where)->field($field)->findOrEmpty();
if ($user->isEmpty()) if ($user->isEmpty())
return []; return [];
@ -103,7 +102,7 @@ class UserService extends BaseAdminService
'is_admin' => $data['is_admin'], 'is_admin' => $data['is_admin'],
'role_ids' => $data['role_ids'], 'role_ids' => $data['role_ids'],
]; ];
$user = $this->model->create($user_data); $user = (new SysUser())->create($user_data);
return $user?->uid; return $user?->uid;
} }
@ -188,7 +187,7 @@ class UserService extends BaseAdminService
*/ */
public function checkUsername($username) public function checkUsername($username)
{ {
$count = $this->model->where([['username', '=', $username]])->count(); $count = (new SysUser())->where([['username', '=', $username]])->count();
if($count > 0) if($count > 0)
{ {
return true; return true;
@ -203,7 +202,7 @@ class UserService extends BaseAdminService
*/ */
public function find(int $uid){ public function find(int $uid){
$user = $this->model->findOrEmpty($uid); $user = (new SysUser())->findOrEmpty($uid);
if ($user->isEmpty()) if ($user->isEmpty())
throw new AdminException('USER_NOT_EXIST'); throw new AdminException('USER_NOT_EXIST');
return $user; return $user;
@ -266,7 +265,7 @@ class UserService extends BaseAdminService
$where = [ $where = [
['uid', '=', $uid] ['uid', '=', $uid]
]; ];
$this->model->where($where)->delete(); (new SysUser())->where($where)->delete();
return true; return true;
} }
@ -277,7 +276,7 @@ class UserService extends BaseAdminService
* @return SysUser|array|mixed|Model * @return SysUser|array|mixed|Model
*/ */
public function getUserInfoByUsername(string $username){ public function getUserInfoByUsername(string $username){
return $this->model->where([['username', '=',$username]])->findOrEmpty(); return (new SysUser())->where([['username', '=',$username]])->findOrEmpty();
} }
/** /**
@ -294,7 +293,7 @@ class UserService extends BaseAdminService
['uid', '=', $uid], ['uid', '=', $uid],
); );
$field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time, role_ids, is_admin'; $field = 'uid, username, head_img, real_name, last_ip, last_time, create_time, login_count, status, delete_time, update_time, role_ids, is_admin';
$user = $this->model->where($where)->field($field)->append(['status_name'])->findOrEmpty(); $user = (new SysUser())->where($where)->field($field)->append(['status_name'])->findOrEmpty();
return $user->toArray(); return $user->toArray();
}, },
[self::$cache_tag_name, RoleService::$cache_tag_name] [self::$cache_tag_name, RoleService::$cache_tag_name]

View File

@ -41,7 +41,7 @@ class DiyService extends BaseApiService
$diy_config_service = new DiyConfigService(); $diy_config_service = new DiyConfigService();
$start_up_page = $diy_config_service->getStartUpPageConfig($params[ 'name' ]); $start_up_page = $diy_config_service->getStartUpPageConfig($params[ 'name' ]);
if (!empty($start_up_page) && $start_up_page[ 'mode' ] == 'other') { if (!empty($start_up_page) && $start_up_page[ 'mode' ] == 'other' && $params[ 'name' ] != $start_up_page[ 'type' ]) {
$info = $start_up_page; $info = $start_up_page;
return $info; return $info;
} else { } else {

View File

@ -35,7 +35,7 @@ class AddressService extends BaseApiService
*/ */
public function getList(array $where = []) public function getList(array $where = [])
{ {
$field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type'; $field = 'id,member_id,name,mobile,address,address_name,full_address,is_default,type';
$order = 'is_default desc, id desc'; $order = 'is_default desc, id desc';
$list = $this->model->where([ ['member_id', '=', $this->member_id ] ])->withSearch(["type"], $where)->field($field)->order($order)->select()->toArray(); $list = $this->model->where([ ['member_id', '=', $this->member_id ] ])->withSearch(["type"], $where)->field($field)->order($order)->select()->toArray();
@ -49,7 +49,7 @@ class AddressService extends BaseApiService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type'; $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,address_name,full_address,lng,lat,is_default,type';
$info = $this->model->field($field)->where([ ['id', '=', $id], ['member_id', '=', $this->member_id ] ])->findOrEmpty()->toArray(); $info = $this->model->field($field)->where([ ['id', '=', $id], ['member_id', '=', $this->member_id ] ])->findOrEmpty()->toArray();
return $info; return $info;
@ -63,7 +63,7 @@ class AddressService extends BaseApiService
public function add(array $data) public function add(array $data)
{ {
if ($data['is_default']) { if ($data['is_default']) {
$this->model->where([ ['member_id', '=', $this->member_id ] ])->update(['is_default' => 0]); $this->model->where([ ['member_id', '=', $this->member_id ], ['type', '=', $data['type']] ])->update(['is_default' => 0]);
} }
$data['member_id'] = $this->member_id; $data['member_id'] = $this->member_id;
$res = $this->model->create($data); $res = $this->model->create($data);
@ -79,7 +79,7 @@ class AddressService extends BaseApiService
public function edit(int $id, array $data) public function edit(int $id, array $data)
{ {
if ($data['is_default']) { if ($data['is_default']) {
$this->model->where([ ['member_id', '=', $this->member_id ] ])->update(['is_default' => 0]); $this->model->where([ ['member_id', '=', $this->member_id ], ['type', '=', $data['type']] ])->update(['is_default' => 0]);
} }
$this->model->where([ ['id', '=', $id], ['member_id', '=', $this->member_id ] ])->update($data); $this->model->where([ ['id', '=', $id], ['member_id', '=', $this->member_id ] ])->update($data);
return true; return true;

View File

@ -90,7 +90,16 @@ class PayService extends BaseApiService
return $this->core_pay_service->getInfoByOutTradeNo($out_trade_no, $this->channel); return $this->core_pay_service->getInfoByOutTradeNo($out_trade_no, $this->channel);
} }
public function getInfoByTrade(string $trade_type, int $trade_id){ /**
* 支付信息
* @param string $trade_type
* @param int $trade_id
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getInfoByTrade(string $trade_type, $trade_id){
return $this->core_pay_service->getInfoByTrade($trade_type, $trade_id, $this->channel); return $this->core_pay_service->getInfoByTrade($trade_type, $trade_id, $this->channel);
} }

View File

@ -59,7 +59,7 @@ trait WapTrait
$file_name = 'diy-' . $path; $file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n"; $content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name :component=\"component\" :index=\"index\" :pullDownRefresh=\"props.pullDownRefresh\"></$file_name>\n"; $content .= " <$file_name :component=\"component\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n"; $content .= " </template>\n";
} }
} }
@ -97,7 +97,7 @@ trait WapTrait
$file_name = 'diy-' . $path; $file_name = 'diy-' . $path;
$content .= " <template v-if=\"component.componentName == '{$name}'\">\n"; $content .= " <template v-if=\"component.componentName == '{$name}'\">\n";
$content .= " <$file_name :component=\"component\" :index=\"index\" :pullDownRefresh=\"props.pullDownRefresh\"></$file_name>\n"; $content .= " <$file_name :component=\"component\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n"; $content .= " </template>\n";
$addon_import_content .= " import diy{$name} from '@/" . $v . "/components/diy/{$path}/index.vue';\n"; $addon_import_content .= " import diy{$name} from '@/" . $v . "/components/diy/{$path}/index.vue';\n";
@ -125,7 +125,7 @@ trait WapTrait
$content .= " import Sortable from 'sortablejs';\n"; $content .= " import Sortable from 'sortablejs';\n";
$content .= " import { range } from 'lodash-es';\n"; $content .= " import { range } from 'lodash-es';\n";
$content .= " const props = defineProps(['data','pullDownRefresh']);\n"; $content .= " const props = defineProps(['data','pullDownRefreshCount']);\n";
$content .= " const diyStore = useDiyStore();\n\n"; $content .= " const diyStore = useDiyStore();\n\n";
$content .= " const data = computed(() => {\n"; $content .= " const data = computed(() => {\n";
@ -200,7 +200,7 @@ trait WapTrait
$file_name = 'fixed-' . $path; $file_name = 'fixed-' . $path;
$content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n"; $content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n";
$content .= " <$file_name :data=\"props.data\" :pullDownRefresh=\"props.pullDownRefresh\"></$file_name>\n"; $content .= " <$file_name :data=\"props.data\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n"; $content .= " </template>\n";
} }
} }
@ -239,7 +239,7 @@ trait WapTrait
$file_name = 'fixed-' . $path; $file_name = 'fixed-' . $path;
$content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n"; $content .= " <template v-if=\"props.data.global.component == '{$path}'\">\n";
$content .= " <$file_name :data=\"props.data\" :pullDownRefresh=\"props.pullDownRefresh\"></$file_name>\n"; $content .= " <$file_name :data=\"props.data\" :pullDownRefreshCount=\"props.pullDownRefreshCount\"></$file_name>\n";
$content .= " </template>\n"; $content .= " </template>\n";
$addon_import_content .= " import fixed{$name} from '@/" . $v . "/components/fixed/{$path}/index.vue';\n"; $addon_import_content .= " import fixed{$name} from '@/" . $v . "/components/fixed/{$path}/index.vue';\n";
@ -255,7 +255,7 @@ trait WapTrait
if (!empty($addon_import_content)) { if (!empty($addon_import_content)) {
$content .= $addon_import_content; $content .= $addon_import_content;
} }
$content .= " const props = defineProps(['data','pullDownRefresh']);\n"; $content .= " const props = defineProps(['data','pullDownRefreshCount']);\n";
$content .= "</script>\n"; $content .= "</script>\n";
$content .= "<style lang=\"scss\" scoped>\n"; $content .= "<style lang=\"scss\" scoped>\n";

View File

@ -45,6 +45,9 @@ class CoreDiyConfigService extends BaseCoreService
$info = [ $info = [
'backgroundColor' => '#ffffff', 'backgroundColor' => '#ffffff',
'textColor' => '#606266',
'textHoverColor' => '#007aff',
'type' => 1,
'list' => [ 'list' => [
[ [
"text" => "首页", "text" => "首页",
@ -68,10 +71,7 @@ class CoreDiyConfigService extends BaseCoreService
"iconPath" => "static/resource/images/tabbar/my.png", "iconPath" => "static/resource/images/tabbar/my.png",
"iconSelectPath" => "static/resource/images/tabbar/my-selected.png" "iconSelectPath" => "static/resource/images/tabbar/my-selected.png"
] ]
], ]
'textColor' => '#606266',
'textHoverColor' => '#007aff',
'type' => 1
]; ];
} }
return $info; return $info;

View File

@ -39,9 +39,9 @@ class CoreMemberAddressService extends BaseCoreService
* @param int $member_id * @param int $member_id
* @return array * @return array
*/ */
public function getDefaultAddressByMemberId(int $member_id){ public function getDefaultAddressByMemberId(int $member_id, $type = 'address'){
$field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type'; $field = 'id,member_id,name,mobile,province_id,city_id,district_id,address,full_address,lng,lat,is_default,type';
return $this->model->where([['member_id', '=', $member_id]])->field($field)->findOrEmpty()->toArray(); return $this->model->where([['member_id', '=', $member_id], ['type', '=', $type] ])->field($field)->order('is_default desc')->findOrEmpty()->toArray();
} }
/** /**

View File

@ -31,9 +31,9 @@ class CoreAuthService extends BaseNiucloudClient
public function getAuthInfo() public function getAuthInfo()
{ {
$auth_info = $this->httpGet('authinfo', ['code' => $this->code, 'secret' => $this->secret]); $auth_info = $this->httpGet('authinfo', ['code' => $this->code, 'secret' => $this->secret]);
if(!empty($auth_info['data'])){ // if(!empty($auth_info['data'])){
$auth_info['data']['address_type'] = $this->diffDomain($auth_info['data']['site_address'], $_SERVER['HTTP_HOST']); // $auth_info['data']['address_type'] = $this->diffDomain($auth_info['data']['site_address'], $_SERVER['HTTP_HOST']);
} // }
return $auth_info; return $auth_info;
} }

View File

@ -27,9 +27,10 @@ class CoreModuleService extends BaseNiucloudClient
public function getModuleList() public function getModuleList()
{ {
$params = [ $params = [
'app_type' => '' 'app_type' => '',
'code' => $this->code,
'secret' => $this->secret
]; ];
return $this->httpGet('member_app_all', $params); return $this->httpGet('member_app_all', $params);
} }
@ -41,7 +42,12 @@ class CoreModuleService extends BaseNiucloudClient
*/ */
public function getAuthInfo() public function getAuthInfo()
{ {
return $this->httpGet('member_app'); $params = [
'app_type' => '',
'code' => $this->code,
'secret' => $this->secret
];
return $this->httpGet('member_app', $params);
} }
/** /**
@ -65,4 +71,16 @@ class CoreModuleService extends BaseNiucloudClient
{ {
} }
/**
* 操作token
* @param $action
* @param $data
* @return array|\core\util\niucloud\Response|object|ResponseInterface
* @throws GuzzleException
*/
public function getActionToken($action, $data)
{
return $this->httpGet('member_app_action/'.$action, $data);
}
} }

View File

@ -130,11 +130,14 @@ class CorePayService extends BaseCoreService
*/ */
public function getInfoByTrade(string $trade_type, string $trade_id, string $channel) public function getInfoByTrade(string $trade_type, string $trade_id, string $channel)
{ {
$where = array( $pay = $this->findPayInfoByTrade($trade_type, $trade_id);
['trade_type', '=', $trade_type], if ($pay->isEmpty()) {
['trade_id', '=', $trade_id], //创建新的支付单据
); $pay = $this->createByTrade( $trade_type, $trade_id);
$pay = $this->model->where($where)->append(['type_name', 'status_name'])->findOrEmpty()->toArray(); }
if(!is_array($pay)){
$pay = $pay->toArray();
}
if (!empty($pay)) { if (!empty($pay)) {
//todo 校验场景控制支付方式 //todo 校验场景控制支付方式
$pay['pay_type_list'] = array_values((new CorePayChannelService())->getAllowPayTypeByChannel($channel, $pay['trade_type'])); $pay['pay_type_list'] = array_values((new CorePayChannelService())->getAllowPayTypeByChannel($channel, $pay['trade_type']));
@ -183,10 +186,10 @@ class CorePayService extends BaseCoreService
if (!in_array($type, array_column((new CorePayChannelService())->getAllowPayTypeByChannel($channel, $trade_type), 'key'))) throw new PayException('PAYMENT_METHOD_NOT_SCENE');//场景不支持 if (!in_array($type, array_column((new CorePayChannelService())->getAllowPayTypeByChannel($channel, $trade_type), 'key'))) throw new PayException('PAYMENT_METHOD_NOT_SCENE');//场景不支持
$pay_result = $this->pay_event->init($channel, $type)->pay($out_trade_no, $money, $body, $return_url, $quit_url, $buyer_id, $openid ?? '', $voucher); $pay_result = $this->pay_event->init($channel, $type)->pay($out_trade_no, $money, $body, $return_url, $quit_url, $buyer_id, $openid ?? '', $voucher);
//todo 特殊支付方式会直接返回支付状态,状态如果为已支付会直接支付 //todo 特殊支付方式会直接返回支付状态,状态如果为已支付会直接支付
if (!empty($pay_result['status']) && $pay_result['status'] == PayDict::STATUS_ED) { if (!empty($pay_result['status']) && $pay_result['status'] == PayDict::STATUS_FINISH) {
$pay->save([ 'channel' => $channel ]); $pay->save([ 'channel' => $channel ]);
$this->paySuccess([ $this->paySuccess([
'status' => PayDict::STATUS_ED, 'status' => PayDict::STATUS_FINISH,
'type' => $type, 'type' => $type,
'out_trade_no' => $out_trade_no 'out_trade_no' => $out_trade_no
]); ]);
@ -235,11 +238,11 @@ class CorePayService extends BaseCoreService
//创建新的支付单据 //创建新的支付单据
$pay = $this->createByTrade( $trade_type, $trade_id); $pay = $this->createByTrade( $trade_type, $trade_id);
} }
if ($pay['status'] == PayDict::STATUS_ED) throw new PayException('PAY_SUCCESS'); if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('PAY_SUCCESS');
if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE'); if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');
if ($pay['status'] == PayDict::STATUS_ING) { if ($pay['status'] == PayDict::STATUS_ING) {
//尝试关闭原有的支付单据 //尝试关闭原有的支付单据
$this->close( $pay->out_trade_no); $this->close( $pay['out_trade_no']);
//创建新的支付单据 //创建新的支付单据
$pay = $this->createByTrade($trade_type, $trade_id); $pay = $this->createByTrade($trade_type, $trade_id);
} }
@ -248,18 +251,28 @@ class CorePayService extends BaseCoreService
/** /**
* 通过业务信息创建支付单据 * 通过业务信息创建支付单据
* @param $trade_type * @param $trade_type
* @param $trade_id * @param $trade_id
* @return Pay|array|mixed|Model * @return Pay|array|mixed|Model
*/ */
public function createByTrade( $trade_type, $trade_id){ public function createByTrade( $trade_type, $trade_id){
//创建新的支付单据 //创建新的支付单据
$data = event('PayCreate', ['trade_type' => $trade_type, 'trade_id' => $trade_id])[0] ?? []; $data = array_values(array_filter(event('PayCreate', ['trade_type' => $trade_type, 'trade_id' => $trade_id])))[0] ?? [];
if(empty($data)) throw new PayException('PAY_NOT_FOUND_TRADE');//找不到可支付的交易
//如果订单已完成,则直接返回完成的支付信息
if(isset($data['status']) && $data['money'] == 0){
$data['status'] = PayDict::STATUS_FINISH;
$data['status_name'] = PayDict::getStatus()[$data['status']] ?? '';
$data['type'] = PayDict::BALANCEPAY;
$data['type_name'] = PayDict::getPayType()[$data['type']]['name'] ?? '';
return $data;
}else{
$out_trade_no = $this->create($data['main_type'], $data['main_id'], $data['money'], $data['trade_type'], $data['trade_id'], $data['body']); $out_trade_no = $this->create($data['main_type'], $data['main_id'], $data['money'], $data['trade_type'], $data['trade_id'], $data['body']);
return $this->findPayInfoByOutTradeNo($out_trade_no); return $this->findPayInfoByOutTradeNo($out_trade_no);
} }
}
/** /**
* 支付单据恢复到待支付 * 支付单据恢复到待支付
* @param $pay_item * @param $pay_item
@ -294,13 +307,16 @@ class CorePayService extends BaseCoreService
public function close(string $out_trade_no) public function close(string $out_trade_no)
{ {
$pay = $this->findPayInfoByOutTradeNo($out_trade_no); $pay = $this->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');
if (empty($pay->type)) throw new PayException('TREAT_PAYMENT_IS_OPEN'); // if (empty($pay->type)) throw new PayException('TREAT_PAYMENT_IS_OPEN');
if($pay['status'] == PayDict::STATUS_CALCLE) return true;
if (!in_array($pay['status'], [ if (!in_array($pay['status'], [
PayDict::STATUS_WAIT, PayDict::STATUS_WAIT,
PayDict::STATUS_ING PayDict::STATUS_ING
])) throw new PayException('TREAT_PAYMENT_IS_OPEN'); ])) throw new PayException('TREAT_PAYMENT_IS_OPEN');
if ($pay['status'] == PayDict::STATUS_ING) { if ($pay['status'] == PayDict::STATUS_ING) {
if (!empty($pay->type)){
//尝试取消或关闭第三方支付 //尝试取消或关闭第三方支付
$close = $this->pay_event->init($pay->channel, $pay->type)->close($out_trade_no); $close = $this->pay_event->init($pay->channel, $pay->type)->close($out_trade_no);
if (!$close) {//有问题查询第三方订单详情 if (!$close) {//有问题查询第三方订单详情
@ -316,6 +332,7 @@ class CorePayService extends BaseCoreService
} }
} }
} }
}
//支付关闭 //支付关闭
$this->payClose([ $this->payClose([
'out_trade_no' => $out_trade_no 'out_trade_no' => $out_trade_no
@ -332,13 +349,14 @@ class CorePayService extends BaseCoreService
public function closeByTrade(string $trade_type, int $trade_id) public function closeByTrade(string $trade_type, int $trade_id)
{ {
$pay = $this->findPayInfoByTrade( $trade_type, $trade_id); $pay = $this->findPayInfoByTrade( $trade_type, $trade_id);
if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); // if ($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');
if ($pay['status'] == PayDict::STATUS_ED) throw new PayException('DOCUMENT_IS_PAID');//当前单据已支付 if ($pay->isEmpty()) return true;
if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('DOCUMENT_IS_PAID');//当前单据已支付
if (!in_array($pay['status'], [ if (!in_array($pay['status'], [
PayDict::STATUS_WAIT, PayDict::STATUS_WAIT,
PayDict::STATUS_ING PayDict::STATUS_ING
])) throw new PayException('IS_PAY_REMOVE_NOT_RESETTING');//只有待支付可以关闭支付 ])) throw new PayException('IS_PAY_REMOVE_NOT_RESETTING');//只有待支付可以关闭支付
if (!$this->close($pay)) { if (!$this->close($pay['out_trade_no'])) {
throw new PayException('DOCUMENT_IS_PAY_REMOVE'); throw new PayException('DOCUMENT_IS_PAY_REMOVE');
} }
return true; return true;
@ -355,8 +373,8 @@ class CorePayService extends BaseCoreService
{ {
$pay = $this->findPayInfoByOutTradeNo( $out_trade_no); $pay = $this->findPayInfoByOutTradeNo( $out_trade_no);
if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');
if ($pay['status'] == PayDict::STATUS_ED) throw new PayException('DOCUMENT_IS_PAID'); if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('DOCUMENT_IS_PAID');
if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE'); if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');
$status = $params['status']; $status = $params['status'];
switch ($status) { switch ($status) {
@ -421,8 +439,8 @@ class CorePayService extends BaseCoreService
{ {
$out_trade_no = $data['out_trade_no']; $out_trade_no = $data['out_trade_no'];
$pay = $this->findPayInfoByOutTradeNo($out_trade_no); $pay = $this->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');
if ($pay['status'] == PayDict::STATUS_ED) throw new PayException('PAY_SUCCESS');//单据已支付 if ($pay['status'] == PayDict::STATUS_FINISH) throw new PayException('PAY_SUCCESS');//单据已支付
if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');//单据已取消 if ($pay['status'] == PayDict::STATUS_CALCLE) throw new PayException('PAY_IS_REMOVE');//单据已取消
//查询第三方支付单据 //查询第三方支付单据
$pay_info = $this->pay_event->init($pay->channel, $pay->type)->getOrder($out_trade_no); $pay_info = $this->pay_event->init($pay->channel, $pay->type)->getOrder($out_trade_no);
@ -468,7 +486,7 @@ class CorePayService extends BaseCoreService
$trade_id = $pay->trade_id; $trade_id = $pay->trade_id;
$data = array( $data = array(
'pay_time' => time(), 'pay_time' => time(),
'status' => PayDict::STATUS_ED, 'status' => PayDict::STATUS_FINISH,
'type' => $type, 'type' => $type,
'trade_no' => $params['trade_no'] ?? '', 'trade_no' => $params['trade_no'] ?? '',
'voucher' => $params['voucher'] ?? '', 'voucher' => $params['voucher'] ?? '',

View File

@ -11,6 +11,7 @@
namespace app\service\core\pay; namespace app\service\core\pay;
use app\dict\pay\PayDict;
use app\dict\pay\RefundDict; use app\dict\pay\RefundDict;
use app\model\pay\Refund; use app\model\pay\Refund;
use core\base\BaseCoreService; use core\base\BaseCoreService;
@ -40,10 +41,10 @@ class CoreRefundService extends BaseCoreService
* @param string $reason * @param string $reason
* @return string|null * @return string|null
*/ */
public function create( string $out_trade_no, float $money, string $reason = ''){ public function create(string $out_trade_no, float $money, string $reason = '', $trade_type = '', $trade_id = ''){
//通过交易流水号获取支付单据 //通过交易流水号获取支付单据
$pay = (new CorePayService())->findPayInfoByOutTradeNo( $out_trade_no); $pay = (new CorePayService())->findPayInfoByOutTradeNo( $out_trade_no);
if($pay->isEmpty()) throw new PayException('ALIPAY_TRANSACTION_NO_NOT_EXIST');//单据不存在 if($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');//单据不存在
//校验当前数据是否存在 //校验当前数据是否存在
//存在就修改,不存在就创建 //存在就修改,不存在就创建
$refund_no = create_no(); $refund_no = create_no();
@ -55,7 +56,9 @@ class CoreRefundService extends BaseCoreService
'refund_no' => $refund_no, 'refund_no' => $refund_no,
'status' => RefundDict::WAIT, 'status' => RefundDict::WAIT,
'reason' => $reason, 'reason' => $reason,
'fail_reason' => $pay->fail_reason ?? '' 'fail_reason' => $pay->fail_reason ?? '',
'trade_type' => $trade_type,
'trade_id' => $trade_id
); );
$this->model->create($data); $this->model->create($data);
return $refund_no; return $refund_no;
@ -67,15 +70,23 @@ class CoreRefundService extends BaseCoreService
* @param string $voucher * @param string $voucher
* @return true * @return true
*/ */
public function refund( string $refund_no, $voucher = ''){ public function refund( string $refund_no, $voucher = '', $refund_type = RefundDict::BACK, $main_type = '', $main_id = 0){
$refund = $this->findByRefundNo( $refund_no); $refund = $this->findByRefundNo( $refund_no);
if($refund->isEmpty()) throw new PayException('REFUND_NOT_EXIST'); if($refund->isEmpty()) throw new PayException('REFUND_NOT_EXIST');
$out_trade_no = $refund->out_trade_no; $out_trade_no = $refund->out_trade_no;
$money = $refund->money; $money = $refund->money;
try{ try{
//存入退款方式
$refund->save(['refund_type' => $refund_type]);
if($refund_type == RefundDict::BACK){
//判断成功的话,可以直接调用退款成功 //判断成功的话,可以直接调用退款成功
$pay_result = $this->pay_event->init( $refund->channel, $refund->type)->refund($out_trade_no, $money, $money, $refund_no, $voucher); $pay_result = $this->pay_event->init( $refund->channel, $refund->type)->refund($out_trade_no, $money, $money, $refund_no, $voucher);
$this->refundNotify($out_trade_no, $refund->type, $pay_result); $this->refundNotify($out_trade_no, $refund->type, $pay_result);
}else if($refund_type == RefundDict::OFFLINE){
$pay_result = $this->pay_event->init( $refund->channel, PayDict::OFFLINEPAY)->refund($out_trade_no, $money, $money, $refund_no, $voucher);
$this->refundNotify($out_trade_no, $refund->type, $pay_result, $main_type, $main_id);
}
}catch ( Throwable $e) { }catch ( Throwable $e) {
throw new PayException($e->getMessage()); throw new PayException($e->getMessage());
} }
@ -95,7 +106,7 @@ class CoreRefundService extends BaseCoreService
public function refundNotify( $out_trade_no, string $type, array $params = []){ public function refundNotify( $out_trade_no, string $type, array $params = [], $main_type = '', $main_id = 0){
$refund_no = $params['refund_no']; $refund_no = $params['refund_no'];
$refund = $this->findByRefundNo($refund_no); $refund = $this->findByRefundNo($refund_no);
@ -112,6 +123,10 @@ class CoreRefundService extends BaseCoreService
$this->refundSuccess( [ $this->refundSuccess( [
'out_trade_no' => $out_trade_no, 'out_trade_no' => $out_trade_no,
'refund_no' => $refund_no, 'refund_no' => $refund_no,
'trade_type' => $refund['trade_type'],
'trade_id' => $refund['trade_id'],
'main_type' => $main_type,
'main_id' => $main_id
]); ]);
break; break;
case RefundDict::DEALING://退款处理中 case RefundDict::DEALING://退款处理中
@ -159,6 +174,8 @@ class CoreRefundService extends BaseCoreService
$this->refundSuccess( [ $this->refundSuccess( [
'out_trade_no' => $out_trade_no, 'out_trade_no' => $out_trade_no,
'refund_no' => $refund_no, 'refund_no' => $refund_no,
'trade_type' => $refund['trade_type'],
'trade_id' => $refund['trade_id'],
]); ]);
break; break;
case RefundDict::DEALING://退款处理中 case RefundDict::DEALING://退款处理中
@ -192,8 +209,8 @@ class CoreRefundService extends BaseCoreService
])->update([ ])->update([
'status' => RefundDict::SUCCESS 'status' => RefundDict::SUCCESS
]); ]);
$pay = (new CorePayService())->findPayInfoByOutTradeNo( $out_trade_no); // $pay = (new CorePayService())->findPayInfoByOutTradeNo( $out_trade_no);
$result = event('RefundSuccess', ['refund_no' => $refund_no, 'trade_type' => $pay->trade_type]); $result = event('RefundSuccess', ['refund_no' => $refund_no, 'trade_type' => $data['trade_type'], 'trade_id' => $data['trade_id']]);
if(!check_event_result($result)){ if(!check_event_result($result)){
return false; return false;
} }

View File

@ -66,7 +66,7 @@ class CoreBalanceService extends BaseCoreService
break; break;
} }
return [ return [
'status' => PayDict::STATUS_ED, 'status' => PayDict::STATUS_FINISH,
'out_trade_no' => $out_trade_no, 'out_trade_no' => $out_trade_no,
]; ];
//业务主体id //业务主体id

View File

@ -40,7 +40,7 @@ class CoreOfflineService extends BaseCoreService
if (empty($voucher)) throw new CommonException('VOUCHER_NOT_EMPTY'); if (empty($voucher)) throw new CommonException('VOUCHER_NOT_EMPTY');
$pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no); $pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new CommonException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new CommonException('PAY_TRANSACTION_NO_NOT_EXIST');
$pay->voucher = $voucher; $pay->voucher = $voucher;
$pay->save(); $pay->save();
@ -63,7 +63,7 @@ class CoreOfflineService extends BaseCoreService
if (empty($voucher)) throw new CommonException('VOUCHER_NOT_EMPTY'); if (empty($voucher)) throw new CommonException('VOUCHER_NOT_EMPTY');
$pay = (new CoreRefundService())->findByRefundNo($refund_no); $pay = (new CoreRefundService())->findByRefundNo($refund_no);
if ($pay->isEmpty()) throw new CommonException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new CommonException('PAY_TRANSACTION_NO_NOT_EXIST');
$pay->voucher = $voucher; $pay->voucher = $voucher;
$pay->save(); $pay->save();
@ -97,12 +97,12 @@ class CoreOfflineService extends BaseCoreService
*/ */
public function pass(string $out_trade_no) { public function pass(string $out_trade_no) {
$pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no); $pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new CommonException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new CommonException('PAY_TRANSACTION_NO_NOT_EXIST');
if ($pay->status != PayDict::STATUS_AUDIT) throw new CommonException('ONLY_PAYING_CAN_AUDIT'); if ($pay->status != PayDict::STATUS_AUDIT) throw new CommonException('ONLY_PAYING_CAN_AUDIT');
if ($pay->type != PayDict::OFFLINEPAY) throw new CommonException('ONLY_OFFLINEPAY_CAN_AUDIT'); if ($pay->type != PayDict::OFFLINEPAY) throw new CommonException('ONLY_OFFLINEPAY_CAN_AUDIT');
return (new CorePayService())->paySuccess( [ return (new CorePayService())->paySuccess( [
'status' => PayDict::STATUS_ED, 'status' => PayDict::STATUS_FINISH,
'type' => $pay->type, 'type' => $pay->type,
'out_trade_no' => $out_trade_no, 'out_trade_no' => $out_trade_no,
'voucher' => $pay->voucher 'voucher' => $pay->voucher
@ -117,7 +117,7 @@ class CoreOfflineService extends BaseCoreService
*/ */
public function refuse(string $out_trade_no, string $reason = '') { public function refuse(string $out_trade_no, string $reason = '') {
$pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no); $pay = (new CorePayService())->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new CommonException('ALIPAY_TRANSACTION_NO_NOT_EXIST'); if ($pay->isEmpty()) throw new CommonException('PAY_TRANSACTION_NO_NOT_EXIST');
if ($pay->status != PayDict::STATUS_AUDIT) throw new CommonException('ONLY_PAYING_CAN_AUDIT'); if ($pay->status != PayDict::STATUS_AUDIT) throw new CommonException('ONLY_PAYING_CAN_AUDIT');
if ($pay->type != PayDict::OFFLINEPAY) throw new CommonException('ONLY_OFFLINEPAY_CAN_AUDIT'); if ($pay->type != PayDict::OFFLINEPAY) throw new CommonException('ONLY_OFFLINEPAY_CAN_AUDIT');

View File

@ -34,17 +34,14 @@ class Address extends BaseValidate
protected $message = [ protected $message = [
'name.require' => ['common_validate.require', ['name']], 'name.require' => ['common_validate.require', ['name']],
'mobile.require' => ['common_validate.require', ['mobile']], 'mobile.require' => ['common_validate.require', ['mobile']],
'province_id.require' => ['common_validate.require', ['province_id']],
'city_id.require' => ['common_validate.require', ['city_id']],
'district_id.require' => ['common_validate.require', ['district_id']],
'address.require' => ['common_validate.require', ['address']], 'address.require' => ['common_validate.require', ['address']],
'full_address.require' => ['common_validate.require', ['full_address']], 'full_address.require' => ['common_validate.require', ['full_address']],
'type.require' => ['common_validate.require', ['type']], 'type.require' => ['common_validate.require', ['type']],
]; ];
protected $scene = [ protected $scene = [
"add" => ['name', 'mobile', 'province_id', 'city_id', 'district_id', 'address', 'full_address', 'lng', 'lat', 'type'], "add" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat', 'type'],
"edit" => ['name', 'mobile', 'province_id', 'city_id', 'district_id', 'address', 'full_address', 'lng', 'lat', 'type'] "edit" => ['name', 'mobile', 'address', 'full_address', 'lng', 'lat', 'type']
]; ];
} }