惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - thanks

07-紧固件MES系统 — 中小企业实施部署指南 06-紧固件MES系统 — 术语与名词解析 05-紧固件MES系统 — 推荐技术架构与智能制造方案 03-紧固件MES系统 — 模块业务详解 04-紧固件MES系统 — 重构建议与待开发分析 01-紧固件MES系统 — 系统总览与架构 02-紧固件MES系统 — 核心业务流程 VsCode+DeepSeek的AI编程助手初体验 [大数据][机器学习]之Model Card(模型卡片)介绍 Bond——大数据时代的数据交换和存储格式 Spark中的那些坑... 为啥就业这么难——聊聊我在培训机构的所见所闻 微软外服工作札记③——窗口函数的介绍 微软外服工作札记②——聊聊微软的知识管理服务平台和一些编程风格 【非技术】试占12月10日后会发生什么 聊聊我在微软外服大数据分析部门的工作经历及一些个人见解 SAAS云平台搭建札记: (四) AntD For React使用react-router-dom路由接收不同参数页面不刷新的问题 [工作札记]03: 微软Winform窗体中设计上的Bug,会导致程序编译失败,影响范围:到最新的.net4.7.2都有 [工作札记]02: .Net Winform控件TreeView最简递归绑定方法 SAAS云平台搭建札记: (三) AntDesign + .Net Core WebAPI权限控制、动态菜单的生成 [工作札记]01: CS系统中分页控件的制作 【非技术】试占新型肺炎的情况与发展趋势 给培训学校讲解ORM框架的课件 SAAS云平台搭建札记: (二) Linux Ubutu下.Net Core整套运行环境的搭建 开源三维地球GIS引擎Cesium常用功能的开发 Asp.net管理信息系统中数据统计功能的实现 - thanks
SAAS云平台搭建札记: (一) 浅论SAAS多租户自助云服务平台的产品、服务和订单
thanks · 2019-03-29 · via 博客园 - thanks

    最近在做一个多租户的云SAAS软件自助服务平台,途中遇到很多问题,我会将一些心得、体会逐渐分享出来,和大家一起探讨。这是本系列的第一篇文章。

    大家知道,要做一个全自助服务的SAAS云平台是比较复杂的,稍微有些漏洞,就会被不法分子钻漏洞,牵涉到一些金钱上的纠纷。因此,一开始的设计就比较重要了。说到云自助服务平台,可能和网上购物、在线商城有些类似,但里面提供的是相关服务,还是有些区别的,我在这里先讲几个概念:

  • 产品:产品即服务,即是提供给用户的服务。产品有单价,有些产品是基础产品,用户购买正式产品必须免费提供的,产品可以提供给用户进行试用。
  • 模块:产品包括很多模块,有些模块是必然会提供给用户的,比如 操作人员管理、操作日志 等,还有些模块是可选的,用户针对自己的情况进行购买,类似增值服务,比如移动端、企业主页等。另外还有些一次性的服务,比如系统数据对接硬件设备购买等;
  • 服务:用户所能享受到的服务,有一定的使用期限;
  • 订单:用户根据所拥有的 服务 所下的订单(而不是产品哦,为什么?);
  • 购物车:在用户订单生成前先把产品放在购物车里,购物车有很多类别,有的购物车是对目前服务进行的延期,有些是把试用的产品转为正式,有些是对现有服务模块的增删,牵涉到追加购买等。购物车操作频繁、需要做非常多的校验,要和已经购买的服务做无缝的对接,这也是云SAAS产品和普通电商很大不同的地方。到了订单阶段,就相对比较简单了,生成订单后将购物车清空、可以生成多张订单,支付的时候再做一遍校验。

     总体的概念流程是 服务->产品->购物车->订单->服务

    上一张购物车验证规则的流程图

    一些类(还没有全部完成):

    对实体类的操作大都采用工厂方式:

    购物车类代码:

 1     public class UserCart
 2     {
 3         public string UserId { get; set; }
 4         /// <summary>
 5         /// 设置域名
 6         /// </summary>
 7         public string ServiceIndentify { get; set; }
 8         public OrderType OrderType { get; set; }
 9         public IList<UserCartProduct> UserCartProducts { get; set; }
10         public float TotalPrice
11         {
12             get
13             {
14                 if (OrderType == OrderType.Experience)
15                 {
16                     return 0;
17                 }
18                 else
19                 {
20                     return UserCartProducts.Sum(p => p.Price);
21                 }
22             }
23         }
24         public virtual IList<UserCartProduct> UserCartProduct { get; set; }
25     }
26 
27     public class UserCartProduct
28     {
29         public string ProductId { get; set; }
30         public int ProductBasePrice { get; set; }
31         public Period Period { get; set; }
32         public DateTime StartDate { get; set; }
33         public DateTime EndDate { get; set; }
34         public IList<string> UserCartProductBasicModules { get; set; }
35         public IList<UserCartAddtionalModule> UserCartProductAddtionalModules { get; set; }
36         public IList<UserCartAddtionalService> UserCartAddtionalServices { get; set; }
37         public IList<UserCartOption> UserCartOptions { get; set; }
38         public float Price
39         {
40             get
41             {
42                 return ProductBasePrice
43                     + UserCartProductAddtionalModules.Sum(m => m.UintPrice.GetPriceByPeriod(Period))
44                     + UserCartAddtionalServices.Sum(m => m.UintPrice.GetPriceByPeriod(new Period(PeriodType.Times, m.Quantity)))
45                     + UserCartOptions.Sum(m => m.UintPrice.GetPriceByPeriod(Period));
46             }
47         }
48         public virtual UserCart UserCart { get; set; }
49     }
50 
51     public class ModuleBase
52     {
53         public string ModuleId { get; set; }
54         
55         public PeriodPrice UintPrice { get; set; }
56 
57     }
58 
59     public class UserCartAddtionalModule: ModuleBase
60     {
61     }
62 
63     public class UserCartAddtionalService : ModuleBase
64     {
65         public int Quantity { get; set; }
66     }
67 
68     public class UserCartOption: ModuleBase
69     {
70         public string CheckId { get; set; }
71         public string OriginCheckedId { get; set; }
72         public PeriodPrice OriginPeriodPrice { get; set; }
73     }

View Code

    其他类类似。

    大家对这块有什么好的意见和建议,希望能够提出来。

    SAAS云平台搭建札记系列文章:

    SAAS云平台搭建札记: (一)浅论SAAS多租户自助云服务平台的产品、服务和订单

    SAAS云平台搭建札记: (二)Linux Unbutu下.Net Core整套运行环境的搭建

    SAAS云平台搭建札记: (三) AntDesign + .Net Core WebAPI权限控制、动态菜单的生成

    SAAS云平台搭建札记: (四) AntD For React使用react-router-dom路由接收不同参数页面不刷新的问题