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
8c713881
Commit
8c713881
authored
Aug 21, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init: ts
parent
1f54aff7
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
641 additions
and
97 deletions
+641
-97
activity.controller.js
server/duiba/controller/activity.controller.js
+4
-4
index.js
server/duibats/dist/config/index.js
+1
-1
index.js.map
server/duibats/dist/config/index.js.map
+1
-1
constants.d.ts
server/duibats/dist/constants.d.ts
+3
-1
constants.js
server/duibats/dist/constants.js
+56
-3
constants.js.map
server/duibats/dist/constants.js.map
+1
-1
save.controller.d.ts
server/duibats/dist/controller/save.controller.d.ts
+5
-9
save.controller.js
server/duibats/dist/controller/save.controller.js
+65
-10
save.controller.js.map
server/duibats/dist/controller/save.controller.js.map
+1
-1
activityconfig.service.d.ts
server/duibats/dist/service/activityconfig.service.d.ts
+9
-3
activityconfig.service.js
server/duibats/dist/service/activityconfig.service.js
+102
-16
activityconfig.service.js.map
server/duibats/dist/service/activityconfig.service.js.map
+1
-1
getSeller.d.ts
server/duibats/dist/utils/getSeller.d.ts
+1
-0
getSeller.js
server/duibats/dist/utils/getSeller.js
+3
-1
getSeller.js.map
server/duibats/dist/utils/getSeller.js.map
+1
-1
saveValidate.js
server/duibats/dist/utils/saveValidate.js
+89
-0
saveValidate.js.map
server/duibats/dist/utils/saveValidate.js.map
+1
-1
request.js
server/duibats/mockServer/sdk/request.js
+1
-1
index.ts
server/duibats/src/config/index.ts
+1
-1
constants.ts
server/duibats/src/constants.ts
+57
-2
save.controller.ts
server/duibats/src/controller/save.controller.ts
+60
-14
activityconfig.service.ts
server/duibats/src/service/activityconfig.service.ts
+79
-19
activity.d.ts
server/duibats/src/typings/activity.d.ts
+5
-3
getSeller.ts
server/duibats/src/utils/getSeller.ts
+5
-3
saveValidate.ts
server/duibats/src/utils/saveValidate.ts
+89
-0
No files found.
server/duiba/controller/activity.controller.js
View file @
8c713881
...
...
@@ -103,12 +103,12 @@ const saveActivityInfoByHasId = async function (context) {
"活动名称不可超过12个字"
);
}
const
taskList
=
Object
.
keys
(
tasks
).
map
(
type
=>
{
const
taskList
=
Object
.
keys
(
tasks
).
map
(
(
type
)
=>
{
return
{
...
tasks
[
type
],
type
}
})
type
,
}
;
})
;
if
(
taskList
.
length
===
0
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"任务配置必须配置一项"
);
}
else
{
...
...
server/duibats/dist/config/index.js
View file @
8c713881
...
...
@@ -10,6 +10,6 @@ var configs = {
};
exports
.
getConfig
=
function
(
context
)
{
var
env
=
context
.
env
;
return
configs
[
env
]
||
configs
.
test
;
return
configs
[
env
]
||
configs
.
online
;
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
server/duibats/dist/config/index.js.map
View file @
8c713881
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mCAA6B;AAC7B,+BAAyB;AAOzB,IAAM,OAAO,GAAG;IACd,MAAM,kBAAA;IACN,IAAI,gBAAA;CACL,CAAA;AAEY,QAAA,SAAS,GAAG,UAAC,OAAgB;IACxC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAA;AACrC,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mCAA6B;AAC7B,+BAAyB;AAOzB,IAAM,OAAO,GAAG;IACd,MAAM,kBAAA;IACN,IAAI,gBAAA;CACL,CAAA;AAEY,QAAA,SAAS,GAAG,UAAC,OAAgB;IACxC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAA;AACvC,CAAC,CAAA"}
\ No newline at end of file
server/duibats/dist/constants.d.ts
View file @
8c713881
...
...
@@ -215,9 +215,10 @@ export declare const errorCode: {
export
declare
const
B_APP_NAME
:
string
;
export
declare
const
GOODSINFO
=
"detail_url,approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sold_quantity"
;
export
declare
const
EIGHT_HOURS
:
number
;
export
declare
const
_48_HOURS
:
number
;
export
declare
const
DELETE_STATUS
:
{
DELETE
:
number
;
EXIST
:
number
;
DELETE
:
number
;
};
export
declare
const
TASK_TYPE_TEXT
:
{
beMembership
:
string
;
...
...
@@ -252,6 +253,7 @@ export declare const TASK_CHECK_TYPE: {
list
:
string
[];
};
};
export
declare
const
PASS_URL_LIST
:
string
[];
export
declare
const
APP_SUB_CODE
:
string
;
export
declare
const
TEMPLATE_INFO
:
{
clients
:
string
;
...
...
server/duibats/dist/constants.js
View file @
8c713881
"use strict"
;
/** @format */
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
TEMPLATE_INFO
=
exports
.
APP_SUB_CODE
=
exports
.
TASK_CHECK_TYPE
=
exports
.
TASK_TYPE_TEXT
=
exports
.
DELETE_STATU
S
=
exports
.
EIGHT_HOURS
=
exports
.
GOODSINFO
=
exports
.
B_APP_NAME
=
exports
.
errorCode
=
exports
.
CODE_TYPES
=
exports
.
PRIZE_TYPE
=
exports
.
LOGGER_TYPE
=
exports
.
DRAW_STATUS
=
exports
.
OPEN_PRIZE_STATUS
=
exports
.
BusinessError
=
void
0
;
exports
.
TEMPLATE_INFO
=
exports
.
APP_SUB_CODE
=
exports
.
PASS_URL_LIST
=
exports
.
TASK_CHECK_TYPE
=
exports
.
TASK_TYPE_TEXT
=
exports
.
DELETE_STATUS
=
exports
.
_48_HOUR
S
=
exports
.
EIGHT_HOURS
=
exports
.
GOODSINFO
=
exports
.
B_APP_NAME
=
exports
.
errorCode
=
exports
.
CODE_TYPES
=
exports
.
PRIZE_TYPE
=
exports
.
LOGGER_TYPE
=
exports
.
DRAW_STATUS
=
exports
.
OPEN_PRIZE_STATUS
=
exports
.
BusinessError
=
void
0
;
var
sdk_1
=
require
(
"./sdk"
);
exports
.
BusinessError
=
{
// 更新重试失败(用于并发更新)
...
...
@@ -162,9 +162,10 @@ exports.errorCode = {
exports
.
B_APP_NAME
=
'promotioncenter-<%=bizCode%>'
;
exports
.
GOODSINFO
=
'detail_url,approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sold_quantity'
;
exports
.
EIGHT_HOURS
=
60
*
60
*
8
*
1000
;
exports
.
_48_HOURS
=
48
*
60
*
60
*
1000
;
exports
.
DELETE_STATUS
=
{
DELETE
:
2
,
EXIST
:
1
EXIST
:
1
,
DELETE
:
2
};
exports
.
TASK_TYPE_TEXT
=
{
beMembership
:
'成为会员'
,
...
...
@@ -206,6 +207,58 @@ exports.TASK_CHECK_TYPE = {
},
link
:
{
list
:
[
'jumpLink'
]
}
};
exports
.
PASS_URL_LIST
=
[
'1688.cn'
,
'1688.com'
,
'alibaba.cn'
,
'alibaba.com'
,
'aliexpress.com'
,
'alimama.cn'
,
'alimama.com'
,
'alipay.com.cn'
,
'alipay.com'
,
'alipay.net'
,
'aliplay.com'
,
'alisoft.cn'
,
'alisoft.com'
,
'aliyun.com'
,
'aliyun.net'
,
'koubei.cn'
,
'koubei.com'
,
'taobao.cn'
,
'taobao.com'
,
'taobao.net'
,
'tb.cn'
,
'tmall.com'
,
'zhifu.com'
,
'zhifubao.com'
,
'juhuasuan.com'
,
'tmall.hk'
,
'tmall.com.hk'
,
'jiyoujia.com'
,
'pailitao.com'
,
'cainiao.com'
,
'dingtalk.com'
,
'yushanfang.com'
,
'guoguo-app.com'
,
'alihealth.cn'
,
'miaostreet.com'
,
'uc123.com'
,
'uc.cn'
,
'ucweb.com'
,
'aliyun-inc.com'
,
'cainiaoyizhan.com'
,
'umeng.com'
,
'aliplus.com'
,
'aliplay.com'
,
'taopiaopiao.com'
,
'youku.com'
,
'tudou.com'
,
'xinlingshou.cn'
,
'fliggy.com'
,
'feizhu.com'
,
'feizhu.cn'
];
//saas订购码 根据需求改变
exports
.
APP_SUB_CODE
=
'FW_GOODS-1001086450'
;
exports
.
TEMPLATE_INFO
=
{
...
...
server/duibats/dist/constants.js.map
View file @
8c713881
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,6BAA0C;AAE7B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,kBAAkB,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,0BAAM;KACnB;IACD,QAAQ;IACR,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,sBAAsB,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,mBAAmB,EAAE;QACnB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,cAAc;IACd,uBAAuB,EAAE;QAC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AAE,CAAC,UAAU,CAAC,EAAE;CAC7B,CAAA;AAED,gBAAgB;AACH,QAAA,YAAY,GAAW,qBAAqB,CAAA;AAE5C,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,gBAAgB;IAC7B,gBAAgB,EAAE,OAAO;CAC1B,CAAA"}
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,6BAA0C;AAE7B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,kBAAkB,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,0BAAM;KACnB;IACD,QAAQ;IACR,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,sBAAsB,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,mBAAmB,EAAE;QACnB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,cAAc;IACd,uBAAuB,EAAE;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,aAAa;KAC1B;IACD,QAAQ;IACR,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;KACpB;IACD,UAAU;IACV,yBAAyB,EAAE;QACzB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,4CAAS;KACtB;IACD,QAAQ;IACR,mBAAmB,EAAE;QACnB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,UAAU;IACV,oBAAoB,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,4CAAS;KACtB;IACD,uBAAuB,EAAE;QACvB,IAAI,EA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IACf,UAAU;IACV,cAAc;IACd,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,WAAW;CACZ,CAAA;AAED,gBAAgB;AACH,QAAA,YAAY,GAAW,qBAAqB,CAAA;AAE5C,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,gBAAgB;IAC7B,gBAAgB,EAAE,OAAO;CAC1B,CAAA"}
\ No newline at end of file
server/duibats/dist/controller/save.controller.d.ts
View file @
8c713881
/** @format */
import
{
ActivityconfigService
}
from
'../service'
;
interface
ISavePrizeParams
{
prizeList
?:
Array
<
IActivityPrize
>
;
}
interface
ISaveActivityContext
extends
Context
{
data
:
{
activityId
?:
string
;
title
:
string
;
startTime
:
number
;
endTime
:
number
;
tasks
:
ITasks
;
rule
:
string
;
};
data
:
IActivityBaseInfo
&
ISavePrizeParams
;
}
export
default
class
ActivitSaveController
{
/**
* 保存活动
*/
saveActivityInfo
(
context
:
ISaveActivityContext
,
{}:
{},
[
activityconfigService
]:
[
ActivityconfigService
]):
Promise
<
void
>
;
saveActivityInfo
(
context
:
ISaveActivityContext
,
{}:
{},
[
activityconfigService
]:
[
ActivityconfigService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
>
;
}
export
{};
server/duibats/dist/controller/save.controller.js
View file @
8c713881
...
...
@@ -45,8 +45,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if
(
op
[
0
]
&
5
)
throw
op
[
1
];
return
{
value
:
op
[
0
]
?
op
[
1
]
:
void
0
,
done
:
true
};
}
};
var
__spreadArrays
=
(
this
&&
this
.
__spreadArrays
)
||
function
()
{
for
(
var
s
=
0
,
i
=
0
,
il
=
arguments
.
length
;
i
<
il
;
i
++
)
s
+=
arguments
[
i
].
length
;
for
(
var
r
=
Array
(
s
),
k
=
0
,
i
=
0
;
i
<
il
;
i
++
)
for
(
var
a
=
arguments
[
i
],
j
=
0
,
jl
=
a
.
length
;
j
<
jl
;
j
++
,
k
++
)
r
[
k
]
=
a
[
j
];
return
r
;
};
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
constants_1
=
require
(
"./../constants"
);
var
decorator_1
=
require
(
"../decorator"
);
var
sdk_1
=
require
(
"../sdk"
);
var
service_1
=
require
(
"../service"
);
var
saveValidate_1
=
require
(
"../utils/saveValidate"
);
var
ActivitSaveController
=
/** @class */
(
function
()
{
...
...
@@ -59,18 +68,64 @@ var ActivitSaveController = /** @class */ (function () {
ActivitSaveController
.
prototype
.
saveActivityInfo
=
function
(
context
,
_a
,
_b
)
{
var
activityconfigService
=
_b
[
0
];
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
_c
,
_d
,
title
,
_e
,
activityId
,
startTime
,
endTime
,
_f
,
tasks
,
rule
,
nowTime
,
initialData
;
return
__generator
(
this
,
function
(
_
g
)
{
switch
(
_
g
.
label
)
{
var
_c
,
_d
,
title
,
_e
,
activityId
,
startTime
,
endTime
,
_f
,
tasks
,
rule
,
prizeList
,
openId
,
baseData
,
allPrizeList
,
result
,
result
,
_g
,
bothIds
,
deleteIds
;
return
__generator
(
this
,
function
(
_
h
)
{
switch
(
_
h
.
label
)
{
case
0
:
_c
=
context
.
data
,
_d
=
_c
.
title
,
title
=
_d
===
void
0
?
''
:
_d
,
_e
=
_c
.
activityId
,
activityId
=
_e
===
void
0
?
''
:
_e
,
startTime
=
_c
.
startTime
,
endTime
=
_c
.
endTime
,
_f
=
_c
.
tasks
,
tasks
=
_f
===
void
0
?
{}
:
_f
,
rule
=
_c
.
rule
;
nowTime
=
Date
.
now
();
if
(
!
activityId
)
return
[
3
/*break*/
,
2
];
return
[
4
/*yield*/
,
activityconfigService
.
getActivityInfoByActivityId
(
activityId
)];
_c
=
context
.
data
,
_d
=
_c
.
title
,
title
=
_d
===
void
0
?
''
:
_d
,
_e
=
_c
.
activityId
,
activityId
=
_e
===
void
0
?
''
:
_e
,
startTime
=
_c
.
startTime
,
endTime
=
_c
.
endTime
,
_f
=
_c
.
tasks
,
tasks
=
_f
===
void
0
?
{}
:
_f
,
rule
=
_c
.
rule
,
prizeList
=
_c
.
prizeList
;
openId
=
context
.
openId
;
baseData
=
{
title
:
title
,
startTime
:
startTime
,
endTime
:
endTime
,
rule
:
rule
,
openId
:
openId
,
tasks
:
tasks
,
// 奖品过期时间, 根据需求领奖是否有过期时间
awardReceiveExpiredTime
:
endTime
+
constants_1
.
_48_HOURS
};
allPrizeList
=
__spreadArrays
(
prizeList
);
if
(
!!
activityId
)
return
[
3
/*break*/
,
2
];
return
[
4
/*yield*/
,
activityconfigService
.
saveNewActivity
(
baseData
,
allPrizeList
,
openId
)];
case
1
:
initialData
=
_g
.
sent
();
_g
.
label
=
2
;
case
2
:
return
[
2
/*return*/
];
result
=
_h
.
sent
();
if
(
result
||
result
===
0
)
{
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
true
)];
}
else
{
console
.
log
(
result
,
'保存活动失败'
);
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
SYSTEM_ERROR
,
'保存活动失败'
)];
}
return
[
3
/*break*/
,
7
];
case
2
:
return
[
4
/*yield*/
,
activityconfigService
.
updateBaseConfigInfo
(
activityId
,
baseData
)
// 找到更新的和删除的奖品id
];
case
3
:
result
=
_h
.
sent
();
return
[
4
/*yield*/
,
activityconfigService
.
diffPrizeList
(
activityId
,
allPrizeList
)
// 将删除的奖品逻辑删除
];
case
4
:
_g
=
_h
.
sent
(),
bothIds
=
_g
.
bothIds
,
deleteIds
=
_g
.
deleteIds
;
return
[
4
/*yield*/
,
activityconfigService
.
deletePrizeByIds
(
deleteIds
)
// 添加和更新奖品
];
case
5
:
// 将删除的奖品逻辑删除
result
=
_h
.
sent
();
return
[
4
/*yield*/
,
activityconfigService
.
insertAndUpdatePrize
(
activityId
,
allPrizeList
,
bothIds
)];
case
6
:
// 添加和更新奖品
result
=
_h
.
sent
();
if
(
result
||
result
===
0
)
{
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
true
)];
}
else
{
console
.
log
(
result
,
'保存活动失败'
);
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
SYSTEM_ERROR
,
'保存活动失败'
)];
}
_h
.
label
=
7
;
case
7
:
return
[
2
/*return*/
];
}
});
});
...
...
server/duibats/dist/controller/save.controller.js.map
View file @
8c713881
{"version":3,"file":"save.controller.js","sourceRoot":"","sources":["../../src/controller/save.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGd,0CAAoE;AAEpE,sCAAkD;AAClD,sDAAkD;AAYlD;IAAA;IAiBA,CAAC;IAhBC;;OAEG;IACH,mEAAmE;IAG7D,gDAAgB,GAAtB,UAAuB,OAA6B,EAAE,EAAE,EAAE,EAAgD;YAA/C,qBAAqB,QAAA;;;;;;wBACxE,KAAwE,OAAO,CAAC,IAAI,EAAlF,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA,EAAE,SAAS,eAAA,EAAE,OAAO,aAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,IAAI,UAAA,CAAiB;wBAEpF,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;6BAGtB,UAAU,EAAV,wBAAU;wBACE,qBAAM,qBAAqB,CAAC,2BAA2B,CAAC,UAAU,CAAC,EAAA;;wBAAjF,WAAW,GAAG,SAAmE,CAAA;;;;;;KAEpF;IATD;QAFC,0BAAc,CAAC,yBAAU,CAAC;QAC1B,oBAAQ,CAAC,CAAC,+BAAqB,CAAC,CAAC;;;;iEAUjC;IACH,4BAAC;CAAA,AAjBD,IAiBC;kBAjBoB,qBAAqB"}
\ No newline at end of file
{"version":3,"file":"save.controller.js","sourceRoot":"","sources":["../../src/controller/save.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAAsD;AACtD,0CAAoE;AACpE,8BAAqC;AACrC,sCAAkD;AAClD,sDAAkD;AAgBlD;IAAA;IA2DA,CAAC;IA1DC;;OAEG;IACH,mEAAmE;IAG7D,gDAAgB,GAAtB,UAAuB,OAA6B,EAAE,EAAE,EAAE,EAAgD;YAA/C,qBAAqB,QAAA;;;;;;wBACxE,KAAmF,OAAO,CAAC,IAAI,EAA7F,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA,EAAE,SAAS,eAAA,EAAE,OAAO,aAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,IAAI,UAAA,EAAE,SAAS,eAAA,CAAiB;wBAC7F,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAGpB,QAAQ,GAAsB;4BAClC,KAAK,OAAA;4BACL,SAAS,WAAA;4BACT,OAAO,SAAA;4BACP,IAAI,MAAA;4BACJ,MAAM,QAAA;4BACN,KAAK,OAAA;4BACL,wBAAwB;4BACxB,uBAAuB,EAAE,OAAO,GAAG,qBAAS;yBAC7C,CAAA;wBAGK,YAAY,kBAA8B,SAAS,CAAC,CAAA;6BAGtD,CAAC,UAAU,EAAX,wBAAW;wBAEE,qBAAM,qBAAqB,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,EAAA;;wBAApF,MAAM,GAAG,SAA2E;wBAC1F,IAAI,MAAM,IAAI,MAAM,KAAK,CAAC,E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ist/service/activityconfig.service.d.ts
View file @
8c713881
...
...
@@ -3,13 +3,19 @@ export default class ActivityConfigService {
activityconfigDao
:
IBaseDao
;
activityconfigPrizeDao
:
IBaseDao
;
constructor
(
context
:
Context
);
saveNewActivity
(
data
:
any
,
prize
:
any
,
openId
:
any
):
Promise
<
any
>
;
updateBaseConfigInfo
(
id
:
any
,
data
:
any
):
Promise
<
any
>
;
saveNewActivity
(
baseConfig
:
IActivityBaseInfo
,
prize
:
Array
<
IActivityPrize
>
,
openId
:
string
):
Promise
<
any
>
;
updateBaseConfigInfo
(
id
:
string
,
data
:
IActivityBaseInfo
):
Promise
<
any
>
;
getPrizeInfoById
(
id
:
any
):
Promise
<
any
>
;
updateDeleteStatusById
(
id
:
any
):
Promise
<
any
>
;
deletePrizeByIds
(
ids
:
string
[]):
Promise
<
any
>
;
insertAndUpdatePrize
(
activityId
:
string
,
allPrizeList
:
Array
<
IActivityPrize
>
,
bothIds
:
string
[]):
Promise
<
any
>
;
updateOnePrizeById
(
id
:
any
,
data
:
any
):
Promise
<
any
>
;
insertPrizeByActivityId
(
activityId
:
any
,
data
:
any
):
Promise
<
any
>
;
getAllOldPrizeList
(
activityId
:
any
):
Promise
<
any
>
;
getAllOldPrizeList
(
activityId
:
string
):
Promise
<
any
>
;
diffPrizeList
(
activityId
:
string
,
pirzeList
:
Array
<
IActivityPrize
>
):
Promise
<
{
deleteIds
:
string
[];
bothIds
:
string
[];
}
>
;
updateActivity
(
activityId
:
any
,
data
:
any
,
prizeNoId
:
any
):
Promise
<
[
unknown
,
unknown
,
unknown
,
unknown
,
unknown
,
unknown
,
unknown
,
unknown
,
unknown
,
unknown
]
>
;
getActivityListByOpenId
(
openId
:
string
,
{
pageSize
,
pageNo
}:
{
pageSize
?:
number
;
...
...
server/duibats/dist/service/activityconfig.service.js
View file @
8c713881
...
...
@@ -64,14 +64,14 @@ var ActivityConfigService = /** @class */ (function () {
this
.
activityconfigPrizeDao
=
new
sdk_1
.
BaseDao
(
context
,
db_1
.
PRIZE_CONFIG_DB_NAME
);
}
//保存新建活动
ActivityConfigService
.
prototype
.
saveNewActivity
=
function
(
data
,
prize
,
openId
)
{
ActivityConfigService
.
prototype
.
saveNewActivity
=
function
(
baseConfig
,
prize
,
openId
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
result_1
,
e_1
,
e_2
;
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
_a
.
trys
.
push
([
0
,
7
,
,
8
]);
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
count
(
__assign
(
__assign
({},
data
),
{
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
,
openPrizeStatus
:
constants_1
.
OPEN_PRIZE_STATUS
.
WAIT_AWARD
}))];
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
insertOne
(
__assign
(
__assign
({},
baseConfig
),
{
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
,
openPrizeStatus
:
constants_1
.
OPEN_PRIZE_STATUS
.
WAIT_AWARD
}))];
case
1
:
result_1
=
_a
.
sent
();
console
.
log
(
result_1
,
'保存基础配置result'
);
...
...
@@ -79,13 +79,8 @@ var ActivityConfigService = /** @class */ (function () {
_a
.
label
=
2
;
case
2
:
_a
.
trys
.
push
([
2
,
4
,
,
6
]);
prize
.
map
(
function
(
item
)
{
item
.
activityId
=
result_1
;
item
.
openId
=
openId
;
item
.
createTime
=
Date
.
now
();
item
.
updateTime
=
Date
.
now
();
item
.
deleteStatus
=
constants_1
.
DELETE_STATUS
.
EXIST
;
return
item
;
prize
=
prize
.
map
(
function
(
item
)
{
return
__assign
(
__assign
({},
item
),
{
activityId
:
result_1
,
openId
:
openId
,
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
});
});
return
[
4
/*yield*/
,
this
.
activityconfigPrizeDao
.
insertMany
(
prize
)];
case
3
:
return
[
2
/*return*/
,
_a
.
sent
()];
...
...
@@ -116,9 +111,7 @@ var ActivityConfigService = /** @class */ (function () {
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
update
({
_id
:
id
},
{
case
0
:
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
update
({
_id
:
id
},
{
$set
:
__assign
(
__assign
({},
data
),
{
updateTime
:
Date
.
now
(),
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
})
})];
case
1
:
return
[
2
/*return*/
,
_a
.
sent
()];
...
...
@@ -162,6 +155,60 @@ var ActivityConfigService = /** @class */ (function () {
});
});
};
ActivityConfigService
.
prototype
.
deletePrizeByIds
=
function
(
ids
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
result
,
i
;
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
i
=
0
;
_a
.
label
=
1
;
case
1
:
if
(
!
(
i
<
ids
.
length
))
return
[
3
/*break*/
,
4
];
return
[
4
/*yield*/
,
this
.
updateDeleteStatusById
(
ids
[
i
])];
case
2
:
result
=
_a
.
sent
();
_a
.
label
=
3
;
case
3
:
i
++
;
return
[
3
/*break*/
,
1
];
case
4
:
return
[
2
/*return*/
,
result
];
}
});
});
};
ActivityConfigService
.
prototype
.
insertAndUpdatePrize
=
function
(
activityId
,
allPrizeList
,
bothIds
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
result
,
i
,
isNewPrize
,
isEditPrize
;
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
i
=
0
;
_a
.
label
=
1
;
case
1
:
if
(
!
(
i
<
allPrizeList
.
length
))
return
[
3
/*break*/
,
7
];
isNewPrize
=
!
allPrizeList
[
i
].
_id
;
if
(
!
isNewPrize
)
return
[
3
/*break*/
,
3
];
return
[
4
/*yield*/
,
this
.
insertPrizeByActivityId
(
activityId
,
allPrizeList
[
i
])];
case
2
:
result
=
_a
.
sent
();
_a
.
label
=
3
;
case
3
:
isEditPrize
=
bothIds
.
includes
(
allPrizeList
[
i
].
_id
);
if
(
!
isEditPrize
)
return
[
3
/*break*/
,
5
];
return
[
4
/*yield*/
,
this
.
updateOnePrizeById
(
allPrizeList
[
i
].
_id
,
allPrizeList
[
i
])];
case
4
:
result
=
_a
.
sent
();
_a
.
label
=
5
;
case
5
:
return
[
2
/*return*/
,
result
];
case
6
:
i
++
;
return
[
3
/*break*/
,
1
];
case
7
:
return
[
2
/*return*/
];
}
});
});
};
// 更新单条数据
ActivityConfigService
.
prototype
.
updateOnePrizeById
=
function
(
id
,
data
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
...
...
@@ -193,14 +240,50 @@ var ActivityConfigService = /** @class */ (function () {
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
return
[
4
/*yield*/
,
this
.
activityconfigPrizeDao
.
find
({
activityId
:
activityId
})];
case
0
:
return
[
4
/*yield*/
,
this
.
activityconfigPrizeDao
.
find
({
activityId
:
activityId
})];
case
1
:
return
[
2
/*return*/
,
_a
.
sent
()];
}
});
});
};
// 编辑活动时, 对比新旧奖品配置, 找出删除的id和更新的id
ActivityConfigService
.
prototype
.
diffPrizeList
=
function
(
activityId
,
pirzeList
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
function
getIds
(
pirzeList
)
{
return
pirzeList
.
reduce
(
function
(
s
,
v
)
{
if
(
v
.
_id
)
{
s
=
__spreadArrays
(
s
,
[
v
.
_id
]);
}
return
s
;
},
[]);
}
var
allNewIds
,
oldPrizeList
,
oldIds
,
deleteIds
,
bothIds
;
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
allNewIds
=
getIds
(
pirzeList
);
return
[
4
/*yield*/
,
this
.
getAllOldPrizeList
(
activityId
)];
case
1
:
oldPrizeList
=
_a
.
sent
();
oldIds
=
getIds
(
oldPrizeList
);
deleteIds
=
[];
bothIds
=
oldIds
.
reduce
(
function
(
s
,
i
)
{
if
(
allNewIds
.
includes
(
i
))
{
s
=
__spreadArrays
(
s
,
[
i
]);
}
else
{
deleteIds
.
push
(
i
);
}
return
s
;
},
[]);
return
[
2
/*return*/
,
{
deleteIds
:
deleteIds
,
bothIds
:
bothIds
}];
}
});
});
};
//更新活动配置
ActivityConfigService
.
prototype
.
updateActivity
=
function
(
activityId
,
data
,
prizeNoId
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
...
...
@@ -315,7 +398,10 @@ var ActivityConfigService = /** @class */ (function () {
switch
(
_b
.
label
)
{
case
0
:
_a
=
{};
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
findOne
({
_id
:
activityId
,
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
})];
return
[
4
/*yield*/
,
this
.
activityconfigDao
.
findOne
({
_id
:
activityId
,
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
})];
case
1
:
_a
.
baseConfig
=
_b
.
sent
();
return
[
4
/*yield*/
,
this
.
activityconfigPrizeDao
.
find
({
activityId
:
activityId
,
deleteStatus
:
constants_1
.
DELETE_STATUS
.
EXIST
},
{
sort
:
{
level
:
1
}
})];
...
...
server/duibats/dist/service/activityconfig.service.js.map
View file @
8c713881
This diff is collapsed.
Click to expand it.
server/duibats/dist/utils/getSeller.d.ts
View file @
8c713881
/** @format */
export
declare
const
getConsumerSeller
:
({
accessToken
,
openId
}:
{
accessToken
:
any
;
openId
:
any
;
...
...
server/duibats/dist/utils/getSeller.js
View file @
8c713881
"use strict"
;
/** @format */
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
getConsumerSeller
=
void
0
;
exports
.
getConsumerSeller
=
function
(
_a
)
{
...
...
@@ -8,7 +9,8 @@ exports.getConsumerSeller = function (_a) {
open_id
:
openId
,
// 'appkey': appKey,
// 'appsecret': secret,
session
:
accessToken
,
session
:
accessToken
// REST_URL: 'http://gw.api.taobao.com/router/rest'
};
};
//# sourceMappingURL=getSeller.js.map
\ No newline at end of file
server/duibats/dist/utils/getSeller.js.map
View file @
8c713881
{"version":3,"file":"getSeller.js","sourceRoot":"","sources":["../../src/utils/getSeller.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,UAAC,EAAuB;QAArB,WAAW,iBAAA,EAAE,MAAM,YAAA;IACrD,OAAO;QACL,4DAA4D;QAC5D,OAAO,EAAE,MAAM;QACf,oBAAoB;QACpB,uBAAuB;QACvB,OAAO,EAAE,WAAW;KAErB,CAAC;AACJ,CAAC,CAAC"}
\ No newline at end of file
{"version":3,"file":"getSeller.js","sourceRoot":"","sources":["../../src/utils/getSeller.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAED,QAAA,iBAAiB,GAAG,UAAC,EAAuB;QAArB,WAAW,iBAAA,EAAE,MAAM,YAAA;IACrD,OAAO;QACL,4DAA4D;QAC5D,OAAO,EAAE,MAAM;QACf,oBAAoB;QACpB,uBAAuB;QACvB,OAAO,EAAE,WAAW;QACpB,mDAAmD;KACpD,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
server/duibats/dist/utils/saveValidate.js
View file @
8c713881
...
...
@@ -13,6 +13,7 @@ var __assign = (this && this.__assign) || function () {
};
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
saveParams
=
void
0
;
var
constants_1
=
require
(
"../constants"
);
exports
.
saveParams
=
{
title
:
{
required
:
true
,
...
...
@@ -59,7 +60,95 @@ exports.saveParams = {
if
(
taskList
.
length
===
0
)
return
new
Error
(
'任务配置必须配置一项'
);
var
canPassTask
=
{
status
:
true
,
message
:
''
};
taskList
.
forEach
(
function
(
i
)
{
if
(
!
i
.
type
)
{
canPassTask
=
{
status
:
false
,
message
:
'任务必须配置'
};
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
link
.
list
.
includes
(
i
.
type
))
{
if
(
canPassTask
.
status
)
{
canPassTask
=
urlCheck
(
i
.
link
,
constants_1
.
PASS_URL_LIST
);
}
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
itemIds
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
itemIds
)
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'必须配置'
};
}
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
value
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
value
)
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务值必须配置'
};
}
if
(
!
constants_1
.
TASK_CHECK_TYPE
.
value
.
reg
.
test
(
i
.
value
))
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务值在'
+
constants_1
.
TASK_CHECK_TYPE
.
value
.
regName
};
}
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
times
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
times
)
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务次数必须配置'
};
}
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
title
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
title
)
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务标题必须配置'
};
}
}
if
(
constants_1
.
TASK_CHECK_TYPE
.
taskRateType
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
taskRateType
)
{
canPassTask
=
{
status
:
false
,
message
:
constants_1
.
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务类型必须配置'
};
}
}
i
.
value
=
+
i
.
value
;
i
.
times
=
+
i
.
times
||
''
;
i
.
taskRateType
=
+
i
.
taskRateType
||
''
;
return
i
;
});
if
(
!
canPassTask
.
status
)
return
new
Error
(
canPassTask
.
message
);
return
cb
();
}
}
};
var
urlCheck
=
function
(
link
,
passUrlList
)
{
if
(
!
link
.
startsWith
(
'http://'
)
&&
!
link
.
startsWith
(
'https://'
))
{
return
{
status
:
false
,
message
:
'页面链接必须以https://或http://开头'
};
}
var
passUrl
=
false
;
passUrlList
.
some
(
function
(
i
)
{
if
(
~
link
.
indexOf
(
i
))
{
passUrl
=
true
;
return
true
;
}
return
false
;
});
if
(
!
passUrl
)
return
{
status
:
false
,
message
:
'域名校验不通过'
};
return
{
status
:
true
,
message
:
''
};
};
//# sourceMappingURL=saveValidate.js.map
\ No newline at end of file
server/duibats/dist/utils/saveValidate.js.map
View file @
8c713881
{"version":3,"file":"saveValidate.js","sourceRoot":"","sources":["../../src/utils/saveValidate.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;AAID,QAAA,UAAU,GAAU;IAC/B,KAAK,EAAE;QACL,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,QAAQ;QACd,SAAS,YAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM;YAC/B,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;YACpB,IAAI,CAAC,KAAK;gBAAE,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAA;YACtC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;gBAAE,OAAO,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;YACvD,OAAO,EAAE,EAAE,CAAA;QACb,CAAC;KACF;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,UAAU;KACpB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,IAAI;QACd,SAAS,YAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM;YACvB,IAAA,OAAO,GAAiB,MAAM,Q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CAAC,KAAK,IAAI,EAAE,CAAA;gBACxB,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAA;gBACtC,OAAO,CAAC,CAAA;YACV,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,WAAW,CAAC,MAAM;gBAAE,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;YAC9D,OAAO,EAAE,EAAE,CAAA;QACb,CAAC;KACF;CACF,CAAA;AAED,IAAM,QAAQ,GAAG,UAAC,IAAY,EAAE,WAAqB;IACnD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAA;KAC/D;IACD,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,WAAW,CAAC,IAAI,CAAC,UAAA,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACpB,OAAO,GAAG,IAAI,CAAA;YACd,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,OAAO;QACV,OAAO;YACL,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,SAAS;SACnB,CAAA;IACH,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE;KACZ,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
server/duibats/mockServer/sdk/request.js
View file @
8c713881
...
...
@@ -11,7 +11,7 @@ const request = async (path, params) => {
})
if
(
!
res
.
data
.
data
)
{
console
.
log
(
`调用
${
path
}${
JSON
.
stringify
(
params
)}
\n返回结果`
,
res
.
data
)
return
false
return
res
.
data
}
return
res
.
data
.
data
}
...
...
server/duibats/src/config/index.ts
View file @
8c713881
...
...
@@ -15,5 +15,5 @@ const configs = {
export
const
getConfig
=
(
context
:
Context
):
Iconfig
=>
{
const
env
=
context
.
env
return
configs
[
env
]
||
configs
.
test
return
configs
[
env
]
||
configs
.
online
}
server/duibats/src/constants.ts
View file @
8c713881
...
...
@@ -170,9 +170,11 @@ export const GOODSINFO =
export
const
EIGHT_HOURS
=
60
*
60
*
8
*
1000
export
const
_48_HOURS
=
48
*
60
*
60
*
1000
export
const
DELETE_STATUS
=
{
DELETE
:
2
,
EXIST
:
1
EXIST
:
1
,
DELETE
:
2
}
export
const
TASK_TYPE_TEXT
=
{
...
...
@@ -217,6 +219,59 @@ export const TASK_CHECK_TYPE = {
link
:
{
list
:
[
'jumpLink'
]
}
}
export
const
PASS_URL_LIST
:
string
[]
=
[
'1688.cn'
,
'1688.com'
,
'alibaba.cn'
,
'alibaba.com'
,
'aliexpress.com'
,
'alimama.cn'
,
'alimama.com'
,
'alipay.com.cn'
,
'alipay.com'
,
'alipay.net'
,
'aliplay.com'
,
'alisoft.cn'
,
'alisoft.com'
,
'aliyun.com'
,
'aliyun.net'
,
'koubei.cn'
,
'koubei.com'
,
'taobao.cn'
,
'taobao.com'
,
'taobao.net'
,
'tb.cn'
,
'tmall.com'
,
'zhifu.com'
,
'zhifubao.com'
,
'juhuasuan.com'
,
'tmall.hk'
,
'tmall.com.hk'
,
'jiyoujia.com'
,
'pailitao.com'
,
'cainiao.com'
,
'dingtalk.com'
,
'yushanfang.com'
,
'guoguo-app.com'
,
'alihealth.cn'
,
'miaostreet.com'
,
'uc123.com'
,
'uc.cn'
,
'ucweb.com'
,
'aliyun-inc.com'
,
'cainiaoyizhan.com'
,
'umeng.com'
,
'aliplus.com'
,
'aliplay.com'
,
'taopiaopiao.com'
,
'youku.com'
,
'tudou.com'
,
'xinlingshou.cn'
,
'fliggy.com'
,
'feizhu.com'
,
'feizhu.cn'
]
//saas订购码 根据需求改变
export
const
APP_SUB_CODE
:
string
=
'FW_GOODS-1001086450'
...
...
server/duibats/src/controller/save.controller.ts
View file @
8c713881
/** @format */
import
{
CODE_TYPES
}
from
'./../constants'
import
{
CODE_TYPES
,
_48_HOURS
}
from
'./../constants'
import
{
services
,
paramsCheck
,
paramsValidate
}
from
'../decorator'
import
{
resultsModel
}
from
'../sdk'
import
{
ActivityconfigService
}
from
'../service'
import
{
saveParams
}
from
'../utils/saveValidate'
// 奖品参数
interface
ISavePrizeParams
{
prizeList
?:
Array
<
IActivityPrize
>
}
// interface IActivityInfo {
// baseConfig: IActivityBaseInfo
// prizeConfig: Array<IActivityPrize>
// }
interface
ISaveActivityContext
extends
Context
{
data
:
{
activityId
?:
string
title
:
string
startTime
:
number
endTime
:
number
tasks
:
ITasks
rule
:
string
}
data
:
IActivityBaseInfo
&
ISavePrizeParams
}
export
default
class
ActivitSaveController
{
...
...
@@ -24,13 +28,55 @@ export default class ActivitSaveController {
@
paramsValidate
(
saveParams
)
@
services
([
ActivityconfigService
])
async
saveActivityInfo
(
context
:
ISaveActivityContext
,
{},
[
activityconfigService
]:
[
ActivityconfigService
])
{
const
{
title
=
''
,
activityId
=
''
,
startTime
,
endTime
,
tasks
=
{},
rule
}
=
context
.
data
const
{
title
=
''
,
activityId
=
''
,
startTime
,
endTime
,
tasks
=
{},
rule
,
prizeList
}
=
context
.
data
const
{
openId
}
=
context
// 存在b_activity_config表里属于基础配置
const
baseData
:
IActivityBaseInfo
=
{
title
,
startTime
,
endTime
,
rule
,
openId
,
tasks
,
// 奖品过期时间, 根据需求领奖是否有过期时间
awardReceiveExpiredTime
:
endTime
+
_48_HOURS
}
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到allPrizeLists里
const
allPrizeList
:
Array
<
IActivityPrize
>
=
[...
prizeList
]
// 保存新活动
if
(
!
activityId
)
{
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到prizeList里
const
result
=
await
activityconfigService
.
saveNewActivity
(
baseData
,
allPrizeList
,
openId
)
if
(
result
||
result
===
0
)
{
return
resultsModel
.
success
(
true
)
}
else
{
console
.
log
(
result
,
'保存活动失败'
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'保存活动失败'
)
}
}
// 有activityId 属于修改活动
else
{
// 更新b_activity_config基础信息
let
result
=
await
activityconfigService
.
updateBaseConfigInfo
(
activityId
,
baseData
)
// 找到更新的和删除的奖品id
const
{
bothIds
,
deleteIds
}
=
await
activityconfigService
.
diffPrizeList
(
activityId
,
allPrizeList
)
// 将删除的奖品逻辑删除
result
=
await
activityconfigService
.
deletePrizeByIds
(
deleteIds
)
const
nowTime
=
Date
.
now
()
// 添加和更新奖品
result
=
await
activityconfigService
.
insertAndUpdatePrize
(
activityId
,
allPrizeList
,
bothIds
)
let
initialData
if
(
activityId
)
{
initialData
=
await
activityconfigService
.
getActivityInfoByActivityId
(
activityId
)
if
(
result
||
result
===
0
)
{
return
resultsModel
.
success
(
true
)
}
else
{
console
.
log
(
result
,
'保存活动失败'
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'保存活动失败'
)
}
}
}
}
server/duibats/src/service/activityconfig.service.ts
View file @
8c713881
...
...
@@ -14,10 +14,10 @@ export default class ActivityConfigService {
}
//保存新建活动
async
saveNewActivity
(
data
,
prize
,
openId
)
{
async
saveNewActivity
(
baseConfig
:
IActivityBaseInfo
,
prize
:
Array
<
IActivityPrize
>
,
openId
:
string
)
{
try
{
let
result
=
await
this
.
activityconfigDao
.
count
({
...
data
,
let
result
=
await
this
.
activityconfigDao
.
insertOne
({
...
baseConfig
,
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
DELETE_STATUS
.
EXIST
,
...
...
@@ -26,13 +26,15 @@ export default class ActivityConfigService {
console
.
log
(
result
,
'保存基础配置result'
)
if
(
result
)
{
try
{
prize
.
map
(
item
=>
{
item
.
activityId
=
result
item
.
openId
=
openId
item
.
createTime
=
Date
.
now
()
item
.
updateTime
=
Date
.
now
()
item
.
deleteStatus
=
DELETE_STATUS
.
EXIST
return
item
prize
=
prize
.
map
(
item
=>
{
return
{
...
item
,
activityId
:
result
,
openId
,
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
DELETE_STATUS
.
EXIST
}
})
return
await
this
.
activityconfigPrizeDao
.
insertMany
(
prize
)
}
catch
(
e
)
{
...
...
@@ -50,11 +52,9 @@ export default class ActivityConfigService {
}
// 更新活动基本信息
async
updateBaseConfigInfo
(
id
,
data
)
{
async
updateBaseConfigInfo
(
id
:
string
,
data
:
IActivityBaseInfo
)
{
return
await
this
.
activityconfigDao
.
update
(
{
_id
:
id
},
{
_id
:
id
},
{
$set
:
{
...
data
,
...
...
@@ -90,6 +90,32 @@ export default class ActivityConfigService {
)
}
async
deletePrizeByIds
(
ids
:
string
[])
{
let
result
:
any
for
(
let
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
result
=
await
this
.
updateDeleteStatusById
(
ids
[
i
])
}
return
result
}
async
insertAndUpdatePrize
(
activityId
:
string
,
allPrizeList
:
Array
<
IActivityPrize
>
,
bothIds
:
string
[])
{
let
result
:
any
for
(
let
i
=
0
;
i
<
allPrizeList
.
length
;
i
++
)
{
// 新奖品
const
isNewPrize
=
!
allPrizeList
[
i
].
_id
if
(
isNewPrize
)
{
result
=
await
this
.
insertPrizeByActivityId
(
activityId
,
allPrizeList
[
i
])
}
// 更新的奖品
const
isEditPrize
=
bothIds
.
includes
(
allPrizeList
[
i
].
_id
)
if
(
isEditPrize
)
{
result
=
await
this
.
updateOnePrizeById
(
allPrizeList
[
i
].
_id
,
allPrizeList
[
i
])
}
return
result
}
}
// 更新单条数据
async
updateOnePrizeById
(
id
,
data
)
{
return
await
this
.
activityconfigPrizeDao
.
update
(
...
...
@@ -118,10 +144,41 @@ export default class ActivityConfigService {
}
// 获取奖品所有配置
async
getAllOldPrizeList
(
activityId
)
{
return
await
this
.
activityconfigPrizeDao
.
find
({
activityId
})
async
getAllOldPrizeList
(
activityId
:
string
)
{
return
await
this
.
activityconfigPrizeDao
.
find
({
activityId
})
}
// 编辑活动时, 对比新旧奖品配置, 找出删除的id和更新的id
async
diffPrizeList
(
activityId
:
string
,
pirzeList
:
Array
<
IActivityPrize
>
)
{
const
allNewIds
=
getIds
(
pirzeList
)
const
oldPrizeList
=
await
this
.
getAllOldPrizeList
(
activityId
)
const
oldIds
=
getIds
(
oldPrizeList
)
let
deleteIds
:
string
[]
=
[]
let
bothIds
:
string
[]
=
oldIds
.
reduce
((
s
,
i
)
=>
{
if
(
allNewIds
.
includes
(
i
))
{
s
=
[...
s
,
i
]
}
else
{
deleteIds
.
push
(
i
)
}
return
s
},
[])
return
{
deleteIds
,
bothIds
}
function
getIds
(
pirzeList
:
Array
<
IActivityPrize
>
)
{
return
pirzeList
.
reduce
((
s
,
v
)
=>
{
if
(
v
.
_id
)
{
s
=
[...
s
,
v
.
_id
]
}
return
s
},
[])
}
}
//更新活动配置
...
...
@@ -216,7 +273,10 @@ export default class ActivityConfigService {
//通过activityId去获取活动配置信息
async
getActivityInfoByActivityId
(
activityId
:
string
)
{
return
{
baseConfig
:
await
this
.
activityconfigDao
.
findOne
({
_id
:
activityId
,
deleteStatus
:
DELETE_STATUS
.
EXIST
}),
baseConfig
:
await
this
.
activityconfigDao
.
findOne
({
_id
:
activityId
,
deleteStatus
:
DELETE_STATUS
.
EXIST
}),
prizeConfig
:
await
this
.
activityconfigPrizeDao
.
find
(
{
activityId
,
deleteStatus
:
DELETE_STATUS
.
EXIST
},
{
sort
:
{
level
:
1
}
}
...
...
server/duibats/src/typings/activity.d.ts
View file @
8c713881
/** @format */
interface
IActivityBaseInfo
{
_id
:
string
_id
?
:
string
activityId
?:
string
openId
?:
string
rule
:
string
startTime
:
number
endTime
:
number
title
:
string
deleteStatus
:
1
|
2
deleteStatus
?
:
1
|
2
openPrizeStatus
?:
1
|
2
|
3
|
4
remark
?:
string
createTime
?:
number
...
...
@@ -17,6 +17,7 @@ interface IActivityBaseInfo {
}
interface
IActivityPrize
{
_id
?:
string
activityId
?:
string
ename
?:
string
prizeType
:
1
|
2
...
...
@@ -32,7 +33,8 @@ interface IActivityPrize {
useUrl
?:
string
stock
:
number
useStock
:
number
deleteStatus
:
1
|
2
openId
?:
string
deleteStatus
:
number
createTime
:
number
updateTime
:
number
}
...
...
server/duibats/src/utils/getSeller.ts
View file @
8c713881
/** @format */
export
const
getConsumerSeller
=
({
accessToken
,
openId
})
=>
{
return
{
// timestamp: formatTime(new Date(), "yyyy-MM-dd hh:mm:ss"),
open_id
:
openId
,
// 'appkey': appKey,
// 'appsecret': secret,
session
:
accessToken
,
session
:
accessToken
// REST_URL: 'http://gw.api.taobao.com/router/rest'
};
};
\ No newline at end of file
}
}
server/duibats/src/utils/saveValidate.ts
View file @
8c713881
/** @format */
import
{
Rules
}
from
'async-validator'
import
{
TASK_CHECK_TYPE
,
TASK_TYPE_TEXT
,
PASS_URL_LIST
}
from
'../constants'
export
const
saveParams
:
Rules
=
{
title
:
{
...
...
@@ -41,6 +42,94 @@ export const saveParams: Rules = {
})
if
(
taskList
.
length
===
0
)
return
new
Error
(
'任务配置必须配置一项'
)
let
canPassTask
=
{
status
:
true
,
message
:
''
}
taskList
.
forEach
(
i
=>
{
if
(
!
i
.
type
)
{
canPassTask
=
{
status
:
false
,
message
:
'任务必须配置'
}
}
if
(
TASK_CHECK_TYPE
.
link
.
list
.
includes
(
i
.
type
))
{
if
(
canPassTask
.
status
)
{
canPassTask
=
urlCheck
(
i
.
link
,
PASS_URL_LIST
)
}
}
if
(
TASK_CHECK_TYPE
.
itemIds
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
itemIds
)
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'必须配置'
}
}
}
if
(
TASK_CHECK_TYPE
.
value
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
value
)
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务值必须配置'
}
}
if
(
!
TASK_CHECK_TYPE
.
value
.
reg
.
test
(
i
.
value
))
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务值在'
+
TASK_CHECK_TYPE
.
value
.
regName
}
}
}
if
(
TASK_CHECK_TYPE
.
times
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
times
)
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务次数必须配置'
}
}
}
if
(
TASK_CHECK_TYPE
.
title
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
title
)
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务标题必须配置'
}
}
}
if
(
TASK_CHECK_TYPE
.
taskRateType
.
list
.
includes
(
i
.
type
))
{
if
(
!
i
.
taskRateType
)
{
canPassTask
=
{
status
:
false
,
message
:
TASK_TYPE_TEXT
[
i
.
type
]
+
'任务类型必须配置'
}
}
}
i
.
value
=
+
i
.
value
i
.
times
=
+
i
.
times
||
''
i
.
taskRateType
=
+
i
.
taskRateType
||
''
return
i
})
if
(
!
canPassTask
.
status
)
return
new
Error
(
canPassTask
.
message
)
return
cb
()
}
}
}
const
urlCheck
=
(
link
:
string
,
passUrlList
:
string
[])
=>
{
if
(
!
link
.
startsWith
(
'http://'
)
&&
!
link
.
startsWith
(
'https://'
))
{
return
{
status
:
false
,
message
:
'页面链接必须以https://或http://开头'
}
}
let
passUrl
=
false
passUrlList
.
some
(
i
=>
{
if
(
~
link
.
indexOf
(
i
))
{
passUrl
=
true
return
true
}
return
false
})
if
(
!
passUrl
)
return
{
status
:
false
,
message
:
'域名校验不通过'
}
return
{
status
:
true
,
message
:
''
}
}
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