Compare commits

..

104 Commits

Author SHA1 Message Date
陈淳
d919e07096 fix: 修复大小写问题 2023-02-20 19:57:13 +08:00
陈淳
1ed37897d5 还原部门页面 2023-01-06 11:42:47 +08:00
陈淳
29df3d658b 模板重新生成可空类型 2023-01-06 11:12:47 +08:00
陈淳
576397a042 修改可空类型 2023-01-06 10:15:37 +08:00
橙子
b7c9b84449 更改null操作 2023-01-05 20:32:58 +08:00
陈淳
efbf799218 采购订单添加物料功能 2023-01-05 19:21:48 +08:00
橙子
7d578ce363 创建采购订单接口 2023-01-04 20:50:10 +08:00
陈淳
e03e584684 采购订单搭建 2023-01-04 18:16:56 +08:00
陈淳
e8e6b928cf 完善单位定义界面 2023-01-04 16:47:24 +08:00
陈淳
5f6d29a3f8 自动生成定义管理通用代码 2023-01-04 15:46:29 +08:00
陈淳
a27d83a5e3 Update README.md 2023-01-04 14:09:03 +08:00
陈淳
ef1154d6f3 更新说明 2023-01-04 13:44:35 +08:00
陈淳
ae2400fd0b Merge branch 'sqlsugar-dev' into sqlsugar 2023-01-04 13:40:58 +08:00
陈淳
fbcd004b7e 添加各个木块代码生成 2023-01-04 13:40:30 +08:00
橙子
cb307f95ce update README.md.
Signed-off-by: 橙子 <454313500@qq.com>
2023-01-04 05:39:00 +00:00
橙子
7838cd1a6a Update Yi.Framework.Template.csproj 2023-01-03 21:03:29 +08:00
橙子
03dcb7d860 完善代码生成器自动生成目录 2023-01-03 21:03:07 +08:00
橙子
62c5470efe 添加代码生成器模块service实现 2023-01-03 20:06:16 +08:00
陈淳
53b4674da4 Create ProgramTemplateProvider.cs 2023-01-03 18:14:18 +08:00
陈淳
ff2cf68b08 添加模板生成代码 2023-01-03 18:05:57 +08:00
陈淳
8b55373794 更新文件helper 2023-01-03 16:03:11 +08:00
橙子
dba67d7127 添加供应商定义模块 2023-01-02 23:32:40 +08:00
橙子
762c455b53 删除多余文件 2023-01-02 21:18:38 +08:00
chenchun
714d1a36c4 添加供应商 2023-01-02 17:27:12 +08:00
chenchun
0e0ddbbd99 Update README.md 2023-01-02 15:09:59 +08:00
chenchun
497f8cfd1f 添加erp模块 2023-01-02 15:08:04 +08:00
chenchun
1ff709e6f8 优化分层结构,添加常量 2023-01-02 14:29:16 +08:00
chenchun
ea35871aba 使用sqlsugar内置工作单元 2023-01-02 13:59:05 +08:00
chenchun
0e78857645 添加自动映射 2023-01-02 00:09:30 +08:00
chenchun
5d7d115910 添加dto模式的demo测试 2023-01-01 23:51:05 +08:00
chenchun
b9384afd5d 爆肝,重构框架,你懂得 2023-01-01 23:06:11 +08:00
陈淳
dbe020dc94 添加工作单元测试 2022-12-29 09:53:45 +08:00
陈淳
9673aa7690 Merge branch 'sqlsugar' into sqlsugar-dev 2022-12-29 09:08:43 +08:00
黎明
ec06d30d59 添加工作单元 2022-12-26 14:19:12 +08:00
橙子
356d2e592b Update README.md 2022-12-20 15:32:59 +08:00
橙子
521c2e7ca6 Update README.md 2022-12-18 23:17:23 +08:00
陈淳
c4014c9333 更新单元测试 2022-12-16 16:00:36 +08:00
陈淳
2908a8d8a9 测试兼容中间件方式测验 2022-12-14 23:27:54 +08:00
陈淳
c964b98240 添加xunit单元测试 2022-12-14 00:14:22 +08:00
陈淳
f7c74b5c96 Quartz更改,使用内置注册 2022-12-13 23:12:10 +08:00
陈淳
d34c9818b4 更改mit协议 2022-12-13 23:01:23 +08:00
陈淳
6414c93116 Update README.md 2022-12-09 10:58:42 +08:00
陈淳
5a12c4a3ce Update README.md 2022-12-06 23:41:41 +08:00
陈淳
97a6ee39e5 Update README.md 2022-12-05 23:18:10 +08:00
陈淳
44db5ab150 添加评论功能 2022-12-01 16:06:53 +08:00
陈淳
e9bcd29e36 评论建表 2022-12-01 13:38:06 +08:00
橙子
a2ca897fca 社区板块添加点赞功能 2022-11-29 23:03:10 +08:00
陈淳
9a34e63d5f 点赞功能接口开发 2022-11-29 18:47:26 +08:00
陈淳
e501b894c3 job异常处理 2022-11-29 12:49:36 +08:00
陈淳
d97ef84b7e 删除hangfire(不支持毫秒级别)
This reverts commit 49a9eb5460.
2022-11-29 12:34:45 +08:00
陈淳
0f2dc4d3ba Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-11-29 12:31:28 +08:00
橙子
49a9eb5460 hangfire测试 2022-11-27 15:05:27 +08:00
陈淳
7e7780a754 Update README.md 2022-11-21 11:20:24 +08:00
陈淳
d0770970f0 Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-11-20 23:36:02 +08:00
陈淳
d5a10a5817 Update README.md 2022-11-19 18:18:03 +08:00
橙子
7b63d8b2ba Update README.md 2022-11-16 19:49:48 +08:00
陈淳
c544de8909 Update README.md 2022-11-14 17:04:39 +08:00
橙子
89da2ab50f 菜单权限管控 2022-11-13 22:52:03 +08:00
陈淳
a1a6b5967b Update README.md 2022-11-12 16:58:58 +08:00
陈淳
53ffb1b565 Update README.md 2022-11-11 08:54:11 +08:00
陈淳
6efecd123f Update README.md 2022-11-09 08:53:48 +08:00
陈淳
1ec5349a96 1108 2022-11-08 21:02:50 +08:00
陈淳
187abcd10c 编码转换 2022-11-07 21:45:29 +08:00
陈淳
d6ca4429d5 添加属性依赖注入、添加自定义日志扩展 2022-11-07 01:31:37 +08:00
陈淳
86e869ff16 注释 2022-11-06 21:38:55 +08:00
陈淳
dc58f9397f saas分库,仓储+公共库+业务库+动态配置连接串框架搭建 2022-11-06 20:22:32 +08:00
陈淳
97b4ab2f15 数据权限功能、用户信息缓存 2022-11-04 23:23:54 +08:00
陈淳
23a9d02aba 修复sqlserver codefirst的问题 2022-11-02 16:36:08 +08:00
陈淳
32ed6c3e97 准备接入Saas多租户 2022-11-02 11:06:41 +08:00
陈淳
102556dd2a 准备接入多租户 2022-11-02 08:48:01 +08:00
陈淳
2df3f7c56d 删除测试文件 2022-10-29 10:33:51 +08:00
陈淳
d6fd02ec19 修复路由切换问题 2022-10-29 10:33:08 +08:00
陈淳
c901b4bc06 时间单位精确到秒 2022-10-28 17:38:14 +08:00
陈淳
e19c89ccd9 修复jwt配置文件问题 2022-10-28 17:22:02 +08:00
陈淳
a667f1a65e 验证码缓存接入 2022-10-28 14:25:59 +08:00
陈淳
9f5829876c 登录验证码 2022-10-28 14:10:11 +08:00
陈淳
189d7c4719 缓存接入 2022-10-27 20:54:05 +08:00
陈淳
dfe877c438 缓存测试 2022-10-26 20:08:16 +08:00
陈淳
3a634d7888 配置文件更改 2022-10-26 20:01:18 +08:00
陈淳
fd9f3d04d9 商品首页完善 2022-10-25 10:59:51 +08:00
陈淳
ac70fc37f6 商品子页面完善 2022-10-25 09:47:30 +08:00
橙子
c29aeeee41 缓存搭建 2022-10-24 22:31:53 +08:00
橙子
51c13c7b52 角色 权限code完善 2022-10-24 21:22:03 +08:00
橙子
fec8c0fe53 Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev 2022-10-23 22:29:44 +08:00
橙子
5da2143212 10/23更新 2022-10-23 22:29:35 +08:00
陈淳
30158ac145 spu、skus数据测试 2022-10-20 18:11:54 +08:00
陈淳
ff7eecee55 10/20更新 2022-10-20 16:33:29 +08:00
陈淳
0755a4026a 修复codefirst 2022-10-19 19:10:48 +08:00
陈淳
9aaf363584 10/19更新 2022-10-19 14:34:53 +08:00
陈淳
0a27cd7403 商城模块 2022-10-18 19:27:58 +08:00
陈淳
ab8cdd88b9 添加codeFirst功能 2022-10-18 18:01:16 +08:00
陈淳
dab4a092d9 sql日志打印输出配置 2022-10-18 09:01:16 +08:00
陈淳
9d365dbf1e 改造null 2022-10-17 18:08:16 +08:00
橙子
16d25fb60d 添加缩略图同步功能 2022-10-17 01:10:31 +08:00
橙子
50d43a2fc5 完善推荐页显示 2022-10-16 22:51:53 +08:00
橙子
6d99539730 修复列表展示问题 2022-10-16 16:09:45 +08:00
橙子
cf43dc8e70 修复上传问题 2022-10-16 15:54:49 +08:00
橙子
95c506c638 修复菜单排序问题 2022-10-16 13:43:23 +08:00
橙子
464b768c55 Revert "文章标题默认值"
This reverts commit 00ca4cc5bd.
2022-10-16 13:18:07 +08:00
橙子
00ca4cc5bd 文章标题默认值 2022-10-16 13:16:40 +08:00
橙子
bfb81ef60d 10/16更新 2022-10-16 13:15:43 +08:00
陈淳
420701bf23 文章管理、前端api、视图代码模板生成 2022-10-14 18:08:45 +08:00
橙子
88073aaa20 样式优化 2022-10-14 02:18:25 +08:00
橙子
8456320884 头像上传功能、性别选择 2022-10-13 23:55:21 +08:00
649 changed files with 25593 additions and 4789 deletions

63
.gitattributes vendored
View File

@@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

214
LICENSE
View File

