算命api-H5网站算命接口-App算命接口-小程序算命接口
接口数据api
接口平台:http://apidoc.sanqizhouyi.com
支持格式:JSON
请求方式:HTTP GET/POST
数据库mysql
FfsmOrders.init(
{
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
oid: Sequelize.STRING,
paytype: Sequelize.INTEGER,
data: Sequelize.STRING,
money: {
type: Sequelize.STRING,
defaultValue: ‘19.9’,
},
createtime: {
type: Sequelize.BIGINT(13),
defaultValue: Date.now(),
},
status: {
type: Sequelize.INTEGER,
defaultValue: 0,
},
dl_status: {
type: Sequelize.INTEGER,
defaultValue: 0,
},
ip: Sequelize.STRING,
des: Sequelize.STRING,
type: Sequelize.INTEGER, // 1=八字精批,2=合婚,3=姓名分析,4=姓名配对,5=紫薇排盘
qfshow: {
type: Sequelize.INTEGER,
defaultValue: 0,
},
lantern_id: {
type: Sequelize.INTEGER,
defaultValue: 0,
},
dl_money: {
type: Sequelize.STRING,
defaultValue: ‘0’,
},
},
{
sequelize,
tableName: ‘ffsm_orders’,
}
)
// 根据id获取订单
router.get('/getOrderByid', async ctx => {
checkParams(ctx, ['oid'])
const { oid } = ctx.request.query
const res = await FfsmOrders.getOrderByid(oid)
ctx.body = {
data: res,
status: 200,
msg: '',
}
})
/**
* 生成八字订单
* 八字精批: type:8
* 八字姻缘: type:16
* 姻缘测算: type:7
* 紫薇命盘: type:5
*/
router.post('/createBzOrder', async ctx => {
checkParams(ctx, ['pay_uid', 'username', 'gender', 'date', 'hour', 'type'])
const { body } = ctx.request
const { username, gender, date, hour } = body
if (!isDate(date)) {
throw new BadParamError('date:格式不正确')
}
const data = JSON.stringify({
username,
gender,
...getOrderData(date, hour),
})
body.data = data
const res = await FfsmOrders.createOrder(body)
ctx.body = {
data: null,
status: 200,
msg: '订单创建成功',
}
})
// 订单详情
router.get('/getOrderDetail', async ctx => {
checkParams(ctx, ['oid'])
const { oid } = ctx.request.query
const { type } = await FfsmOrders.getOrderByid(oid)
let res = {}
switch (type.toString()) {
case '2':
res = await FfsmOrders.bazihh(oid)
break
case '4':
res = await FfsmOrders.xmpd(oid)
break
case '5':
res = await FfsmOrders.zwmp(oid)
break
case '7':
res = await FfsmOrders.baziyy(oid)
break
case '8':
res = await FfsmOrders.bazijp(oid)
break
case '16':
res = await FfsmOrders.baziyy(oid)
break
case '18':
res = await FfsmOrders.hmjx(oid)
break
case '24':
res = await FfsmOrders.gsqm(oid)
break
case '37':
res = await FfsmOrders.xzys(oid)
break
}
ctx.body = {
data: res,
status: 200,
msg: '',
}
})
请求示例:
接口实现: