Commit 7d20b520 by 钟占达

zyd

parent f3223a8a
const APIBase = require("../../api.base");
const system = require("../../../system");
const settings = require("../../../../config/settings");
var db = system.getObject("db.common.connection").getCon();
/**
* 用户端调用订单相关接口
*/
class Templateconfig extends APIBase {
constructor() {
super();
// this.templateinfoSve = system.getObject("service.template.templateinfoSve");
this.imginfoSve = system.getObject("service.configmag.imginfoSve");
this.forminfoSve = system.getObject("service.configmag.forminfoSve")
this.templateinfoSve = system.getObject("service.template.templateinfoSve.js");
// this.templatelinkSve = system.getObject("service.template.templatelinkSve");
}
/**
......@@ -32,6 +37,19 @@ class Templateconfig extends APIBase {
case "test"://测试
opResult = system.getResultSuccess("测试接口");
break;
case "getImgList": // 查询图片
opResult = await this.imginfoSve.findAndCountAll(pobj.actionBody);
break;
case "createImginfo": // 添加图片
opResult = await this.imginfoSve.create(pobj.actionBody);
break;
case "getTemplateList": // 获取模板列表
opResult = await this.templateinfoSve.findAndCountAll(pobj.actionBody);
// opResult = await this.templateinfoSve.findByCompanyId(pobj.actionBody);
break;
case "getFormList": // 获取表单列表
opResult = await this.forminfoSve.findByCompanyId(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
const system=require("../../../system");
const Dao=require("../../dao.base");
class ImginfoDao extends Dao{
constructor(){
super(Dao.getModelName(ImginfoDao));
}
// extraWhere(obj,w,qc,linkAttrs){
// w["company_id"]=obj.company_id;
// return w;
// }
}
module.exports=ImginfoDao;
\ No newline at end of file
module.exports = (sequelize, DataType) => {
return sequelize.define("c_marketing_subject", {
id: {
type: DataType.INTTEGER,
primaryKey: true,
},
code: DataType.STRING(100),
name: DataType.STRING(100),
notes: DataType.STRING(255),
user_name: DataType.STRING(100),
user_id: DataType.STRING(100),
company_id: DataType.INTEGER,
}, {
// 不添加时间戳属性 (updatedAt, createdAt)
timestamps: true,
// 不删除数据库条目,但将新添加的属性deletedAt设置为当前日期(删除完成时)。
// paranoid 只有在启用时间戳时才能工作
paranoid: true,
// 将自动设置所有属性的字段选项为下划线命名方式。
// 不会覆盖已经定义的字段选项
underscored: true,
// 禁用修改表名; 默认情况下,sequelize将自动将所有传递的模型名称(define的第一个参数)转换为复数。 如果你不想这样,请设置以下内容
freezeTableName: true,
// 定义表的名称
tableName: 'c_marketing_subject',
// 启用乐观锁定。 启用时,sequelize将向模型添加版本计数属性,
// 并在保存过时的实例时引发OptimisticLockingError错误。
// 设置为true或具有要用于启用的属性名称的字符串。
version: true
});
};
\ No newline at end of file
......@@ -7,9 +7,17 @@ class ImginfoService extends ServiceBase {
}
async create(pobj){
// var code = await this.getBusUid("img");
// pobj.code = code;
return this.dao.create(pobj);
let code = await this.getBusUid("img");
let imginfo = pobj.imginfo;
let data = {
name: imginfo.name,
pic_url: imginfo.url,
pic_size: imginfo.size,
company_id: imginfo.company_id || 10,
code: code
};
let res = this.dao.create(data);
return system.getResult(res);
}
}
module.exports = ImginfoService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const System = require("../../../system");
class TemplateconfigService extends ServiceBase {
constructor() {
super("template", ServiceBase.getDaoName(TemplateconfigService));
}
async findAndCountAll (obj) {
console.log(JSON.stringify(obj));
let res = await this.dao.findAndCountAll(obj);
return System.getResultSuccess(res);
}
}
module.exports = TemplateconfigService;
\ No newline at end of file
......@@ -5,6 +5,9 @@
1. [获取模板信息](#findOneByCode)
1. [模板列表查询](#findAndCountAll)
1. [编辑模板TDK](#editTemplateTdk)
1. [获取图片列表](#getImgList)
1. [添加图片](#createImginfo)
1. [获取表单列表](#getFormList)
## **<a name="createTemplate"> 创建模板</a>**
......@@ -263,3 +266,185 @@
}
```
## **<a name="getImgList"> 获取图片列表</a>**
[返回到目录](#menu)
##### URL
[/api/action/templateconfig/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getImgList
``` javascript
{
"actionType": "getImgList",
"actionBody": {
"pageInfo": {
"pageNo": 1,
"pageSize": 2
}
}
}}
```
#### 返回结果
```javascript
{
"results": {
"count": 5,
"rows": [
{
"id": 38,
"code": "IMG202008101530vc4Sw",
"name": "test",
"company_id": 10,
"pic_url": "https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_167715970446417352020101530417351920-1103.jpg",
"created_at": "2020-08-10T07:30:43.000Z",
"updated_at": "2020-08-10T07:30:43.000Z",
"deleted_at": null,
"version": 0
},
{
"id": 37,
"code": "IMG202008101501DQhko",
"name": "1",
"company_id": 10,
"pic_url": "",
"created_at": "2020-08-10T07:01:59.000Z",
"updated_at": "2020-08-10T07:01:59.000Z",
"deleted_at": null,
"version": 0
}
]
},
"aggresult": {},
"requestId": "600d1778c2b64f7aae959e0214d360d1"
}
```
## **<a name="createImginfo"> 添加图片</a>**
[返回到目录](#menu)
##### URL
[/api/action/templateconfig/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:createImginfo
``` javascript
{
"actionType": "createImginfo",
"actionBody": {
"imginfo": {
"url": "https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_1137159702950007820201011182078huluwa.jpg",
"name": "444",
"size": "200K"
}
}
}
```
#### 返回结果
```javascript
{
"version": 0,
"id": 55,
"name": "444",
"pic_url": "https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_1137159702950007820201011182078huluwa.jpg",
"code": "IMG202008101624l5Vd5",
"company_id": 10,
"updated_at": "2020-08-10T08:24:49.672Z",
"created_at": "2020-08-10T08:24:49.672Z"
}
```
## **<a name="getFormList"> 获取表单列表</a>**
[返回到目录](#menu)
##### URL
[/api/action/templateconfig/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getFormList
``` javascript
{
"actionType":"getFormList",
"actionBody":{
"pageInfo":{
"pageNo":1,
"pageSize":10
},
"where": {
"company_id": 10
}
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "操作成功",
"data": {
"results": {
"count": 3,
"rows": [
{
"id": 1,
"code": "00001",
"name": "1",
"form_items": "手机号",
"form_describe": "1",
"notes": "test",
"user_id": 1,
"user_name": "zhangsan",
"company_id": 10,
"record_num": 2,
"created_at": "2020-08-07T15:59:56.000Z",
"updated_at": "2020-08-10T05:43:03.000Z",
"deleted_at": null,
"version": null
},
{
"id": 3,
"code": "00001",
"name": "1",
"form_items": "1",
"form_describe": "1",
"notes": "test3",
"user_id": 1,
"user_name": "1",
"company_id": 11,
"record_num": null,
"created_at": "2020-08-07T15:59:56.000Z",
"updated_at": "2020-08-07T15:59:58.000Z",
"deleted_at": null,
"version": null
},
{
"id": 2,
"code": null,
"name": "sssssss",
"form_items": null,
"form_describe": "ss",
"notes": "tset2",
"user_id": null,
"user_name": null,
"company_id": 10,
"record_num": 3,
"created_at": "2020-08-07T10:42:27.000Z",
"updated_at": "2020-08-07T10:42:27.000Z",
"deleted_at": null,
"version": 0
}
]
},
"aggresult": {}
},
"bizmsg": "empty",
"requestId": "a36fdfff4c2b4ae98b462c54b3cf588d"
}
```
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