Commit f064f920 by linboxuan

ucommune order callbackNotify

parents cb4f7600 4d35e6ae
var APIBase = require("../../api.base");
var system = require("../../../system");
class AskForAPI extends APIBase {
constructor() {
super();
this.askForSve = system.getObject("service.askfor.askForSve");
}
async tradeMark (pobj, qobj, req) {
if (!pobj.userInfo) {
return system.getResultFail(system.noLogin, "user no login!");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
let result
switch (pobj.actionType) {
case "getByUid":
result = await this.askForSve.getByUid(pobj.userInfo.id, pobj.actionBody.page, pobj.actionBody.offset)
return system.getResult2(result)
case 'create':
let param = {}
param.user_id = pobj.userInfo.id
delete pobj.actionBody.type
param.a_content = JSON.stringify(pobj.actionBody.content)
param.a_type = 1
param.a_id = new Date().getTime()
if (pobj.actionBody.user_name) {
param.user_name = pobj.actionBody.user_name
}
param.a_mobile = pobj.actionBody.mobile || pobj.userInfo.mobile
if (pobj.actionBody.addr) {
param.a_addr = pobj.actionBody.addr
}
result = await this.askForSve.create(param)
return system.getResult2(result)
case 'delete':
result = await this.askForSve.delete(pobj.actionBody.id)
return system.getResult2(result)
}
}
}
module.exports = AskForAPI;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
class CollectAPI extends APIBase {
constructor() {
super();
this.collectSve = system.getObject("service.askfor.collectSve");
}
async tradeMark (pobj, qobj, req) {
if (!pobj.userInfo) {
return system.getResultFail(system.noLogin, "user no login!");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
let result
switch (pobj.actionType) {
case 'getByUid':
result = await this.collectSve.getByUid(pobj.userInfo.id, pobj.actionBody.page, pobj.actionBody.offset)
return system.getResult2(result)
case 'getByUidAndCollections':
result = await this.collectSve.getByUidAndCollections(pobj.userInfo.id, pobj.actionBody.collections)
return system.getResult2(result)
case 'create':
let param = {}
param.user_id = pobj.userInfo.id
delete pobj.actionBody.type
param.c_content = JSON.stringify(pobj.actionBody)
param.c_type = 1
result = await this.collectSve.create(param)
return system.getResult2(result)
case 'delete':
result = await this.collectSve.delete(pobj.actionBody.id)
return system.getResult2(result)
}
}
}
module.exports = CollectAPI;
\ No newline at end of file
const Dao = require("../../dao.base");
class AskForDao extends Dao {
constructor() {
super(Dao.getModelName(AskForDao));
}
async getByUid (uid, page = 1, offset = 11) {
return await this.model.findAndCountAll({
where: { user_id: uid, a_type: 1 },
limit: 11,
offset: (page - 1) * offset
})
}
async create (param) {
return await this.model.create(param)
}
async delete (id) {
return await this.model.destroy({
where: {
id: id
}
})
}
}
module.exports = AskForDao;
\ No newline at end of file
const Dao = require("../../dao.base");
class CollectDao extends Dao {
constructor() {
super(Dao.getModelName(CollectDao));
}
async getByUid (uid, page = 1, offset = 9) {
return await this.model.findAndCountAll({
where: { user_id: uid, c_type: 1 },
limit: 9,
offset: (page - 1) * offset
})
}
async getByUidAndCollections (uid, collections) {
let selectSql = `SELECT * FROM c_collect WHERE user_id=${uid} and c_type=1 and (`;
for (let i in collections) {
if (i == 0) {
selectSql += `c_content like "%\\"name\\":\\"${collections[i]}\\"%"`
} else {
selectSql += ` or c_content like "%\\"name\\":\\"${collections[i]}\\"%"`
}
}
selectSql += ')'
let list = await this.customQuery(selectSql);
return list
}
async create (param) {
return await this.model.create(param)
}
async delete (id) {
return await this.model.destroy({
where: {
id: id
}
})
}
}
module.exports = CollectDao;
\ No newline at end of file
module.exports = (db, DataTypes) => {
return db.define("askfor", {
user_id: DataTypes.INTEGER, // userId
a_type: DataTypes.INTEGER, // 申请类型 枚举 1: 商标 剩余待定
a_content: DataTypes.STRING, // 内容 具体格式为 {xxx: url: desc: } 默认空对象
user_name: DataTypes.STRING, // 申请人姓名 可空
a_status: DataTypes.INTEGER, // 申请状态 1: 已发布 2: 待响应 3: 待确认方案 4: 已完成
a_id: DataTypes.STRING, // 需求id 随机
a_mobile: DataTypes.STRING, // 申请人手机号
a_addr: DataTypes.STRING // 服务区域 可空
}, {
paranoid: true,
underscored: true,
timestamps: true,
tableName: 'a_askfor',
version: true,
freezeTableName: true
}
)
}
\ No newline at end of file
module.exports = (db, DataTypes) => {
return db.define("collect", {
user_id: {type:DataTypes.INTEGER,
comment: 'userid'
}, // userId
c_type: DataTypes.INTEGER, // 收藏类型 枚举 1: 商标 剩余待定
c_content: DataTypes.STRING, // 内容 具体格式为 {name: url: desc: }
}, {
paranoid: true,
underscored: true,
timestamps: true,
tableName: 'c_collect',
version: true,
freezeTableName: true
}
)
}
\ No newline at end of file
const ServiceBase = require("../../sve.base");
class AskForService extends ServiceBase {
constructor() {
super("askfor", ServiceBase.getDaoName(AskForService));
}
async getByUid (uid, page = 1, offset = 11) {
return await this.dao.getByUid(uid, page, offset);
}
async create (param) {
return await this.dao.create(param);
}
async delete (id) {
return await this.dao.delete(id)
}
}
module.exports = AskForService;
\ No newline at end of file
const ServiceBase = require("../../sve.base");
class CollectService extends ServiceBase {
constructor() {
super("askfor", ServiceBase.getDaoName(CollectService));
}
async getByUid (uid, page = 1, offset = 9) {
return await this.dao.getByUid(uid, page, offset);
}
async getByUidAndCollections (uid, collections) {
return await this.dao.getByUidAndCollections(uid, collections)
}
async create (param) {
return await this.dao.create(param);
}
async delete (id) {
return await this.dao.delete(id)
}
}
module.exports = CollectService;
\ No newline at end of file
...@@ -1088,7 +1088,7 @@ class OrderInfoService extends ServiceBase { ...@@ -1088,7 +1088,7 @@ class OrderInfoService extends ServiceBase {
async getOrderDetails(pobj, actionBody) {//获取订单详情信息 async getOrderDetails(pobj, actionBody) {//获取订单详情信息
var sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`," + var sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`," +
" `invoiceApplyStatus`,`opNotes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,`serviceItemSnapshot`,`orderSnapshot`,created_at from " + " `invoiceApplyStatus`,`opNotes`,`notes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,`serviceItemSnapshot`,`orderSnapshot`,created_at from " +
" v_order where uapp_id=:uapp_id and orderNo=:orderNo LIMIT 1"; " v_order where uapp_id=:uapp_id and orderNo=:orderNo LIMIT 1";
var paramWhere = { uapp_id: pobj.appInfo.uapp_id, orderNo: actionBody.orderNo }; var paramWhere = { uapp_id: pobj.appInfo.uapp_id, orderNo: actionBody.orderNo };
var list = await this.customQuery(sql, paramWhere); var list = await this.customQuery(sql, paramWhere);
......
示例:----------------------------------开始-------------------------------------------------------------------- 示例:----------------------------------开始--------------------------------------------------------------------
...@@ -70,3 +70,42 @@ CREATE TABLE `b_policy_subscribe` ( ...@@ -70,3 +70,42 @@ CREATE TABLE `b_policy_subscribe` (
`version` int(11) NOT NULL DEFAULT '0', `version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2020-6-22 wkliang
----------------------------------开始--------------------------------------------------------------------
DROP TABLE IF EXISTS `a_askfor`;
CREATE TABLE `a_askfor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NULL DEFAULT NULL,
`a_type` int(11) NOT NULL COMMENT '申请类型 1 商标',
`a_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '{}' COMMENT '内容 具体格式为 {xxx: url: desc: } 默认空对象',
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申请人姓名',
`a_status` int(11) NOT NULL DEFAULT 1 COMMENT '申请状态 1: 已发布 2: 待响应 3: 待确认方案 4: 已完成',
`a_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '需求id 随机 ',
`a_mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ' 申请人手机号',
`a_addr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务区域 ',
`deleted_at` datetime(0) NULL DEFAULT NULL,
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`version` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `a_id_index`(`a_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `c_collect`;
CREATE TABLE `c_collect` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`c_type` int(255) NOT NULL COMMENT '收藏类型 枚举 1: 商标 剩余待定',
`c_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '{}' COMMENT '内容 具体格式为 {name: url: desc: }',
`deleted_at` datetime(0) NULL DEFAULT NULL,
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`version` int(255) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
INSERT INTO `center_app`.`p_product_type`(`id`, `uapp_id`, `p_id`, `type_code`, `type_name`, `channel_type_code`, `channel_type_name`, `type_pic`, `type_desc`, `type_icon`, `is_enabled`, `created_at`, `updated_at`, `deleted_at`, `version`) VALUES (52, 22, 20, 'sbqm', '商标起名', 'sbqm', '商标起名', NULL, NULL, NULL, 1, '2020-06-24 10:31:33', '2020-06-24 10:31:37', NULL, 0);
----------------------------------结束--------------------------------------------------------------------
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment