kulley 6 жил өмнө
parent
commit
f360fc6cce

+ 3 - 3
src/app/basicVersion/caseShow/UserCustom.js

@@ -6,7 +6,7 @@ import {CloudConfig} from "../../../login/CloudConfig";
 import {Layout, Button, message, Modal, Icon, Steps, Row, Col, Radio, Input} from 'antd';
 import {FormattedMessage} from 'react-intl';
 import {request} from 'graphql-request'
-import {idGen} from "../../../func";
+import {idGen, convert_} from "../../../func";
 import axios from 'axios';
 import './index.css';
 
@@ -400,7 +400,7 @@ class NameAndDB extends Component {
             });
 
             let now = new Date().getTime(),
-                functionName = userID + '_' + customName,
+                functionName = convert_(userID + '_' + customName),
                 serviceName = userID + '_' + customName,
                 resources = [`${bucketName}/schema.edn`, `${bucketName}/resolve-map.edn`, `${bucketName}/${dbKind}/${userID}/deploy-conf.edn`, `${bucketName}/html/index.html`, `${bucketName}/wx-config.edn`];
 
@@ -964,7 +964,7 @@ class WechatDeploy extends Component {
                             this.setState({
                                 deployButton: false
                             })
-                            let functionName = customName,
+                            let functionName = convert_(customName),
                                 resources = [`${bucketName}/schema.edn`, `${bucketName}/resolve-map.edn`, `${bucketName}/${dbKind}/${userID}/deploy-conf.edn`, `${bucketName}/html/index.html`, `${bucketName}/wx-config.edn`];
 
                             if (dbKind === 'mongodb') {

+ 5 - 1
src/func.js

@@ -21,5 +21,9 @@ const pushPostfix = (postfix, value) => {
     return  value + postfix;
 };
 
+const convert_ = (value) => {
+    return value.replace(/-/g, '_');
+}
 
-export {shiftPrefix, removePrefix, removeSpace, idGen, pushPostfix}
+
+export {shiftPrefix, removePrefix, removeSpace, idGen, pushPostfix, convert_}