Commit 11e4a5ea by 庄冰

logo

parent 4e201ed1
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class LogoOrderAPI extends APIBase {
constructor() {
super();
this.centerorderSve = system.getObject("service.common.centerorderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if (pobj.actionType == 'getPolicyNeedList' || pobj.actionType == 'submitPolicyNeedNotes') {
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "singlelogo"://生成logo
opResult = await this.centerorderSve.singlelogo(pobj);
break;
case "getLogoListByUser"://获取已购买的logo
opResult = system.getResultSuccess(null, "测试成功");
break;
case "getCollectibleLogoListByUser"://获取收藏的logo
opResult = system.getResultSuccess(null, "测试成功");
break;
case "collectLogo"://收藏logo
opResult = system.getResultSuccess(null, "测试成功");
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = LogoOrderAPI;
\ No newline at end of file
...@@ -399,6 +399,37 @@ class CenterorderService extends AppServiceBase { ...@@ -399,6 +399,37 @@ class CenterorderService extends AppServiceBase {
return res; return res;
} }
//--------------------------阿里ICP---end-------------------------------------------------------- //--------------------------阿里ICP---end--------------------------------------------------------
//生成logo
async singlelogo(pobj){
var reqUrl = "http://43.247.184.92:15501/api/singlelogo";
var obj = pobj.actionBody;
if(!obj.title){
return system.getResult(null,"品牌名称不能为空");
}
if(!obj.subtitle){
return system.getResult(null,"品牌标语不能为空");
}
if(!obj.profession){
return system.getResult(null,"行业名称不能为空");
}
if(!obj.description){
obj.description="";
}
var rtn = null;
try {
rtn = await this.execClient.execPost(obj, reqUrl);
var res = JSON.parse(rtn.stdout);
if(res && res.status==0 && res.data){
return system.getResultSuccess(res.data);
}else{
return system.getResult(null,"生成logo操作失败");
}
}catch (e) {
return system.getResult(null,"生成logo操作异常");
}
}
} }
module.exports = CenterorderService; module.exports = CenterorderService;
// var task = new CenterorderService(); // var task = new CenterorderService();
......
...@@ -39,3 +39,5 @@ ...@@ -39,3 +39,5 @@
## 12. ICP订单相关接口 ## 12. ICP订单相关接口
  1 [ICP订单接口](doc/api/platform/icpOrder.md)   1 [ICP订单接口](doc/api/platform/icpOrder.md)
## 13. Logo订单相关接口
  1 [Logo订单接口](doc/api/platform/logoOrder.md)
\ No newline at end of file
<a name="menu" href="/doc">返回主目录</a>
1. [生成logo](#singlelogo)
1. [获取已购买的logo](#getLogoListByUser)
1. [获取收藏的logo](#getCollectibleLogoListByUser)
1. [收藏logo](#collectLogo)
## **<a name="singlelogo"> icp方案提交</a>**
[返回到目录](#menu)
##### URL
[/web/action/logoOrderApi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
#### 渠道执行的类型 actionType:singlelogo
``` javascript
{
"actionType":"singlelogo",
"actionBody":{
"title":"周杰伦", //名牌名称,必传
"subtitle":"baby", //品牌标语必填
"profession": "通讯行业", //行业 必填
"description":"有公司的地方就有公司宝",//现在必填,可以为空,后续会控制可传可不传
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "成功",
"data": [
{
"id": 1138, //id:后续用了购买的标识,购买时需要回传
"description": "淡蓝色象征着清新,淡雅", //描述
"pic_url": "https://gsb-zc.oss-cn-beijing.aliyuncs.com/generator_202004270135297459.png" //图像url
},
{
"id": 1149,
"description": "灰色象征高雅,朴素,沉稳。",
"pic_url": "https://gsb-zc.oss-cn-beijing.aliyuncs.com/generator_202004270135315198.png"
}
]
}
```
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