Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
q289089000
server
提交
48336111
S
server
项目概览
q289089000
/
server
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
48336111
编写于
5月 12, 2021
作者:
q289089000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
5-12
上级
9d6702a8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
23 deletion
+64
-23
src/app.module.ts
src/app.module.ts
+5
-0
src/controller/item/item.model.ts
src/controller/item/item.model.ts
+32
-22
src/controller/orderdata/orderdata.gateway.ts
src/controller/orderdata/orderdata.gateway.ts
+16
-1
src/controller/orderdata/orderdata.service.ts
src/controller/orderdata/orderdata.service.ts
+11
-0
未找到文件。
src/app.module.ts
浏览文件 @
48336111
...
...
@@ -9,7 +9,11 @@ import { Module, Inject } from '@nestjs/common';
import
{
AppController
}
from
'
./app.controller
'
;
import
{
AppService
}
from
'
./app.service
'
;
import
*
as
mongoose
from
'
mongoose
'
;
mongoose
.
set
(
'
useFindAndModify
'
,
false
)
import
{
MongooseModule
}
from
'
@nestjs/mongoose
'
;
import
{
UserModule
}
from
'
./controller/user/user.module
'
;
import
{
GlobalGateway
}
from
'
./global.gateway
'
;
...
...
@@ -24,6 +28,7 @@ import { PaymentModule } from './controller/payment/payment.module';
import
{
PaymentGateway
}
from
'
./controller/payment/payment.gateway
'
;
EventEmitter
.
defaultMaxListeners
=
1024
;
@
Module
({
imports
:
[
MongooseModule
.
forRoot
(
'
mongodb://localhost/nest
'
),
...
...
src/controller/item/item.model.ts
浏览文件 @
48336111
import
{
Supplier
}
from
'
../supplier/supplier.model
'
;
import
{
Document
,
Schema
as
mSchame
}
from
'
mongoose
'
;
import
{
Document
,
Schema
as
mSchame
}
from
'
mongoose
'
;
import
{
Prop
,
Schema
,
SchemaFactory
}
from
'
@nestjs/mongoose
'
;
import
{
Shipper
}
from
'
../shipper/shipper.model
'
;
@
Schema
()
export
class
Item
extends
Document
{
export
class
Item
extends
Document
{
//_id?:string;
@
Prop
({
default
:
Date
.
now
default
:
Date
.
now
})
date
:
Date
;
//连接供应商id 数组
@
Prop
({
type
:[
mSchame
.
Types
.
ObjectId
],
ref
:
"
Supplier
"
type
:
[
mSchame
.
Types
.
ObjectId
],
ref
:
"
Supplier
"
})
suppliers
:
string
;
suppliers
:
string
;
//产品照片
@
Prop
({
type
:[
String
],
type
:
[
String
],
})
images
:
string
;
images
:
string
[];
//分类
@
Prop
({
type
:
Number
,
})
classes
:
number
;
//标签
@
Prop
({
type
:
[
String
],
})
tabs
:
string
[];
@
Prop
({
default
:
"
none
"
default
:
"
none
"
})
no
:
string
;
@
Prop
({
default
:
"
"
default
:
"
"
})
name
:
string
;
@
Prop
({
default
:
1
default
:
1
})
box
:
number
;
@
Prop
({
default
:
0
default
:
0
})
qty
:
number
;
@
Prop
({
default
:
0
default
:
0
})
price
:
number
;
@
Prop
({
default
:
1
default
:
1
})
discount
:
number
;
//状态
@
Prop
({
default
:
0
})
state
:
number
;
@
Prop
({
default
:
0
})
state
:
number
;
//备注
@
Prop
()
mark
:
string
;
mark
:
string
;
//外箱规格
@
Prop
({
default
:[
0
,
0
,
0
]
})
size
:
[
number
];
@
Prop
({
default
:
[
0
,
0
,
0
]
})
size
:
number
[
];
//外箱重量
@
Prop
({
default
:[
0
,
0
]
})
weight
:
[
number
];
@
Prop
({
default
:
[
0
,
0
]
})
weight
:
number
[
];
}
...
...
src/controller/orderdata/orderdata.gateway.ts
浏览文件 @
48336111
...
...
@@ -185,5 +185,20 @@ export class OrderDataGateway {
})
})
}
@
SubscribeMessage
(
'
OrderDataDisconnectLink
'
)
DisconnectLink
(
client
:
Socket
,
_id
:
any
):
Promise
<
boolean
>
{
console
.
log
(
'
断连 11111111111111
'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
_od
.
_model
.
findByIdAndUpdate
(
_id
,{
link
:
null
}).
then
(
doc
=>
{
console
.
log
(
'
断连
'
,
doc
);
}
)
})
}
}
src/controller/orderdata/orderdata.service.ts
浏览文件 @
48336111
...
...
@@ -41,6 +41,17 @@ export class OrderDataService {
rejects
(
e
)
}
}
//Update
async
FindUpdate
(
filter
,
update
):
Promise
<
OrderData
>
{
try
{
let
doc
=
await
this
.
_model
.
findOneAndUpdate
(
filter
,
update
)
return
doc
}
catch
(
e
)
{
console
.
log
(
e
);
rejects
(
e
)
}
}
//创建 Orders
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录