@@ -1,201 +1,21 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
MIT License
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (c) 2022 jacktang
1. Definitions.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -20,11 +20,11 @@
Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
与Sqlsugar理念一致以用户体验出发。
架构干净整洁、无业务代码、采用微软风格原生框架封装、WebFrist开发。
架构干净整洁、无业务代码、采用微软风格原生框架封装、CodeFrist+配套自研文件模板代码生成器 开发。
适合.Net6学习、Sqlsugar学习 、项目二次开发。
集大成者,终究轮子
Yi框架最新版本标签`v1.2.0`,具体版本可以查看标签迭代
Yi框架最新版本标签`v1.2.1`,具体版本可以查看标签迭代
项目与Sqlsugar同步更新但这作者老杰哥代码天天爆肝到凌晨两点我们也尽量会跟上他的脚步。更新频繁所以可watching持续关注。
@@ -36,11 +36,13 @@ Yi框架最新版本标签`v1.2.0`,具体版本可以查看标签迭代
**SqlSugar**:.Net6 DDD领域驱动设计 简单分层微服务架构
- Yi.Framework.Net6.NetCore 6 意框架
- Yi.Framework.Net6.NetCore 6 意框架 (后端)
- Yi.Vue3.X.RuoYiVue3 RuoYi前端框架
- Yi.Vue3.X.RuoYiVue3 RuoYi前端框架 (前端后台)
你没有听错已经接入java流行指数最高最火爆的框架之一与其他框架不同Yi框架后端为完全重制版并非为ruoyi java模仿版
- Yi.Vue3.x.VantVue3 移动端前端框架 (前端前台)持续迭代
**SqlSugar-Dev**为sqlsugar分支的实时开发版本
@@ -52,19 +54,15 @@ Yi框架最新版本标签`v1.2.0`,具体版本可以查看标签迭代
废话少说直接上地址,**请不要**更改里面的数据
API服务~~[yi.ccnetcore.com](http://yi.ccnetcore.com) 管理员账号:admin 、 123~~
API服务[yi.ccnetcore.com](http://yi.ccnetcore.com) 管理员账号:cc 、 123456
网关地址:~~[gate.ccnetcore.com/swagger](http://gate.ccnetcore.com/swagger)~~
WebFirst开发所有代码生成器已经配置完成无需任何操作数据库及任何代码只需要网页表格上点点点即可
~~WebFirst开发所有代码生成器已经配置完成无需任何操作数据库及任何代码只需要网页表格上点点点即可~~
[https://www.donet5.com/Doc/11](https://www.donet5.com/Doc/11)
代码自动生成:
谁能把持的住Sqlsugar作者自己都依赖成瘾的东西呢这是继DbFirst、CodeFirst下一代的划时代产品无脑爽
![image](https://s1.ax1x.com/2022/04/12/Lnm5Yq.png)
(首次添加实体后,生成代码记得修改对应的路径哦~~
![代码生成](Readme/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90.gif)
### 支持:
@@ -95,30 +93,37 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
****
<h3>业务支持模块</h3>
RABC权限管理系统正在更新
大部分ruoyi功能采用ruoyi前端
- 用户管理
- 角色管理
- 菜单管理
- 部门管理
- 岗位管理
- 字典管理
- 参数管理
- 用户在线
- 操作日志
- 登录日志
- 登录日志
- 等等
ERP进销存系统正在更新
- 供货商管理
- 等等
BBS论坛系统持续迭代
- 文章管理
- 评论管理
- 等等
SHOP电商系统持续迭代
- SPU管理
- SKU管理
- 商品规格
- 商品分类
- 等等
![输入图片说明](Readme/%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86.png)
![输入图片说明](Readme/%E8%8F%9C%E5%8D%95%E7%AE%A1%E7%90%86.png)
@@ -136,8 +141,6 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持采用`异步`开发awit/async
- [x] 支持数据库主从`读写分离`
- [x] 支持功能替换,无需改动代码,只需配置`json文件`进行装配即可
- [x] 支持WebFirst无需改动代码自动生成全套代码与数据库只需点点点
- [x] 支持`用户-角色-菜单-接口`以及vue2.0前端全部逻辑代码,下载无需修改直接使用
- [x] 支持`Aop封装`FilterAop、IocAop、LogAop、SqlAop
- [x] 支持`Log4Net日志`记录自动生成至bin目录下的logs文件夹
- [x] 支持`DbSeed数据库种子数据`接入
@@ -149,11 +152,13 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持`consul`服务器注册与发现
- [x] 支持`健康检查`
- [x] 支持`RabbitMQ`消息队列
- [x] 支持`Redis`多级缓存
- [x] 支持`Redis`多级缓存
- [x] 支持`MemoryCache`多级缓存
- [x] 支持`Ocelot`网关路由、服务聚合、服务发现、认证、鉴权、限流、熔断、缓存、Header头传递
- [x] 支持`Apollo`全局配置中心;
- [x] 支持`docker`镜像制作
- [x] 支持`Quartz.net`任务调度,实现任意接口被调度
- [x] 支持`ThumbnailSharp`缩略图封装
- [x] 支持`ELK`log4net+kafka+es+logstach+kibana
- [x] 支持`IdentityService4`授权中心
- [x] 支持`Es`分词查询
@@ -162,13 +167,18 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
- [x] 支持`Docker+k8s`部署
- [x] 支持`Jenkins+CI/CD`
- [x] 支持`AutoMapper`模块映射
- [x] 支持`微信支付`
- [x] 支持`微信支付`模块
- [x] 支持`单表多租户`常用功能
- [x] 支持`逻辑删除`常用功能
- [x] 支持`操作日志`常用功能
- [x] 支持`自动分表`
- [x] 支持`数据权限`
- [x] 支持`CodeFrist`快速构建数据库
- [x] 支持自研文件版`代码生成器`快速构建通用代码
- [x] 支持完整`Dto`模式
- [x] 支持 太多了忘了
****
### 目录结构:
@@ -180,10 +190,11 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
分层如此清晰什么还感觉太复杂了用户只需关注Api、Service其他都是轮子啊
~~- BackGround后台进程目前可以无视,等待更新)~~
- Client客户端测试、客户端
- BackGround后台进程通常使用消息队列进行消费任务)
- Test测试单元测试
- Domain领域层Dto、服务接口层、模型层、仓储层、服务层
- Infrastructure基础实例层(通用工具层、核心层、定时任务Job、国际化、Web扩展层)
- Module模块层其他模块可按需进行引入例如微信支付、代码生成
- MicroServiceInstance服务层微服务
****
@@ -191,14 +202,20 @@ WebFirst开发所有代码生成器已经配置完成无需任何操作数
我们将在之后更新教程手册!
后端
1. 下载全部源码默认使用sqlite数据库已经生成
2. 直接点击sln文件运行即可没有其他依赖
2. 直接点击sln文件运行即可没有任何其他依赖
前端
1. 下载全部源码npm i 安装依赖
2. 使用npm run dev进行运行
****
### 使用说明:
1. 导入使用仓库中的WebFirst数据库
2. 使用WebFirst添加实体、同步实体、修改模板生成路径并生成方案
~~1. 导入使用仓库中的WebFirst数据库~~
~~2. 使用WebFirst添加实体、同步实体、修改模板生成路径并生成方案~~
没了,恭喜你已经成功完成了项目,并且已经具备大部分通用场景业务
是不是一个字?爽!

BIN
Readme/代码生成.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

View File

@@ -4,84 +4,6 @@
<name>Yi.Framework.ApiMicroservice</name>
</assembly>
<members>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
<summary>
账户管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.RestCC">
<summary>
重置管理员CC的密码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Login(Yi.Framework.DTOModel.LoginDto)">
<summary>
没啥说,登录
</summary>
<param name="loginDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Register(Yi.Framework.DTOModel.RegisterDto)">
<summary>
没啥说,注册
</summary>
<param name="registerDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Logout">
<summary>
没啥说,登出
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetUserAllInfo">
<summary>
通过已登录的用户获取用户信息
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetRouterInfo">
<summary>
获取当前登录用户的前端路由
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.UpdateUserByHttp(Yi.Framework.Model.Models.UserEntity)">
<summary>
更新已登录用户的用户信息
</summary>
<param name="user"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.UpdatePassword(Yi.Framework.DTOModel.UpdatePasswordDto)">
<summary>
自己更新密码
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.CaptchaImage">
<summary>
验证码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.PageList(Yi.Framework.Model.Models.ArticleEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="entity"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.Add(Yi.Framework.Model.Models.ArticleEntity)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1">
<summary>
Json To Sql 类比模式,通用模型
@@ -95,13 +17,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.GetList(Yi.Framework.Model.Query.QueryCondition)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.GetList(Yi.Framework.Model.Base.Query.QueryCondition)">
<summary>
列表查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.PageList(Yi.Framework.Model.Query.QueryPageCondition)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseCrudController`1.PageList(Yi.Framework.Model.Base.Query.QueryPageCondition)">
<summary>
条件分页查询
</summary>
@@ -213,7 +135,319 @@
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ConfigController.PageList(Yi.Framework.Model.Models.ConfigEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AgreeController.Operate(System.Int64)">
<summary>
点赞操作
</summary>
<param name="articleId"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.ArticleController">
<summary>
文章控制器
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.PageList(Yi.Framework.Model.BBS.Entitys.ArticleEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="entity"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ArticleController.Add(Yi.Framework.Model.BBS.Entitys.ArticleEntity)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.GetListByArticleId(System.Int64)">
<summary>
获取文章的全部一级评论
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.GetById(System.Int64)">
<summary>
获取一级评论详情
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.CommentController.Add(Yi.Framework.Model.BBS.Entitys.CommentEntity)">
<summary>
回复文章或回复评论
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.PageList(Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Create(Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.PageList(Yi.Framework.DtoModel.ERP.Purchase.PurchaseGetListInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Create(Yi.Framework.DtoModel.ERP.Purchase.PurchaseCreateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Purchase.PurchaseUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.PageList(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Create(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Update(System.Int64,Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.PageList(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Create(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.PageList(Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.GetList">
<summary>
全查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Create(Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.PageList(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
<summary>
分页查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.GetById(System.Int64)">
<summary>
单查
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Create(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput)">
<summary>
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput)">
<summary>
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.Del(System.Collections.Generic.List{System.Int64})">
<summary>
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
<summary>
账户管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.RestCC">
<summary>
重置管理员CC的密码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Login(Yi.Framework.DtoModel.Base.Dto.LoginDto)">
<summary>
没啥说,登录
</summary>
<param name="loginDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Register(Yi.Framework.DtoModel.Base.Dto.RegisterDto)">
<summary>
没啥说,注册
</summary>
<param name="registerDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Logout">
<summary>
没啥说,登出
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetUserAllInfo">
<summary>
通过已登录的用户获取用户信息
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.GetRouterInfo">
<summary>
获取当前登录用户的前端路由
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.UpdatePassword(Yi.Framework.DtoModel.Base.Dto.UpdatePasswordDto)">
<summary>
自己更新密码
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.CaptchaImage">
<summary>
验证码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ConfigController.PageList(Yi.Framework.Model.RABC.Entitys.ConfigEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -221,21 +455,21 @@
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.SelctGetList(Yi.Framework.Model.Models.DeptEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.SelctGetList(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
动态条件查询
</summary>
<param name="dept"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Add(Yi.Framework.Model.Models.DeptEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Add(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
添加
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Update(Yi.Framework.Model.Models.DeptEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.Update(Yi.Framework.Model.RABC.Entitys.DeptEntity)">
<summary>
更新
</summary>
@@ -249,7 +483,7 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.Models.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.RABC.Entitys.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -257,7 +491,7 @@
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.Models.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.RABC.Entitys.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -277,29 +511,37 @@
文件
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.#ctor(Yi.Framework.Interface.IFileService,Microsoft.Extensions.Hosting.IHostEnvironment)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.#ctor(Yi.Framework.Interface.RABC.IFileService,Microsoft.Extensions.Hosting.IHostEnvironment,Yi.Framework.Core.ThumbnailSharpInvoer)">
<summary>
文件上传下载
</summary>
<param name="iFileService"></param>
<param name="env"></param>
<param name="thumbnailSharpInvoer"></param>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Get(System.Int64)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Get(System.Int64,System.Nullable{System.Boolean})">
<summary>
文件下载,只需用文件code即可
文件下载,只需用文件code即可,可选择是否为缩略图
</summary>
<param name="code"></param>
<param name="isThumbnail"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Upload(System.String,Microsoft.AspNetCore.Http.IFormFileCollection,System.String)">
<summary>
多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的
多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的,同时如果时图片类型,还需要进行缩略图制作
</summary>
<param name="type">文件类型,可空</param>
<param name="file">多文件表单</param>
<param name="remark">描述</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.ThumbnailSync">
<summary>
一键同步图片到缩略图
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LogController.Add">
<summary>
自动分表,日志添加
@@ -312,7 +554,7 @@
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LoginLogController.PageList(Yi.Framework.Model.Models.LoginLogEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.LoginLogController.PageList(Yi.Framework.Model.RABC.Entitys.LoginLogEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -325,21 +567,21 @@
菜单管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.SelctGetList(Yi.Framework.Model.Models.MenuEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.SelctGetList(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
动态条件查询全部
</summary>
<param name="menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Add(Yi.Framework.Model.Models.MenuEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Add(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
插入
</summary>
<param name="menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Update(Yi.Framework.Model.Models.MenuEntity)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.Update(Yi.Framework.Model.RABC.Entitys.MenuEntity)">
<summary>
更新
</summary>
@@ -379,7 +621,7 @@
<param name="connnectionId"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.OperationLogController.PageList(Yi.Framework.Model.Models.OperationLogEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.OperationLogController.PageList(Yi.Framework.Model.RABC.Entitys.OperationLogEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -387,7 +629,7 @@
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.PostController.PageList(Yi.Framework.Model.Models.PostEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.PostController.PageList(Yi.Framework.Model.RABC.Entitys.PostEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
@@ -400,27 +642,27 @@
角色管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.PageList(Yi.Framework.Model.Models.RoleEntity,Yi.Framework.Common.Models.PageParModel)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.PageList(Yi.Framework.Model.RABC.Entitys.RoleEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DTOModel.GiveRoleSetMenuDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GiveRoleSetMenu(Yi.Framework.DtoModel.Base.Dto.GiveRoleSetMenuDto)">
<summary>
给多用户设置多角色
</summary>
<param name="giveRoleSetMenuDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Add(Yi.Framework.DTOModel.RoleInfoDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Add(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
添加角色包含菜单
</summary>
<param name="roleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Update(Yi.Framework.DTOModel.RoleInfoDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Update(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
更新角色信息
</summary>
@@ -434,20 +676,103 @@
<param name="isDel"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateDataScpoce(Yi.Framework.DTOModel.RoleInfoDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateDataScpoce(Yi.Framework.DtoModel.Base.Dto.RoleInfoDto)">
<summary>
更改角色数据权限
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
<summary>
用户管理
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.PageList(Yi.Framework.Model.RABC.Entitys.UserEntity,Yi.Framework.Common.Models.PageParModel,System.Nullable{System.Int64})">
<summary>
动态条件分页查询
</summary>
<param name="user"></param>
<param name="page"></param>
<param name="deptId"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateStatus(System.Int64,System.Boolean)">
<summary>
更改用户状态
</summary>
<param name="userId"></param>
<param name="isDel"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DtoModel.Base.Dto.GiveUserSetRoleDto)">
<summary>
给多用户设置多角色
</summary>
<param name="giveUserSetRoleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetById(System.Int64)">
<summary>
通过用户id得到用户信息关联部门、岗位、角色
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Update(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
更新用户信息
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateProfile(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
更新个人中心信息
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.DtoModel.Base.Dto.UserInfoDto)">
<summary>
添加用户
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.RestPassword(Yi.Framework.Model.RABC.Entitys.UserEntity)">
<summary>
重置密码
</summary>
<param name="user"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SkuController.PageList(Yi.Framework.Model.SHOP.Entitys.SkuEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SpuController.PageList(Yi.Framework.Model.SHOP.Entitys.SpuEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.TestController">
<summary>
测试控制器
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{Yi.Framework.WebCore.SignalRHub.MainHub},Microsoft.Extensions.Logging.ILogger{Yi.Framework.Model.Models.UserEntity},Yi.Framework.Interface.IRoleService,Yi.Framework.Interface.IUserService,Microsoft.Extensions.Localization.IStringLocalizer{Yi.Framework.Language.LocalLanguage},Yi.Framework.Core.QuartzInvoker)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{Yi.Framework.WebCore.SignalRHub.MainHub},Microsoft.Extensions.Logging.ILogger{Yi.Framework.ApiMicroservice.Controllers.TestController},Yi.Framework.Interface.RABC.IRoleService,Yi.Framework.Interface.RABC.IUserService,Microsoft.Extensions.Localization.IStringLocalizer{Yi.Framework.Language.LocalLanguage},Yi.Framework.Core.Quartz.QuartzInvoker,Yi.Framework.Core.ThumbnailSharpInvoer,Yi.Framework.Core.Cache.CacheInvoker,SqlSugar.ISugarUnitOfWork{Yi.Framework.Repository.UnitOfWork})">
<summary>
依赖注入
依赖注入,优雅写法
</summary>
<param name="hub"></param>
<param name="logger"></param>
@@ -455,6 +780,9 @@
<param name="iUserService"></param>
<param name="local"></param>
<param name="quartzInvoker"></param>
<param name="thumbnailSharpInvoer"></param>
<param name="cacheInvoker"></param>
<param name="unitOfWork"></param>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.Swagger">
<summary>
@@ -468,6 +796,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.UnitOfWorkTest">
<summary>
工作单元测试使用sqlsugar内置
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.SqlTest">
<summary>
执行Sql返回
@@ -516,6 +850,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ErrorJob">
<summary>
job异常处理
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.TreeTest">
<summary>
树形结构构建测试
@@ -554,68 +894,34 @@
<param name="msg"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.UserController">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ThumbnailTest">
<summary>
用户管理
缩略图测试,需要生成前及生成后的路径
</summary>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.PageList(Yi.Framework.Model.Models.UserEntity,Yi.Framework.Common.Models.PageParModel,System.Nullable{System.Int64})">
<summary>
动态条件分页查询
</summary>
<param name="user"></param>
<param name="page"></param>
<param name="deptId"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateStatus(System.Int64,System.Boolean)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CacheDBTest">
<summary>
更改用户状态
缓存测试
</summary>
<param name="userId"></param>
<param name="isDel"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CustomLogTest">
<summary>
给多用户设置多角色
自定义日志
</summary>
<param name="giveUserSetRoleDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetById(System.Int64)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.PropertyTest">
<summary>
通过用户id得到用户信息关联部门、岗位、角色
属性注入测试
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Update(Yi.Framework.DTOModel.UserInfoDto)">
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CurrentUserTest">
<summary>
更新用户信息
获取当前用户信息测试
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateProfile(Yi.Framework.DTOModel.UserInfoDto)">
<summary>
更新个人中心信息
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.DTOModel.UserInfoDto)">
<summary>
添加用户
</summary>
<param name="userDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.RestPassword(Yi.Framework.Model.Models.UserEntity)">
<summary>
重置密码
</summary>
<param name="user"></param>
<returns></returns>
</member>
</members>

View File

@@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Org.BouncyCastle.Asn1.IsisMtt.X509;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class AgreeController : ControllerBase
{
[Autowired]
public IAgreeService? _iAgreeService { get; set; }
[Autowired]
public IArticleService? _iArticleService { get; set; }
[Autowired]
public ILogger<AgreeEntity>? _logger { get; set; }
/// <summary>
/// 点赞操作
/// </summary>
/// <param name="articleId"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> Operate(long articleId)
{
long userId = HttpContext.GetUserIdInfo();
if (await _iAgreeService!.OperateAsync(articleId, userId))
{
return Result.Success("点赞成功");
}
else
{
return Result.Success("已点赞,取消点赞").StatusFalse();
}
}
}
}

View File

@@ -7,16 +7,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
using Yi.Framework.DtoModel.Base.Vo;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 文章控制器
/// </summary>
[ApiController]
[Route("api/[controller]/[action]")]
public class ArticleController : BaseSimpleCrudController<ArticleEntity>
@@ -38,8 +42,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpGet]
public async Task<Result> PageList([FromQuery] ArticleEntity entity, [FromQuery] PageParModel page)
{
var pageData= await _iArticleService.SelctPageList(entity, page);
return Result.Success().SetData(new PageModel() { Data = _mapper.Map<List<ArticleVo>>(pageData.Data), Total = pageData.Total }) ;
var pageData = await _iArticleService.SelctPageList(entity, page);
return Result.Success().SetData(new PageModel() { Data = _mapper.Map<List<ArticleVo>>(pageData.Data), Total = pageData.Total });
}
/// <summary>
@@ -49,6 +53,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns>
public override Task<Result> Add(ArticleEntity entity)
{
//如果标题为空默认为内容的前20个字符
entity.Title = string.IsNullOrEmpty(entity.Title) ?
(entity.Content?.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) :
entity.Title;
entity.UserId = HttpContext.GetUserIdInfo();
return base.Add(entity);
}

View File

@@ -0,0 +1,67 @@
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.Base.Vo;
using Yi.Framework.Interface;
using Yi.Framework.Interface.BBS;
using Yi.Framework.Model.BBS.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class CommentController : BaseSimpleCrudController<CommentEntity>
{
private ICommentService _iCommentService;
private IMapper _mapper;
public CommentController(ILogger<CommentEntity> logger, ICommentService iCommentService, IMapper mapper) : base(logger, iCommentService)
{
_iCommentService = iCommentService;
_mapper = mapper;
}
/// <summary>
/// 获取文章的全部一级评论
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{articleId}")]
public async Task<Result> GetListByArticleId(long articleId)
{
//一级评论被回复的用户id为空
var data = await _repository._DbQueryable.Where(u => u.ParentId == 0 && u.ArticleId == articleId).Includes(u => u.CreateUserInfo).OrderByDescending(u=>u.CreateTime).ToListAsync();
return Result.Success().SetData(_mapper.Map<List<CommentVo>>(data));
}
/// <summary>
/// 获取一级评论详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public override async Task<Result> GetById([FromRoute] long id)
{
var data = await _repository._DbQueryable.Includes(u => u.CreateUserInfo).Includes(u => u.UserInfo).FirstAsync(u => u.Id == id);
return Result.Success().SetData(_mapper.Map<CommentVo>(data));
}
/// <summary>
/// 回复文章或回复评论
/// </summary>
/// <returns></returns>
[HttpPost]
public override async Task<Result> Add(CommentEntity comment)
{
return Result.Success().SetStatus(await _iCommentService.AddAsync(comment));
}
}
}

View File

@@ -2,10 +2,9 @@
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Query;
using Yi.Framework.Model.Base.Query;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -7,8 +7,6 @@ using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Query;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -2,10 +2,8 @@
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Query;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;
@@ -31,7 +29,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Permission($"{nameof(T)}:get")]
[Route("{id}")]
[HttpGet]
public virtual async Task<Result> GetById([FromRoute]long id)

View File

@@ -2,10 +2,8 @@
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.Base;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Query;
using Yi.Framework.Repository;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Material;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class MaterialController : ControllerBase
{
private readonly ILogger<MaterialController> _logger;
private readonly IMaterialService _materialService;
public MaterialController(ILogger<MaterialController> logger, IMaterialService materialService)
{
_logger = logger;
_materialService = materialService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] MaterialCreateUpdateInput input, [FromQuery] PageParModel page)
{
var result = await _materialService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _materialService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(MaterialCreateUpdateInput input)
{
var result = await _materialService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, MaterialCreateUpdateInput input)
{
var result = await _materialService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _materialService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,83 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Abstract;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Purchase;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PurchaseController : ControllerBase
{
private readonly ILogger<PurchaseController> _logger;
private readonly IPurchaseService _purchaseService;
public PurchaseController(ILogger<PurchaseController> logger, IPurchaseService purchaseService)
{
_logger = logger;
_purchaseService = purchaseService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PurchaseGetListInput input, [FromQuery] PageParModel page)
{
var result = await _purchaseService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _purchaseService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(PurchaseCreateInput input)
{
var result = await _purchaseService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, PurchaseUpdateInput input)
{
var result = await _purchaseService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _purchaseService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.PurchaseDetails;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PurchaseDetailsController : ControllerBase
{
private readonly ILogger<PurchaseDetailsController> _logger;
private readonly IPurchaseDetailsService _purchaseDetailsService;
public PurchaseDetailsController(ILogger<PurchaseDetailsController> logger, IPurchaseDetailsService purchaseDetailsService)
{
_logger = logger;
_purchaseDetailsService = purchaseDetailsService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PurchaseDetailsCreateUpdateInput input, [FromQuery] PageParModel page)
{
var result = await _purchaseDetailsService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _purchaseDetailsService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(PurchaseDetailsCreateUpdateInput input)
{
var result = await _purchaseDetailsService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, PurchaseDetailsCreateUpdateInput input)
{
var result = await _purchaseDetailsService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _purchaseDetailsService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Supplier;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SupplierController : ControllerBase
{
private readonly ILogger<SupplierController> _logger;
private readonly ISupplierService _supplierService;
public SupplierController(ILogger<SupplierController> logger, ISupplierService supplierService)
{
_logger = logger;
_supplierService = supplierService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SupplierCreateUpdateInput input, [FromQuery] PageParModel page)
{
var result = await _supplierService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _supplierService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(SupplierCreateUpdateInput input)
{
var result = await _supplierService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, SupplierCreateUpdateInput input)
{
var result = await _supplierService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _supplierService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,92 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Unit;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class UnitController : ControllerBase
{
private readonly ILogger<UnitController> _logger;
private readonly IUnitService _unitService;
public UnitController(ILogger<UnitController> logger, IUnitService unitService)
{
_logger = logger;
_unitService = unitService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] UnitCreateUpdateInput input, [FromQuery] PageParModel page)
{
var result = await _unitService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _unitService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 全查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetList()
{
var result = await _unitService.GetListAsync();
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(UnitCreateUpdateInput input)
{
var result = await _unitService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, UnitCreateUpdateInput input)
{
var result = await _unitService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _unitService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Warehouse;
using Yi.Framework.Interface.ERP;
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
{
[ApiController]
[Route("api/[controller]/[action]")]
public class WarehouseController : ControllerBase
{
private readonly ILogger<WarehouseController> _logger;
private readonly IWarehouseService _warehouseService;
public WarehouseController(ILogger<WarehouseController> logger, IWarehouseService warehouseService)
{
_logger = logger;
_warehouseService = warehouseService;
}
/// <summary>
/// 分页查
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] WarehouseCreateUpdateInput input, [FromQuery] PageParModel page)
{
var result = await _warehouseService.PageListAsync(input, page);
return Result.Success().SetData(result);
}
/// <summary>
/// 单查
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public async Task<Result> GetById(long id)
{
var result = await _warehouseService.GetByIdAsync(id);
return Result.Success().SetData(result);
}
/// <summary>
/// 增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> Create(WarehouseCreateUpdateInput input)
{
var result = await _warehouseService.CreateAsync(input);
return Result.Success().SetData(result);
}
/// <summary>
/// 更
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
public async Task<Result> Update(long id, WarehouseCreateUpdateInput input)
{
var result = await _warehouseService.UpdateAsync(id, input);
return Result.Success().SetData(result);
}
/// <summary>
/// 删
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpDelete]
public async Task<Result> Del(List<long> ids)
{
await _warehouseService.DeleteAsync(ids);
return Result.Success();
}
}
}

View File

@@ -1,140 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.WebCore;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 文件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class FileController : ControllerBase
{
private IFileService _iFileService;
private readonly IHostEnvironment _env;
/// <summary>
/// 文件上传下载
/// </summary>
/// <param name="iFileService"></param>
/// <param name="env"></param>
public FileController(IFileService iFileService, IHostEnvironment env)
{
_iFileService = iFileService;
_env = env;
}
/// <summary>
/// 文件下载,只需用文件code即可
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[Route("/api/file/{code}")]
[HttpGet]
public async Task<IActionResult> Get(long code)
{
var file = await _iFileService._repository.GetByIdAsync(code);
if (file is null)
{
return new NotFoundResult();
}
try
{
//路径为: 文件路径/文件id+文件扩展名
var path = Path.Combine($"{PathConst.wwwroot}/{file.FilePath}", file.Id.ToString()+ Path.GetExtension(file.FileName));
var stream = System.IO.File.OpenRead(path);
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(file.FileName);
return File(stream, MimeType, file.FileName);
}
catch
{
return new NotFoundResult();
}
}
/// <summary>
/// 多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的
/// </summary>
/// <param name="type">文件类型,可空</param>
/// <param name="file">多文件表单</param>
/// <param name="remark">描述</param>
/// <returns></returns>
[Route("/api/file/Upload/{type?}")]
[HttpPost]
public async Task<Result> Upload([FromRoute] string? type, [FromForm] IFormFileCollection file,[FromQuery] string? remark)
{
if (type is null)
{
type = PathEnum.File.ToString();
}
else
{
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type!.ToLower());
if (!Enum.IsDefined(typeof(PathEnum), type))
{
//后续类型可从字典表中获取
return Result.Error("上传失败!文件类型不支持!");
}
}
if (file.Count() == 0)
{
return Result.Error("未选择文件");
}
//批量插入
List<FileEntity> datas = new();
//返回的codes
List<long> codes = new();
try
{
foreach (var f in file)
{
FileEntity data = new();
data.Id = SnowFlakeSingle.Instance.NextId();
data.FileSize = ((decimal)f.Length) / 1024;
data.FileName = f.FileName;
data.FileType = Common.Helper.MimeHelper.GetMimeMapping(f.FileName);
data.FilePath = type;
data.Remark = remark;
data.IsDeleted = false;
//落盘文件文件名为雪花id+自己的扩展名
string filename = data.Id.ToString() + Path.GetExtension(f.FileName);
string typePath = $"{PathConst.wwwroot}/{type}";
if (!Directory.Exists(typePath))
{
Directory.CreateDirectory(typePath);
}
using (var stream = new FileStream(Path.Combine(typePath, filename), FileMode.CreateNew, FileAccess.Write))
{
await f.CopyToAsync(stream);
}
//将文件信息添加到数据库
datas.Add(data);
codes.Add(data.Id);
}
return Result.Success().SetData(codes).SetStatus(await _iFileService._repository.InsertRangeAsync(datas));
}
catch
{
return Result.Error();
}
}
}
}

View File

@@ -11,13 +11,15 @@ using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DTOModel;
using Yi.Framework.Core.Cache;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
@@ -34,13 +36,19 @@ namespace Yi.Framework.ApiMicroservice.Controllers
private ILogger _logger;
private SecurityCodeHelper _securityCode;
private IRepository<UserEntity> _repository;
public AccountController(ILogger<UserEntity> logger, IUserService iUserService, JwtInvoker jwtInvoker, SecurityCodeHelper securityCode)
private CacheInvoker _cacheDb;
public AccountController(ILogger<UserEntity> logger,
IUserService iUserService,
JwtInvoker jwtInvoker,
SecurityCodeHelper securityCode,
CacheInvoker cacheInvoker)
{
_iUserService = iUserService;
_jwtInvoker = jwtInvoker;
_logger = logger;
_securityCode = securityCode;
_repository = iUserService._repository;
_cacheDb = cacheInvoker;
}
/// <summary>
@@ -71,16 +79,52 @@ namespace Yi.Framework.ApiMicroservice.Controllers
//先效验验证码和UUID
//登录还需要进行登录日志的落库
//先进行验证码的效验
var code = _cacheDb.Get<string>($"Yi:Captcha:{loginDto.Uuid}");
//判断是否开启二维码效验
if (GobalModel.LoginCodeEnable)
{
if (code != loginDto.Code)
{
return Result.Error("验证码错误!");
}
}
var loginInfo = HttpContext.GetLoginLogInfo();
loginInfo.LoginUser = loginDto.UserName;
loginInfo.LogMsg = "登录成功!";
var loginLogRepository = _repository.ChangeRepository<Repository<LoginLogEntity>>();
UserEntity user = new();
//这里其实可以返回Dto
if (await _iUserService.Login(loginDto.UserName, loginDto.Password, o => user = o))
{
//根据用户id获取改用户的完整信息
var userRoleMenu = await _iUserService.GetUserAllInfo(user.Id);
//如果该用户没有任何一个菜单,或者没有任何一个角色,无意义的登录
if (userRoleMenu.PermissionCodes.Count == 0)
{
return Result.Error("登录禁用!该用户分配无任何权限,无意义登录!");
}
//将该用户的完整信息缓存一份至缓存后续需要完整用户信息只需通过token中的id从缓存中获取即可
//先制作token
var token = _jwtInvoker.GetAccessToken(userRoleMenu.User, userRoleMenu.Menus);
//需要注意缓存用户信息时间应大于或等于token过期时间
_cacheDb.Set($"Yi:UserInfo:{user.Id}", userRoleMenu, _jwtInvoker.GetTokenExpiration());
await loginLogRepository.InsertReturnSnowflakeIdAsync(loginInfo);
return Result.Success(loginInfo.LogMsg).SetData(new { token = _jwtInvoker.GetAccessToken(userRoleMenu.User, userRoleMenu.Menus) });
return Result.Success(loginInfo.LogMsg).SetData(new { token });
}
loginInfo.LogMsg = "登录失败!用户名或者密码错误!";
await loginLogRepository.InsertReturnSnowflakeIdAsync(loginInfo);
@@ -122,12 +166,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
//[Authorize]
public async Task<Result> GetUserAllInfo()
public Result GetUserAllInfo()
{
//通过鉴权jwt获取到用户的id
var userId = HttpContext.GetUserIdInfo();
var data = await _iUserService.GetUserAllInfo(userId);
//此处从缓存中获取即可
var data = _cacheDb.Get<UserRoleMenuDto>($"Yi:UserInfo:{userId}");
//var data = await _iUserService.GetUserAllInfo(userId);
//系统用户数据被重置,老前端访问重新授权
if (data is null)
{
@@ -159,22 +204,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
return Result.Success().SetData(routers);
}
/// <summary>
/// 更新已登录用户的用户信息
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> UpdateUserByHttp(UserEntity user)
{
//当然,密码是不能给他修改的
user.Password = null;
user.Salt = null;
//修改需要赋值上主键哦
user.Id = HttpContext.GetUserIdInfo();
return Result.Success().SetStatus(await _iUserService._repository.UpdateIgnoreNullAsync(user));
}
/// <summary>
/// 自己更新密码
@@ -204,6 +233,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
var uuid = Guid.NewGuid();
var code = _securityCode.GetRandomEnDigitalText(4);
//将uuid与codeRedis缓存中心化保存起来登录根据uuid比对即可
//10分钟过期
_cacheDb.Set($"Yi:Captcha:{uuid}", code, new TimeSpan(0, 10, 0));
var imgbyte = _securityCode.GetEnDigitalCodeByte(code);
return Result.Success().SetData(new { uuid = uuid, img = imgbyte });
}

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -8,7 +8,8 @@ using System.Threading.Tasks;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;

View File

@@ -8,7 +8,8 @@ using System.Threading.Tasks;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;

View File

@@ -0,0 +1,242 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.WebCore;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 文件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class FileController : ControllerBase
{
private IFileService _iFileService;
private readonly IHostEnvironment _env;
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
/// <summary>
/// 文件上传下载
/// </summary>
/// <param name="iFileService"></param>
/// <param name="env"></param>
/// <param name="thumbnailSharpInvoer"></param>
public FileController(IFileService iFileService, IHostEnvironment env, ThumbnailSharpInvoer thumbnailSharpInvoer)
{
_iFileService = iFileService;
_env = env;
_thumbnailSharpInvoer = thumbnailSharpInvoer;
}
/// <summary>
/// 文件下载,只需用文件code即可,可选择是否为缩略图
/// </summary>
/// <param name="code"></param>
/// <param name="isThumbnail"></param>
/// <returns></returns>
[Route("/api/file/{code}/{isThumbnail?}")]
[HttpGet]
public async Task<IActionResult> Get(long code, bool? isThumbnail)
{
var file = await _iFileService._repository.GetByIdAsync(code);
if (file is null)
{
return new NotFoundResult();
}
try
{
//如果为缩略图
if (isThumbnail is true)
{
file.FilePath = PathEnum.Thumbnail.ToString();
}
//路径为: 文件路径/文件id+文件扩展名
var path = Path.Combine($"{PathConst.wwwroot}/{file.FilePath}", file.Id.ToString() + Path.GetExtension(file.FileName));
var stream = System.IO.File.OpenRead(path);
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(file.FileName!);
return File(stream, MimeType, file.FileName);
}
catch
{
return new NotFoundResult();
}
}
/// <summary>
/// 多文件上传,type可空默认上传至File文件夹下swagger返回雪花id精度是有问题的同时如果时图片类型还需要进行缩略图制作
/// </summary>
/// <param name="type">文件类型,可空</param>
/// <param name="file">多文件表单</param>
/// <param name="remark">描述</param>
/// <returns></returns>
[Route("/api/file/Upload/{type?}")]
[HttpPost]
public async Task<Result> Upload([FromRoute] string? type, [FromForm] IFormFileCollection file, [FromQuery] string? remark)
{
type = type ?? PathEnum.File.ToString();
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type.ToLower());
if (!Enum.IsDefined(typeof(PathEnum), type))
{
//后续类型可从字典表中获取
return Result.Error("上传失败!文件类型不支持!");
}
if (file.Count() == 0)
{
return Result.Error("未选择文件");
}
//批量插入
List<FileEntity> datas = new();
//返回的codes
List<long> codes = new();
try
{
foreach (var f in file)
{
FileEntity data = new();
data.Id = SnowFlakeSingle.Instance.NextId();
data.FileSize = ((decimal)f.Length) / 1024;
data.FileName = f.FileName;
data.FileType = Common.Helper.MimeHelper.GetMimeMapping(f.FileName);
data.FilePath = type;
data.Remark = remark;
data.IsDeleted = false;
//落盘文件文件名为雪花id+自己的扩展名
string filename = data.Id.ToString() + Path.GetExtension(f.FileName);
string typePath = $"{PathConst.wwwroot}/{type}";
if (!Directory.Exists(typePath))
{
Directory.CreateDirectory(typePath);
}
//生成文件
using (var stream = new FileStream(Path.Combine(typePath, filename), FileMode.CreateNew, FileAccess.ReadWrite))
{
await f.CopyToAsync(stream);
//如果是图片类型,还需要生成缩略图,当然,如果图片很小,直接复制过去即可
if (PathEnum.Image.ToString().Equals(type))
{
string thumbnailPath = $"{PathConst.wwwroot}/{PathEnum.Thumbnail}";
if (!Directory.Exists(thumbnailPath))
{
Directory.CreateDirectory(thumbnailPath);
}
//保存至缩略图路径
byte[] result=null!;
try
{
result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: stream,
imageFormat: Format.Jpeg);
}
catch
{
result = new byte[stream.Length];
stream.Read(result, 0, result.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
}
finally
{
await System.IO.File.WriteAllBytesAsync(Path.Combine(thumbnailPath, filename), result);
}
}
};
//将文件信息添加到数据库
datas.Add(data);
codes.Add(data.Id);
}
return Result.Success().SetData(codes).SetStatus(await _iFileService._repository.InsertRangeAsync(datas));
}
catch
{
return Result.Error();
}
}
/// <summary>
/// 一键同步图片到缩略图
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> ThumbnailSync()
{
string typePath = $"{PathConst.wwwroot}/{PathEnum.Image}";
string thumbnailPath = $"{PathConst.wwwroot}/{PathEnum.Thumbnail}";
List<string> fileNames = FileHelper.GetAllFileNames(typePath);
foreach (var filename in fileNames)
{
if (System.IO.File.Exists(Path.Combine(thumbnailPath, filename)))
{
//如果缩略图存在,直接跳过
continue;
}
if (!Directory.Exists(typePath))
{
Directory.CreateDirectory(typePath);
}
using (var stream = new FileStream(Path.Combine(typePath, filename), FileMode.Open, FileAccess.ReadWrite))
{
byte[] result=null!;
try
{
//保存至缩略图路径
result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: stream,
imageFormat: Format.Jpeg);
if (!Directory.Exists(thumbnailPath))
{
Directory.CreateDirectory(thumbnailPath);
}
}
catch
{
result = new byte[stream.Length];
stream.Read(result, 0, result.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
////如果当前文件同步失败,就跳转到下一个
}
finally {
await System.IO.File.WriteAllBytesAsync(Path.Combine(thumbnailPath, filename), result);
}
}
}
return Result.Success();
}
}
}

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
@@ -35,6 +36,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="menu"></param>
/// <returns></returns>
[HttpGet]
[Permission("system:menu:query")]
public async Task<Result> SelctGetList([FromQuery] MenuEntity menu)
{
return Result.Success().SetData(await _iMenuService.SelctGetList(menu));
@@ -46,6 +48,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="menu"></param>
/// <returns></returns>
[HttpPost]
[Permission("system:menu:add")]
public async Task<Result> Add(MenuEntity menu)
{
return Result.Success().SetData(await _iMenuService._repository.InsertReturnSnowflakeIdAsync(menu));
@@ -57,6 +60,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="menu"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:menu:edit")]
public async Task<Result> Update(MenuEntity menu)
{
//注意,这里如果是主目录,还需要判断/,需要以/开头
@@ -69,6 +73,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
[Permission("system:menu:query")]
public async Task<Result> GetMenuTree()
{
return Result.Success().SetData(await _iMenuService.GetMenuTreeAsync());
@@ -81,6 +86,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns>
[HttpGet]
[Route("{id}")]
[Permission("system:menu:query")]
public async Task<Result> GetListByRoleId(long id)
{
return Result.Success().SetData(await _iMenuService.GetListByRoleId(id));

View File

@@ -12,9 +12,8 @@ using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DTOModel;
using Yi.Framework.DtoModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
@@ -53,11 +52,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
if (!string.IsNullOrEmpty(online.Ipaddr))
{
dataWhere = dataWhere.Where((u) => u.Ipaddr.Contains(online.Ipaddr));
dataWhere = dataWhere.Where((u) => u.Ipaddr!.Contains(online.Ipaddr));
}
if (!string.IsNullOrEmpty(online.UserName))
{
dataWhere = dataWhere.Where((u) => u.UserName.Contains(online.UserName));
dataWhere = dataWhere.Where((u) => u.UserName!.Contains(online.UserName));
}
return Result.Success().SetData(new PageModel<List<OnlineUser>>() { Total = data.Count, Data = dataWhere.ToList() });
}

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -7,7 +7,8 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;

View File

@@ -6,9 +6,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service;
using Yi.Framework.WebCore;
@@ -34,6 +35,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[Permission("system:role:query")]
[HttpGet]
public async Task<Result> PageList([FromQuery] RoleEntity role, [FromQuery] PageParModel page)
{
@@ -47,6 +49,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="giveRoleSetMenuDto"></param>
/// <returns></returns>
[HttpPut]
[Permission("system:role:edit")]
public async Task<Result> GiveRoleSetMenu(GiveRoleSetMenuDto giveRoleSetMenuDto)
{
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
@@ -58,7 +61,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <param name="roleDto"></param>
/// <returns></returns>
[Permission("system:role:add")]
[HttpPost]
public async Task<Result> Add(RoleInfoDto roleDto)
{
@@ -69,6 +72,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 更新角色信息
/// </summary>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> Update(RoleInfoDto roleDto)
{
@@ -81,6 +85,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="roleId"></param>
/// <param name="isDel"></param>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> UpdateStatus(long roleId, bool isDel)
{
@@ -91,10 +96,23 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///更改角色数据权限
/// </summary>
/// <returns></returns>
[Permission("system:role:edit")]
[HttpPut]
public async Task<Result> UpdateDataScpoce(RoleInfoDto roleDto)
{
return Result.Success().SetStatus(await _iRoleService.UpdateDataScpoce(roleDto));
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[Permission("system:role:remove")]
[HttpDelete]
public override async Task<Result> DelList(List<long> ids)
{
return await base.DelList(ids);
}
}
}

View File

@@ -10,13 +10,14 @@ using Yi.Framework.Common.Const;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.DTOModel;
using Yi.Framework.DtoModel.Base.Dto;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
@@ -101,7 +102,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[Log("用户模块", OperEnum.Update)]
public async Task<Result> Update(UserInfoDto userDto)
{
if (await _repository.IsAnyAsync(u => userDto.User.UserName.Equals(u.UserName) && !userDto.User.Id.Equals(u.Id)))
if (await _repository.IsAnyAsync(u => userDto.User!.UserName!.Equals(u.UserName) && !userDto.User.Id.Equals(u.Id)))
{
return Result.Error("用户名已存在,修改失败!");
}
@@ -119,6 +120,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[Log("用户模块", OperEnum.Update)]
public async Task<Result> UpdateProfile(UserInfoDto userDto)
{
//修改需要赋值上主键哦
userDto.User!.Id = HttpContext.GetUserIdInfo();
return Result.Success().SetStatus(await _iUserService.UpdateProfile(userDto));
}
@@ -132,11 +135,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[Log("用户模块", OperEnum.Insert)]
public async Task<Result> Add(UserInfoDto userDto)
{
if (string.IsNullOrEmpty(userDto.User.Password))
if (string.IsNullOrEmpty(userDto?.User?.Password))
{
return Result.Error("密码为空,添加失败!");
}
if (await _repository.IsAnyAsync(u => userDto.User.UserName.Equals(u.UserName)))
if (await _repository.IsAnyAsync(u => userDto.User.UserName!.Equals(u.UserName)))
{
return Result.Error("用户已经存在,添加失败!");
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class CategoryController : BaseCrudController<CategoryEntity>
{
private ICategoryService _iCategoryService;
public CategoryController(ILogger<CategoryEntity> logger, ICategoryService iCategoryService) : base(logger, iCategoryService)
{
_iCategoryService = iCategoryService;
}
}
}

View File

@@ -0,0 +1,115 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SkuController : BaseSimpleCrudController<SkuEntity>
{
private ISkuService _iSkuService;
public SkuController(ILogger<SkuEntity> logger, ISkuService iSkuService) : base(logger, iSkuService)
{
_iSkuService = iSkuService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SkuEntity eneity, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iSkuService.SelctPageList(eneity, page));
}
//数据测试
[HttpGet]
public async Task<Result> Test(OperEnum operEnum)
{
switch (operEnum)
{
case OperEnum.Insert:
List<SkuEntity> spus = new();
var sku1 = new SkuEntity()
{
Id = 1,
Stock = 100,
IsDeleted = false,
SpuId = 1,
Price = 1000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="1GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } },
};
var sku2 = new SkuEntity()
{
Id = 2,
Stock = 100,
IsDeleted = false,
SpuId = 1,
Price = 4000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "绿" } },
};
var sku3 = new SkuEntity()
{
Id = 3,
Stock = 100,
IsDeleted = false,
SpuId = 2,
Price = 2000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="3GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } },
};
var sku4 = new SkuEntity()
{
Id = 4,
Stock = 100,
IsDeleted = false,
SpuId = 2,
Price = 1000,
SpecsSkuAllInfo = new List<SpecsSkuAllInfoModel> {
new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } ,
new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "蓝" } },
};
spus.Add(sku1);
spus.Add(sku2);
spus.Add(sku3);
spus.Add(sku4);
await _iSkuService._repository.InsertRangeAsync(spus);
break;
case OperEnum.Delete:
await _iSkuService._repository.DeleteAsync((u)=>true);
break;
default:
break;
}
return Result.Success();
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpecsController : BaseCrudController<SpecsEntity>
{
private ISpecsService _iSpecsService;
public SpecsController(ILogger<SpecsEntity> logger, ISpecsService iSpecsService) : base(logger, iSpecsService)
{
_iSpecsService = iSpecsService;
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpecsGroupController : BaseCrudController<SpecsGroupEntity>
{
private ISpecsGroupService _iSpecsGroupService;
public SpecsGroupController(ILogger<SpecsGroupEntity> logger, ISpecsGroupService iSpecsGroupService) : base(logger, iSpecsGroupService)
{
_iSpecsGroupService = iSpecsGroupService;
}
}
}

View File

@@ -0,0 +1,96 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Enum;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Interface.SHOP;
using Yi.Framework.Model.SHOP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class SpuController : BaseSimpleCrudController<SpuEntity>
{
private ISpuService _iSpuService;
public SpuController(ILogger<SpuEntity> logger, ISpuService iSpuService) : base(logger, iSpuService)
{
_iSpuService = iSpuService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] SpuEntity eneity, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page));
}
[Route("{id}")]
[HttpGet]
public override async Task<Result> GetById([FromRoute] long id)
{
return Result.Success().SetData(await _repository._DbQueryable.Includes(u=>u.Skus).SingleAsync(u=>u.Id.Equals(id)));
}
//数据测试
[HttpGet]
public async Task<Result> Test(OperEnum operEnum)
{
switch (operEnum)
{
case OperEnum.Insert:
List<SpuEntity> spus = new();
var spu1 = new SpuEntity()
{
Id = 1,
SpuName = "华为mate40 5G手机",
IsDeleted = false,
Details = "华为手机就是牛",
Price = "1000-2000",
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
};
var spu2 = new SpuEntity()
{
Id = 2,
SpuName = "小米888 8G手机",
IsDeleted = false,
Details = "小米手机就是牛",
Price = "2000-3000",
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
};
spus.Add(spu1);
spus.Add(spu2);
await _iSpuService._repository.InsertRangeAsync(spus);
break;
case OperEnum.Delete:
await _iSpuService._repository.DeleteAsync((u) => true);
break;
default:
break;
}
return Result.Success();
}
}
}

View File

@@ -1,19 +1,26 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Abstract;
using Yi.Framework.Common.Attribute;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.Core.Cache;
using Yi.Framework.Core.Quartz;
using Yi.Framework.Interface;
using Yi.Framework.Interface.RABC;
using Yi.Framework.Job;
using Yi.Framework.Language;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
@@ -35,9 +42,18 @@ namespace Yi.Framework.ApiMicroservice.Controllers
private IRoleService _iRoleService;
private QuartzInvoker _quartzInvoker;
private IHubContext<MainHub> _hub;
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
private CacheInvoker _cacheDb;
private ILogger<TestController> _logger;
ISugarUnitOfWork<UnitOfWork> _unitOfWork;
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
public CacheInvoker CacheInvoker { get; set; }
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
/// <summary>
/// 依赖注入
/// 依赖注入,优雅写法
/// </summary>
/// <param name="hub"></param>
/// <param name="logger"></param>
@@ -45,13 +61,24 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="iUserService"></param>
/// <param name="local"></param>
/// <param name="quartzInvoker"></param>
public TestController(IHubContext<MainHub> hub , ILogger<UserEntity> logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer<LocalLanguage> local, QuartzInvoker quartzInvoker)
{
_iUserService = iUserService;
_iRoleService = iRoleService;
_quartzInvoker = quartzInvoker;
_hub = hub;
}
/// <param name="thumbnailSharpInvoer"></param>
/// <param name="cacheInvoker"></param>
/// <param name="unitOfWork"></param>
public TestController(IHubContext<MainHub> hub,
ILogger<TestController> logger,
IRoleService iRoleService,
IUserService iUserService,
IStringLocalizer<LocalLanguage> local,
QuartzInvoker quartzInvoker,
ThumbnailSharpInvoer thumbnailSharpInvoer,
CacheInvoker cacheInvoker,
ISugarUnitOfWork<UnitOfWork> unitOfWork
) =>
(_logger, _iUserService, _iRoleService, _quartzInvoker, _hub, _local, _thumbnailSharpInvoer, _cacheDb, _unitOfWork) =
(logger, iUserService, iRoleService, quartzInvoker, hub, local, thumbnailSharpInvoer, cacheInvoker, unitOfWork);
/// <summary>
/// swagger跳转
@@ -95,6 +122,22 @@ namespace Yi.Framework.ApiMicroservice.Controllers
return Result.Success().SetData(await _iUserService.DbTest());
}
/// <summary>
/// 工作单元测试使用sqlsugar内置
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> UnitOfWorkTest()
{
var data = await _iRoleService._repository._DbQueryable.ToListAsync();
using (var uow = _unitOfWork.CreateContext())
{
var res = await _iRoleService._repository.InsertReturnSnowflakeIdAsync(new RoleEntity { RoleName = "测试", RoleCode = "tt" });
throw new ApplicationException("测试uow");
}
}
/// <summary>
/// 执行Sql返回
/// </summary>
@@ -203,6 +246,17 @@ namespace Yi.Framework.ApiMicroservice.Controllers
public async Task<Result> StopJob()
{
await _quartzInvoker.StopAsync(new Quartz.JobKey("test", "my"));
return Result.Success("http://localhost:19001/hangfire");
}
/// <summary>
/// job异常处理
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> ErrorJob()
{
await _quartzInvoker.StartAsync("*/5 * * * * ?", "ErrorJob");
return Result.Success();
}
@@ -265,10 +319,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
public Result SeedDb()
public Result SeedDb()
{
var rep = _iUserService._repository;
return Result.Success().SetStatus(DbSeedExtend.Invoer(rep._Db));
return Result.Success().SetStatus(DbSeedExtend.DataInvoer(rep._Db));
}
/// <summary>
@@ -289,11 +343,81 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="msg"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> SignalrTest(int msg)
public async Task<Result> SignalrTest(int msg)
{
await _hub.Clients.All.SendAsync("onlineNum", msg);
return Result.Success("向所有连接客户端发送一个消息");
}
//job任务与公告管理
/// <summary>
/// 缩略图测试,需要生成前及生成后的路径
/// </summary>
/// <returns></returns>
[HttpGet]
public Result ThumbnailTest()
{
try
{
var path = @"D:\App\test11.jpg";
var result = _thumbnailSharpInvoer.CreateThumbnailBytes(thumbnailSize: 300,
imageStream: new FileStream(path, FileMode.Open, FileAccess.ReadWrite),
imageFormat: Format.Jpeg);
System.IO.File.WriteAllBytes(@"D:\App\test222.jpg", result);
}
catch (Exception ex)
{
return Result.Error(ex.Message);
}
return Result.Success();
}
/// <summary>
/// 缓存测试
/// </summary>
/// <returns></returns>
[HttpGet]
public Result CacheDBTest()
{
var key = "Yi:Test";
var item = "你好世界";
_cacheDb.Set(key, item);
var data = _cacheDb.Get<string>(key);
return Result.Success().SetData(data);
}
/// <summary>
/// 自定义日志
/// </summary>
/// <returns></returns>
[HttpGet]
public Result CustomLogTest()
{
_logger.LogWarning("输出一条日志");
return Result.Success();
}
/// <summary>
/// 属性注入测试
/// </summary>
/// <returns></returns>
[HttpGet]
public Result PropertyTest()
{
return Result.Success().SetStatus(CacheInvoker is not null);
}
/// <summary>
/// 获取当前用户信息测试
/// </summary>
/// <returns></returns>
[HttpGet]
[Authorize]
public Result CurrentUserTest()
{
var per = _currentUser.Permission;
return Result.Success().SetData(per);
}
}
}

View File

@@ -3,7 +3,6 @@ using Autofac.Extensions.DependencyInjection;
using Yi.Framework.WebCore.BuilderExtend;
using Yi.Framework.Core;
using Yi.Framework.WebCore.MiddlewareExtend;
using Yi.Framework.WebCore.Utility;
using Autofac;
using Yi.Framework.Common.Models;
using Yi.Framework.Language;
@@ -11,10 +10,17 @@ using Microsoft.Extensions.Localization;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.SignalRHub;
using Hei.Captcha;
using Yi.Framework.WebCore;
using Microsoft.Extensions.DependencyInjection;
using Yi.Framework.WebCore.DbExtend;
using IPTools.Core;
using Yi.Framework.WebCore.LogExtend;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Yi.Framework.WebCore.AutoFacExtend;
using AspectCore.Extensions.DependencyInjection;
using AspectCore.Extensions.Hosting;
using Yi.Framework.WebCore.AspNetCoreExtensions;
using Yi.Framework.WebCore.CommonExtend;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddCommandLine(args);
@@ -28,24 +34,34 @@ builder.Host.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder
#endregion
configurationBuilder.AddApolloService("Yi");
});
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
{
#region
//交由Module依赖注入
#endregion
containerBuilder.RegisterModule<CustomAutofacModule>();
#region
//添加属性注入模块
#endregion
containerBuilder.RegisterModule<PropertiesAutowiredModule>();
#region
//使用AppService特性优雅的进行自动依赖注入,仓储与基类服务便是使用该种方式自动注入
#endregion
containerBuilder.AddAutoIocService("Yi.Framework.Repository", "Yi.Framework.Service");
});
////属性注入将控制器的mvc模块转接给ioc
builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
builder.Host.ConfigureLogging(loggingBuilder =>
{
loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning);
loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning);
loggingBuilder.AddLog4Net("./Config/Log4net.config");
//添加自定义日志
//loggingBuilder.AddCustomLogger();
});
#region
//配置类配置
@@ -60,10 +76,9 @@ builder.Host.ConfigureLogging(loggingBuilder =>
#endregion
builder.Services.AddIocService(builder.Configuration);
#region
//Sqlsugar上下文注入,是否开启数据权限功能,开启需要Redis缓存
//Sqlsugar上下文注入,是否开启数据权限功能,开启需缓存
#endregion
builder.Services.AddSqlsugarServer();
//builder.Services.AddSqlsugarServer(DbFiterExtend.Data);
builder.Services.AddSqlsugarServer(DbFiterExtend.Data);
#region
//Quartz任务调度配置
#endregion
@@ -75,7 +90,8 @@ builder.Services.AddAutoMapperService();
#region
//控制器+过滤器配置
#endregion
builder.Services.AddControllers(optios => {
builder.Services.AddControllers(optios =>
{
//注册全局
optios.Filters.Add<GlobalLogAttribute>();
}).AddJsonFileService();
@@ -105,7 +121,7 @@ builder.Services.AddAuthorizationService();
#region
//Redis服务配置
#endregion
builder.Services.AddRedisService();
builder.Services.AddCacheService();
#region
//RabbitMQ服务配置
#endregion
@@ -137,8 +153,22 @@ builder.Services.AddHeiCaptcha();
#region
//添加Http上下文
#endregion
builder.Services.AddHttpContextAccessor();
#region
//添加缩略图引入了System.Drawinglinu需要插件支持
#endregion
builder.Services.AddSingleton<ThumbnailSharpInvoer>();
#region
//添加当前用户信息使用
#endregion
builder.Services.AddCurrentUserServer();
#region
//全局配置初始化值
#endregion
GobalModel.SqlLogEnable = Appsettings.appBool("SqlLog_Enable");
GobalModel.LoginCodeEnable = Appsettings.appBool("LoginCode_Enable");
//-----------------------------------------------------------------------------------------------------------
var app = builder.Build();
#region
@@ -151,9 +181,6 @@ ServiceLocator.Instance = app.Services;
//测试页面注入
#endregion
app.UseDeveloperExceptionPage();
#region
//Swagger服务注入
#endregion
app.UseSwaggerService();
}
#region
@@ -199,6 +226,10 @@ app.UseAuthentication();
#endregion
app.UseAuthorization();
#region
//添加当前用户信息使用
#endregion
app.UseCurrentUserServer();
#region
//Consul服务注入
#endregion
app.UseConsulService();
@@ -220,5 +251,5 @@ app.UseEndpoints(endpoints =>
endpoints.MapHub<MainHub>("/api/hub/main");
endpoints.MapControllers();
});
//准备添加多租户
app.Run();

View File

@@ -2,8 +2,8 @@
"profiles": {
"Yi.Framework.ApiMicroservice": {
"commandName": "Project",
//开发环境根据情况是否自动启动浏览器,个人感觉开开关关比较麻烦
"launchBrowser": false,
//开发环境根据情况是否自动启动浏览器
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},

View File

@@ -10,7 +10,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>./Config/SwaggerDoc.xml</DocumentationFile>
<NoWarn>1701;1702;CS1591</NoWarn>
<NoWarn>1701;1702;CS1591;CS8618</NoWarn>
</PropertyGroup>
<ItemGroup>
@@ -20,10 +20,20 @@
<None Remove="wwwrooot\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\Image\0.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="Config\SwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -37,9 +47,6 @@
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="yi-sqlsugar-dev.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,5 +1,8 @@
{
"StartUrl": "http://localohost:19001",
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,74 +10,117 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
"RedisSeed_Enabled": false,
"Cors_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
//"WriteUrl": "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.",
"ReadUrl": [
"server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.",
"server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.",
"server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020."
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
]
},
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
"PolicyName": "permission",
"DefaultScheme": "Bearer",
"IsHttps": false,
"Expiration": 30,
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "118.195.191.41",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "Qz52013142020."
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "118.195.191.41",
"UserName": "cc",
"Password": "cc",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "https://es-4zakkyyn.public.tencentelasticsearch.com:9200",
"IndexName": "yies",
"UserName": "elastic",
"PassWord": "Qz52013142020."
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "192.168.3.230:9092",
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "118.195.191.41",
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "118.195.191.41",
"Port": "19005",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -82,11 +128,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "LTAI5tJvjPaXCyyPMfXLNbVA",
"Secret": "fLQv7jjj57fUKLFK8REeAQPFVDjUYn",
"Sign": "JiftCC",
"Template": "SMS_221640732"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

View File

@@ -1,5 +1,8 @@
{
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,72 +10,117 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"RedisSeed_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
"Cors_Enabled": true,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbSelect": "Mysql",
"Pan": {
"ZipPath": "D:/AppWeb/test/zip"
},
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
"WriteUrl": "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
"ReadUrl": [
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
]
},
"JWTTokenOptions": {
"Audience": "http://localhost:7000",
"Issuer": "http://localhost:7000",
"SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
"PolicyName": "permission",
"DefaultScheme": "Bearer",
"IsHttps": false,
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "[xxxx]",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "[xxxx]"
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "[xxxx]",
"UserName": "[xxxx]",
"Password": "[xxxx]",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "[xxxx]",
"IndexName": "[xxxx]",
"UserName": "[xxxx]",
"PassWord": "[xxxx]"
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "[xxxx]",
"TopicName": "[xxxx]"
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "[xxxx]",
"Port": "[xxxx]",
"Datacenter": "[xxxx]"
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "[xxxx]",
"Port": "19001",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -80,11 +128,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "[xxxx]",
"Secret": "[xxxx]",
"Sign": "[xxxx]",
"Template": "[xxxx]"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

View File

@@ -1,5 +1,8 @@
{
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19001",
//默认日志打印过滤
"Logging": {
"LogLevel": {
"Default": "Information",
@@ -7,34 +10,72 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
//运行全部主机
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": false,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"RabbitMQ_Enabled": false,
"Redis_Enabled": false,
"RedisSeed_Enabled": false,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
"MutiDB_Enabled": false,
"SMS_Enabled": false,
"CAP_Enabled": false,
"CAPDashboard_Enabled": false,
//【全局配置开启】
//Sql语句日志是否打印
"SqlLog_Enable": false,
//登录二维码是否打印
"LoginCode_Enable": false,
"Cors_Enabled": true,
//【数据库配置】
//多数据库主从复制是否开启
"MutiDB_Enabled": false,
//数据库CodeFirst是否开启
"DbCodeFirst_Enabled": true,
//数据库种子数据是否开启
"DbSeed_Enabled": true,
//数据库列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
//数据库类型选择
"DbSelect": "Sqlite",
//数据库连接地址,支持读写分离
"DbConn": {
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
//"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"ReadUrl": [
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
"DataSource=[xxxx]",//sqlite
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver
]
},
//【缓存配置】
//缓存列表
"CacheList": [ "Redis", "MemoryCache" ],
//选择缓存
"CacheSelect": "MemoryCache",
//缓存种子数据是否开启
"CacheSeed_Enabled": false,
//【中间件开启】
//Consul是否开启
"Consul_Enabled": false,
//健康检查是否开启
"HealthCheck_Enabled": false,
//跨域开放是否开启
"Cors_Enabled": true,
//Apollo是否开启
"Apollo_Enabled": false,
//RabbitMQ是否开启
"RabbitMQ_Enabled": false,
//Kafka是否开启
"Kafka_Enabled": false,
//ElasticSeach是否开启
"ElasticSeach_Enabled": false,
//短信发送是否开启
"SMS_Enabled": false,
//分布式CAP是否开启
"CAP_Enabled": false,
//分布式CAP面板是否开启
"CAPDashboard_Enabled": false,
//【中间件配置】
//jwt授权内容公钥私钥转移到目录下的pem文件
"JwtAuthorize": {
"Issuer": "cc",
"Audience": "cc",
@@ -44,36 +85,42 @@
"Expiration": 300,
"ReExpiration": 3000
},
//Redis地址配置
"RedisConnOptions": {
"Host": "[xxxx]",
"Host": "[]",
"Prot": 6379,
"DB": 1,
"Password": "[xxxx]"
"Password": "[]"
},
//RabbitMq地址配置
"RabbitConn": {
"HostName": "[xxxx]",
"UserName": "[xxxx]",
"Password": "[xxxx]",
"HostName": "[]",
"UserName": "[]",
"Password": "[]",
"Port": 5672
},
//ElasticSeach地址配置
"ElasticSeachConn": {
"Url": "[xxxx]",
"IndexName": "[xxxx]",
"UserName": "[xxxx]",
"PassWord": "[xxxx]"
"Url": "[]",
"IndexName": "[]",
"UserName": "[]",
"PassWord": "[]."
},
//Kafka地址配置
"KafkaOptions": {
"BrokerList": "[xxxx]",
"TopicName": "[xxxx]"
"BrokerList": "[]:9092",
"TopicName": "kafkalog"
},
//Consul地址配置
"ConsulClientOption": {
"IP": "[xxxx]",
"Port": "[xxxx]",
"Datacenter": "[xxxx]"
"IP": "[]",
"Port": "8500",
"Datacenter": "dc1"
},
//Consul注册本机配置
"ConsulRegisterOption": {
"IP": "[xxxx]",
"Port": "19001",
"IP": "[]",
"Port": "[]",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
@@ -81,11 +128,11 @@
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
//阿里云短信配置
"SMS": {
"ID": "[xxxx]",
"Secret": "[xxxx]",
"Sign": "[xxxx]",
"Template": "[xxxx]"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
"ID": "[]",
"Secret": "[]",
"Sign": "[]",
"Template": "[]"
}
}

View File

@@ -1,97 +0,0 @@
测试测试测试账号密码123456
shLEBG部门管理员拥有全部权限最高权限
xz 星能研究所管理员,能查看星能研究所及以下的所有的权限
cdb星能研究所访客测试除了通用软件框架其他星能研究所下的权限能看可自定义配置
ccb通用软件框架部门个人管理员只能看到自我全权限范围最小
ynb: plc部门管理员只能看plc部门的权限
杨建c语言开发过学生管理系统专业能力比较低不太了解行业未来规划较模糊。和语言绑定只要c和c++就可以,抗压能力大。
张傲学习期间成绩较好大概年纪百分之10在工业界做过相关光伏损伤图形检测。表达思路比较清晰。抗压能力较强参与多项学硕的项目担任学院研究生主席。
第一年根据公司具体的项目,着手锻炼专业技能,第二年根据公司发展,融入公司。
黄炳洁:
在校经历:
在校发表三篇论文在工业界江苏宁阳公司实习进行智能电表通信模块的开发与测试在同事指导下工作。本科成绩前百分之40硕士成绩前百分之50
职业规划:
第一年对公司业务不太熟悉,需要一定的嵌入式知识的学习。认为第一年会有导师来带项目。
工作一年之后,有了经验,第二年绩效考核,进入公司之后刻苦学习。
遇到学习上的困难,可以请教别人有经验的人,相信自己可以克服困难。
问题解答:
表达沟通比较吞吐,总结能力不太强。有一定的自学能力
杨哲:
机械专业面试图像算法
1、在校经历
机械专业图像算法方向。本科成绩排名百分之前30研究生成绩前百分之10。一直在做导师的项目在工业界没有经验。
2、职业规划
第一年熟悉公司算法库的流程,怎么调用,然后从项目的一部分开始熟悉项目的流程,争取独立完成项目的一部分内容
第二年先继续学习算法的内容,争取完成一个项目的经历。
遇到困难,有准备,现在目前只能从加班。
自学能力比较强,完成度比较高。
前期充当学习的角色,后期担当负责人
季建杰:
1、在校经历
做过无人机点源处理成绩比较靠后后百分之50。公司内没有无人机相关不太了解海目星。
对于学习新领域的知识,自学去找比较困难,请教身边的人。从事无人机激光测距专业。
2、职业规划
为什么选择这个岗位:因为其他岗位更不了解,这个岗位稍微好点
对规划挺少的,不太了解未来
只要给的够多,抗压不是问题。
自学能力比较强,在校期间基本是自学。
性格比较开朗,没有很多突出的地方,比较随和
没有说明补充的。
为什么选择这个岗位
目标是什么
来海目星担当什么角色
抗压能力怎么样
自学能力怎么样
相比于其他人你的独特的优势是什么
李志刚
1、在校经历
研究生成绩综合排名前百分之5实习经历没有没有在工控行业的经验。学习过桥梁缺陷检测
2、职业规划
对于应届生做一个长远规划不太现实
前两年主要是学习
相比于理论,更喜欢实践。
碰到不会,以自学为主,最后在找人
为什么选择这个岗位:专业对口,能力比较强
来海目星担当什么角色:刚开始是学习的角度,积累经验
抗压能力怎么样:抗压能力还可以,就业压力,放松心态
自学能力怎么样:自学能力在校期间基本都是靠自己自学,主要靠自己搭建自己知识体系
优势:兴趣,自律,信用
沟通比较清楚,有些紧张

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Abstract
{
public interface ICurrentUser
{
public bool IsAuthenticated { get; set; }
public long Id { get; set; }
public string UserName { get; set; }
public Guid? TenantId { get; set; }
public string Email { get; set; }
public bool EmailVerified { get; set; }
public string PhoneNumber { get; set; }
public bool PhoneNumberVerified { get; set; }
public string[]? Roles { get; set; }
public string[]? Permission { get; set; }
}
}

View File

@@ -19,7 +19,7 @@ namespace Yi.Framework.Common.Attribute
/// <summary>
/// 指定服务类型
/// </summary>
public Type ServiceType { get; set; }
public Type? ServiceType { get; set; }
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Attribute
{
[AttributeUsage(AttributeTargets.Property)]
public class AutowiredAttribute : System.Attribute
{
}
}

View File

@@ -1,4 +1,6 @@
namespace System
using System;
namespace Yi.Framework.Common.Base
{
#region
@@ -71,12 +73,12 @@
/// <summary>
/// 字串的默认无值
/// </summary>
public static readonly string String = String.Empty;
public static readonly string String = string.Empty;
/// <summary>
/// 一般对象的判断
/// </summary>
public const Object Object = null;
public const object Object = null;
}
#endregion
@@ -150,7 +152,7 @@
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否为空(true--真,false--假)</returns>
public static bool IsNull(this String value)
public static bool IsNull(this string value)
{
if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
{
@@ -165,7 +167,7 @@
/// </summary>
/// <param name="value">待判断对象</param>
/// <returns>是否不为空(true--真,false--假)</returns>
public static bool IsNotNull(this String value)
public static bool IsNotNull(this string value)
{
return !value.IsNull();
}

View File

@@ -12,5 +12,8 @@ namespace Yi.Framework.Common.Const
public const string AdminRolesCode = "admin";
public const string AdminPermissionCode = "*:*:*";
public const string PermissionClaim = "permission";
public const string UserName = "userName";
public const string DeptId = "deptId";
public const string TenantId = "tenantId";
}
}

View File

@@ -11,6 +11,7 @@ namespace Yi.Framework.Common.Enum
Excel,
File,
Image,
Thumbnail,
Temp
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Enum
{
public enum StateEnum
{
Normal=0,
Disable=1
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Runtime.Serialization;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
[Serializable]
public class BusinessException : Exception,
IHasErrorCode,
IHasErrorDetails,
IHasLogLevel
{
public ResultCodeEnum Code { get; set; }
public string? Details { get; set; }
public LogLevel LogLevel { get; set; }
public BusinessException(
ResultCodeEnum code = ResultCodeEnum.NotSuccess,
string? message = null,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(message, innerException)
{
Code = code;
Details = details;
LogLevel = logLevel;
}
/// <summary>
/// 序列化参数的构造函数
/// </summary>
public BusinessException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
public BusinessException WithData(string name, object value)
{
Data[name] = value;
return this;
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Runtime.ExceptionServices;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// <see cref="Exception"/>类的扩展方法
/// </summary>
public static class ExceptionExtensions
{
/// <summary>
/// 使用 <see cref="ExceptionDispatchInfo.Capture"/> 再次抛出异常
/// </summary>
/// <param name="exception">Exception to be re-thrown</param>
public static void ReThrow(this Exception exception)
{
ExceptionDispatchInfo.Capture(exception).Throw();
}
/// <summary>
/// 获取异常中的日志等级
/// </summary>
/// <param name="exception"></param>
/// <param name="defaultLevel"></param>
/// <returns></returns>
public static LogLevel GetLogLevel(this Exception exception, LogLevel defaultLevel = LogLevel.Error)
{
return (exception as IHasLogLevel)?.LogLevel ?? defaultLevel;
}
/// <summary>
/// 获取异常中的日志错误码
/// </summary>
/// <param name="exception"></param>
/// <param name="defaultLevel"></param>
/// <returns></returns>
public static ResultCodeEnum GetLogErrorCode(this Exception exception, ResultCodeEnum defaultCode = ResultCodeEnum.NotSuccess)
{
return (exception as IHasErrorCode)?.Code ?? defaultCode;
}
}

View File

@@ -0,0 +1,8 @@
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
public interface IHasErrorCode
{
ResultCodeEnum Code { get; }
}

View File

@@ -0,0 +1,6 @@
namespace Yi.Framework.Common.Exceptions;
public interface IHasErrorDetails
{
string? Details { get; }
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// 定义<see cref="LogLevel"/> 属性的接口
/// </summary>
public interface IHasLogLevel
{
/// <summary>
/// Log severity.
/// </summary>
LogLevel LogLevel { get; set; }
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Runtime.Serialization;
using Microsoft.Extensions.Logging;
using Yi.Framework.Common.Enum;
namespace Yi.Framework.Common.Exceptions;
/// <summary>
/// 用户友好异常
/// </summary>
[Serializable]
public class UserFriendlyException : BusinessException
{
public UserFriendlyException(
string message,
ResultCodeEnum code = ResultCodeEnum.NotSuccess,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(
code,
message,
details,
innerException,
logLevel)
{
Details = details;
}
/// <summary>
/// 序列化参数的构造函数
/// </summary>
public UserFriendlyException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
}

View File

@@ -1,4 +1,6 @@
using System;
using AutoMapper;
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -9,14 +11,32 @@ namespace Yi.Framework.Common.Helper
{
public class AssemblyHelper
{
public static List<Type> GetClass(string assemblyFile, string className = null, string spaceName=null)
public static List<Type> GetClass(string assemblyFile, string? className = null, string? spaceName = null)
{
Assembly assembly = Assembly.Load(assemblyFile);
return assembly.GetTypes().Where(m => m.IsClass
&& className == null?true:m.Name==className
&& spaceName == null ? true :m.Namespace == spaceName
return assembly.GetTypes().Where(m => m.IsClass
&& className == null ? true : m.Name == className
&& spaceName == null ? true : m.Namespace == spaceName
).ToList();
}
public static List<Type> GetClassByBaseClassesAndInterfaces(string assemblyFile, Type type)
{
Assembly assembly = Assembly.Load(assemblyFile);
List<Type> resList = new List<Type>();
List<Type> typeList = assembly.GetTypes().Where(m => m.IsClass).ToList();
foreach (var t in typeList)
{
var data = t.BaseClassesAndInterfaces();
if (data.Contains(type))
{
resList.Add(t);
}
}
return resList;
}
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -13,13 +14,14 @@ namespace Yi.Framework.Common.Helper
{
this._getField = getfield;
}
public bool Equals(T x, T y)
public bool Equals(T? x, T? y)
{
return EqualityComparer<C>.Default.Equals(_getField(x), _getField(y));
return EqualityComparer<C>.Default.Equals(_getField(x!), _getField(y!));
}
public int GetHashCode(T obj)
{
return EqualityComparer<C>.Default.GetHashCode(this._getField(obj));
return EqualityComparer<C>.Default.GetHashCode(this._getField(obj)!);
}
}
public static class DistinctHelper

View File

@@ -9,10 +9,10 @@ namespace Yi.Framework.Common.Helper
{
public class EmailHelper
{
public static string fromMail { get; set; }
public static string pwdMail { get; set; }
public static string senderMail { get; set; }
public static string subjectMail { get; set; }
public static string fromMail { get; set; } = string.Empty;
public static string pwdMail { get; set; } = string.Empty;
public static string senderMail { get; set; } = string.Empty;
public static string subjectMail { get; set; } = string.Empty;
public static void Init(string fromMail,string pwdMail,string senderMail, string subjectMail)
{
EmailHelper.fromMail = fromMail;

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@@ -10,6 +11,8 @@ namespace Yi.Framework.Common.Helper
private bool _alreadyDispose = false;
#region
public FileHelper()
{
@@ -391,5 +394,97 @@ namespace Yi.Framework.Common.Helper
}
}
#endregion
/// <summary>
/// 获取目录下全部文件名
/// </summary>
/// <param name="path"></param>
/// <param name="pattern"></param>
/// <returns></returns>
public static List<string> GetAllFileNames(string path, string pattern = "*")
{
List<FileInfo> folder = new DirectoryInfo(path).GetFiles(pattern).ToList();
return folder.Select(x => x.Name).ToList();
}
/// <summary>
/// 文件内容替换
/// </summary>
public static string FileContentReplace(string path, string oldStr, string newStr)
{
var content = File.ReadAllText(path);
if (content.Contains(oldStr))
{
File.Delete(path);
File.WriteAllText(path, content.Replace(oldStr, newStr));
}
return path;
}
/// <summary>
/// 文件名称
/// </summary>
public static string FileNameReplace(string path, string oldStr, string newStr)
{
string fileName = Path.GetFileName(path);
if (!fileName.Contains(oldStr))
{
return path;
}
string? directoryName = Path.GetDirectoryName(path);
string newFileName = fileName.Replace(oldStr, newStr);
string newPath = Path.Combine(directoryName ?? "", newFileName);
File.Move(path, newPath);
return newPath;
}
/// <summary>
/// 目录名替换
/// </summary>
public static string DirectoryNameReplace(string path, string oldStr, string newStr)
{
string fileName = Path.GetFileName(path);
if (!fileName.Contains(oldStr))
{
return path;
}
string? directoryName = Path.GetDirectoryName(path);
string newFileName = fileName.Replace(oldStr, newStr);
string newPath = Path.Combine(directoryName ?? "", newFileName);
Directory.Move(path, newPath);
return newPath;
}
/// <summary>
/// 全部信息递归替换
/// </summary>
/// <param name="dirPath"></param>
/// <param name="oldStr"></param>
/// <param name="newStr"></param>
public static void AllInfoReplace(string dirPath, string oldStr, string newStr)
{
var path = DirectoryNameReplace(dirPath, oldStr, newStr);
var dirInfo = new DirectoryInfo(path);
var files = dirInfo.GetFiles();
var dirs = dirInfo.GetDirectories();
if (files.Length > 0)
{
foreach (var f in files)
{
FileContentReplace(f.FullName, oldStr, newStr);
FileNameReplace(f.FullName, oldStr, newStr);
}
}
if (dirs.Length > 0)
{
foreach (var d in dirs)
{
AllInfoReplace(d.FullName, oldStr, newStr);
}
}
}
}
}

View File

@@ -28,7 +28,7 @@ namespace Yi.Framework.Common.Helper
}
public static async Task<string> Post(string url, object item = null, Dictionary<string, string> head = null)
public static async Task<string> Post(string url, object? item = null, Dictionary<string, string>? head = null)
{
using StringContent json = new(JsonSerializer.Serialize(item), Encoding.UTF8, MediaTypeNames.Application.Json);

View File

@@ -24,6 +24,11 @@ namespace Yi.Framework.Common.Helper
// 获取所有可用网卡IP信息
var ipCollection = nics?.Select(x => x.GetIPProperties())?.SelectMany(x => x.UnicastAddresses);
if (ipCollection is null)
{
return instanceIp;
}
foreach (var ipadd in ipCollection)
{
if (!IPAddress.IsLoopback(ipadd.Address) && ipadd.Address.AddressFamily == AddressFamily.InterNetwork)

View File

@@ -15,7 +15,7 @@ namespace Yi.Framework.Common.Helper
public static T StrToObj<T>(string str)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str);
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str)!;
}
/// <summary>
/// 转换对象为JSON格式数据
@@ -85,7 +85,7 @@ namespace Yi.Framework.Common.Helper
{
System.Runtime.Serialization.Json.DataContractJsonSerializer serializer =
new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T));
return (T)serializer.ReadObject(ms);
return (T)serializer.ReadObject(ms)!;
}
}

View File

@@ -35,7 +35,7 @@ namespace Yi.Framework.Common.Helper
byte[] bIn = Encoding.Unicode.GetBytes(pass);
byte[] bSalt = Convert.FromBase64String(salt);
byte[] bAll = new byte[bSalt.Length + bIn.Length];
byte[] bRet = null;
byte[]? bRet = null;
Buffer.BlockCopy(bSalt, 0, bAll, 0, bSalt.Length);
Buffer.BlockCopy(bIn, 0, bAll, bSalt.Length, bIn.Length);

View File

@@ -22,15 +22,15 @@ namespace Yi.Framework.Common.Helper
public static string GetMimeMapping(string FileName)
{
string text = null;
string text = null!;
int num = FileName.LastIndexOf('.');
if (0 < num && num > FileName.LastIndexOf('\\'))
{
text = (string)MimeHelper._mimeMappingTable[FileName.Substring(num)];
text = (string)MimeHelper._mimeMappingTable[FileName.Substring(num)]!;
}
if (text == null)
{
text = (string)MimeHelper._mimeMappingTable[".*"];
text = (string)MimeHelper._mimeMappingTable[".*"]!;
}
return text;
}

View File

@@ -11,8 +11,8 @@ namespace Yi.Framework.Common.Helper
/// </summary>
public class RSAHelper
{
public readonly RSA _privateKeyRsaProvider;
public readonly RSA _publicKeyRsaProvider;
public readonly RSA? _privateKeyRsaProvider;
public readonly RSA? _publicKeyRsaProvider;
private readonly HashAlgorithmName _hashAlgorithmName;
private readonly Encoding _encoding;
@@ -23,7 +23,7 @@ namespace Yi.Framework.Common.Helper
/// <param name="encoding">编码类型</param>
/// <param name="privateKey">私钥</param>
/// <param name="publicKey">公钥</param>
public RSAHelper(RSAType rsaType, Encoding encoding, string privateKey, string publicKey = null)
public RSAHelper(RSAType rsaType, Encoding encoding, string privateKey, string? publicKey = null)
{
_encoding = encoding;
if (!string.IsNullOrEmpty(privateKey))
@@ -50,7 +50,7 @@ namespace Yi.Framework.Common.Helper
{
byte[] dataBytes = _encoding.GetBytes(data);
var signatureBytes = _privateKeyRsaProvider.SignData(dataBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
var signatureBytes = _privateKeyRsaProvider!.SignData(dataBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
return Convert.ToBase64String(signatureBytes);
}
@@ -70,7 +70,7 @@ namespace Yi.Framework.Common.Helper
byte[] dataBytes = _encoding.GetBytes(data);
byte[] signBytes = Convert.FromBase64String(sign);
var verify = _publicKeyRsaProvider.VerifyData(dataBytes, signBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
var verify = _publicKeyRsaProvider!.VerifyData(dataBytes, signBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
return verify;
}
@@ -225,7 +225,7 @@ namespace Yi.Framework.Common.Helper
/// </summary>
/// <param name="publicKeyString"></param>
/// <returns></returns>
public RSA CreateRsaProviderFromPublicKey(string publicKeyString)
public RSA? CreateRsaProviderFromPublicKey(string publicKeyString)
{
// encoded OID sequence for PKCS #1 rsaEncryption szOID_RSA_RSA = "1.2.840.113549.1.1.1"
byte[] seqOid = { 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 };

View File

@@ -22,7 +22,7 @@ namespace Yi.Framework.Common.Helper
/// <typeparam name="TEntity"></typeparam>
/// <param name="value"></param>
/// <returns></returns>
public static TEntity Deserialize<TEntity>(byte[] value)
public static TEntity? Deserialize<TEntity>(byte[] value)
{
if (value == null)
{

View File

@@ -50,7 +50,7 @@ namespace Yi.Framework.Common.Helper
{
StringBuilder sb = new StringBuilder();
string urlPars = null;
string? urlPars = null;
bool isEnter = false;
foreach (var item in dic)
{
@@ -69,7 +69,7 @@ namespace Yi.Framework.Common.Helper
{
StringBuilder sb = new StringBuilder();
string urlPars = null;
string? urlPars = null;
bool isEnter = false;
foreach (var item in dic)
{

View File

@@ -9,50 +9,50 @@ namespace Yi.Framework.Common.Helper
{
public static class TreeHelper
{
public static List<T> SetTree<T>(List<T> list, Action<T> action = null)
public static List<T> SetTree<T>(List<T> list, Action<T> action = null!)
{
if (list != null && list.Count > 0)
if (list is not null && list.Count > 0)
{
IList<T> result = new List<T>();
long pid = list.Min(m => (m as ITreeModel<T>).ParentId);
IList<T> t = list.Where(m => (m as ITreeModel<T>).ParentId == pid).ToList();
long pid = list.Min(m => (m as ITreeModel<T>)!.ParentId);
IList<T> t = list.Where(m => (m as ITreeModel<T>)!.ParentId == pid).ToList();
foreach (T model in t)
{
if (action != null)
if (action is not null)
{
action(model);
}
result.Add(model);
var item = (model as ITreeModel<T>);
IList<T> children = list.Where(m => (m as ITreeModel<T>).ParentId == item.Id).ToList();
IList<T> children = list.Where(m => (m as ITreeModel<T>)!.ParentId == item!.Id).ToList();
if (children.Count > 0)
{
SetTreeChildren(list, children, model, action);
SetTreeChildren(list, children, model, action!);
}
}
return result.OrderBy(m => (m as ITreeModel<T>).OrderNum).ToList();
return result.OrderByDescending(m => (m as ITreeModel<T>)!.OrderNum).ToList();
}
return null;
return null!;
}
private static void SetTreeChildren<T>(IList<T> list, IList<T> children, T model, Action<T> action = null)
private static void SetTreeChildren<T>(IList<T> list, IList<T> children, T model, Action<T> action = null!)
{
var mm = (model as ITreeModel<T>);
mm.Children = new List<T>();
mm!.Children = new List<T>();
foreach (T item in children)
{
if (action != null)
if (action is not null)
{
action(item);
}
mm.Children.Add(item);
var _item = (item as ITreeModel<T>);
IList<T> _children = list.Where(m => (m as ITreeModel<T>).ParentId == _item.Id).ToList();
IList<T> _children = list.Where(m => (m as ITreeModel<T>)!.ParentId == _item!.Id).ToList();
if (_children.Count > 0)
{
SetTreeChildren(list, _children, item, action);
SetTreeChildren(list, _children, item, action!);
}
}
mm.Children = mm.Children.OrderBy(m => (m as ITreeModel<T>).OrderNum).ToList();
mm.Children = mm.Children.OrderByDescending(m => (m as ITreeModel<T>)!.OrderNum).ToList();
}
}
}

View File

@@ -13,7 +13,7 @@ namespace Yi.Framework.Common.Helper
/// <typeparam name="T">类</typeparam>
/// <param name="obj">对象</param>
/// <returns>字符格式的JSON数据</returns>
public static string GetXML<T>(object obj)
public static string? GetXML<T>(object obj)
{
try
{
@@ -42,7 +42,7 @@ namespace Yi.Framework.Common.Helper
XmlSerializer serializer = new XmlSerializer(typeof(T), new XmlRootAttribute(rootName));
StringReader reader = new StringReader(xml);
T res = (T)serializer.Deserialize(reader);
T res = (T)serializer.Deserialize(reader)!;
reader.Close();
reader.Dispose();
return res;

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Models
{
public static class GobalModel
{
public static bool SqlLogEnable { get; set; } = true;
public static bool LoginCodeEnable { get; set; } = true;
}
}

View File

@@ -12,6 +12,6 @@ namespace Yi.Framework.Common.Models
public long ParentId { get; set; }
public int OrderNum { get; set; }
public List<T> Children { get; set; }
public List<T>? Children { get; set; }
}
}

View File

@@ -11,8 +11,8 @@ namespace Yi.Framework.Common.Models
/// </summary>
public class LogModel
{
public string OriginalClassName { get; set; }
public string OriginalMethodName { get; set; }
public string Remark { get; set; }
public string OriginalClassName { get; set; } = string.Empty;
public string OriginalMethodName { get; set; } = string.Empty;
public string? Remark { get; set; }
}
}

View File

@@ -16,7 +16,7 @@ namespace Yi.Framework.Common.Models
Total = total;
}
public int Total { get; set; }
public T Data { get; set; }
public T Data { get; set; } = default(T)!;
}
public class PageModel : PageModel<object>

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