From 3b121f2c78b187fd2e58fcad44d604798fa1eaad Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 24 六月 2024 11:19:30 +0800 Subject: [PATCH] 2024-06-24 --- src/setupProxy.js | 6 --- src/api/index.js | 35 ++++++----------- src/templates/zshare/verifycard/baseform/index.jsx | 38 ++++++------------ src/tabviews/zshare/actionList/normalbutton/index.jsx | 25 +++++++----- 4 files changed, 41 insertions(+), 63 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 50f5937..d700941 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -101,14 +101,7 @@ * @description 寰俊涓氬姟璇锋眰 鍘熸帴鍙� 'wxpay/getaccesstoken' */ wxAccessToken (domain = '') { - let _url = domain || window.GLOB.baseurl - - if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') - } + let _url = domain || window.GLOB.baseurl return new Promise(resolve => { if (window.GLOB.accessToken.domain === domain && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { @@ -116,15 +109,13 @@ } else { window.GLOB.accessToken = {domain} axios({ - url: _url + 'wechat/jsapi/getaccesstoken', + url: _url + 'wechat/getaccesstoken', method: 'post', - headers: { 'Content-Type': 'application/json' }, - data: JSON.stringify({appId: 'wx4d8a34c8d4494872'}) + data: JSON.stringify({app_id: domain === '' ? window.GLOB.WXAppID : 'wx4d8a34c8d4494872'}) }).then(res => { - if (res.oa_access_token) { + if (res.access_token) { window.GLOB.accessToken.accessTime = parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.oa_access_token = res.oa_access_token - // window.GLOB.accessToken.mini_access_token = res.mini_access_token + window.GLOB.accessToken.access_token = res.access_token } resolve(res) }) @@ -145,10 +136,10 @@ _url = document.location.origin + '/' + url } if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') + _url = _url.replace('http://qingqiumarket.cn/', 'http://qingqiumarket.cn:8080/') + _url = _url.replace('http://cloud.mk9h.cn/', 'http://cloud.mk9h.cn:8080/') + _url = _url.replace('https://qingqiumarket.cn/', 'https://qingqiumarket.cn:8443/') + _url = _url.replace('https://cloud.mk9h.cn/', 'https://cloud.mk9h.cn:8443/') } } @@ -1031,10 +1022,10 @@ _url = document.location.origin + '/file/oss/upload' } if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') + _url = _url.replace('http://qingqiumarket.cn/', 'http://qingqiumarket.cn:8080/') + _url = _url.replace('http://cloud.mk9h.cn/', 'http://cloud.mk9h.cn:8080/') + _url = _url.replace('https://qingqiumarket.cn/', 'https://qingqiumarket.cn:8443/') + _url = _url.replace('https://cloud.mk9h.cn/', 'https://cloud.mk9h.cn:8443/') } return axios({ diff --git a/src/setupProxy.js b/src/setupProxy.js index c82ef96..4d69c53 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -36,12 +36,6 @@ changeOrigin: true })) - app.use(proxy('/wechat', { - target: `${options.host}/${options.service}`, - secure: false, - changeOrigin: true - })) - // app.use(proxy('/trans', { // target: `${host}/${service}`, // secure: false, diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 8f0c450..9a6ee18 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2552,10 +2552,22 @@ } sendWxMessage = (verify, id) => { - if (!window.GLOB.nginx) { + let domain = '' + if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { + domain = 'https://cloud.mk9h.cn/' + } + + if (!window.GLOB.nginx && !domain) { notification.warning({ top: 92, message: 'nginx鏈嶅姟灏氭湭寮�鍚紝涓嶅彲鍙戦�佹ā鏉挎秷鎭��', + duration: 5 + }) + return + } else if (!window.GLOB.WXAppID && !domain) { + notification.warning({ + top: 92, + message: '灏氭湭娣诲姞鍏紬鍙稩D锛屼笉鍙彂閫佹ā鏉挎秷鎭��', duration: 5 }) return @@ -2569,13 +2581,6 @@ param.LText = Utils.getuuid() param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - let domain1 = '' - let domain2 = '' - if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { - domain1 = 'https://cloud.mk9h.cn/' - domain2 = 'https://cloud.mk9h.cn:8443/' - } Api.genericInterface(param).then(res => { // res.send_data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: Utils.getuuid(), p1: '010000000001', p2: '鏄庣', p3: 'dddd', p4: '椤洪', p5: '鎴愬姛'}] @@ -2639,11 +2644,11 @@ return m }) - Api.wxAccessToken(domain1).then(res => { + Api.wxAccessToken(domain).then(res => { if (!res.oa_access_token) return params.forEach(n => { - Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { + Api.wxNginxRequest(`${domain}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { if (verify.wxNoteCallback === 'true') { let msg = re.errmsg || '' diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index d67515e..6b3106f 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -33,11 +33,8 @@ if (window.GLOB.WXAppID && window.GLOB.nginx && !wxTemps) { Api.wxAccessToken().then(res => { - let wxtoken = res.oa_access_token || '' - // let minitoken = res.mini_access_token || '' - - if (wxtoken) { - Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { + if (res.access_token) { + Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${res.access_token}`, 'get').then(res => { let temps = [] if (res.template_list) { temps = res.template_list.filter(item => { @@ -63,22 +60,13 @@ localStorage.removeItem('wxTemplates') } - // if (minitoken) { - // Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { - // if (res.errmsg === 'ok' && res.data) { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } - // }) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } }) } else if (wxTemps) { wxTemps = JSON.parse(wxTemps) this.resetTemps(wxTemps) + } else { + this.resetTemps([]) } } @@ -102,14 +90,14 @@ content: '璁㈠崟绫诲瀷锛歿{keyword1.DATA}}\n璁㈠崟鍙凤細{{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}', example: '璁㈠崟绫诲瀷锛氶��绉熺敵璇穃r\n璁㈠崟鍙凤細TZ16101909\r\n璁㈠崟鐘舵�侊細寰呭彇璐�' }, - { - template_id: 'mk_category_temp', - title: '绫荤洰妯℃澘', - primary_industry: '', - deputy_industry: '', - content: '', - example: '' - } + // { + // template_id: 'mk_category_temp', + // title: '绫荤洰妯℃澘', + // primary_industry: '', + // deputy_industry: '', + // content: '', + // example: '' + // } ] let _wxTemps = [...wxTemps, ...sysTemps] @@ -636,7 +624,7 @@ <Col span={24}></Col> <Col span={8}> <Form.Item label={ - <Tooltip placement="bottomLeft" title={'璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�'}> + <Tooltip placement="bottomLeft" title="璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 鍏紬鍙锋秷鎭� </Tooltip> -- Gitblit v1.8.0