| | |
| | | * @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)) { |
| | |
| | | } 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) |
| | | }) |
| | |
| | | _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/') |
| | | } |
| | | } |
| | | |
| | |
| | | _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({ |
| | |
| | | changeOrigin: true |
| | | })) |
| | | |
| | | app.use(proxy('/wechat', { |
| | | target: `${options.host}/${options.service}`, |
| | | secure: false, |
| | | changeOrigin: true |
| | | })) |
| | | |
| | | // app.use(proxy('/trans', { |
| | | // target: `${host}/${service}`, |
| | | // secure: false, |
| | |
| | | } |
| | | |
| | | 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: '尚未添加公众号ID,不可发送模板消息。', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | 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: '成功'}] |
| | |
| | | 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 || '' |
| | | |
| | |
| | | |
| | | 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 => { |
| | |
| | | |
| | | 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([]) |
| | | } |
| | | } |
| | | |
| | |
| | | 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] |
| | |
| | | <Col span={24}></Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'请在服务器完成公众号配置。'}> |
| | | <Tooltip placement="bottomLeft" title="请在服务器完成公众号配置。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 公众号消息 |
| | | </Tooltip> |