这是我的商店
Ext.define('Movie.store.CartStore', {
extend: 'Ext.data.Store',
alias: 'store.cart',
storeId: 'cartStore',
requires: [
'Movie.model.CartModel'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
model: 'Movie.model.CartModel',
remoteSort: true,
proxy: {
type: 'rest',
enablePaging: true,
api: {
create: 'https://localhost:44369/Movies/AddCart',
read: 'https://localhost:44369/Movies/GetCart',
update: 'https://localhost:44369/Movies/EditCart',
destroy: 'https://localhost:44369/Movies/DeleteCart'
},
reader: {
type: 'json',
headers: { 'Accept': 'application/json' }
},
writer: {
type: 'json',
}
}
}, cfg)]);
}
});
我的模特
Ext.define('Movie.model.CartModel', {
extend: 'Movie.model.Base',
idProperty:'Id',
uses: [
'Movie.model.UsersModel'
],
fields: [
{ name: 'Id', type: 'int' , persist: false},
{ name: 'userid', type: 'int' },
{ name: 'name', type: 'string' },
{ name: 'moviename', type: 'string' },
{ name: 'address', type: 'string' },
{ name: 'price', type: 'int' },
{ name: 'rentday', type: 'string' },
{ name: 'url', type: 'string' },
]
});
Web API请求
[Route("Movies/GetCart/{id}")]
[HttpGet]
[EnableCors("*", "*", "*")]
public IHttpActionResult GetCart(int? id)
{
using (var ctx = new MyEntity())
{
var data = from cus in db.Users
from mov in db.Movie
from cart in db.Movie_cart
where cus.CustomerId ==cart.CustomerId && mov.Movie_id ==cart.Movie_Id && cus.CustomerId == id
select new
{
Id = cart.Cart_id,
userid = cus.CustomerId,
name = cus.Fname,
moviename = mov.Movie_name,
address = cus.Address,
price = mov.Movie_price,
rentday = mov.Rent_day,
url = mov.Movie_url
};
return Ok(data);
}
}
所以我想通过IDE到我的休息代理URL Something这样
https://localhost:44369/Movies/GetCart/123
我没有任何想法我会尝试使用
extraParams:{
id:123
}
禁用appendId:false但不能解决我的问题,它返回
https://localhost:44369/Movies/GetCart?dc_23213124124124&id=123而不是https://localhost:44369/Movies/GetCart/123
1条答案
按热度按时间ie3xauqp1#
dc_ param用于缓存。当您将noCache设置为false时,可以在store/model中停用此选项:
可以在全球范围内做到这一点:
你应该看看其他文章:https://stackoverflow.com/a/2047783/21182733https://stackoverflow.com/a/25409972/21182733