初步编写测试次数限制

pull/7/head^2
WeiRan 2024-09-03 09:40:49 +08:00
parent b5b9ce86bc
commit d0a13cc604
7 changed files with 132 additions and 27 deletions

View File

@ -10,6 +10,25 @@ export function apitest(email){
}
export function reducetestcount(data){
return request({
url:"/market/product/reducetestcount",
method: "POST",
data: data
})
}
export function iftest(data){
return request({
url:"/market/product/iftest",
method: "POST",
data: data
})
}
export function sendrequest(options){
// 确保options是一个对象并且包含必要的属性
if (!options || typeof options !== 'object' || !options.apiRouter || typeof options.parameter === 'undefined') {

View File

@ -47,3 +47,10 @@ export function delapi(productId){
})
}
export function getprice(productId){
return request({
url:"/background/apimanage/getprice/"+productId,
method: "POST",
})
}

View File

@ -9,15 +9,14 @@ export function selectList(data){
}
export function selectTypeList(data){
export function selectTypeList(data) {
return request({
url:"/market/product/typeList",
url: "/market/product/typeList",
method: "POST",
data: data
})
}export function selectproductspecification(data){
}
export function selectproductspecification(data){
return request({
url:"/market/product/specification",
method: "POST",
@ -25,5 +24,13 @@ export function selectTypeList(data){
})
}
export function ifbuy(data){
return request({
url:"/market/product/ifbuy",
method: "POST",
data: data
})
}

View File

@ -119,7 +119,7 @@
<!--新增对话框-->
<el-dialog
title="提示"
title="新增接口"
:visible.sync="dialogVisible"
width="60%"
:before-close="handleClose">
@ -149,8 +149,13 @@
<el-form-item label="请求方式" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.requestMethod" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="默认选择规格" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.productSpecification" autocomplete="off"></el-input>
<el-form-item label="选择默认规格" prop="requestMethod" style="width: 70%">
<el-select v-model="api.productSpecification" placeholder="请选择默认规格">
<el-option label="按次查询" value="按次查询"></el-option>
<el-option label="包日" value="包日"></el-option>
<el-option label="包月" value="包月"></el-option>
<el-option label="包年" value="包年"></el-option>
</el-select>
</el-form-item>
<el-divider></el-divider>
<span>价格</span>
@ -187,14 +192,13 @@
//import from ',
import {
addproduct,
delapi,
productStateLis,
productStateList,
delapi, getprice,
selectapiList,
UpdproductState
} from "@/api/background/apimanage";
import {resetForm} from "@/utils/muyu";
import {add} from "lodash/math";
import api from "js-cookie";
export default {
name: "Apimanage",
@ -205,6 +209,13 @@ export default {
//"
return {
tableData:[],
moneyData:[],
money:{
timemoney:'',
daymoney:'',
monthmoney:'',
yearmoney:''
},
ruleForm:{
pageNum:1,
pageSize:9,
@ -269,7 +280,21 @@ export default {
},
//
handleEdit(row){
this.$router.push({path:"/apiupdmessage/index",query:{api:row}})
//
getprice(row.productId).then(response=>{
this.moneyData=response.data
this.money.timemoney=this.moneyData[0].middlePrice
this.money.daymoney=this.moneyData[1].middlePrice
this.money.monthmoney=this.moneyData[2].middlePrice
this.money.yearmoney=this.moneyData[3].middlePrice
row.timemoney = this.money.timemoney;
row.daymoney = this.money.daymoney;
row.monthmoney = this.money.monthmoney;
row.yearmoney = this.money.yearmoney;
this.$router.push({path:"/apiupdmessage/index",query:{api:row}})
})
},
//
handleDelete(row){

View File

@ -20,9 +20,6 @@
<el-form-item label="接口销量" prop="productSales" style="width: 70%">
<el-input type="text" v-model="api.productSales" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="接口价格" prop="productPrice" style="width: 70%">
<el-input type="text" v-model="api.productPrice" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="接口来源" prop="productFrom" style="width: 70%">
<el-input type="text" v-model="api.productFrom" autocomplete="off"></el-input>
</el-form-item>
@ -38,6 +35,28 @@
<el-form-item label="请求方式" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.requestMethod" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="选择默认规格" prop="requestMethod" style="width: 70%">
<el-select v-model="api.productSpecification" placeholder="请选择默认规格">
<el-option label="按次查询" value="按次查询"></el-option>
<el-option label="包日" value="包日"></el-option>
<el-option label="包月" value="包月"></el-option>
<el-option label="包年" value="包年"></el-option>
</el-select>
</el-form-item>
<el-divider></el-divider>
<span>价格</span>
<el-form-item label="按次查询" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.timemoney" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="包日" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.daymoney" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="包月" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.monthmoney" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="包年" prop="requestMethod" style="width: 70%">
<el-input type="text" v-model="api.yearmoney" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm(api)"></el-button>
<el-button @click="resetForm('ruleForm')"></el-button>

View File

@ -19,8 +19,15 @@
<el-row>
<el-col :span="24"><div class="grid-content bg-purple-dark">
<el-button type="info" @click="test(myapi)"></el-button>
<el-button type="primary" @click="apply(myapi)"></el-button>
<span v-if="myapi.remark=='是'">
<el-button type="info" @click="test(myapi)">使</el-button>
<el-button type="primary" @click="apply(myapi)"></el-button>
</span>
<span v-if="myapi.remark=='否'">
<el-button type="info" @click="test(myapi)"></el-button>
<el-button type="primary" @click="apply(myapi)"></el-button>
</span>
</div></el-col>
</el-row>
</el-form>
@ -191,7 +198,7 @@
<script>
//jsjsjson,
//import from ',
import {sendrequest, sendrequest1} from "@/api/apitest/apitest";
import {iftest, reducetestcount, sendrequest, sendrequest1} from "@/api/apitest/apitest";
import api from "js-cookie";
import {companyauthentication, ifcompanyauthentication} from "@/api/authentication/authentication";
import {selectproductspecification} from "@/api/market/product";
@ -231,13 +238,21 @@ export default {
},
//
test(myapi){
this.dialogVisible=true
this.ruleForm={
productName: myapi.productName,
apiAddress: myapi.apiAddress,
requestMethod: myapi.requestMethod,
apiRouter: myapi.apiRouter
}
//<=0
iftest(myapi).then(response=>{
if (response.data=='' || response.data<=0){
alert("使用次数已到期")
}else{
this.dialogVisible=true
this.ruleForm={
productName: myapi.productName,
apiAddress: myapi.apiAddress,
requestMethod: myapi.requestMethod,
apiRouter: myapi.apiRouter
}
}
})
},
//
apply(myapi){
@ -297,6 +312,11 @@ export default {
// <pre>innerHTMLJSON
document.getElementById('json-display').innerHTML = formattedJson;
})
//-1
reducetestcount(this.myapi).then(response=>{
})
},
//
newsForm(ruleForm) {
@ -356,6 +376,9 @@ export default {
container.appendChild(resultDiv);
});
//-1
reducetestcount(this.myapi).then(response=>{
})
}
},
// - 访this",

View File

@ -73,14 +73,13 @@
//import from ',
import {selectList, selectTypeList} from "@/api/market/product";
import {ifbuy, selectList, selectTypeList} from "@/api/market/product";
export default {
name: 'Product',
//import使"
components: {},
props: {},
data() {
//"
return {
@ -132,6 +131,12 @@ export default {
},
//
test(product){
//
ifbuy(product).then(response=>{
if (response.code!=200) {
alert(response.msg)
}
})
this.$router.push({path:"/apitest/index",query:{myapi:JSON.stringify(product)}})
},
// test(product) {