exchangeCoupon.js
1.98 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Created by ty on 2016/6/23.
* 发券管理
*/
var request = require('request');
var apiDomain = global.Register.domain;
module.exports={
namespace:"exchangeCoupon",
apis:{
queryList:{
title: "发券列表",
url: '/activity/couponExchangeActivity/queryList',
params: [
{name: 'name', type: 'string'},//名称
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
},
add:{
title: "添加",
url: '/activity/couponExchangeActivity/add',
params: [
{name: 'name', type: 'string'},//名称
{name: 'subName', type: 'string'}, // 副标题
{name: 'sendCouponId', type: 'string'}, // 券Id
{name: 'exchangeYohoCoinNum', type: 'Number'} // 使用有货币数量
]
},
update:{
title: "更新",
url: '/activity/couponExchangeActivity/update',
params: [
{name: 'name', type: 'string'},//名称
{name: 'subName', type: 'string'}, // 副标题
{name: 'sendCouponId', type: 'string'}, // 券Id
{name: 'exchangeYohoCoinNum', type: 'Number'} // 使用有货币数量
]
},
delete: function(req, callback) {
const params = []
for(let key in req.body) {
params.push(key+'='+encodeURI(req.body[key]))
}
const url = apiDomain + "/activity/couponExchangeActivity/delete?"+ params.join('&')
request.get(url,function(err,res,body){
if(err) {
return callback(null, err)
}
try{
body = JSON.parse(body)
}catch{
return callback(null, {message: '删除失败'})
}
return callback(null, body);
});
},
}
}