message.ts 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. import { Request, Response } from 'express';
  2. /**
  3. * @author bianlanzhou
  4. * @since 2024-11-06
  5. * @desc 消息中心mock
  6. */
  7. /** 等待时间 */
  8. const waitTime = (time: number = 100) => {
  9. return new Promise((resolve) => {
  10. setTimeout(() => {
  11. resolve(true);
  12. }, time);
  13. });
  14. };
  15. /** 分页查询短信签名响应数据 */
  16. const pageQuerySmsSignRespData = {
  17. "success": true,
  18. "errCode": null,
  19. "errMessage": null,
  20. "total": 1,
  21. "pageSize": 10,
  22. "pageIndex": 1,
  23. "data": [
  24. {
  25. "id": 1,
  26. "signatureName": "惠融数科签名",
  27. "signatureContent": "惠融数科",
  28. "createUsername": "刘涛",
  29. "modifyUsername": "张元英",
  30. "gmtCreate": "2024-10-21 09:33:51",
  31. "gmtModify": "2024-10-21 09:33:51",
  32. "status": "draft"
  33. }
  34. ],
  35. "totalPages": 1,
  36. "notEmpty": true,
  37. "empty": false
  38. }
  39. /** 分页查询短信签名响应数据 */
  40. const querySmsSignRespData = {
  41. "success": true,
  42. "errCode": null,
  43. "errMessage": null,
  44. "data": [
  45. {
  46. "id": 1,
  47. "signatureName": "惠融数科签名",
  48. "signatureContent": "惠融数科",
  49. "createUsername": "刘涛",
  50. "modifyUsername": "张元英",
  51. "gmtCreate": "2024-10-21 09:33:51",
  52. "gmtModify": "2024-10-21 09:33:51",
  53. "status": "draft"
  54. }
  55. ],
  56. "notEmpty": true,
  57. "empty": false
  58. }
  59. /** 分页查询短信模版响应数据 */
  60. const pageQuerySmsTemplateRespData = {
  61. "success": true,
  62. "errCode": null,
  63. "errMessage": null,
  64. "total": 1,
  65. "pageSize": 10,
  66. "pageIndex": 1,
  67. "data": [
  68. {
  69. "id": 1,
  70. "templateName": "惠融数科模版",
  71. "templateContent": "尊敬的xxx,您的手机号${phone}已经欠费,哈哈哈哈.",
  72. "createUsername": "刘涛",
  73. "modifyUsername": "张元英",
  74. "gmtCreate": "2024-10-21 09:33:51",
  75. "gmtModify": "2024-10-21 09:33:51",
  76. "status": "draft"
  77. }
  78. ],
  79. "totalPages": 1,
  80. "notEmpty": true,
  81. "empty": false
  82. }
  83. /** 查询短信模版响应数据 */
  84. const querySmsTemplateRespData = {
  85. "success": true,
  86. "errCode": null,
  87. "errMessage": null,
  88. "data": [
  89. {
  90. "id": 1,
  91. "templateName": "惠融数科模版",
  92. "templateContent": "尊敬的xxx,您的手机号${phone}已经欠费,哈哈哈哈.",
  93. "createUsername": "刘涛",
  94. "modifyUsername": "张元英",
  95. "gmtCreate": "2024-10-21 09:33:51",
  96. "gmtModify": "2024-10-21 09:33:51",
  97. "status": "draft"
  98. }
  99. ],
  100. "notEmpty": true,
  101. "empty": false
  102. }
  103. /** 分页查询短信服务响应数据 */
  104. const pageQuerySmsServiceRespData = {
  105. "success": true,
  106. "errCode": null,
  107. "errMessage": null,
  108. "total": 1,
  109. "pageSize": 10,
  110. "pageIndex": 1,
  111. "data": [
  112. {
  113. "id": 1,
  114. "serviceName": "促申请短信",
  115. "serviceCode": "apply-sms",
  116. "createUsername": "刘涛",
  117. "modifyUsername": "张元英",
  118. "gmtCreate": "2024-10-21 09:33:51",
  119. "gmtModify": "2024-10-21 09:33:51",
  120. "status": "draft"
  121. }
  122. ],
  123. "totalPages": 1,
  124. "notEmpty": true,
  125. "empty": false
  126. }
  127. /** 分页查询短信平台响应数据 */
  128. const pageQuerySmsPlatformRespData = {
  129. "success": true,
  130. "errCode": null,
  131. "errMessage": null,
  132. "total": 1,
  133. "pageSize": 10,
  134. "pageIndex": 1,
  135. "data": [
  136. {
  137. "id": 1,
  138. "platformName": "红树短信平台",
  139. "createUsername": "刘涛",
  140. "modifyUsername": "张元英",
  141. "gmtCreate": "2024-10-21 09:33:51",
  142. "gmtModify": "2024-10-21 09:33:51",
  143. "status": "draft"
  144. }
  145. ],
  146. "totalPages": 1,
  147. "notEmpty": true,
  148. "empty": false
  149. }
  150. /** 查询短信平台响应数据 */
  151. const querySmsPlatformRespData = {
  152. "success": true,
  153. "errCode": null,
  154. "errMessage": null,
  155. "data": [
  156. {
  157. "id": 1,
  158. "platformName": "红树短信平台",
  159. "createUsername": "刘涛",
  160. "modifyUsername": "张元英",
  161. "gmtCreate": "2024-10-21 09:33:51",
  162. "gmtModify": "2024-10-21 09:33:51",
  163. "status": "draft"
  164. }
  165. ],
  166. "notEmpty": true,
  167. "empty": false
  168. }
  169. /** 分页查询短信通道响应数据 */
  170. const pageQuerySmsChannelRespData = {
  171. "success": true,
  172. "errCode": null,
  173. "errMessage": null,
  174. "total": 1,
  175. "pageSize": 10,
  176. "pageIndex": 1,
  177. "data": [
  178. {
  179. "id": 1,
  180. "channelName": "红树短信平台-营销通道",
  181. "createUsername": "刘涛",
  182. "modifyUsername": "张元英",
  183. "gmtCreate": "2024-10-21 09:33:51",
  184. "gmtModify": "2024-10-21 09:33:51",
  185. "status": "draft"
  186. }
  187. ],
  188. "totalPages": 1,
  189. "notEmpty": true,
  190. "empty": false
  191. }
  192. /** 查询短信通道响应数据 */
  193. const querySmsChannelRespData = {
  194. "success": true,
  195. "errCode": null,
  196. "errMessage": null,
  197. "data": [
  198. {
  199. "id": 1,
  200. "channelName": "红树短信平台-营销通道",
  201. "createUsername": "刘涛",
  202. "modifyUsername": "张元英",
  203. "gmtCreate": "2024-10-21 09:33:51",
  204. "gmtModify": "2024-10-21 09:33:51",
  205. "status": "draft"
  206. }
  207. ],
  208. "notEmpty": true,
  209. "empty": false
  210. }
  211. /** 更新/插入短信签名响应数据 */
  212. const upsertSmsSignRespData = {
  213. "success": true,
  214. "errCode": null,
  215. "errMessage": null,
  216. "data": 1848565642249170945
  217. }
  218. /** 更新/插入短信模版响应数据 */
  219. const upsertSmsTemplateRespData = {
  220. "success": true,
  221. "errCode": null,
  222. "errMessage": null,
  223. "data": 1848565642249170945
  224. }
  225. /** 更新/插入短信平台响应数据 */
  226. const upsertSmsPlatformRespData = {
  227. "success": true,
  228. "errCode": null,
  229. "errMessage": null,
  230. "data": 1848565642249170945
  231. }
  232. /** 更新/插入短信通道响应数据 */
  233. const upsertSmsChannelRespData = {
  234. "success": true,
  235. "errCode": null,
  236. "errMessage": null,
  237. "data": 1848565642249170945
  238. }
  239. /** 分页查询短信签名 */
  240. const pageQuerySmsSign = async (req: Request, res: Response) => {
  241. await waitTime(2000);
  242. res.json(pageQuerySmsSignRespData);
  243. }
  244. /** 查询短信签名 */
  245. const querySmsSign = async (req: Request, res: Response) => {
  246. await waitTime(2000);
  247. res.json(querySmsSignRespData);
  248. }
  249. /** 更新/插入短信签名 */
  250. const upsertSmsSign = async (req: Request, res: Response) => {
  251. await waitTime(2000);
  252. res.json(upsertSmsSignRespData);
  253. }
  254. /** 分页查询短信模版 */
  255. const pageQuerySmsTemplate = async (req: Request, res: Response) => {
  256. await waitTime(2000);
  257. res.json(pageQuerySmsTemplateRespData);
  258. }
  259. /** 分页查询短信模版 */
  260. const querySmsTemplate = async (req: Request, res: Response) => {
  261. await waitTime(2000);
  262. res.json(querySmsTemplateRespData);
  263. }
  264. /** 更新/插入短信模版 */
  265. const upsertSmsTemplate = async (req: Request, res: Response) => {
  266. await waitTime(2000);
  267. res.json(upsertSmsTemplateRespData);
  268. }
  269. /** 分页查询短信服务 */
  270. const pageQuerySmsService = async (req: Request, res: Response) => {
  271. await waitTime(2000);
  272. res.json(pageQuerySmsServiceRespData);
  273. }
  274. /** 分页查询短信平台 */
  275. const pageQuerySmsPlatform = async (req: Request, res: Response) => {
  276. await waitTime(2000);
  277. res.json(pageQuerySmsPlatformRespData);
  278. }
  279. /** 查询短信平台 */
  280. const querySmsPlatform = async (req: Request, res: Response) => {
  281. await waitTime(2000);
  282. res.json(querySmsPlatformRespData);
  283. }
  284. /** 更新/插入短信模版 */
  285. const upsertSmsPlatform = async (req: Request, res: Response) => {
  286. await waitTime(2000);
  287. res.json(upsertSmsPlatformRespData);
  288. }
  289. /** 分页查询短信通道 */
  290. const pageQuerySmsChannel = async (req: Request, res: Response) => {
  291. await waitTime(2000);
  292. res.json(pageQuerySmsChannelRespData);
  293. }
  294. /** 查询短信通道 */
  295. const querySmsChannel = async (req: Request, res: Response) => {
  296. await waitTime(2000);
  297. res.json(querySmsChannelRespData);
  298. }
  299. /** 更新/插入短信通道 */
  300. const upsertSmsChannel = async (req: Request, res: Response) => {
  301. await waitTime(2000);
  302. res.json(upsertSmsChannelRespData);
  303. }
  304. export default {
  305. 'GET /sms/sign/page': pageQuerySmsSign,
  306. 'GET /sms/sign/list': querySmsSign,
  307. 'POST /sms/sign/upsert': upsertSmsSign,
  308. 'GET /sms/template/page': pageQuerySmsTemplate,
  309. 'GET /sms/template/list': querySmsTemplate,
  310. 'POST /sms/template/upsert': upsertSmsTemplate,
  311. 'GET /sms/service/page': pageQuerySmsService,
  312. 'GET /sms/platform/page': pageQuerySmsPlatform,
  313. 'GET /sms/platform/list': querySmsPlatform,
  314. 'POST /sms/platform/upsert': upsertSmsPlatform,
  315. 'GET /sms/channel/page': pageQuerySmsChannel,
  316. 'GET /sms/channel/list': querySmsChannel,
  317. 'POST /sms/channel/upsert': upsertSmsChannel,
  318. };