Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scilla-components
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
劳工
scilla-components
Commits
ad075289
Commit
ad075289
authored
Apr 12, 2019
by
Stepheno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat) mock
parent
855b04e7
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
486 additions
and
55 deletions
+486
-55
index.ts
src/index.ts
+2
-1
SampleApi.ts
src/net/SampleApi.ts
+52
-51
SamplePollingApi.ts
src/net/SamplePollingApi.ts
+1
-1
AjaxElementComponent.ts
src/net/api/hdtool/base/AjaxElementComponent.ts
+22
-0
DoJoinComponent.ts
src/net/api/hdtool/base/DoJoinComponent.ts
+35
-0
GetOrderStatusComponent.ts
src/net/api/hdtool/base/GetOrderStatusComponent.ts
+20
-0
PrizeDetailComponent.ts
src/net/api/hdtool/base/PrizeDetailComponent.ts
+26
-0
SubCreditsStatusComponent.ts
src/net/api/hdtool/base/SubCreditsStatusComponent.ts
+18
-0
DatapashComponent.ts
src/net/api/hdtool/game/DatapashComponent.ts
+22
-0
GetNgameStartStatusComponent.ts
src/net/api/hdtool/game/GetNgameStartStatusComponent.ts
+20
-0
NgameManySubmitComponent.ts
src/net/api/hdtool/game/NgameManySubmitComponent.ts
+31
-0
NgameSubmitComponent.ts
src/net/api/hdtool/game/NgameSubmitComponent.ts
+31
-0
ResurrectionComponent.ts
src/net/api/hdtool/game/ResurrectionComponent.ts
+20
-0
ResurrectionStatusComponent.ts
src/net/api/hdtool/game/ResurrectionStatusComponent.ts
+22
-0
GetGameOrderInfoComponent.ts
src/net/api/hdtool/preLottery/GetGameOrderInfoComponent.ts
+20
-0
GetGameSubmitComponent.ts
src/net/api/hdtool/preLottery/GetGameSubmitComponent.ts
+22
-0
CheckOutAnswerComponent.ts
src/net/api/hdtool/question/CheckOutAnswerComponent.ts
+22
-0
GetQuestionComponent.ts
src/net/api/hdtool/question/GetQuestionComponent.ts
+20
-0
QuestionSubmitComponent.ts
src/net/api/hdtool/question/QuestionSubmitComponent.ts
+22
-0
AjaxThroughInfoComponent.ts
src/net/api/hdtool/throughGame/AjaxThroughInfoComponent.ts
+22
-0
ThroughSubmitComponent.ts
src/net/api/hdtool/throughGame/ThroughSubmitComponent.ts
+20
-0
index.ts
src/net/index.ts
+2
-0
webService.ts
src/net/webService.ts
+14
-2
No files found.
src/index.ts
View file @
ad075289
...
...
@@ -7,5 +7,6 @@ export * from './base';
export
*
from
'./other'
;
export
*
from
'./renderer'
;
export
*
from
'./ui'
;
export
*
from
'./net'
;
export
*
from
'./registerAllComponents'
\ No newline at end of file
src/net/SampleApi.ts
View file @
ad075289
...
...
@@ -12,7 +12,7 @@ export default class SampleApi extends ApiComponent {
name
:
string
;
uri
:
string
;
method
:
string
=
'POST'
;
params
:
any
;
params
:
any
=
{};
ignoreSuccessField
:
boolean
=
false
;
async
callApi
(
name
,
paramsInput
,
...
args
){
...
...
@@ -38,6 +38,7 @@ export default class SampleApi extends ApiComponent {
const
{
uri
,
method
}
=
this
;
try
{
const
response
=
await
callApi
(
uri
,
params
,
method
,
'json'
,
this
.
ignoreSuccessField
);
...
...
src/net/SamplePollingApi.ts
View file @
ad075289
...
...
@@ -14,7 +14,7 @@ export default class SamplePollingApi extends ApiComponent {
successValues
:
any
[];
uri
:
string
;
method
:
string
=
'GET'
;
params
:
any
;
params
:
any
=
{}
;
maxTimes
:
number
=
5
;
delay
:
number
=
500
;
...
...
src/net/api/hdtool/base/AjaxElementComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取渲染数据
*/
export
default
class
AjaxElementComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'ajaxElement'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ajaxElement'
;
//请求方式
method
:
string
=
'GET'
;
//duiba活动ID
duibaId
:
string
;
//入库活动ID
activityId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
duibaId
:
this
.
duibaId
,
activityId
:
this
.
activityId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/base/DoJoinComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取渲染数据
*/
export
default
class
DoJoinComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'doJoin'
;
//访问路径
uri
:
string
=
'/hdtool/recon/doJoin'
;
//请求方式
method
:
string
=
'GET'
;
//入库活动ID
activityId
:
string
;
//token
token
:
string
;
//再来一次订单ID
againOrderId
:
string
;
//活动类型
activityType
:
string
;
//用户ID
consumerId
:
string
;
//积分
credits
:
number
;
//分数 分段发奖
score
:
number
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
activityId
:
this
.
activityId
,
token
:
this
.
token
,
againOrderId
:
this
.
againOrderId
,
activityType
:
this
.
activityType
,
consumerId
:
this
.
consumerId
,
credits
:
this
.
credits
,
score
:
this
.
score
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/base/GetOrderStatusComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 查询订单状态
*/
export
default
class
GetOrderStatusComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'getOrderStatus'
;
//访问路径
uri
:
string
=
'/hdtool/recon/getOrderStatus'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/base/PrizeDetailComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 查询奖品信息
*/
export
default
class
PrizeDetailComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'prizeDetail'
;
//访问路径
uri
:
string
=
'/hdtool/recon/prizeDetail'
;
//请求方式
method
:
string
=
'GET'
;
//
appItemId
:
string
;
//
itemId
:
string
;
//
appId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
appItemId
:
this
.
appItemId
,
itemId
:
this
.
itemId
,
appId
:
this
.
appId
});
super
.
execute
();
}
}
src/net/api/hdtool/base/SubCreditsStatusComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SamplePollingApi
from
"../../../SamplePollingApi"
;
export
default
class
SubCreditsStatusComponent
extends
SamplePollingApi
{
//唯一标识
name
:
string
=
'subCreditsStatus'
;
//访问路径
uri
:
string
=
'/hdtool/recon/subCreditsStatus'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/DatapashComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
export
default
class
DatapashComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'datapash'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/datapash'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
//防作弊数据
dynamicData
:
any
;
//duiba活动ID
duibaId
:
any
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
duibaId
:
this
.
duibaId
,
dynamicData
:
this
.
dynamicData
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/GetNgameStartStatusComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SamplePollingApi
from
"../../../SamplePollingApi"
;
/**
* 查询游戏开始订单状态
*/
export
default
class
GetNgameStartStatusComponent
extends
SamplePollingApi
{
//唯一标识
name
:
string
=
'getNgameStartStatus'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/getNgameStartStatus'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/NgameManySubmitComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 游戏提交成绩接口
*/
export
default
class
NgameManySubmitComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'ngameManySubmit'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/ngameManySubmit'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
//分数
score
:
string
;
//无用
gameData
:
any
;
//签名
sgin
:
string
;
//防作弊数据
dynamicData
:
any
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
score
:
this
.
score
,
gameData
:
this
.
gameData
,
sgin
:
this
.
sgin
,
dynamicData
:
this
.
dynamicData
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/NgameSubmitComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 游戏提交成绩接口
*/
export
default
class
NgameSubmitComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'ngameSubmit'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/ngameSubmit'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
//分数
score
:
string
;
//无用
gameData
:
any
;
//签名
sgin
:
string
;
//防作弊数据
dynamicData
:
any
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
score
:
this
.
score
,
gameData
:
this
.
gameData
,
sgin
:
this
.
sgin
,
dynamicData
:
this
.
dynamicData
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/ResurrectionComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 游戏复活接口
*/
export
default
class
ResurrectionComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'resurrection'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/resurrection'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/game/ResurrectionStatusComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SamplePollingApi
from
"../../../SamplePollingApi"
;
/**
* 查询复活状态
*/
export
default
class
ResurrectionStatusComponent
extends
SamplePollingApi
{
//唯一标识
name
:
string
=
'resurrectionStatus'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ngame/resurrectionStatus'
;
//请求方式
method
:
string
=
'POST'
;
//doJoin订单ID
orderId
:
string
;
//resurrec订单ID
resurrecOrderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
resurrecOrderId
:
this
.
resurrecOrderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/preLottery/GetGameOrderInfoComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SamplePollingApi
from
"../../../SamplePollingApi"
;
/**
* 查询前置开奖结果
*/
export
default
class
GetGameOrderInfoComponent
extends
SamplePollingApi
{
//唯一标识
name
:
string
=
'getGameOrderInfo'
;
//访问路径
uri
:
string
=
'/hdtool/recon/getGameOrderInfo'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/preLottery/GetGameSubmitComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 前置开奖提交成绩接口
*/
export
default
class
GetGameSubmitComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'getGameSubmit'
;
//访问路径
uri
:
string
=
'/hdtool/recon/getGameSubmit'
;
//请求方式
method
:
string
=
'POST'
;
//订单ID
orderId
:
string
;
//价值
facePrice
:
number
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
facePrice
:
this
.
facePrice
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/question/CheckOutAnswerComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 检查题目答案是否正确
*/
export
default
class
CheckOutAnswerComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'checkOutAnswer'
;
//访问路径
uri
:
string
=
'/hdtool/recon/checkOutAnswer'
;
//请求方式
method
:
string
=
'GET'
;
//订单ID
orderId
:
string
;
//答案
answerData
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
answerData
:
this
.
answerData
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/question/GetQuestionComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取题目数据
*/
export
default
class
GetQuestionComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'getQuestionInfo'
;
//访问路径
uri
:
string
=
'/recon/getQuestionInfo'
;
//请求方式
method
:
string
=
'GET'
;
//入库活动ID
activityId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
activityId
:
this
.
activityId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/question/QuestionSubmitComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取题目数据
*/
export
default
class
QuestionSubmitComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'questionSubmit'
;
//访问路径
uri
:
string
=
'/hdtool/recon/questionSubmit'
;
//请求方式
method
:
string
=
'POST'
;
//doJoin订单ID
orderId
:
string
;
//答案
answerData
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
,
answerData
:
this
.
answerData
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/throughGame/AjaxThroughInfoComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取渲染数据
*/
export
default
class
AjaxThroughInfoComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'ajaxThroughInfo'
;
//访问路径
uri
:
string
=
'/hdtool/recon/ajaxThroughInfo'
;
//请求方式
method
:
string
=
'GET'
;
//duiba活动ID
duibaId
:
string
;
//关卡ID
throughId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
duibaId
:
this
.
duibaId
,
throughId
:
this
.
throughId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/api/hdtool/throughGame/ThroughSubmitComponent.ts
0 → 100644
View file @
ad075289
import
{
utils
}
from
"scilla"
;
import
SampleApi
from
"../../../SampleApi"
;
/**
* 获取渲染数据
*/
export
default
class
ThroughSubmitComponent
extends
SampleApi
{
//唯一标识
name
:
string
=
'throughSubmit'
;
//访问路径
uri
:
string
=
'/hdtool/recon/throughSubmit'
;
//请求方式
method
:
string
=
'GET'
;
//duiba活动ID
orderId
:
string
;
protected
async
execute
()
{
utils
.
injectProp
(
this
.
params
,
{
orderId
:
this
.
orderId
});
super
.
execute
();
}
}
\ No newline at end of file
src/net/index.ts
0 → 100644
View file @
ad075289
export
{
enjectBaseUrl
}
from
'./webService'
export
{
default
as
SampleApi
}
from
'./SampleApi'
\ No newline at end of file
src/net/webService.ts
View file @
ad075289
...
...
@@ -5,6 +5,9 @@
import
{
utils
}
from
"scilla"
;
// 请求路径 root
let
baseUrl
:
string
;
/**
* 调用接口
* @param uri
...
...
@@ -24,9 +27,9 @@ export function callApi(uri: string, params: any = null, method: string = 'post'
method
,
};
//if (!GameConfig.debug
) {
if
(
!
baseUrl
)
{
options
.
credentials
=
'include'
;
//
}
}
let
temp
=
typeof
params
===
'string'
?
params
:
utils
.
objectStringify
(
params
);
switch
(
method
.
toUpperCase
())
{
...
...
@@ -45,6 +48,8 @@ export function callApi(uri: string, params: any = null, method: string = 'post'
const
fetchMethod
=
responseType
==
'jsonp'
?
window
[
'fetchJsonp'
]
:
fetch
;
url
=
baseUrl
?
baseUrl
+
url
:
url
return
fetchMethod
(
url
,
options
)
.
then
((
response
)
=>
{
if
(
response
.
type
===
'opaque'
)
{
...
...
@@ -177,3 +182,10 @@ export function createSgin(ticketId: number, score: number, gameData: any, submi
return
window
[
'duiba_md5'
](
ticketId
+
''
+
score
+
''
+
gameData
+
''
+
submitToken
);
}
/**
* @desc 请求root补全
* @param {string} u
*/
export
function
enjectBaseUrl
(
u
)
{
baseUrl
=
u
;
}
\ No newline at end of file
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