Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
q289089000
server
提交
daeb637e
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 搜索 >>
提交
daeb637e
编写于
6月 24, 2021
作者:
q289089000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6-24
上级
9fddf8c7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
237 addition
and
9 deletion
+237
-9
src/app.module.ts
src/app.module.ts
+5
-6
src/controller/item/item.gateway.ts
src/controller/item/item.gateway.ts
+3
-3
src/controller/shipper-bill/shipper-bill.gateway.ts
src/controller/shipper-bill/shipper-bill.gateway.ts
+100
-0
src/controller/shipper-bill/shipper-bill.model.ts
src/controller/shipper-bill/shipper-bill.model.ts
+59
-0
src/controller/shipper-bill/shipper-bill.module.ts
src/controller/shipper-bill/shipper-bill.module.ts
+17
-0
src/controller/shipper-bill/shipper-bill.service.ts
src/controller/shipper-bill/shipper-bill.service.ts
+53
-0
未找到文件。
src/app.module.ts
浏览文件 @
daeb637e
...
...
@@ -5,9 +5,7 @@ import { OrderDataModule } from './controller/orderdata/orderdata.module';
import
{
OrdersGateway
}
from
'
./controller/orders/orders.gateway
'
;
import
{
OrdersModule
}
from
'
./controller/orders/orders.module
'
;
import
{
SupplierGateway
}
from
'
./controller/supplier/supplier.gateway
'
;
import
{
Module
,
Inject
}
from
'
@nestjs/common
'
;
import
{
AppController
}
from
'
./app.controller
'
;
import
{
AppService
}
from
'
./app.service
'
;
import
{
Module
}
from
'
@nestjs/common
'
;
import
*
as
mongoose
from
'
mongoose
'
;
mongoose
.
set
(
'
useFindAndModify
'
,
false
)
...
...
@@ -18,15 +16,14 @@ import { UserModule } from './controller/user/user.module';
import
{
GlobalGateway
}
from
'
./global.gateway
'
;
import
{
AuthModule
}
from
'
./controller/auth/auth.module
'
;
import
{
AuthGateway
}
from
'
./controller/auth/auth.gateway
'
;
import
{
SupplierModule
}
from
'
./controller/supplier/supplier.module
'
;
import
{
ShipperModule
}
from
'
./controller/shipper/shipper.module
'
;
import
{
ShipperGateway
}
from
'
./controller/shipper/shipper.gateway
'
;
import
{
EventEmitter
}
from
'
events
'
;
import
{
PaymentModule
}
from
'
./controller/payment/payment.module
'
;
import
{
PaymentGateway
}
from
'
./controller/payment/payment.gateway
'
;
import
{
UserGateway
}
from
'
./controller/user/user.gateway
'
;
import
{
ShipperBillGateway
}
from
'
./controller/shipper-bill/shipper-bill.gateway
'
;
import
{
ShipperBillModule
}
from
'
./controller/shipper-bill/shipper-bill.module
'
;
EventEmitter
.
defaultMaxListeners
=
1024
;
...
...
@@ -41,6 +38,7 @@ EventEmitter.defaultMaxListeners=1024;
OrderDataModule
,
PaymentModule
,
ItemModule
,
ShipperBillModule
,
],
controllers
:
[],
...
...
@@ -53,6 +51,7 @@ EventEmitter.defaultMaxListeners=1024;
OrderDataGateway
,
PaymentGateway
,
ItemGateway
,
ShipperBillGateway
,
// UserGateway,UserService,HashService
],
...
...
src/controller/item/item.gateway.ts
浏览文件 @
daeb637e
...
...
@@ -35,7 +35,7 @@ export class ItemGateway {
})
console
.
log
(
'
ItemGet
'
,
filter
);
return
new
Promise
((
resolve
,
reject
)
=>
{
le
t
result
=
new
ResultDTO
();
cons
t
result
=
new
ResultDTO
();
this
.
_od
.
Get
(
filter
).
then
(
docs
=>
{
console
.
log
(
"
Finded:
"
,
docs
.
length
);
if
(
docs
){
...
...
@@ -52,8 +52,8 @@ export class ItemGateway {
@
SubscribeMessage
(
'
ItemGetOne
'
)
GetOne
(
client
:
Socket
,
filter
:
any
):
Promise
<
ResultDTO
>
{
console
.
log
(
'
ItemGetOne
'
,
filter
);
return
new
Promise
((
resolve
,
reject
)
=>
{
le
t
result
=
new
ResultDTO
();
return
new
Promise
((
resolve
)
=>
{
cons
t
result
=
new
ResultDTO
();
this
.
_od
.
GetOne
(
filter
).
then
(
doc
=>
{
if
(
doc
){
result
.
ok
=
1
;
...
...
src/controller/shipper-bill/shipper-bill.gateway.ts
0 → 100644
浏览文件 @
daeb637e
import
{
SubscribeMessage
,
WebSocketGateway
}
from
'
@nestjs/websockets
'
;
import
{
Socket
}
from
'
socket.io
'
;
import
{
ResultDTO
}
from
'
src/result.dto
'
;
import
{
ShipperBillService
}
from
'
./shipper-bill.service
'
;
@
WebSocketGateway
({
namespace
:
'
api
'
})
export
class
ShipperBillGateway
{
constructor
(
private
_ShipperBill
:
ShipperBillService
)
{
console
.
log
(
'
ShipperBill gateway readed.
'
);
}
@
SubscribeMessage
(
'
ShipperBillGet
'
)
//@UseGuards(AuthGuard)
Get
(
client
:
Socket
,
filter
:
any
):
Promise
<
ResultDTO
>
{
console
.
log
(
'
ShipperBillGet
'
,
filter
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
result
=
new
ResultDTO
();
this
.
_ShipperBill
.
Get
(
filter
).
then
(
docs
=>
{
console
.
log
(
"
Finded:
"
,
docs
.
length
);
if
(
docs
){
result
.
ok
=
1
;
result
.
msg
=
"
Geted.
"
result
.
count
=
docs
.
length
;
result
.
data
=
docs
resolve
(
result
)
}
})
})
}
@
SubscribeMessage
(
'
ShipperBillGetOne
'
)
GetOne
(
client
:
Socket
,
filter
:
any
):
Promise
<
ResultDTO
>
{
console
.
log
(
'
ShipperBillGetOne
'
,
filter
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
result
=
new
ResultDTO
();
this
.
_ShipperBill
.
GetOne
(
filter
).
then
(
doc
=>
{
if
(
doc
){
result
.
ok
=
1
;
result
.
msg
=
"
Geted.
"
result
.
count
=
1
;
result
.
data
=
doc
resolve
(
result
)
}
})
})
}
@
SubscribeMessage
(
'
ShipperBillAdd
'
)
Add
(
client
:
Socket
,
data
:
any
):
Promise
<
ResultDTO
>
{
console
.
log
(
'
ShipperBillAdd
'
,
data
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
result
=
new
ResultDTO
();
this
.
_ShipperBill
.
Add
(
data
).
then
(
doc
=>
{
if
(
doc
){
result
.
ok
=
1
;
result
.
msg
=
"
Added.
"
result
.
count
=
1
;
result
.
data
=
doc
resolve
(
result
)
}
})
})
}
@
SubscribeMessage
(
'
ShipperBillUpd
'
)
Update
(
client
:
Socket
,
data
:
any
):
Promise
<
ResultDTO
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
result
=
new
ResultDTO
();
result
.
ok
=
1
;
//判断当前用户等级
this
.
_ShipperBill
.
Update
(
data
).
then
(
doc
=>
{
console
.
log
(
'
UPD
'
,
doc
)
result
.
msg
=
'
Upded
'
result
.
data
=
doc
;
resolve
(
result
)
})
})
}
@
SubscribeMessage
(
'
ShipperBillDelete
'
)
Delete
(
client
:
Socket
,
data
:
any
):
Promise
<
ResultDTO
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
result
=
new
ResultDTO
();
result
.
ok
=
1
;
//判断当前用户等级
resolve
(
result
)
})
}
}
src/controller/shipper-bill/shipper-bill.model.ts
0 → 100644
浏览文件 @
daeb637e
import
{
Prop
,
Schema
,
SchemaFactory
}
from
'
@nestjs/mongoose
'
;
import
{
Document
,
Schema
as
mSchame
}
from
'
mongoose
'
;
@
Schema
()
export
class
ShipperBill
extends
Document
{
//_id?:string;
//发货人
@
Prop
({
type
:
mSchame
.
Types
.
ObjectId
,
ref
:
"
Supplier
"
})
supplier
:
string
;
//物流公司
@
Prop
({
type
:
mSchame
.
Types
.
ObjectId
,
ref
:
"
Shipper
"
})
shipper
:
string
;
@
Prop
({
default
:
Date
.
now
})
date
:
Date
;
//运单号
@
Prop
()
no
:
string
;
//箱数
@
Prop
()
box
:
number
//收货
@
Prop
()
got
:
number
//重量
@
Prop
()
weight
:
number
//大小
@
Prop
()
size
:
number
//计费单价
@
Prop
()
price
:
number
//计费方式
@
Prop
()
paytype
:
number
//总金额
@
Prop
()
total
:
number
}
export
const
ShipperBillSchema
=
SchemaFactory
.
createForClass
(
ShipperBill
);
\ No newline at end of file
src/controller/shipper-bill/shipper-bill.module.ts
0 → 100644
浏览文件 @
daeb637e
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
MongooseModule
}
from
'
@nestjs/mongoose
'
;
import
{
ShipperBillSchema
}
from
'
./shipper-bill.model
'
;
import
{
ShipperBillService
}
from
'
./shipper-bill.service
'
;
@
Module
({
imports
:
[
MongooseModule
.
forFeature
([{
name
:
'
ShipperBill
'
,
schema
:
ShipperBillSchema
}])],
controllers
:
[],
providers
:
[
ShipperBillService
],
exports
:[
ShipperBillService
]
})
export
class
ShipperBillModule
{
constructor
(){
console
.
log
(
"
ShipperBill Module.
"
);
}
}
\ No newline at end of file
src/controller/shipper-bill/shipper-bill.service.ts
0 → 100644
浏览文件 @
daeb637e
import
{
Model
}
from
'
mongoose
'
;
import
{
Injectable
,
Inject
}
from
'
@nestjs/common
'
;
import
{
InjectModel
}
from
'
@nestjs/mongoose
'
;
import
{
ShipperBill
}
from
'
./shipper-bill.model
'
;
@
Injectable
()
export
class
ShipperBillService
{
constructor
(
@
InjectModel
(
'
ShipperBill
'
)
public
_model
:
Model
<
ShipperBill
>
,
)
{
console
.
log
(
'
Shipper Service
'
);
}
//创建 Shipper
async
Get
(
filter
:
any
):
Promise
<
ShipperBill
[]
>
{
return
this
.
_model
.
find
(
filter
)
}
async
GetOne
(
filter
:
any
):
Promise
<
ShipperBill
>
{
return
this
.
_model
.
findOne
(
filter
)
}
//创建 Shipper
async
Add
(
theShipper
:
ShipperBill
):
Promise
<
ShipperBill
>
{
//make a Shipper.
const
newItem
=
new
this
.
_model
(
theShipper
);
//set user and limit
return
newItem
.
save
();
}
//Update
async
Update
(
theShipper
:
ShipperBill
):
Promise
<
ShipperBill
>
{
try
{
const
newItem
=
new
this
.
_model
(
theShipper
);
newItem
.
isNew
=
false
;
return
newItem
.
save
()
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
//删除
async
Delete
(
theShipper
:
ShipperBill
):
Promise
<
any
>
{
try
{
return
this
.
_model
.
remove
(
theShipper
)
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录