Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
ff7fc85d
Commit
ff7fc85d
authored
Sep 02, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci:
🎡
增加vscode debug 功能
parent
e41bcde3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
148 additions
and
10 deletions
+148
-10
.gitignore
v2.0/.gitignore
+0
-1
awards.controller.d.ts
v2.0/dist/controller/awards.controller.d.ts
+2
-2
stat.controller.d.ts
v2.0/dist/controller/stat.controller.d.ts
+1
-1
index.d.ts
v2.0/dist/index.d.ts
+2
-2
server_ts_debug.js
v2.0/mockServer/server_ts_debug.js
+107
-0
package.json
v2.0/package.json
+2
-1
tsconfig.json
v2.0/tsconfig.json
+2
-2
yarn.lock
v2.0/yarn.lock
+32
-1
No files found.
v2.0/.gitignore
View file @
ff7fc85d
.tea
.DS_Store
.vscode
debug.log
node_modules
\ No newline at end of file
v2.0/dist/controller/awards.controller.d.ts
View file @
ff7fc85d
...
...
@@ -29,11 +29,11 @@ export default class AwardsController {
/**
* 权益重新领取
*/
receiveEnamePrize
(
context
:
IContext
<
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
AwardsService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{},
true
>>
;
receiveEnamePrize
(
context
:
IContext
<
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
AwardsService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
number
[]
|
object
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{},
true
>>
;
/**
* 概率抽奖
*/
drawLotteryPrize
(
context
:
IContext
<
IParams
>
,
{
userInfo
}:
IControllerInfos
,
[
awardSer
]:
[
AwardsService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{
drawLotteryPrize
(
context
:
IContext
<
IParams
>
,
{
userInfo
}:
IControllerInfos
,
[
awardSer
]:
[
AwardsService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
number
[]
|
object
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{
data
:
{
type
:
number
;
name
:
string
;
...
...
v2.0/dist/controller/stat.controller.d.ts
View file @
ff7fc85d
...
...
@@ -9,5 +9,5 @@ export default class StatController {
/**
* 统计数据
*/
getStats
(
context
:
IContext
<
IStatsParams
>
):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
object
[]
|
number
[]
|
string
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
[],
true
>>
;
getStats
(
context
:
IContext
<
IStatsParams
>
):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
number
[]
|
object
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
[],
true
>>
;
}
v2.0/dist/index.d.ts
View file @
ff7fc85d
...
...
@@ -13,8 +13,8 @@ declare const _default: {
}
>
,
{}:
{},
[
baseService
]:
[
import
(
"./service"
).
BaseService
])
=>
Promise
<
IResult
<
IActivityInfo
>>
;
getMyPrizeList
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IPrizeListParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
IResult
<
IAwards
[]
>>
;
receiveObjectPrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveOjectParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
IResult
<
boolean
>>
;
receiveEnamePrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{},
true
>>
;
receiveEnamePrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
number
[]
|
object
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{},
true
>>
;
doHelp
:
(
context
:
IContext
<
IParams
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
,
accessService
]:
[
import
(
"./service/user.service"
).
default
,
import
(
"./service"
).
TaskService
,
import
(
"./service"
).
AccessService
])
=>
Promise
<
IResult
<
boolean
>>
;
getStats
:
(
context
:
IContext
<
import
(
"./controller/stat.controller"
).
IStatsParams
>
)
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
[],
true
>>
;
getStats
:
(
context
:
IContext
<
import
(
"./controller/stat.controller"
).
IStatsParams
>
)
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
number
[]
|
object
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
[],
true
>>
;
};
export
default
_default
;
v2.0/mockServer/server_ts_debug.js
0 → 100755
View file @
ff7fc85d
/** @format */
var
express
=
require
(
'express'
)
var
bodyParser
=
require
(
'body-parser'
)
var
cookieParser
=
require
(
'cookie-parser'
)
var
{
createProxyMiddleware
}
=
require
(
'http-proxy-middleware'
)
const
routers
=
require
(
'../src/index'
).
default
const
{
port
,
serverProxy
}
=
require
(
'./package.json'
)
var
app
=
express
()
app
.
use
(
cookieParser
())
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
})
)
app
.
use
(
bodyParser
.
json
())
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
res
.
json
({
message
:
`ok`
})
})
// 执行本地云函数方法
app
.
post
(
'/handler'
,
async
(
req
,
res
)
=>
{
console
.
log
(
req
.
body
)
let
{
data
,
openId
,
db
}
=
req
.
body
if
(
!
db
)
{
res
.
json
({
message
:
`参数错误,缺少数据库db`
})
}
if
(
!
openId
)
{
res
.
json
({
message
:
`参数错误,缺少openId`
})
}
try
{
let
query
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
}
catch
(
e
)
{
res
.
json
({
message
:
`查询参数格式错误`
})
}
let
{
handler
,
data
:
queryData
}
=
data
if
(
!
handler
)
{
res
.
json
({
message
:
`格式错误, handler参数不能为空`
})
}
if
(
!
queryData
)
{
res
.
json
({
message
:
`格式错误, data参数不能为空`
})
}
if
(
!
process
.
db
)
{
process
.
db
=
db
}
req
.
context
=
{
openId
,
db
,
env
:
'mock'
,
data
:
queryData
,
handler
}
if
(
routers
[
handler
])
{
let
result
=
await
routers
[
handler
](
req
.
context
)
res
.
json
(
result
)
}
else
{
res
.
json
({
message
:
`函数
${
handler
}
不存在`
})
}
})
// 获取本地export的数据库表及云函数
app
.
get
(
'/getDBHandlers'
,
async
(
req
,
res
)
=>
{
let
dbs
=
require
(
'../dist/db'
)
let
handlers
=
routers
// dbsInfo
let
dbArray
=
[]
let
handlerArray
=
[]
Object
.
keys
(
dbs
).
map
(
v
=>
{
dbArray
.
push
(
dbs
[
v
])
})
Object
.
keys
(
handlers
).
map
(
v
=>
{
handlerArray
.
push
(
v
)
})
console
.
log
(
dbArray
,
handlerArray
)
res
.
json
({
dbs
:
dbArray
,
handlers
:
handlerArray
,
success
:
true
})
})
const
ProxyOption
=
{
target
:
serverProxy
.
target
,
changeOrigin
:
true
,
pathRewrite
:
(
path
,
req
)
=>
{
console
.
log
(
`path`
,
path
)
return
path
.
replace
(
'/proxy'
,
''
)
},
onProxyReq
:
(
proxyReq
,
req
,
res
)
=>
{
console
.
log
(
`req.body`
,
req
.
body
)
if
(
req
.
body
)
{
let
bodyData
=
JSON
.
stringify
(
req
.
body
)
console
.
log
(
`bodyData`
,
bodyData
)
// incase if content-type is application/x-www-form-urlencoded -> we need to change to application/json
proxyReq
.
setHeader
(
'Content-Type'
,
'application/json'
)
proxyReq
.
setHeader
(
'Content-Length'
,
Buffer
.
byteLength
(
bodyData
))
// stream the content
proxyReq
.
write
(
bodyData
)
}
}
}
app
.
use
(
'/proxy'
,
createProxyMiddleware
(
ProxyOption
))
app
.
listen
(
port
||
5555
)
v2.0/package.json
View file @
ff7fc85d
...
...
@@ -30,6 +30,7 @@
"eslint-config-prettier"
:
"^6.11.0"
,
"eslint-plugin-prettier"
:
"^3.1.4"
,
"prettier"
:
"^2.0.5"
,
"typescript"
:
"^3.9.7"
"typescript"
:
"^3.9.7"
,
"ts-node"
:
"^9.0.0"
}
}
v2.0/tsconfig.json
View file @
ff7fc85d
...
...
@@ -11,6 +11,7 @@
"module"
:
"commonjs"
,
"watch"
:
true
,
"moduleResolution"
:
"node"
,
"allowJs"
:
true
,
"isolatedModules"
:
false
,
"declaration"
:
true
,
"experimentalDecorators"
:
true
,
...
...
@@ -19,6 +20,5 @@
},
"include"
:
[
"./src/**/*"
],
"exclude"
:
[
"./src/mockServer/**/*"
]
]
}
\ No newline at end of file
v2.0/yarn.lock
View file @
ff7fc85d
...
...
@@ -186,6 +186,11 @@ ansi-styles@^4.1.0:
"@types/color-name" "^1.1.1"
color-convert "^2.0.1"
arg@^4.1.0:
version "4.1.3"
resolved "https://registry.npm.taobao.org/arg/download/arg-4.1.3.tgz?cache=0&sync_timestamp=1580666454632&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Farg%2Fdownload%2Farg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
integrity sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz?cache=0&sync_timestamp=1597414399705&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fargparse%2Fdownload%2Fargparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
...
...
@@ -328,6 +333,11 @@ deep-is@^0.1.3:
resolved "https://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
diff@^4.0.1:
version "4.0.2"
resolved "https://registry.npm.taobao.org/diff/download/diff-4.0.2.tgz?cache=0&sync_timestamp=1578890988059&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdiff%2Fdownload%2Fdiff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=
doctrine@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/doctrine/download/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
...
...
@@ -662,6 +672,11 @@ lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.20.tgz?cache=0&sync_timestamp=1597336053864&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI=
make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.npm.taobao.org/make-error/download/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
...
...
@@ -810,7 +825,7 @@ slice-ansi@^2.1.0:
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"
source-map-support@^0.5.19:
source-map-support@^0.5.1
7, source-map-support@^0.5.1
9:
version "0.5.19"
resolved "https://registry.npm.taobao.org/source-map-support/download/source-map-support-0.5.19.tgz?cache=0&sync_timestamp=1587719289626&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map-support%2Fdownload%2Fsource-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=
...
...
@@ -899,6 +914,17 @@ text-table@^0.2.0:
resolved "https://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
ts-node@^9.0.0:
version "9.0.0"
resolved "https://registry.npm.taobao.org/ts-node/download/ts-node-9.0.0.tgz?cache=0&sync_timestamp=1598040497631&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fts-node%2Fdownload%2Fts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"
integrity sha1-52mdKhEMyMDTuDFxXkF2iGg0YLM=
dependencies:
arg "^4.1.0"
diff "^4.0.1"
make-error "^1.1.1"
source-map-support "^0.5.17"
yn "3.1.1"
tslib@^1.8.1:
version "1.13.0"
resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.13.0.tgz?cache=0&sync_timestamp=1596752024863&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
...
...
@@ -976,3 +1002,8 @@ xlsx@^0.14.1:
crc-32 "~1.2.0"
exit-on-epipe "~1.0.1"
ssf "~0.10.2"
yn@3.1.1:
version "3.1.1"
resolved "https://registry.npm.taobao.org/yn/download/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
integrity sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment