-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStoreForGC.js
44 lines (41 loc) · 1.29 KB
/
StoreForGC.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Store
* by kingpjchen 20160813
*/
define(function factory(require, exports, module) {
var Store = require('./Store')
var net = require('util/net')
var router = require('business/router')
var StoreForGC = Store.extend({
parse: function(data){
var acceptResults = this.get('acceptResults') || [0];
if(data && ~acceptResults.indexOf(data.result) && data.data){
return data.data
}
},
proxy: function(params, callback){
var self = this;
var path = self.server.indexOf("http")==0? self.server: '/cgi-bin/'+self.server;
net.ajax({
url: router.createUrl(path),
data:{
module: self.module,
method: self.method,
param: params
},
plugins : {
'business/mergeRequest': true
},
cache: false,
dataType: 'json',
success: function(json) {
callback(null, json);
},
error: function(xhr, errorType, error) {
callback(error, errorType);
}
});
}
})
return StoreForGC
})