diff --git a/niucloud/addon/cms/Manage.php b/niucloud/addon/cms/Manage.php deleted file mode 100644 index 72bcf18e9..000000000 --- a/niucloud/addon/cms/Manage.php +++ /dev/null @@ -1,37 +0,0 @@ -) { - return request.get(`cms/article`, {params}) -} - -/** - * 获取文章表详情 - * @param id 文章表id - * @returns - */ -export function getArticleInfo(id: number) { - return request.get(`cms/article/${id}`); -} - -/** - * 添加文章表 - * @param params - * @returns - */ -export function addArticle(params: Record) { - return request.post('cms/article', params, {showSuccessMessage: true}) -} - -/** - * 编辑文章表 - * @param params - */ -export function editArticle(params: Record) { - return request.put(`cms/article/${params.id}`, params, {showSuccessMessage: true}) -} - -/** - * 删除文章表 - * @param id - * @returns - */ -export function deleteArticle(id: number) { - return request.delete(`cms/article/${id}`, {showSuccessMessage: true}) -} - -/***************************************************** 文章分类管理 ****************************************************/ - -/** - * 获取文章分类列表 - * @param params - * @returns - */ -export function getArticleCategoryList(params: Record) { - return request.get(`cms/category`, {params}) -} - - -/** - * 获取文章全部分类 - * @param params - * @returns - */ -export function getArticleCategoryAll(params: Record) { - return request.get(`cms/category/all`, params) -} - -/** - * 获取文章分类详情 - * @param category_id - */ -export function getArticleCategoryInfo(category_id: number) { - return request.get(`cms/category/${category_id}`); -} - -/** - * 添加文章分类 - * @param params - * @returns - */ -export function addArticleCategory(params: Record) { - return request.post('cms/category', params, {showSuccessMessage: true}) -} - -/** - * 编辑文章分类 - * @param params - * @returns - */ -export function editArticleCategory(params: Record) { - return request.put(`cms/category/${params.category_id}`, params, {showSuccessMessage: true}) -} - -/** - * 文章分类删除 - * @param category_id - */ -export function deleteArticleCategory(category_id: number) { - return request.delete(`cms/category/${category_id}`, {showSuccessMessage: true}); -} \ No newline at end of file diff --git a/niucloud/addon/cms/admin/lang/zh-cn/article.category.json b/niucloud/addon/cms/admin/lang/zh-cn/article.category.json deleted file mode 100644 index 886b34a5e..000000000 --- a/niucloud/addon/cms/admin/lang/zh-cn/article.category.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "栏目名称", - "sort": "排序", - "isShow": "是否显示", - "namePlaceholder": "请输入栏目名称", - "sortPlaceholder": "请输入排序", - "isShowPlaceholder": "是否显示", - "addArticleCategory": "添加栏目", - "updateArticleCategory": "编辑栏目", - "articleCategoryDeleteTips": "确定要删除该栏目吗?", - "nameMax": "名称不能超过20个字符", - "sortNumber": "排序号必须是数字", - "sortBetween": "排序号不能超过10000", - "show": "显示", - "hide": "不显示", - "articleNumber": "文章数量" -} \ No newline at end of file diff --git a/niucloud/addon/cms/admin/lang/zh-cn/article.edit.json b/niucloud/addon/cms/admin/lang/zh-cn/article.edit.json deleted file mode 100644 index 437e8c034..000000000 --- a/niucloud/addon/cms/admin/lang/zh-cn/article.edit.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "categoryName": "文章栏目", - "title": "文章标题", - "intro": "简介", - "summary": "文章摘要", - "image": "文章图片", - "author": "作者", - "content": "文章内容", - "visit": "实际浏览量", - "visitVirtual": "初始浏览量", - "isShow": "是否显示", - "sort": "排序", - "categoryIdPlaceholder": "请选择文章栏目", - "titlePlaceholder": "请输入文章标题", - "introPlaceholder": "请输入简介", - "summaryPlaceholder": "请输入文章摘要", - "imagePlaceholder": "请上传文章图片", - "authorPlaceholder": "请输入作者", - "contentPlaceholder": "请输入文章内容", - "visitPlaceholder": "请输入实际浏览量", - "visitVirtualPlaceholder": "请输入初始浏览量", - "isShowPlaceholder": "是否显示", - "sortPlaceholder": "请输入排序", - "addArticle": "添加文章", - "updateArticle": "编辑文章", - "titleMax": "文章标题不能超过20个字符", - "introMax": "文章简介不能超过50个字符", - "summaryMax": "文章摘要不能超过50个字符", - "imageMax": "图片路径太长", - "authorMax": "文章作者不能超过20个字符", - "isShowNumber": "是否显示必须是数字", - "isShowBetween": "是否显示只能是0或者1", - "sortNumber": "排序号必须是数字", - "sortBetween": "排序号需要在0-10000之间", - "articleNull": "未读取到文章信息!" -} \ No newline at end of file diff --git a/niucloud/addon/cms/admin/lang/zh-cn/article.list.json b/niucloud/addon/cms/admin/lang/zh-cn/article.list.json deleted file mode 100644 index 2f4b07617..000000000 --- a/niucloud/addon/cms/admin/lang/zh-cn/article.list.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "categoryName": "栏目", - "ID": "ID", - "title": "标题", - "intro": "简介", - "summary": "摘要", - "image": "封面", - "author": "作者", - "content": "文章内容", - "visit": "浏览量", - "visitVirtual": "初始浏览量", - "isShow": "是否显示", - "sort": "排序", - "createTime": "创建时间", - "updateTime": "更新时间", - "addArticle": "添加文章", - "updateArticle": "编辑文章", - "titlePlaceholder": "请输入文章标题", - "categoryIdPlaceholder": "请选择文章栏目", - "articleDeleteTips": "确定要删除该文章吗?" -} \ No newline at end of file diff --git a/niucloud/addon/cms/admin/views/article/category.vue b/niucloud/addon/cms/admin/views/article/category.vue deleted file mode 100644 index b05615015..000000000 --- a/niucloud/addon/cms/admin/views/article/category.vue +++ /dev/null @@ -1,144 +0,0 @@ - - - - - diff --git a/niucloud/addon/cms/admin/views/article/components/edit-category.vue b/niucloud/addon/cms/admin/views/article/components/edit-category.vue deleted file mode 100644 index 1545a1101..000000000 --- a/niucloud/addon/cms/admin/views/article/components/edit-category.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/cms/admin/views/article/edit.vue b/niucloud/addon/cms/admin/views/article/edit.vue deleted file mode 100644 index 826261dd2..000000000 --- a/niucloud/addon/cms/admin/views/article/edit.vue +++ /dev/null @@ -1,176 +0,0 @@ - - - - - diff --git a/niucloud/addon/cms/admin/views/article/list.vue b/niucloud/addon/cms/admin/views/article/list.vue deleted file mode 100644 index ab238cf43..000000000 --- a/niucloud/addon/cms/admin/views/article/list.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - - - diff --git a/niucloud/addon/cms/admin/views/diy/components/edit-article.vue b/niucloud/addon/cms/admin/views/diy/components/edit-article.vue deleted file mode 100644 index 6d8356541..000000000 --- a/niucloud/addon/cms/admin/views/diy/components/edit-article.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/niucloud/addon/cms/app/adminapi/controller/article/Article.php b/niucloud/addon/cms/app/adminapi/controller/article/Article.php deleted file mode 100644 index f46696255..000000000 --- a/niucloud/addon/cms/app/adminapi/controller/article/Article.php +++ /dev/null @@ -1,108 +0,0 @@ -request->params([ - [ 'title', '' ], - [ 'category_id', '' ], - [ 'sort', '' ], - [ 'is_show', '' ], - ]); - return success(( new ArticleService() )->getPage($data)); - } - - /** - * 文章详情 - * @param int $id - * @return Response - */ - public function info(int $id) - { - return success(( new ArticleService() )->getInfo($id)); - } - - /** - * 添加文章 - * @return Response - */ - public function add() - { - $data = $this->request->params([ - [ 'title', '' ], - [ 'category_id', '' ], - [ 'intro', '' ], - [ 'summary', '' ], - [ 'image', '' ], - [ 'author', '' ], - [ 'content', '', false ], - [ 'visit_virtual', 0 ], - [ 'is_show', 1 ], - [ 'sort', 0 ], - ]); - $this->validate($data, 'addon\cms\app\validate\article\Article.add'); - $id = ( new ArticleService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 文章编辑 - * @param int $id - * @return Response - */ - public function edit(int $id) - { - $data = $this->request->params([ - [ 'title', '' ], - [ 'category_id', '' ], - [ 'intro', '' ], - [ 'summary', '' ], - [ 'image', '' ], - [ 'author', '' ], - [ 'content', '', false ], - [ 'visit_virtual', 0 ], - [ 'is_show', 1 ], - [ 'sort', 0 ], - ]); - $this->validate($data, 'addon\cms\app\validate\article\Article.edit'); - ( new ArticleService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 文章删除 - * @param int $id - * @return Response - */ - public function del(int $id) - { - ( new ArticleService() )->del($id); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/cms/app/adminapi/controller/article/ArticleCategory.php b/niucloud/addon/cms/app/adminapi/controller/article/ArticleCategory.php deleted file mode 100644 index 00d148f07..000000000 --- a/niucloud/addon/cms/app/adminapi/controller/article/ArticleCategory.php +++ /dev/null @@ -1,95 +0,0 @@ -request->params([ - [ 'name', '' ], - ]); - return success(( new ArticleCategoryService() )->getPage($data)); - } - - /** - * 查询所有分类(文章添加,编辑,索引) - * @return Response - */ - public function all() - { - return success(( new ArticleCategoryService() )->getAll()); - } - - /** - * 文章分类详情 - * @param int $id - * @return Response - */ - public function info(int $id) - { - return success(( new ArticleCategoryService() )->getInfo($id)); - } - - /** - * 添加文章分类 - * @return Response - */ - public function add() - { - $data = $this->request->params([ - [ 'name', '' ], - [ 'is_show', 1 ], - [ 'sort', 0 ], - ]); - $this->validate($data, 'addon\cms\app\validate\article\ArticleCategory.add'); - $id = ( new ArticleCategoryService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 文章分类编辑 - * @param int $category_id //分类id - * @return Response - */ - public function edit(int $category_id) - { - $data = $this->request->params([ - [ 'name', '' ], - [ 'is_show', 1 ], - [ 'sort', 0 ], - ]); - $this->validate($data, 'addon\cms\app\validate\article\ArticleCategory.edit'); - ( new ArticleCategoryService() )->edit($category_id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 文章分类删除 - * @param int $category_id - * @return Response - */ - public function del(int $category_id) - { - ( new ArticleCategoryService() )->del($category_id); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/cms/app/adminapi/route/route.php b/niucloud/addon/cms/app/adminapi/route/route.php deleted file mode 100644 index 3cfad854c..000000000 --- a/niucloud/addon/cms/app/adminapi/route/route.php +++ /dev/null @@ -1,64 +0,0 @@ -middleware([ - AdminCheckToken::class, - AdminCheckRole::class, - AdminLog::class -]); diff --git a/niucloud/addon/cms/app/api/controller/article/Article.php b/niucloud/addon/cms/app/api/controller/article/Article.php deleted file mode 100644 index 7b365029c..000000000 --- a/niucloud/addon/cms/app/api/controller/article/Article.php +++ /dev/null @@ -1,59 +0,0 @@ -request->params([ - [ 'title', '' ], - [ 'category_id', '' ], - ]); - return success(( new ArticleService() )->getPage($data)); - } - - public function all() - { - $data = $this->request->params([ - [ 'title', '' ], - [ 'category_id', '' ], - [ 'ids', [] ], - [ 'limit', 0 ] - ]); - return success(( new ArticleService() )->getAll($data, $data[ 'limit' ])); - } - - /** - * 文章详情 - * @param int $id - * @return Response - */ - public function info(int $id) - { - return success(( new ArticleService() )->getInfo($id)); - } - -} diff --git a/niucloud/addon/cms/app/api/controller/article/ArticleCategory.php b/niucloud/addon/cms/app/api/controller/article/ArticleCategory.php deleted file mode 100644 index a89257952..000000000 --- a/niucloud/addon/cms/app/api/controller/article/ArticleCategory.php +++ /dev/null @@ -1,48 +0,0 @@ -request->params([ - [ 'name', '' ], - ]); - return success(( new ArticleCategoryService() )->getPage($data)); - } - - /** - * 文章分类详情 - * @param int $id - * @return Response - */ - public function info(int $id) - { - return success(( new ArticleCategoryService() )->getInfo($id)); - } - - -} diff --git a/niucloud/addon/cms/app/api/route/route.php b/niucloud/addon/cms/app/api/route/route.php deleted file mode 100644 index 0c117254c..000000000 --- a/niucloud/addon/cms/app/api/route/route.php +++ /dev/null @@ -1,44 +0,0 @@ -middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class, false) //false表示不验证登录 - ->middleware(ApiLog::class); diff --git a/niucloud/addon/cms/app/dict/diy/components.php b/niucloud/addon/cms/app/dict/diy/components.php deleted file mode 100644 index 450ddb9b4..000000000 --- a/niucloud/addon/cms/app/dict/diy/components.php +++ /dev/null @@ -1,23 +0,0 @@ - [ - 'title' => get_lang('dict_diy.component_type_basic'), - 'list' => [ - 'Article' => [ - 'title' => '文章', - 'icon' => 'iconfont-iconwenzhang', - 'path' => 'edit-article', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10007, - 'value' => [ - 'sources' => 'initial', - 'count' => 8, - 'articleIds' => [] - ], - ], - ], - ], - -]; \ No newline at end of file diff --git a/niucloud/addon/cms/app/dict/diy/links.php b/niucloud/addon/cms/app/dict/diy/links.php deleted file mode 100644 index 67e800839..000000000 --- a/niucloud/addon/cms/app/dict/diy/links.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - 'key' => 'cms', - 'addon_title' => get_lang('dict_diy.cms_title'), - 'title' => get_lang('dict_diy.cms_link'), - 'child_list' => [ - [ - 'name' => 'ARTICLE_LIST', - 'title' => get_lang('dict_diy.cms_link_article_list'), - 'url' => '/cms/pages/list', - 'is_share' => 1, - 'action' => '' - ], - ] - ], -]; \ No newline at end of file diff --git a/niucloud/addon/cms/app/dict/menu/admin.php b/niucloud/addon/cms/app/dict/menu/admin.php deleted file mode 100644 index d223f6140..000000000 --- a/niucloud/addon/cms/app/dict/menu/admin.php +++ /dev/null @@ -1,73 +0,0 @@ - '微官网', - 'menu_key' => 'cms', - 'menu_type' => 0, - 'icon' => 'element-Tickets', - 'api_url' => '', - 'router_path' => 'cms', - 'view_path' => '', - 'methods' => '', - 'sort' => 100, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '文章管理', - 'menu_short_name' => '文章', - 'menu_key' => 'cms_article', - 'menu_type' => 0, - 'icon' => 'iconfont-iconwenzhangguanli1', - 'api_url' => '', - 'router_path' => 'article', - 'view_path' => '', - 'methods' => '', - 'sort' => 98, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '文章列表', - 'menu_key' => 'cms_article_list', - 'menu_type' => 1, - 'icon' => 'element-ChatDotSquare', - 'api_url' => 'cms/article', - 'router_path' => 'list', - 'view_path' => 'article/list', - 'methods' => 'get', - 'sort' => 100, - 'status' => 1, - 'is_show' => 1, - ], - [ - 'menu_name' => '文章添加/编辑', - 'menu_key' => 'cms_article_edit', - 'menu_type' => 1, - 'icon' => '', - 'api_url' => 'cms/article', - 'router_path' => 'edit', - 'view_path' => 'article/edit', - 'methods' => 'post', - 'sort' => 90, - 'status' => 1, - 'is_show' => 0, - ], - [ - 'menu_name' => '文章栏目', - 'menu_key' => 'cms_article_category', - 'menu_type' => 1, - 'icon' => 'element-CollectionTag', - 'api_url' => 'article/category', - 'router_path' => 'category', - 'view_path' => 'article/category', - 'methods' => 'get', - 'sort' => 80, - 'status' => 1, - 'is_show' => 1, - ], - ] - ] - ] - ] -]; diff --git a/niucloud/addon/cms/app/event.php b/niucloud/addon/cms/app/event.php deleted file mode 100644 index e97c7685d..000000000 --- a/niucloud/addon/cms/app/event.php +++ /dev/null @@ -1,7 +0,0 @@ - [ - 'WapIndex' => [ 'addon\cms\app\listener\WapIndexListener' ], - ] -]; \ No newline at end of file diff --git a/niucloud/addon/cms/app/lang/en/api.php b/niucloud/addon/cms/app/lang/en/api.php deleted file mode 100644 index 92293fcd4..000000000 --- a/niucloud/addon/cms/app/lang/en/api.php +++ /dev/null @@ -1,14 +0,0 @@ - [ - 'article' => 'article', - 'article_list' => 'article list', - 'article_edit' => 'article edit', - 'article_category' => 'article category', - ], - -]; diff --git a/niucloud/addon/cms/app/lang/en/validate.php b/niucloud/addon/cms/app/lang/en/validate.php deleted file mode 100644 index 8a318b171..000000000 --- a/niucloud/addon/cms/app/lang/en/validate.php +++ /dev/null @@ -1,27 +0,0 @@ - [ - 'title_require' => 'title is require', - 'title_max' => 'title must not be exceed 20 points', - 'intro_max' => 'intro must not be exceed 50 points', - 'summary_max' => 'summary must not be exceed 50 points', - 'image_max' => 'image is exceed max', - 'author_max' => 'author must not be exceed 20 points', - 'is_show_number' => 'is_show must be a number', - 'is_show_between' => 'is_show must be 0 or 1', - 'sort_number' => 'sort must be a number', - 'sort_between' => 'sort must not be exceed 10000', - 'cate_name_require' => 'cate_name is require', - 'cate_name_max' => 'cate_name must not be exceed 120 points', - ] -]; diff --git a/niucloud/addon/cms/app/lang/zh-cn/api.php b/niucloud/addon/cms/app/lang/zh-cn/api.php deleted file mode 100644 index 92293fcd4..000000000 --- a/niucloud/addon/cms/app/lang/zh-cn/api.php +++ /dev/null @@ -1,14 +0,0 @@ - [ - 'cms_title' => '微官网', - 'cms_link' => '微官网链接', - 'cms_link_article_list' => '文章资讯', - ], - 'dict_wap_index' => [ - 'cms' => '微官网', - 'cms_desc' => '文章栏目管理', - ], -]; diff --git a/niucloud/addon/cms/app/lang/zh-cn/validate.php b/niucloud/addon/cms/app/lang/zh-cn/validate.php deleted file mode 100644 index 1a56efc1a..000000000 --- a/niucloud/addon/cms/app/lang/zh-cn/validate.php +++ /dev/null @@ -1,30 +0,0 @@ - [ - 'title_require' => '文章标题必须填写', - 'title_max' => '文章标题不能超过20个字符', - 'intro_max' => '文章简介不能超过50个字符', - 'summary_max' => '文章摘要不能超过50个字符', - 'image_max' => '图片路径太长', - 'author_max' => '文章作者不能超过20个字符', - 'is_show_number' => '是否显示必须是数字', - 'is_show_between' => '是否显示只能是0或者1', - 'sort_number' => '排序号必须是数字', - 'sort_between' => '排序号不能超过10000', - 'cate_name_require' => '栏目名称必须填写', - 'cate_name_max' => '栏目不能超过20个字符', - 'category_id_require' => '文章栏目必须填写', - 'category_id_num' => '文章栏目必须是整数', - 'content_require' => '文章内容必须填写', - ], -]; diff --git a/niucloud/addon/cms/app/listener/WapIndexListener.php b/niucloud/addon/cms/app/listener/WapIndexListener.php deleted file mode 100644 index 5d84d4321..000000000 --- a/niucloud/addon/cms/app/listener/WapIndexListener.php +++ /dev/null @@ -1,31 +0,0 @@ - 'cms', - "title" => get_lang("dict_wap_index.cms"), - 'desc' => get_lang("dict_wap_index.cms_desc"), - "url" => "/cms/pages/list", - 'icon'=>'addon/cms/icon.png' - ], - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/cms/app/model/article/CmsArticle.php b/niucloud/addon/cms/app/model/article/CmsArticle.php deleted file mode 100644 index d825e2fc7..000000000 --- a/niucloud/addon/cms/app/model/article/CmsArticle.php +++ /dev/null @@ -1,139 +0,0 @@ -hasOne(CmsArticleCategory::class, 'category_id', 'category_id')->joinType('left')->withField('category_id, name')->bind([ 'category_name' => 'name' ]); - } - - /** - * 文章分类搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchCategoryIdAttr($query, $value, $data) - { - if ($value) { - $query->where('category_id', $value); - } - } - - /** - * 文章标题搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchTitleAttr($query, $value, $data) - { - if ($value) { - $query->where('title', 'like', '%' . $value . '%'); - } - } - - /** - * 文章标题搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchIsShowAttr($query, $value, $data) - { - if ($value != '') { - $query->where('is_show', $value); - } - } - - public function searchIdsAttr(Query $query, $value, $data) - { - if (!empty($value)) { - $query->whereIn('id', $data[ 'ids' ]); - } - } - - - /** - * 文章标题搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchSortAttr($query, $value, $data) - { - if ($value) { - $query->where('sort', $value); - } - } - - public function getArticleUrlAttr($value, $data) - { - - $wap_domain = !empty(env("system.wap_domain")) ? preg_replace('#/$#', '', env("system.wap_domain")) : request()->domain(); - $web_domain = !empty(env("system.web_domain")) ? preg_replace('#/$#', '', env("system.web_domain")) : request()->domain(); - - return [ - 'wap_url' => $wap_domain . "/wap/cms/pages/detail?id={$data['id']}", - 'web_url' => $web_domain . "/web/article/detail?id={$data['id']}" - ]; - } - - public function getImageThumbBigAttr($value, $data) - { - if ($data[ 'image' ] != '') { - return get_thumb_images($data[ 'image' ], FileDict::BIG); - } - } - - public function getImageThumbMidAttr($value, $data) - { - if ($data[ 'image' ] != '') { - return get_thumb_images($data[ 'image' ], FileDict::MID); - } - } - - public function getImageThumbSmallAttr($value, $data) - { - if ($data[ 'image' ] != '') { - return get_thumb_images($data[ 'image' ], FileDict::SMALL); - } - } -} diff --git a/niucloud/addon/cms/app/model/article/CmsArticleCategory.php b/niucloud/addon/cms/app/model/article/CmsArticleCategory.php deleted file mode 100644 index 07ca27ef2..000000000 --- a/niucloud/addon/cms/app/model/article/CmsArticleCategory.php +++ /dev/null @@ -1,54 +0,0 @@ -where([ [ 'name', 'like', "%$value%" ] ]); - } - } - - public function getArticleNumAttr($value, $data) - { - return ( new CmsArticle() )->where([ [ 'category_id', '=', $data[ 'category_id' ] ] ])->count(); - } - -} diff --git a/niucloud/addon/cms/app/service/admin/article/ArticleCategoryService.php b/niucloud/addon/cms/app/service/admin/article/ArticleCategoryService.php deleted file mode 100644 index d6e0ec665..000000000 --- a/niucloud/addon/cms/app/service/admin/article/ArticleCategoryService.php +++ /dev/null @@ -1,102 +0,0 @@ -model = new CmsArticleCategory(); - } - - /** - * 获取文章分类列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - - $field = 'category_id, name, sort, is_show, create_time, update_time'; - $order = 'create_time desc'; - $search_model = $this->model->withSearch(['name'], $where)->field($field)->order($order)->append(["article_num"]); - return $this->pageQuery($search_model); - } - - /** - * 查询所有分类(文章添加) - */ - public function getAll() - { - $field = 'category_id, name, sort'; - $order = 'sort desc'; - return $this->model->where([['is_show', '=', 1]])->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取文章分类信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'category_id, name, sort, is_show, create_time, update_time'; - - return $this->model->field($field)->where([['category_id', '=', $id]])->append(["article_num"])->findOrEmpty()->toArray(); - } - - /** - * 添加文章分类 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $res = $this->model->create($data); - return $res->category_id; - - } - - /** - * 文章分类编辑 - * @param int $id - * @param array $data - * @return true - */ - public function edit(int $id, array $data) - { - $data['update_time'] = time(); - $this->model->where([['category_id', '=', $id]])->update($data); - return true; - } - - /** - * 删除文章分类 - * @param int $id - * @return bool - */ - public function del(int $id) - { - return $this->model->where([['category_id', '=', $id]])->delete(); - } - -} diff --git a/niucloud/addon/cms/app/service/admin/article/ArticleService.php b/niucloud/addon/cms/app/service/admin/article/ArticleService.php deleted file mode 100644 index f3b3c7c95..000000000 --- a/niucloud/addon/cms/app/service/admin/article/ArticleService.php +++ /dev/null @@ -1,92 +0,0 @@ -model = new CmsArticle(); - } - - /** - * 获取文章列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'id, category_id, title, intro, summary, image, author, content, visit, visit_virtual, is_show, sort, create_time, update_time'; - $order = 'create_time desc'; - $search_model = $this->model->withSearch([ 'title', 'category_id', 'is_show'], $where)->with('cmsArticleCategory')->field($field)->order($order)->append(['article_url','image_thumb_small']); - return $this->pageQuery($search_model); - } - - /** - * 获取文章信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'id, category_id, title, intro, summary, image, author, content, visit, visit_virtual, is_show, sort, create_time, update_time'; - - return $this->model->where([ [ 'id', '=', $id ]])->with('cmsArticleCategory')->field($field)->append(['image_thumb_small'])->findOrEmpty()->toArray(); - } - - /** - * 添加文章 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $res = $this->model->create($data); - return $res->id; - - } - - /** - * 文章编辑 - * @param int $id - * @param array $data - * @return true - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $this->model->where([ [ 'id', '=', $id ]])->update($data); - return true; - } - - /** - * 删除文章 - * @param int $id - * @return bool - */ - public function del(int $id) - { - return $this->model->where([ [ 'id', '=', $id ] ])->delete(); - } - -} diff --git a/niucloud/addon/cms/app/service/api/article/ArticleCategoryService.php b/niucloud/addon/cms/app/service/api/article/ArticleCategoryService.php deleted file mode 100644 index efccbab98..000000000 --- a/niucloud/addon/cms/app/service/api/article/ArticleCategoryService.php +++ /dev/null @@ -1,53 +0,0 @@ -model = new CmsArticleCategory(); - } - - /** - * 获取文章分类列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'category_id, name, sort, is_show, create_time, update_time'; - $order = 'create_time desc'; - $search_model = $this->model->withSearch(['name'], $where)->field($field)->order($order); - return $this->pageQuery($search_model); - } - - /** - * 获取文章分类信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'category_id, name, sort, is_show, create_time, update_time'; - return $this->model->field($field)->where([['category_id', '=', $id]])->findOrEmpty()->toArray(); - } -} diff --git a/niucloud/addon/cms/app/service/api/article/ArticleService.php b/niucloud/addon/cms/app/service/api/article/ArticleService.php deleted file mode 100644 index bab4a4d02..000000000 --- a/niucloud/addon/cms/app/service/api/article/ArticleService.php +++ /dev/null @@ -1,74 +0,0 @@ -model = new CmsArticle(); - } - - /** - * 获取文章列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'id, category_id, title, intro, summary, image, author, content, visit, visit_virtual, is_show, sort, create_time, update_time'; - $order = 'create_time desc'; - $search_model = $this->model->withSearch([ 'title', 'category_id'], $where)->with('cmsArticleCategory')->field($field)->order($order)->append(['image_thumb_mid']); - return $this->pageQuery($search_model); - } - - /** - * 文章列表 - * @param array $where - * @param int $limit - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getAll(array $where = [], int $limit = 0){ - $field = 'id, category_id, title, intro, summary, image, author, content, visit, visit_virtual, is_show, sort, create_time, update_time'; - $order = 'create_time desc'; - return $this->model->where([ ['is_show', '=', 1]])->withSearch([ 'title', 'category_id', 'ids' ], $where)->limit($limit)->with('cmsArticleCategory')->field($field)->append(['image_thumb_mid'])->order($order)->select()->toArray(); - } - - /** - * 获取文章信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'id, category_id, title, intro, summary, image, author, content, visit, visit_virtual, is_show, sort, create_time, update_time'; - - return $this->model->with('cmsArticleCategory')->field($field)->where([ [ 'id', '=', $id ] ])->append(['image_thumb_big'])->findOrEmpty()->toArray(); - } - -} diff --git a/niucloud/addon/cms/app/validate/article/Article.php b/niucloud/addon/cms/app/validate/article/Article.php deleted file mode 100644 index 1ebfcfaa9..000000000 --- a/niucloud/addon/cms/app/validate/article/Article.php +++ /dev/null @@ -1,57 +0,0 @@ - 'require|max:20', - 'intro' => 'max:50', - 'summary' => 'max:50', - 'image' => 'max:100', - 'author' => 'max:20', - 'is_show' => 'number|between:0,1', - 'sort' => 'number|between:0,10000', - 'category_id' => 'number|require', - 'content' => 'require', - ]; - - protected $message = [ - 'title.require' => 'validate_article.title_require', - 'title.max' => 'validate_article.title_max', - 'intro.max' => 'validate_article.intro_max', - 'summary.max' => 'validate_article.summary_max', - 'image.max' => 'validate_article.image_max', - 'author.max' => 'validate_article.author_max', - 'is_show.number' => 'validate_article.is_show_number', - 'is_show.between' => 'validate_article.is_show_between', - 'sort.number' => 'validate_article.sort_number', - 'sort.between' => 'validate_article.sort_between', - 'category_id.require' => 'validate_article.category_id_require', - 'category_id.number' => 'validate_article.category_id_number', - 'content.require' => 'validate_article.content_require', - ]; - - protected $scene = [ - 'add' => ['title', 'intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'], - 'edit' => ['title', 'intro', 'summary', 'image', 'author', 'is_show', 'sort', 'content', 'category_id'], - ]; -} diff --git a/niucloud/addon/cms/app/validate/article/ArticleCategory.php b/niucloud/addon/cms/app/validate/article/ArticleCategory.php deleted file mode 100644 index a02644103..000000000 --- a/niucloud/addon/cms/app/validate/article/ArticleCategory.php +++ /dev/null @@ -1,45 +0,0 @@ - 'require|max:20', - 'is_show' => 'number|between:0,1', - 'sort' => 'number|between:0,10000' - ]; - - protected $message = [ - 'name.require' => 'validate_article.cate_name_require', - 'name.max' => 'validate_article.cate_name_max', - 'is_show.number' => 'validate_article.is_show_number', - 'is_show.between' => 'validate_article.is_show_between', - 'sort.number' => 'validate_article.sort_number', - 'sort.between' => 'validate_article.sort_between', - ]; - - protected $scene = [ - 'add' => ['name', 'is_show', 'sort'], - 'edit' => ['name', 'is_show', 'sort'], - ]; -} diff --git a/niucloud/addon/cms/info.json b/niucloud/addon/cms/info.json deleted file mode 100644 index a9bdde68e..000000000 --- a/niucloud/addon/cms/info.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "title": "微官网", - "desc": "文章栏目管理", - "key": "cms", - "version": "1.0.1", - "author": "niucloud", - "type": "app", - "support_app": "" -} \ No newline at end of file diff --git a/niucloud/addon/cms/package/uni-app-pages.php b/niucloud/addon/cms/package/uni-app-pages.php deleted file mode 100644 index c42e2130a..000000000 --- a/niucloud/addon/cms/package/uni-app-pages.php +++ /dev/null @@ -1,19 +0,0 @@ - <<) { - return request.get('cms/article', params) -} - -/** - * 文章列表 - */ -export function getArticleAll(params: Record) { - return request.get('cms/article/all', params) -} - -/** - * 文章详情 - */ -export function getArticleDetail(id: number) { - return request.get(`cms/article/${id}`) -} - -/** - * 文章分类 - */ -export function getArticleCategory() { - return request.get('cms/category') -} \ No newline at end of file diff --git a/niucloud/addon/cms/uni-app/components/diy/article/index.vue b/niucloud/addon/cms/uni-app/components/diy/article/index.vue deleted file mode 100644 index 000dd1a15..000000000 --- a/niucloud/addon/cms/uni-app/components/diy/article/index.vue +++ /dev/null @@ -1,132 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/cms/uni-app/locale/en.json b/niucloud/addon/cms/uni-app/locale/en.json deleted file mode 100644 index 7a73a41bf..000000000 --- a/niucloud/addon/cms/uni-app/locale/en.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/niucloud/addon/cms/uni-app/locale/zh-Hans.json b/niucloud/addon/cms/uni-app/locale/zh-Hans.json deleted file mode 100644 index bf3bd620f..000000000 --- a/niucloud/addon/cms/uni-app/locale/zh-Hans.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pages.list": "资讯中心", - "pages.detail": "文章详情" -} \ No newline at end of file diff --git a/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.detail.json b/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.detail.json deleted file mode 100644 index ca6b8c2d5..000000000 --- a/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.detail.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "detail": "文章详情", - "abstract": "摘要", - "loadingText": "正在加载" -} diff --git a/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.list.json b/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.list.json deleted file mode 100644 index 1770d8c57..000000000 --- a/niucloud/addon/cms/uni-app/locale/zh-Hans/pages.list.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "list": "文章列表", - "noData": "~ 暂无数据 ~", - "all": "全部", - "end": "-- 到底了 --", - "searchPlaceholder": "请输入搜索关键词" -} diff --git a/niucloud/addon/cms/uni-app/pages/detail.vue b/niucloud/addon/cms/uni-app/pages/detail.vue deleted file mode 100644 index 3a5da5b47..000000000 --- a/niucloud/addon/cms/uni-app/pages/detail.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - \ No newline at end of file diff --git a/niucloud/addon/cms/uni-app/pages/list.vue b/niucloud/addon/cms/uni-app/pages/list.vue deleted file mode 100644 index f36731b3d..000000000 --- a/niucloud/addon/cms/uni-app/pages/list.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/cms/web/api/article.ts b/niucloud/addon/cms/web/api/article.ts deleted file mode 100644 index 266901f09..000000000 --- a/niucloud/addon/cms/web/api/article.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 文章列表 - */ -export function getArticleList(params: Record) { - return request.get('cms/article', params) -} - -/** - * 文章列表 - */ -export function getArticleAll(params: Record) { - return request.get('cms/article/all', params) -} - -/** - * 文章详情 - */ -export function getArticleDetail(id: number) { - return request.get(`cms/article/${id}`) -} - -/** - * 文章分类 - */ -export function getArticleCategory() { - return request.get('cms/category') -} \ No newline at end of file diff --git a/niucloud/addon/cms/web/lang/zh-cn/article.detail.json b/niucloud/addon/cms/web/lang/zh-cn/article.detail.json deleted file mode 100644 index 96fc010c4..000000000 --- a/niucloud/addon/cms/web/lang/zh-cn/article.detail.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "文章" -} \ No newline at end of file diff --git a/niucloud/addon/cms/web/lang/zh-cn/article.list.json b/niucloud/addon/cms/web/lang/zh-cn/article.list.json deleted file mode 100644 index 96fc010c4..000000000 --- a/niucloud/addon/cms/web/lang/zh-cn/article.list.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "文章" -} \ No newline at end of file diff --git a/niucloud/addon/cms/web/lang/zh-cn/pages.json b/niucloud/addon/cms/web/lang/zh-cn/pages.json deleted file mode 100644 index ca3a6263a..000000000 --- a/niucloud/addon/cms/web/lang/zh-cn/pages.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "pages": { - "cms": { - "article": { - "list": "文章", - "detail": "文章" - } - } - } -} \ No newline at end of file diff --git a/niucloud/addon/cms/web/pages/article/detail.vue b/niucloud/addon/cms/web/pages/article/detail.vue deleted file mode 100644 index 00e47bda9..000000000 --- a/niucloud/addon/cms/web/pages/article/detail.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - diff --git a/niucloud/addon/cms/web/pages/article/list.vue b/niucloud/addon/cms/web/pages/article/list.vue deleted file mode 100644 index 1b5161635..000000000 --- a/niucloud/addon/cms/web/pages/article/list.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - - - diff --git a/niucloud/addon/cms/web/pages/routes.ts b/niucloud/addon/cms/web/pages/routes.ts deleted file mode 100644 index 760f8b083..000000000 --- a/niucloud/addon/cms/web/pages/routes.ts +++ /dev/null @@ -1,10 +0,0 @@ -export default [ - { - path: "/cms/article/list", - component: () => import('~/cms/pages/article/list.vue') - }, - { - path: "/cms/article/detail", - component: () => import('~/cms/pages/article/detail.vue') - } -] \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/dict/diy/template.php b/niucloud/addon/hello_world/app/dict/diy/template.php index c493f06a5..116e5509a 100644 --- a/niucloud/addon/hello_world/app/dict/diy/template.php +++ b/niucloud/addon/hello_world/app/dict/diy/template.php @@ -3,12 +3,12 @@ return [ 'DIY_HELLO_WORLD_INDEX' => [ 'title' => get_lang('dict_diy.page_hello_world_index'), - 'page' => 'hello_world/pages/index', + 'page' => '/hello_world/pages/index', 'action' => '' ], 'DIY_HELLO_WORLD_INFO' => [ 'title' => get_lang('dict_diy.page_hello_world_info'), - 'page' => 'hello_world/pages/info', + 'page' => '/hello_world/pages/info', 'action' => '' ], ]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/dict/notice/notice.php b/niucloud/addon/hello_world/app/dict/notice/notice.php index 138a50529..2cb6e4e9a 100644 --- a/niucloud/addon/hello_world/app/dict/notice/notice.php +++ b/niucloud/addon/hello_world/app/dict/notice/notice.php @@ -2,6 +2,7 @@ return [ //充值成功通知,站点端发送 'recharge_success' => [ + 'addon' => 'hello_world', 'key' => 'recharge_success', 'receiver_type' => 1, 'name' => '充值成功通知', diff --git a/niucloud/addon/hello_world/sql/install.sql b/niucloud/addon/hello_world/sql/install.sql index a308250a1..5287466d1 100644 --- a/niucloud/addon/hello_world/sql/install.sql +++ b/niucloud/addon/hello_world/sql/install.sql @@ -2,5 +2,5 @@ CREATE TABLE IF NOT EXISTS `{{prefix}}hello_world` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='演示插件表'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='演示插件表'; INSERT INTO `{{prefix}}hello_world`(`name`) VALUES ('名称'); \ No newline at end of file diff --git a/niucloud/addon/hello_world/uni-app/components/fixed/hello-index/index.vue b/niucloud/addon/hello_world/uni-app/components/fixed/hello-index/index.vue index 15ad80071..d02fe27cd 100644 --- a/niucloud/addon/hello_world/uni-app/components/fixed/hello-index/index.vue +++ b/niucloud/addon/hello_world/uni-app/components/fixed/hello-index/index.vue @@ -2,13 +2,13 @@ hello-index,固定模板示例,我也可以装修 - + \ No newline at end of file diff --git a/niucloud/addon/recharge/Manage.php b/niucloud/addon/recharge/Manage.php deleted file mode 100644 index c86139615..000000000 --- a/niucloud/addon/recharge/Manage.php +++ /dev/null @@ -1,37 +0,0 @@ -) { - return request.get(`recharge/order`, {params}) -} - -/** - * 获取充值订单统计 - * @param params - * @returns - */ -export function getRechargeStat(params: Record) { - return request.get(`recharge/order/stat`, {params}) -} - -/** - * 获取充值订单详情 - * @param order_id - * @returns - */ -export function getRechargeOrderInfo(order_id: number) { - return request.get(`recharge/order/${order_id}`); -} - -/** - * 获取充值订单状态列表 - * @returns - */ -export function getRechargeOrderStatusList() { - return request.get(`recharge/order/status`) -} - -/** - * 获取退款记录 - * @returns - */ -export function getRechargeRefund(params: Record) { - return request.get(`recharge/refund`, {params}) -} - -/** - * 获取退款状态 - * @returns - */ -export function getRechargeRefundStatus() { - return request.get(`recharge/refund/status`) -} - -/** - * 充值订单发起退款 - * @returns - */ -export function rechargeRefund(order_id: number) { - return request.put(`recharge/refund/${order_id}`, {}, {showSuccessMessage: true}); -} - -/** - * 获取退款统计 - * @returns - */ -export function getRechargeRefundStat() { - return request.get(`recharge/refund/stat`); -} \ No newline at end of file diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/order.detail.json b/niucloud/addon/recharge/admin/lang/zh-cn/order.detail.json deleted file mode 100644 index b9399e180..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/order.detail.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "orderInfo":"订单详情", - "orderDiscountMoney":"优惠金额", - "ip":"下单IP", - "payTime":"支付时间", - "remark":"商家留言", - "memberMessage":"买家留言", - "orderNo":"订单编号", - "orderStatus":"订单状态", - "orderNoPlaceholder":"请输入订单编号", - "createTime":"创建时间", - "rechargeMoney":"充值金额", - "orderMoney":"订单金额", - "member":"买家", - "orderFromName":"订单来源", - "payTypeName":"支付方式", - "startDate":"开始时间", - "endDate":"结束时间" -} \ No newline at end of file diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/order.list.json b/niucloud/addon/recharge/admin/lang/zh-cn/order.list.json deleted file mode 100644 index bb9e49d42..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/order.list.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "totalRechargeRefundMoney":"充值退款(元)", - "totalRechargeMoney":"充值金额(元)", - "rechargeRefundMoney":"充值退款", - "rechargeNo":"充值单号", - "orderStatus":"订单状态", - "rechargeNoPlaceholder":"请输入充值单号", - "createTime":"充值时间", - "rechargeMoney":"充值金额", - "orderMoney":"订单金额", - "member":"会员信息", - "orderFromName":"订单来源", - "payTypeName":"支付方式", - "startDate":"开始时间", - "endDate":"结束时间", - "namePlaceholder":"请选择", - "refundBtn":"退款", - "refundContent":"是否确认退款", - "payTime": "支付时间", - "refundStatus": "退款状态", - "startMoney": "起始金额", - "endMoney": "结束金额" -} \ No newline at end of file diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/order.refund.json b/niucloud/addon/recharge/admin/lang/zh-cn/order.refund.json deleted file mode 100644 index a02a18f78..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/order.refund.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "refundNumber":"退款单号", - "userInfo":"用户信息", - "sourceNumber":"来源单号", - "refundAmount":"退款金额", - "refundTime":"退款时间", - "detail": "详情", - "statusName": "状态", - "memberInfo": "会员信息", - "refundSource": "退款来源", - "startDate":"开始时间", - "endDate":"结束时间", - "refundStatus": "退款状态", - "accumulateRefundMoney": "累计退款金额(元)", - "haveRefundMoney": "退款中金额(元)", - "refundSuccessMonry": "退款成功金额(元)", - "refundFailMoney": "退款失败金额(元)", - "memberInfoPlaceholder":"请输入会员编号/昵称/手机号", - "refundNumberPlaceholder":"请输入退款单号", - "orderNumber": "来源单号", - "orderNumberPlaceholder": "请输入来源单号", - "refundDetail": "退款详情", - "nickname": "会员昵称" -} diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.detail.json b/niucloud/addon/recharge/admin/lang/zh-cn/recharge.detail.json deleted file mode 100644 index b9399e180..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.detail.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "orderInfo":"订单详情", - "orderDiscountMoney":"优惠金额", - "ip":"下单IP", - "payTime":"支付时间", - "remark":"商家留言", - "memberMessage":"买家留言", - "orderNo":"订单编号", - "orderStatus":"订单状态", - "orderNoPlaceholder":"请输入订单编号", - "createTime":"创建时间", - "rechargeMoney":"充值金额", - "orderMoney":"订单金额", - "member":"买家", - "orderFromName":"订单来源", - "payTypeName":"支付方式", - "startDate":"开始时间", - "endDate":"结束时间" -} \ No newline at end of file diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.list.json b/niucloud/addon/recharge/admin/lang/zh-cn/recharge.list.json deleted file mode 100644 index bb9e49d42..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.list.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "totalRechargeRefundMoney":"充值退款(元)", - "totalRechargeMoney":"充值金额(元)", - "rechargeRefundMoney":"充值退款", - "rechargeNo":"充值单号", - "orderStatus":"订单状态", - "rechargeNoPlaceholder":"请输入充值单号", - "createTime":"充值时间", - "rechargeMoney":"充值金额", - "orderMoney":"订单金额", - "member":"会员信息", - "orderFromName":"订单来源", - "payTypeName":"支付方式", - "startDate":"开始时间", - "endDate":"结束时间", - "namePlaceholder":"请选择", - "refundBtn":"退款", - "refundContent":"是否确认退款", - "payTime": "支付时间", - "refundStatus": "退款状态", - "startMoney": "起始金额", - "endMoney": "结束金额" -} \ No newline at end of file diff --git a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.refund.json b/niucloud/addon/recharge/admin/lang/zh-cn/recharge.refund.json deleted file mode 100644 index a02a18f78..000000000 --- a/niucloud/addon/recharge/admin/lang/zh-cn/recharge.refund.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "refundNumber":"退款单号", - "userInfo":"用户信息", - "sourceNumber":"来源单号", - "refundAmount":"退款金额", - "refundTime":"退款时间", - "detail": "详情", - "statusName": "状态", - "memberInfo": "会员信息", - "refundSource": "退款来源", - "startDate":"开始时间", - "endDate":"结束时间", - "refundStatus": "退款状态", - "accumulateRefundMoney": "累计退款金额(元)", - "haveRefundMoney": "退款中金额(元)", - "refundSuccessMonry": "退款成功金额(元)", - "refundFailMoney": "退款失败金额(元)", - "memberInfoPlaceholder":"请输入会员编号/昵称/手机号", - "refundNumberPlaceholder":"请输入退款单号", - "orderNumber": "来源单号", - "orderNumberPlaceholder": "请输入来源单号", - "refundDetail": "退款详情", - "nickname": "会员昵称" -} diff --git a/niucloud/addon/recharge/admin/views/order/detail.vue b/niucloud/addon/recharge/admin/views/order/detail.vue deleted file mode 100644 index d9ec246af..000000000 --- a/niucloud/addon/recharge/admin/views/order/detail.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - - diff --git a/niucloud/addon/recharge/admin/views/order/list.vue b/niucloud/addon/recharge/admin/views/order/list.vue deleted file mode 100644 index 8236b6203..000000000 --- a/niucloud/addon/recharge/admin/views/order/list.vue +++ /dev/null @@ -1,280 +0,0 @@ - - - - - diff --git a/niucloud/addon/recharge/admin/views/order/refund.vue b/niucloud/addon/recharge/admin/views/order/refund.vue deleted file mode 100644 index a8a5b738b..000000000 --- a/niucloud/addon/recharge/admin/views/order/refund.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - - diff --git a/niucloud/addon/recharge/app/adminapi/controller/Order.php b/niucloud/addon/recharge/app/adminapi/controller/Order.php deleted file mode 100644 index 06391adee..000000000 --- a/niucloud/addon/recharge/app/adminapi/controller/Order.php +++ /dev/null @@ -1,119 +0,0 @@ -request->params([ - [ 'order_no', '' ], - [ 'order_status', '' ], - [ 'order_from', '' ], - [ 'create_time', [] ], - [ 'pay_time', [] ], - [ 'member_id', '' ], - [ 'start_money', 0 ], - [ 'end_money', 0 ] - ]); - return success(( new RechargeOrderService() )->getPage($data)); - } - - /** - * 充值订单详情 - * @param int $order_id - * @return Response - */ - public function detail(int $order_id) - { - return success(( new RechargeOrderService() )->getDetail($order_id)); - } - - public function status() - { - return success(( new RechargeOrderService() )->getStatus()); - } - - public function refund($order_id) - { - $res = ( new RechargeOrderRefundService() )->create($order_id); - if ($res === true) return success(); - return fail($res); - } - - /** - * 退款列表 - * @return Response - */ - public function refundLists() - { - $data = $this->request->params([ - [ 'create_time', [] ], - [ 'member_id', '' ], - [ 'refund_no', '' ], - [ 'status', '' ], - [ 'keywords', '' ], - [ 'order_no', '' ], - ]); - return success(( new RechargeOrderRefundService() )->getPage($data)); - } - - /** - * 退款详情 - * @param int $refund_id - * @return Response - */ - public function refundDetail(int $refund_id) - { - return success(( new RechargeOrderRefundService() )->getDetail($refund_id)); - } - - /** - * 查询退款状态 - * @return Response - */ - public function refundStatus() - { - return success(( new RechargeOrderRefundService() )->getStatus()); - } - - /** - * 退款统计 - */ - public function refundStat() - { - return success(( new RechargeOrderRefundService() )->stat()); - } - - /** - * 充值统计 - */ - public function stat() - { - $data = $this->request->params([ - [ 'member_id', '' ], - ]); - $res = ( new RechargeOrderService() )->stat($data); - return success($res); - } - - -} diff --git a/niucloud/addon/recharge/app/adminapi/route/route.php b/niucloud/addon/recharge/app/adminapi/route/route.php deleted file mode 100644 index cb4d0e77a..000000000 --- a/niucloud/addon/recharge/app/adminapi/route/route.php +++ /dev/null @@ -1,56 +0,0 @@ -middleware([ - AdminCheckToken::class, - AdminCheckRole::class, - AdminLog::class -]); diff --git a/niucloud/addon/recharge/app/api/controller/Recharge.php b/niucloud/addon/recharge/app/api/controller/Recharge.php deleted file mode 100644 index 3005ae69b..000000000 --- a/niucloud/addon/recharge/app/api/controller/Recharge.php +++ /dev/null @@ -1,53 +0,0 @@ -request->params([ - [ 'member_message', '' ], - [ 'recharge_money', 0 ] - ]); - $res = ( new RechargeOrderService() )->recharge($data); - return success($res); - } - - public function lists() - { - $data = $this->request->params([ - [ 'order_status', '' ] - ]); - $res = ( new RechargeOrderService() )->getPage($data); - return success($res); - } - - /** - * 查询充值订单详情 - * @param int $order_id - * @return Response - */ - public function detail(int $order_id) - { - $res = ( new RechargeOrderService() )->getDetail($order_id); - return success($res); - } -} diff --git a/niucloud/addon/recharge/app/api/route/route.php b/niucloud/addon/recharge/app/api/route/route.php deleted file mode 100644 index dc9b66f54..000000000 --- a/niucloud/addon/recharge/app/api/route/route.php +++ /dev/null @@ -1,36 +0,0 @@ -middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class, true) - ->middleware(ApiLog::class); diff --git a/niucloud/addon/recharge/app/dict/RechargeOrderDict.php b/niucloud/addon/recharge/app/dict/RechargeOrderDict.php deleted file mode 100644 index de35ff998..000000000 --- a/niucloud/addon/recharge/app/dict/RechargeOrderDict.php +++ /dev/null @@ -1,132 +0,0 @@ - 'recharge', - 'name' => get_lang('dict_order.order_type_recharge') - ]; - } - - public static function getStatus($status = '') - { - $data = [ - - self::WAIT_PAY => [ - 'name' => '待支付', - 'status' => self::WAIT_PAY, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - [ - 'name' => '支付', - 'class' => '', - 'params' => '' - ], - ], - ], - self::FINISH => [ - 'name' => '已完成', - 'status' => self::FINISH, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - ], - ], - self::CLOSE => [ - 'name' => '已关闭', - 'status' => self::CLOSE, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - ], - ] - - - ]; - if ($status == '') { - return $data; - } - return $data[$status] ?? ''; - } - - /** - * 获取退款状态 - * @param string $status - * @return array|array[]|string - */ - public static function getRefundStatus(string $status = '') - { - $data = [ - self::REFUNDING => [ - 'name' => get_lang('dict_order_refund.refunding'), - 'status' => self::REFUNDING - ], - self::REFUND_COMPLETED => [ - 'name' => get_lang('dict_order_refund.refund_complete'), - 'status' => self::REFUND_COMPLETED - ], - self::REFUND_FAIL => [ - 'name' => get_lang('dict_order_refund.refund_fail'), - 'status' => self::REFUND_FAIL - ] - ]; - - if ($status == '') { - return $data; - } - return $data[$status] ?? ''; - } - -} diff --git a/niucloud/addon/recharge/app/dict/diy/links.php b/niucloud/addon/recharge/app/dict/diy/links.php deleted file mode 100644 index f7150ccfa..000000000 --- a/niucloud/addon/recharge/app/dict/diy/links.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - 'key' => 'recharge', - 'addon_title' => get_lang('dict_diy.recharge_title'), - 'title' => get_lang('dict_diy.recharge_link'), - 'child_list' => [ - [ - 'name' => 'RECHARGE_INDEX', - 'title' => get_lang('dict_diy.recharge_index'), - 'url' => '/recharge/pages/recharge', - 'is_share' => 1, - 'action' => '' - ] - ] - ], -]; diff --git a/niucloud/addon/recharge/app/dict/member/MemberAccountChangeTypeDict.php b/niucloud/addon/recharge/app/dict/member/MemberAccountChangeTypeDict.php deleted file mode 100644 index c277d32ae..000000000 --- a/niucloud/addon/recharge/app/dict/member/MemberAccountChangeTypeDict.php +++ /dev/null @@ -1,38 +0,0 @@ -load(); - if (empty($type)) { - return $account_change_type; - } - return $account_change_type[$type] ?? ''; - } - -} diff --git a/niucloud/addon/recharge/app/dict/member/MemberAccountTypeDict.php b/niucloud/addon/recharge/app/dict/member/MemberAccountTypeDict.php deleted file mode 100644 index bdfc05a3c..000000000 --- a/niucloud/addon/recharge/app/dict/member/MemberAccountTypeDict.php +++ /dev/null @@ -1,39 +0,0 @@ - get_lang('dict_member.account_point'), - self::BALANCE => get_lang('dict_member.account_balance'), - ]; - if (empty($type)) { - return $data; - } - return $data[$type] ?? ''; - } - -} diff --git a/niucloud/addon/recharge/app/dict/member/account_change_type.php b/niucloud/addon/recharge/app/dict/member/account_change_type.php deleted file mode 100644 index 3386f0c3d..000000000 --- a/niucloud/addon/recharge/app/dict/member/account_change_type.php +++ /dev/null @@ -1,37 +0,0 @@ - [ - //充值赠送 - 'recharge_give' => [ - //名称 - 'name' => get_lang('dict_member.account_point_recharge_give'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - ], - MemberAccountTypeDict::BALANCE => [ - - //充值 - 'recharge' => [ - //名称 - 'name' => get_lang('dict_member.account_balance_recharge'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - 'recharge_refund' => [ - //名称 - 'name' => get_lang('dict_member.account_balance_recharge_refund'), - //是否增加 - 'inc' => 0, - //是否减少 - 'dec' => 1, - ], - ] -]; diff --git a/niucloud/addon/recharge/app/dict/menu/admin.php b/niucloud/addon/recharge/app/dict/menu/admin.php deleted file mode 100644 index d6f1393e1..000000000 --- a/niucloud/addon/recharge/app/dict/menu/admin.php +++ /dev/null @@ -1,104 +0,0 @@ - '会员充值', - 'menu_key' => 'recharge', - 'menu_type' => 0, - 'icon' => 'element-Help', - 'api_url' => '', - 'router_path' => 'recharge', - 'view_path' => '', - 'methods' => '', - 'sort' => 100, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '充值订单', - 'menu_key' => 'recharge_order', - 'menu_type' => 0, - 'icon' => 'iconfont-iconchongzhidingdan', - 'api_url' => '', - 'router_path' => 'order', - 'view_path' => '', - 'methods' => 'get', - 'sort' => 100, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '订单列表', - 'menu_key' => 'recharge_order_list', - 'menu_type' => 1, - 'icon' => '', - 'api_url' => 'recharge/order', - 'router_path' => 'list', - 'view_path' => 'order/list', - 'methods' => 'get', - 'sort' => 100, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '退款', - 'menu_key' => 'recharge_order_refund', - 'menu_type' => 2, - 'icon' => '', - 'api_url' => 'recharge/refund/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => 100, - 'status' => 1, - 'is_show' => 0, - ], - ] - ], - [ - 'menu_name' => '订单详情', - 'menu_key' => 'recharge_order_detail', - 'menu_type' => 1, - 'icon' => '', - 'api_url' => 'recharge/order/', - 'router_path' => 'detail', - 'view_path' => 'order/detail', - 'methods' => 'get', - 'sort' => 90, - 'status' => 1, - 'is_show' => 0, - ], - [ - 'menu_name' => '退款记录', - 'menu_key' => 'recharge_order_refund_list', - 'menu_type' => 1, - 'icon' => 'iconfont-icontuikuanjilu', - 'api_url' => 'recharge/refund', - 'router_path' => 'refund', - 'view_path' => 'order/refund', - 'methods' => 'get', - 'sort' => 90, - 'status' => 1, - 'is_show' => 1, - 'children' => [ - [ - 'menu_name' => '退款详情', - 'menu_key' => 'recharge_refund_detail', - 'menu_type' => 2, - 'icon' => '', - 'api_url' => 'recharge/refund/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'get', - 'sort' => 100, - 'status' => 1, - 'is_show' => 0, - ] - ] - ] - ] - ] - ] - ] - ]; diff --git a/niucloud/addon/recharge/app/dict/notice/notice.php b/niucloud/addon/recharge/app/dict/notice/notice.php deleted file mode 100644 index 138a50529..000000000 --- a/niucloud/addon/recharge/app/dict/notice/notice.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - 'key' => 'recharge_success', - 'receiver_type' => 1, - 'name' => '充值成功通知', - 'title' => '会员充值成功后发送', - 'async' => true, - 'variable' => [ - 'price' => '充值金额', - 'balance' => '充值后账户', - 'time' => '充值时间', - 'trade_no' => '交易单号' - ], - ] - -]; diff --git a/niucloud/addon/recharge/app/dict/notice/sms.php b/niucloud/addon/recharge/app/dict/notice/sms.php deleted file mode 100644 index 6047ba416..000000000 --- a/niucloud/addon/recharge/app/dict/notice/sms.php +++ /dev/null @@ -1,7 +0,0 @@ - [ - 'content' => '您充值金额¥{price}, 充值后金额¥{balance}', - ] - -]; diff --git a/niucloud/addon/recharge/app/dict/notice/weapp.php b/niucloud/addon/recharge/app/dict/notice/weapp.php deleted file mode 100644 index c07c422b1..000000000 --- a/niucloud/addon/recharge/app/dict/notice/weapp.php +++ /dev/null @@ -1,14 +0,0 @@ - [ - 'tid' => '755', - 'content' => [ - ['交易单号', '{trade_no}', 'keyword1'], - ['充值金额', '{price}', 'keyword2'], - ['账户余额', '{balance}', 'keyword3'], - ['充值时间', '{time}', 'keyword4'], - ], - 'kid_list' => [1, 3, 4, 2], - 'scene_desc' => '' - ] -]; \ No newline at end of file diff --git a/niucloud/addon/recharge/app/dict/notice/wechat.php b/niucloud/addon/recharge/app/dict/notice/wechat.php deleted file mode 100644 index f3ad7698f..000000000 --- a/niucloud/addon/recharge/app/dict/notice/wechat.php +++ /dev/null @@ -1,11 +0,0 @@ - [ - 'temp_key' => '52552', - 'keyword_name_list' => [ '充值时间', '充值金额' ], - 'content' => [ - [ '充值时间', '{time}', 'time1' ], - [ '充值金额', '{price}', 'amount3' ], - ] - ] -]; \ No newline at end of file diff --git a/niucloud/addon/recharge/app/event.php b/niucloud/addon/recharge/app/event.php deleted file mode 100644 index 1364d3d4d..000000000 --- a/niucloud/addon/recharge/app/event.php +++ /dev/null @@ -1,30 +0,0 @@ - [ - ], - 'listen' => [ - //会员账户变化事件 - 'MemberAccount' => [ 'addon\recharge\app\listener\member\MemberAccountListener' ], - /** - * 支付相关事件 - */ - 'PayCreate' => [ 'addon\recharge\app\listener\pay\PayCreateListener' ], - //支付成功 - 'PaySuccess' => [ 'addon\recharge\app\listener\pay\PaySuccessListener' ], - //退款成功 - 'RefundSuccess' => [ 'addon\recharge\app\listener\pay\RefundSuccessListener' ], - //消息模板数据内容 - 'NoticeData' => [ - 'addon\recharge\app\listener\notice_template\RechargeSuccess', - ], - 'AllowPayTypeByTrade' => [ - 'addon\recharge\app\listener\pay\PayTypeByTrade', - ], - 'WapIndex' => [ 'addon\recharge\app\listener\WapIndexListener' ], - ], - 'subscribe' => [ - ], -]; - diff --git a/niucloud/addon/recharge/app/lang/en/api.php b/niucloud/addon/recharge/app/lang/en/api.php deleted file mode 100644 index 92293fcd4..000000000 --- a/niucloud/addon/recharge/app/lang/en/api.php +++ /dev/null @@ -1,14 +0,0 @@ - [ - 'account_point_recharge_give' => 'recharge give', - 'account_balance_recharge' => 'recharge', - - ], - 'dict_order' => [ - //订单类型 - 'order_type_recharge' => 'recharge order', - - ], - - - 'dict_menu_admin' => [ - 'order' => 'order', - 'recharge_order' => 'recharge order', - 'recharge_order_list' => 'order list', - 'recharge_refund' => 'refund', - 'recharge_order_detail' => 'order detail', - 'recharge_refund_list' => 'refund list', - 'recharge_refund_detail' => 'refund detail', - ], -]; diff --git a/niucloud/addon/recharge/app/lang/en/validate.php b/niucloud/addon/recharge/app/lang/en/validate.php deleted file mode 100644 index 0f1f7e8b6..000000000 --- a/niucloud/addon/recharge/app/lang/en/validate.php +++ /dev/null @@ -1,13 +0,0 @@ - [ - 'account_point' => '积分', - 'account_balance' => '余额', - 'account_balance_recharge_refund' => '充值订单退款', - 'account_balance_recharge' => '余额充值', - 'account_point_recharge_give' => '充值赠送' - ], - 'dict_order' => [ - 'trade_type_recharge' => '充值订单' - ], - 'dict_wap_index' => [ - 'recharge' => '会员充值', - 'recharge_desc' => '在线充值到会员账户', - ], - 'dict_diy' => [ - 'recharge_link' => '充值链接', - 'recharge_title'=>'会员充值', - 'recharge_index' => '充值' - ] -]; diff --git a/niucloud/addon/recharge/app/lang/zh-cn/validate.php b/niucloud/addon/recharge/app/lang/zh-cn/validate.php deleted file mode 100644 index 0f1f7e8b6..000000000 --- a/niucloud/addon/recharge/app/lang/zh-cn/validate.php +++ /dev/null @@ -1,13 +0,0 @@ - 'recharge', - "title" => get_lang("dict_wap_index.recharge"), - 'desc' => get_lang("dict_wap_index.recharge_desc"), - "url" => "/recharge/pages/recharge", - 'icon'=>'addon/recharge/icon.png' - ], - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/recharge/app/listener/member/MemberAccountListener.php b/niucloud/addon/recharge/app/listener/member/MemberAccountListener.php deleted file mode 100644 index 2edbf2f2b..000000000 --- a/niucloud/addon/recharge/app/listener/member/MemberAccountListener.php +++ /dev/null @@ -1,30 +0,0 @@ -key == $params['key']) { - $data = $params['data']; - $order_id = $data['order_id']; - - $core_order_service = new CoreRechargeOrderService(); - $order = $core_order_service->orderInfo($order_id); - if (!empty($order)) { - $member = (new CoreMemberService())->getInfoByMemberId($order['member_id']); - //通过订单id查询订单信息 - return $this->toReturn( - [ - '__wechat_page' => '',//模板消息链接 - '__miniprogram' => '',//模板消息小程序 - '__weapp_page' => '',//小程序链接 - 'balance' => $member['balance'],//充值后的余额 - 'price' => $order['order_item_money'],//订单项总价 - 'time' => $order['create_time'],//创建时间 - 'trade_no' => $order['out_trade_no'],//交易流水号 - ], - [ - 'member_id' => $order['member_id'], - ] - ); - } - - } - - } - -} diff --git a/niucloud/addon/recharge/app/listener/pay/PayCreateListener.php b/niucloud/addon/recharge/app/listener/pay/PayCreateListener.php deleted file mode 100644 index 8fac66580..000000000 --- a/niucloud/addon/recharge/app/listener/pay/PayCreateListener.php +++ /dev/null @@ -1,44 +0,0 @@ -orderInfo($trade_id); - if ($order_info['order_status'] != RechargeOrderDict::WAIT_PAY) throw new CommonException('ONLY_PAYING_CAN_PAY'); - //添加订单支付表 - return [ - 'main_type' => PayDict::MEMBER, - 'main_id' => $order_info['member_id'],//买家id - 'money' => $order_info['order_money'],//订单金额 - 'trade_type' => 'recharge',//业务类型 - 'trade_id' => $trade_id, - 'body' => get_lang("dict_order.trade_type_recharge") - ]; - } - - - } -} diff --git a/niucloud/addon/recharge/app/listener/pay/PaySuccessListener.php b/niucloud/addon/recharge/app/listener/pay/PaySuccessListener.php deleted file mode 100644 index d04ecdd0f..000000000 --- a/niucloud/addon/recharge/app/listener/pay/PaySuccessListener.php +++ /dev/null @@ -1,28 +0,0 @@ -pay($pay_info); - } - } -} diff --git a/niucloud/addon/recharge/app/listener/pay/PayTypeByTrade.php b/niucloud/addon/recharge/app/listener/pay/PayTypeByTrade.php deleted file mode 100644 index 428f37d4f..000000000 --- a/niucloud/addon/recharge/app/listener/pay/PayTypeByTrade.php +++ /dev/null @@ -1,32 +0,0 @@ -refundComplete($refund_info['refund_no']); - } - - } -} diff --git a/niucloud/addon/recharge/app/model/RechargeOrder.php b/niucloud/addon/recharge/app/model/RechargeOrder.php deleted file mode 100644 index f5269b97b..000000000 --- a/niucloud/addon/recharge/app/model/RechargeOrder.php +++ /dev/null @@ -1,225 +0,0 @@ - 'timestamp', - 'close_time' => 'timestamp', - ]; - - - /** - * 登录渠道字段转化 - * @param $value - * @param $data - * @return mixed - */ - public function getOrderFromNameAttr($value, $data) - { - if (isset($data['order_from'])) { - return ChannelDict::getType()[$data['order_from']] ?? ''; - } - - } - - /** - * 会员id搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchMemberIdAttr($query, $value, $data) - { - if ($value) { - $query->where('member_id', '=', $value); - } - } - - /** - * 订单来源 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderFromAttr($query, $value, $data) - { - if ($value) { - $query->where('order_from', '=', $value); - } - } - - /** - * 订单类型 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderTypeAttr($query, $value, $data) - { - if ($value) { - $query->where('order_type', '=', $value); - } - } - - /** - * 支付流水号 - * @param $query - * @param $value - * @param $data - */ - public function searchOutTradeNoAttr($query, $value, $data) - { - if ($value) { - $query->where('out_trade_no', '=', $value); - } - } - - /** - * 订单号 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderNoAttr($query, $value, $data) - { - if ($value) { - $query->where('order_no', '=', $value); - } - } - - /** - * 订单金额 - * @param $query - * @param $value - * @param $data - * @return void - */ - public function searchOrderMoneyAttr($query, $value, $data) - { - if (!empty($data['start_money']) && !empty($data['end_money'])) { - $money = [$data['start_money'], $data['end_money']]; - sort($money); - $query->where('order_money', 'between', $money); - } else if (!empty($data['start_money'])) { - $query->where('order_money', '>=', $data['start_money']); - } else if (!empty($data['end_money'])) { - $query->where('order_money', '<=', $data['end_money']); - } - } - - /** - * 订单状态 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where('order_status', '=', $value); - } - } - - /** - * 创建时间搜索器 - * @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 - * @param $data - * @return void - */ - public function searchPayTimeAttr($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('pay_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['pay_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['pay_time', '<=', $end_time]]); - } - } - - /** - * 订单项目 - * @return HasMany - */ - public function item() - { - return $this->hasMany(RechargeOrderItem::class, 'order_id', 'order_id'); - } - - /** - * 订单会员 - * @return HasOne - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id'); - } - - /** - * 支付记录 - * @return HasOne - */ - public function pay() - { - return $this->hasOne(Pay::class, 'out_trade_no', 'out_trade_no')->bind(['pay_type_name' => 'type_name']); - } -} diff --git a/niucloud/addon/recharge/app/model/RechargeOrderItem.php b/niucloud/addon/recharge/app/model/RechargeOrderItem.php deleted file mode 100644 index bddfb7897..000000000 --- a/niucloud/addon/recharge/app/model/RechargeOrderItem.php +++ /dev/null @@ -1,66 +0,0 @@ -hasOne(RechargeOrder::class, 'order_id', 'order_id')->joinType('left')->withField('order_id, order_no')->bind(['order_no' => 'order_no']); - } - - /** - * 数量字段处理 - * @param $value - * @param $data - * @return string|void - */ - public function getNumAttr($value, $data) - { - if (isset($data['num'])) { - return number_format($data['num']); - } - } - - /** - * 关联订单主表 - * @return HasOne - */ - public function ordermain() - { - return $this->hasOne(RechargeOrder::class, 'order_id')->joinType('inner'); - } -} diff --git a/niucloud/addon/recharge/app/model/RechargeOrderItemRefund.php b/niucloud/addon/recharge/app/model/RechargeOrderItemRefund.php deleted file mode 100644 index 3d810a807..000000000 --- a/niucloud/addon/recharge/app/model/RechargeOrderItemRefund.php +++ /dev/null @@ -1,216 +0,0 @@ - 'timestamp', - 'audit_time' => 'timestamp', - 'transfer_time' => 'timestamp', - ]; - - /** - * 数据表主键 - * @var string - */ - protected $pk = 'refund_id'; - - /** - * 模型名称 - * @var string - */ - protected $name = 'recharge_order_item_refund'; - - /** - * 退款状态字段处理 - * @param $value - * @param $data - * @return mixed - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data['status'])) - return ''; - $temp = RechargeOrderDict::getRefundStatus()[$data['status']] ?? []; - return $temp['name'] ?? ''; - } - - /** - * - * @return HasOne - */ - public function item() - { - return $this->hasOne(RechargeOrderItem::class, 'order_item_id', 'order_item_id')->joinType('inner'); - } - - /** - * 订单会员 - * @return HasOne - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id')->withField('member_id, username, mobile, nickname, headimg')->joinType('left'); - } - - /** - * 关联退款支付记录表 - * @return HasOne - */ - public function payrefund() - { - return $this->hasOne(Refund::class, 'refund_no', 'refund_no'); - } - - /** - * 会员id搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchRefundNoAttr($query, $value, $data) - { - if ($value) { - $query->where('refund_no', '=', $value); - } - } - - - /** - * 订单号搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderNoAttr($query, $value, $data) - { - if ($value) { - $query->where('order_no', '=', $value); - } - } - - /** - * 订单号搜索(用于关联) - * @param $query - * @param $value - * @param $data - */ - public function searchJoinOrderNoAttr($query, $value, $data) - { - if ($value) { - $query->where('recharge_order_item_refund.order_no', '=', $value); - } - } - - /** - * 会员id搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchMemberIdAttr($query, $value, $data) - { - if ($value) { - $query->where('member_id', '=', $value); - } - } - - /** - * 会员id搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchJoinMemberIdAttr($query, $value, $data) - { - if ($value) { - $query->where('recharge_order_item_refund.member_id', '=', $value); - } - } - - /** - * 退款状态 - * @param $query - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where('status', '=', $value); - } - } - - /** - * 退款状态 - * @param $query - * @param $value - * @param $data - */ - public function searchJoinStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where('recharge_order_item_refund.status', '=', $value); - } - } - - /** - * 创建时间搜索器 - * @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 - * @param $data - */ - public function searchJoinCreateTimeAttr($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('recharge_order_item_refund.create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['recharge_order_item_refund.create_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['recharge_order_item_refund.create_time', '<=', $end_time]]); - } - } -} diff --git a/niucloud/addon/recharge/app/model/RechargeOrderLog.php b/niucloud/addon/recharge/app/model/RechargeOrderLog.php deleted file mode 100644 index fa30a231c..000000000 --- a/niucloud/addon/recharge/app/model/RechargeOrderLog.php +++ /dev/null @@ -1,37 +0,0 @@ -model = new RechargeOrderItemRefund(); - } - - public function create($order_id) { - try { - (new CoreRechargeRefundService())->create($order_id); - return true; - } catch ( Exception $e) { - return $e->getMessage(); - } - } - - /** - * 查询退款列表 - * @param array $where - * @return array - */ - public function getPage(array $where) { - - $field = 'recharge_order_item_refund.refund_id,recharge_order_item_refund.num,recharge_order_item_refund.money,recharge_order_item_refund.refund_no,recharge_order_item_refund.status,recharge_order_item_refund.create_time,recharge_order_item_refund.audit_time,recharge_order_item_refund.transfer_time,recharge_order_item_refund.item_type,recharge_order_item_refund.order_item_id, recharge_order_item_refund.order_id,recharge_order_item_refund.member_id,recharge_order_item_refund.order_no'; - $member_where = []; - if(!empty($where['keywords'])) - { - $member_where[] = ["member.member_id|member.nickname|member.mobile", '=', $where['keywords']]; - } - $search_model = $this->model->with(['item' => function($query) { - $query->with('orderNo')->field('order_id, order_item_id, item_name, item_image'); - }])->withSearch(['join_order_no' => 'order_no', 'join_status' => 'status', 'join_member_id' => 'member_id', 'refund_no' => 'refund_no', 'join_create_time' => 'create_time'],$where)->withJoin(['member' => function($query){ - $query->field("member.nickname, member.headimg, member.mobile, member.member_id"); - } - ])->where($member_where)->field($field)->order('create_time desc')->append(['status_name', 'payrefund.type_name']); - - return $this->pageQuery($search_model); - } - - /** - * 查询退款详情 - * @param int $refund_id - * @return array - */ - public function getDetail(int $refund_id) { - $field = 'refund_id,num,money,refund_no,status,create_time,audit_time,transfer_time,item_type,order_item_id, order_id,member_id'; - return $this->model->where([ ['refund_id', '=', $refund_id]])->field($field)->with(['item' => function($query) { - $query->field('order_item_id, item_name, item_image'); - }, 'member' => function($query) { - $query->field('member_id, nickname, mobile, headimg'); - }, 'payrefund' => function($query) { - $query->field('refund_no'); - }])->append(['status_name', 'payrefund.type_name'])->findOrEmpty()->toArray(); - } - - /** - * 获取退款状态 - * @return array|array[]|string - */ - public function getStatus(){ - return RechargeOrderDict::getRefundStatus(); - } - - /** - * 退款统计数据(根据状态查询) - */ - public function stat() - { - $status = RechargeOrderDict::getRefundStatus(); - $all = 0; - $have = 0; - foreach ($status as $k => &$v) - { - $money = $this->model->where([['status', '=', $v['status']]])->sum("money"); - if($money == null) - { - $money = 0; - } - if($k == 1 || $k == 2){ - $have += $money; - } - $v['money'] = number_format($money, 2); - $all += $money; - } - $status['all'] = [ - 'name' => get_lang('dict_refund.all'), - 'key' => 'all', - 'money' => number_format($all, 2) - ]; - $status['have'] = [ - 'name' => get_lang('dict_refund.have'), - 'key' => 'all', - 'money' => number_format($have, 2) - ]; - return $status; - - } -} diff --git a/niucloud/addon/recharge/app/service/admin/RechargeOrderService.php b/niucloud/addon/recharge/app/service/admin/RechargeOrderService.php deleted file mode 100644 index ee162f9c2..000000000 --- a/niucloud/addon/recharge/app/service/admin/RechargeOrderService.php +++ /dev/null @@ -1,122 +0,0 @@ -model = new RechargeOrder(); - } - - /** - * 充值订单分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'order_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason'; - $order = 'create_time desc'; - $where['order_type'] = 'recharge'; - $search_model = $this->model->withSearch(['order_no', 'order_money', 'order_from', 'order_status', 'order_type', 'member_id', 'out_trade_no', 'create_time', 'pay_time'], $where)->field($field)->with(['item' => function($query) { - $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time'); - }, 'member' => function($query) { - $query->field('member_id, nickname, mobile, headimg'); - }, 'pay' => function($query) { - $query->field(''); - } ])->order($order)->append(['order_from_name' ]); - $list = $this->pageQuery($search_model); - $order_status = RechargeOrderDict::getStatus(); - $refund_status = RechargeOrderDict::getRefundStatus(); - foreach ($list['data'] as $k => $v) - { - $list['data'][$k]['order_status_info'] = $order_status[$v['order_status']] ?? []; - $list['data'][$k]['refund_status_name'] = $refund_status[$v['refund_status']]['name'] ?? ''; - } - return $list; - } - - /** - * 充值订单详情 - * @param int $order_id - * @return array - */ - public function getDetail(int $order_id) - { - $field = 'order_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason'; - $detail = $this->model->where([['order_type', '=', 'recharge'], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) { - $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time'); - }, 'member' => function($query) { - $query->field('member_id, nickname, mobile, headimg'); - }, 'pay' => function($query) { - $query->field(''); - } ])->append(['order_from_name'])->findOrEmpty()->toArray(); - if(!empty($detail)) - { - $detail['order_status_info'] = RechargeOrderDict::getStatus($detail['order_status']) ?? []; - } - return $detail; - } - - /** - * 充值订单状态 - * @return array|array[]|string - */ - public function getStatus() - { - return RechargeOrderDict::getStatus(); - } - - - /** - * 充值订单 - * @param array $data - * @return int[] - */ - public function stat(array $data = []) - { - $res = [ - 'recharge_money' => 0, - 'recharge_refund_money' => 0 - ]; - $where = [ - ['order_type', '=', 'recharge'], - ['order_status', '=', RechargeOrderDict::FINISH], - ]; - if(!empty($data['member_id'])) $where[] = ['member_id', '=', $data['member_id']]; - - $res['recharge_money'] = $this->model->where($where)->sum('order_money'); - - $where = [ - ['order_type', '=', 'recharge'], - ['refund_status', '=', RechargeOrderDict::REFUND_COMPLETED], - ]; - if(!empty($data['member_id'])) $where[] = ['member_id', '=', $data['member_id']]; - $res['recharge_refund_money'] = $this->model->where($where)->sum('order_money'); - return $res; - } - - - - -} diff --git a/niucloud/addon/recharge/app/service/api/RechargeOrderService.php b/niucloud/addon/recharge/app/service/api/RechargeOrderService.php deleted file mode 100644 index 7b332648d..000000000 --- a/niucloud/addon/recharge/app/service/api/RechargeOrderService.php +++ /dev/null @@ -1,94 +0,0 @@ -model = new RechargeOrder(); - } - - /** - * 会员充值 - * @param $data //['order_from' => 'h5', 'ip' => '127.0.0.1', 'member_message' => '','recharge_money' => 12.00] - */ - public function recharge(array $data) - { - $data['order_from'] = $this->channel; - $data['member_id'] = $this->member_id; - return (new CoreRechargeOrderService())->create($data); - } - - - /** - * 充值订单分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'order_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason'; - $order = 'create_time desc'; - $where['order_type'] = 'recharge'; - $search_model = $this->model->where([ ['member_id', '=', $this->member_id] ])->withSearch(['order_status'], $where)->field($field)->with(['item' => function($query) { - $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time'); - }])->order($order)->append(['order_from_name']); - $list = $this->pageQuery($search_model); - $order_status = RechargeOrderDict::getStatus(); - //$refund_status = RechargeOrderDict::getRefundStatus(); - foreach ($list['data'] as $k => $v) - { - $list['data'][$k]['order_status_info'] = $order_status[$v['order_status']] ?? []; - // $list['data'][$k]['refund_status_name'] = $refund_status[$v['refund_status']]['name'] ?? ''; - } - return $list; - } - - /** - * 充值订单详情 - * @param int $order_id - * @return array - */ - public function getDetail(int $order_id) - { - $field = 'order_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason'; - $detail = $this->model->where([['order_type', '=', 'recharge'], ['member_id', '=', $this->member_id], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) { - $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time'); - }])->append(['order_from_name'])->findOrEmpty()->toArray(); - if(!empty($detail)) - { - $detail['order_status_info'] = RechargeOrderDict::getStatus($detail['order_status']) ?? []; - } - return $detail; - } - - /** - * 充值订单状态 - * @return array|array[]|string - */ - public function getStatus() - { - return RechargeOrderDict::getStatus(); - } -} diff --git a/niucloud/addon/recharge/app/service/core/CoreRechargeOrderService.php b/niucloud/addon/recharge/app/service/core/CoreRechargeOrderService.php deleted file mode 100644 index 79e40aaca..000000000 --- a/niucloud/addon/recharge/app/service/core/CoreRechargeOrderService.php +++ /dev/null @@ -1,156 +0,0 @@ - 1, 'order_from' => 'h5', 'member_message' => '','recharge_money' => 12.00] - * @return array - */ - public function create(array $data) - { - $order_data = [ - 'order_from' => $data[ 'order_from' ] ?? 'h5', - 'order_type' => 'recharge', - 'order_status' => RechargeOrderDict::WAIT_PAY, - 'member_id' => $data[ 'member_id' ], - 'ip' => request()->ip() ?? '', - 'member_message' => $data[ 'member_message' ] ?? '', - 'order_item_money' => $data[ 'recharge_money' ], - 'order_discount_money' => 0, - 'order_money' => $data[ 'recharge_money' ], - ]; - $order_items = [ - [ - 'member_id' => $data[ 'member_id' ], - 'item_id' => 0, - 'item_type' => 'recharge', //项目类型 recharge, goods - 'item_name' => '会员充值', - 'item_image' => '/static/image/icon.png', - 'price' => $data[ 'recharge_money' ], - 'num' => 1, - 'item_money' => $data[ 'recharge_money' ], - 'is_refund' => 0 - ] - ]; - Db::startTrans(); - try { - //添加订单表 - $order_data[ 'order_no' ] = create_no(); - $create_order = ( new RechargeOrder() )->create($order_data); - $order_id = $create_order->order_id; - //添加订单支付表 - ( new CorePayService() )->create(PayDict::MEMBER, $order_data[ 'member_id' ], $order_data[ 'order_money' ], $order_data[ 'order_type' ], $order_id, get_lang("dict_order.trade_type_recharge")); - //添加订单项目表 - $order_item_model = new RechargeOrderItem(); - foreach ($order_items as $k => $order_item) { - $order_item[ 'order_id' ] = $order_id; - $order_item_model->create($order_item); - } - Db::commit(); - //返回订单信息 - return [ - 'trade_type' => $order_data[ 'order_type' ], - 'trade_id' => $order_id - ]; - } catch (Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 订单支付 - * @param array $pay_info - * @return true - */ - public function pay(array $pay_info) - { - try { - $trade_id = $pay_info[ 'trade_id' ] ?? 0; - $order_model = new RechargeOrder(); - $order_info = $order_model->where([ [ 'order_id', '=', $trade_id ] ])->findOrEmpty()->toArray(); - if (empty($order_info)) - throw new CommonException('ORDER_NOT_EXIST'); - $order_data = [ - 'pay_time' => time(), - 'order_status' => RechargeOrderDict::FINISH, - 'is_enable_refund' => 1, // 是否允许退款 - 'out_trade_no' => $pay_info[ 'out_trade_no' ]//支付后的交易流水号 - ]; - $order_model->where([ [ 'order_id', '=', $trade_id ] ])->update($order_data); - //会员余额 - ( new CoreMemberAccountService() )->addLog($order_info[ 'member_id' ], MemberAccountTypeDict::BALANCE, $order_info[ 'order_item_money' ], 'recharge', '会员充值', $order_info[ 'order_id' ]); - return true; - } catch (Exception $e) { - throw new CommonException($e->getMessage()); - } - } - - /** - * 关闭订单 - * @param int $order_id - * @return true - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function close(int $order_id) - { - $order = ( new RechargeOrder() )->where([ [ 'order_id', '=', $order_id ], ])->find(); - if ($order->isEmpty()) throw new CommonException('ORDER_NOT_EXIST'); - //如果是支付中的话 - //if ($order->order_status == RechargeOrderDict::CLOSE) throw new CommonException('ORDER_CLOSED'); - //关闭支付单据 - if ($order->order_status == RechargeOrderDict::WAIT_PAY) - ( new CorePayService() )->closeByTrade('recharge', $order_id); - $order->save([ 'order_status' => RechargeOrderDict::CLOSE ]); - - return true; - } - - /** - * 获取订单信息 - * @param int $order_id - * @return array - */ - public function orderInfo(int $order_id) - { - return ( new RechargeOrder() )->where([ - [ 'order_id', '=', $order_id ] - ])->field('*')->findOrEmpty()->toArray(); - } - -} - diff --git a/niucloud/addon/recharge/app/service/core/CoreRechargeRefundService.php b/niucloud/addon/recharge/app/service/core/CoreRechargeRefundService.php deleted file mode 100644 index 6ed648def..000000000 --- a/niucloud/addon/recharge/app/service/core/CoreRechargeRefundService.php +++ /dev/null @@ -1,142 +0,0 @@ -where([ [ 'order_id', '=', $order_id ], [ 'item_type', '=', $this->order_type ] ])->with('ordermain')->find(); - $order = $order_model->toArray(); - $order_info = ( new RechargeOrder() )->where([ [ 'order_id', '=', $order_id ] ])->field("order_no")->find(); - if (empty($order)) throw new CommonException('ORDER_NOT_EXIST'); - if (!$order[ 'ordermain' ][ 'is_enable_refund' ]) throw new CommonException('NOT_ALLOW_APPLY_REFUND'); - if ($order[ 'ordermain' ][ 'order_status' ] != RechargeOrderDict::FINISH) throw new CommonException('ORDER_UNPAID_NOT_ALLOW_APPLY_REFUND'); - if ($order[ 'refund_status' ] != RechargeOrderDict::NOT_APPLAY) throw new CommonException('REFUND_HAD_APPLIED'); - - Db::startTrans(); - try { - // 查询会员账户余额 - $member_info = ( new Member() )->where([ - [ 'member_id', '=', $order[ 'member_id' ] ] - ])->field('balance')->find(); - - if ($member_info[ 'balance' ] == 0) throw new CommonException('NO_REFUNDABLE_AMOUNT'); - - $order[ 'out_trade_no' ] = $order[ 'ordermain' ][ 'out_trade_no' ]; - $order[ 'money' ] = $order[ 'item_money' ] > $member_info[ 'balance' ] ? $member_info[ 'balance' ] : $order[ 'item_money' ]; - $order[ 'order_no' ] = $order_info[ 'order_no' ]; - $refund_no = ( new CoreRefundService() )->create($order[ 'out_trade_no' ], $order[ 'money' ], $order[ 'reason' ] ?? ''); - ( new RechargeOrderItemRefund() )->create([ - 'order_item_id' => $order[ 'order_item_id' ], - 'order_id' => $order[ 'order_id' ], - 'member_id' => $order[ 'member_id' ], - 'num' => $order[ 'num' ], - 'money' => $order[ 'money' ], - 'refund_no' => $refund_no, - 'item_type' => $order[ 'item_type' ], - 'create_time' => time() - ]); - $order_model->save([ - 'refund_no' => $refund_no, - 'refund_status' => RechargeOrderDict::REFUNDING - ]); - $order_model->ordermain->save([ - 'refund_status' => RechargeOrderDict::REFUNDING - ]); - - ( new RechargeOrderItemRefund() )->update([ 'status' => RechargeOrderDict::REFUNDING ], [ [ 'refund_no', '=', $refund_no ] ]); - - // 执行退款 - $this->refund($order, $refund_no); - - Db::commit(); - - return true; - } catch (Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 退款 - * @param array $order - * @param string $refund_no - * @return void - */ - public function refund(array $order, string $refund_no) - { - ( new CoreMemberAccountService() )->addLog($order[ 'member_id' ], 'balance', -$order[ 'money' ], 'recharge_refund', '充值订单退款', $order[ 'order_id' ]); - // 调用支付退款 - ( new CoreRefundService() )->refund($refund_no); - } - - /** - * 退款完成 - * @param $refund_no - * @return true - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function refundComplete($refund_no) - { - $model = ( new RechargeOrderItemRefund() )->where([ [ 'refund_no', '=', $refund_no ] ])->find(); - if ($model->isEmpty()) throw new CommonException('ORDER_NOT_EXIST'); - if ($model->status != RechargeOrderDict::REFUNDING) throw new CommonException('REFUND_STATUS_ABNORMAL'); - - Db::startTrans(); - try { - $model->save([ 'status' => RechargeOrderDict::REFUND_COMPLETED ]); - $model->item()->save([ 'refund_status' => RechargeOrderDict::REFUND_COMPLETED ]); - ( new RechargeOrder() )->update([ 'refund_status' => RechargeOrderDict::REFUND_COMPLETED ], [ [ 'order_id', '=', $model->order_id ] ]); - ( new CoreRechargeOrderService() )->close($model->order_id); - Db::commit(); - return true; - } catch (Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } -} - diff --git a/niucloud/addon/recharge/info.json b/niucloud/addon/recharge/info.json deleted file mode 100644 index a0291d23e..000000000 --- a/niucloud/addon/recharge/info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "会员充值", - "desc": "在线充值到会员账户", - "key": "recharge", - "version": "1.0.1", - "author": "niucloud", - "url": "https://www.niucloud.com", - "type": "addon", - "support_app": "" -} diff --git a/niucloud/addon/recharge/package/uni-app-pages.php b/niucloud/addon/recharge/package/uni-app-pages.php deleted file mode 100644 index aed7425fd..000000000 --- a/niucloud/addon/recharge/package/uni-app-pages.php +++ /dev/null @@ -1,28 +0,0 @@ - << - - - - - - - \ No newline at end of file diff --git a/niucloud/addon/recharge/uni-app/pages/recharge_record.vue b/niucloud/addon/recharge/uni-app/pages/recharge_record.vue deleted file mode 100644 index d1f2f6245..000000000 --- a/niucloud/addon/recharge/uni-app/pages/recharge_record.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/recharge/uni-app/pages/recharge_record_detail.vue b/niucloud/addon/recharge/uni-app/pages/recharge_record_detail.vue deleted file mode 100644 index 2f800b037..000000000 --- a/niucloud/addon/recharge/uni-app/pages/recharge_record_detail.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - - \ No newline at end of file