Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stock_new
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
stock_new
Commits
0b0f7c70
Commit
0b0f7c70
authored
Jun 21, 2024
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复交付资金
parent
c8781f83
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
20 deletions
+41
-20
application/function.php
application/function.php
+5
-1
application/market/command/TrustCommand.php
application/market/command/TrustCommand.php
+14
-5
application/market/home/Trade.php
application/market/home/Trade.php
+7
-7
application/market/model/Deal_stock.php
application/market/model/Deal_stock.php
+5
-3
application/market/model/Delivery.php
application/market/model/Delivery.php
+5
-2
application/market/model/Trust.php
application/market/model/Trust.php
+5
-2
No files found.
application/function.php
View file @
0b0f7c70
...
...
@@ -1230,7 +1230,11 @@ if (!function_exists('getEndDay')) {
$time
=
date
(
'H:i:s'
,
time
());
}
if
(
toMarket
(
$res
[
2
])
==
"HK"
){
return
array
(
'code'
=>
$res
[
2
],
'name'
=>
$res
[
1
],
'yesterday_price'
=>
$res
[
4
],
'open_price'
=>
$res
[
5
],
'national_debt'
=>
'0.00'
,
'current_price'
=>
$res
[
3
],
'buy_one_price'
=>
$res
[
9
],
'buy_two_price'
=>
$res
[
11
],
'buy_three_price'
=>
$res
[
13
],
'buy_one_amount'
=>
$res
[
10
],
'buy_two_amount'
=>
$res
[
12
],
'buy_three_amount'
=>
$res
[
14
],
'sell_one_price'
=>
$res
[
19
],
'sell_two_price'
=>
$res
[
21
],
'sell_three_price'
=>
$res
[
23
],
'sell_one_amount'
=>
$res
[
20
],
'sell_two_amount'
=>
$res
[
22
],
'sell_three_amount'
=>
$res
[
24
],
'buy_four_price'
=>
$res
[
15
],
'buy_five_price'
=>
$res
[
17
],
'buy_four_amount'
=>
$res
[
16
],
'buy_five_amount'
=>
$res
[
18
],
'sell_four_price'
=>
$res
[
25
],
'sell_five_price'
=>
$res
[
27
],
'sell_four_amount'
=>
$res
[
26
],
'sell_five_amount'
=>
$res
[
28
],
'mini_trans'
=>
100
,
'buy_chang_price'
=>
'0.01'
,
'sell_chang_price'
=>
'0.01'
,
'type'
=>
1
,
'currency'
=>
0
,
'debt_sign'
=>
255
,
'info'
=>
''
,
'last_date_time'
=>
$res
[
30
],
'price_range'
=>
$res
[
31
],
'price_rate'
=>
$res
[
32
],
'highest'
=>
$res
[
33
],
'lowest'
=>
$res
[
34
],
'volume'
=>
$res
[
36
],
'turnover'
=>
$res
[
37
],
'time'
=>
$time
,
'pe_ratio'
=>
$res
[
39
],
'exchange_code'
=>
$res
[
40
],
'amplitude'
=>
$res
[
43
],
'circulation_market_value'
=>
$res
[
44
],
'total_market_value'
=>
$res
[
45
],
'pb_ratio'
=>
$res
[
58
],
'turnover_rate'
=>
$res
[
59
]);
}
else
{
return
array
(
'code'
=>
$res
[
2
],
'name'
=>
$res
[
1
],
'yesterday_price'
=>
$res
[
4
],
'open_price'
=>
$res
[
5
],
'national_debt'
=>
'0.00'
,
'current_price'
=>
$res
[
3
],
'buy_one_price'
=>
$res
[
9
],
'buy_two_price'
=>
$res
[
11
],
'buy_three_price'
=>
$res
[
13
],
'buy_four_price'
=>
$res
[
15
],
'buy_five_price'
=>
$res
[
17
],
'buy_one_amount'
=>
$res
[
10
],
'buy_two_amount'
=>
$res
[
12
],
'buy_three_amount'
=>
$res
[
14
],
'buy_four_amount'
=>
$res
[
16
],
'buy_five_amount'
=>
$res
[
18
],
'sell_one_price'
=>
$res
[
19
],
'sell_two_price'
=>
$res
[
21
],
'sell_three_price'
=>
$res
[
23
],
'sell_four_price'
=>
$res
[
25
],
'sell_five_price'
=>
$res
[
27
],
'sell_one_amount'
=>
$res
[
20
],
'sell_two_amount'
=>
$res
[
22
],
'sell_three_amount'
=>
$res
[
24
],
'sell_four_amount'
=>
$res
[
26
],
'sell_five_amount'
=>
$res
[
28
],
'exchange_code'
=>
$res
[
40
],
'mini_trans'
=>
100
,
'buy_chang_price'
=>
'0.01'
,
'sell_chang_price'
=>
'0.01'
,
'type'
=>
1
,
'currency'
=>
0
,
'debt_sign'
=>
255
,
'info'
=>
''
,
'price_range'
=>
$res
[
31
],
'price_rate'
=>
$res
[
32
],
'highest'
=>
$res
[
41
],
'lowest'
=>
$res
[
42
],
'volume'
=>
$res
[
36
],
'turnover'
=>
$res
[
37
],
'time'
=>
$time
,
'turnover_rate'
=>
$res
[
38
],
'pe_ratio'
=>
$res
[
39
],
'amplitude'
=>
$res
[
43
],
'circulation_market_value'
=>
$res
[
44
],
'total_market_value'
=>
$res
[
45
],
'pb_ratio'
=>
$res
[
46
]);
}
}
}
...
...
application/market/command/TrustCommand.php
View file @
0b0f7c70
...
...
@@ -3,9 +3,11 @@ declare (strict_types = 1);
namespace
app\market\command
;
use
app\admin\model\Config
as
ConfigModel
;
use
app\market\model\Deal_stock
;
use
app\market\model\Position
;
use
app\market\model\SubAccountMoney
;
use
think\Config
;
use
think\console\Command
;
use
think\console\Input
;
use
think\console\input\Argument
;
...
...
@@ -27,11 +29,18 @@ class TrustCommand extends Command
protected
function
execute
(
Input
$input
,
Output
$output
)
{
// 启动协程
//if(!checkTradeTime()) return false;
$time
=
config
(
'trust_active_time'
)
*
60
??
TRUST_ACTIVE_TIME
;
// 处理超时委托线程
//if (!yan_time()) return false;
$trust_active_time
=
ConfigModel
::
where
([
'name'
=>
"trust_active_time"
])
->
value
(
"value"
);
$time
=
$trust_active_time
*
60
??
TRUST_ACTIVE_TIME
;
if
(
$time
>
0
){
$res_c
=
Db
::
name
(
'stock_trust'
)
->
where
(
'status'
,
'已委托'
)
->
where
(
"add_time"
,
"<="
,
time
()
-
$time
)
->
select
();
}
else
if
(
time
()
>
strtotime
(
"today 17:00"
)){
//0表示当日有效
$res_c
=
Db
::
name
(
'stock_trust'
)
->
where
(
'status'
,
'已委托'
)
->
select
();
}
else
{
$res_c
=
null
;
}
if
(
!
empty
(
$res_c
))
$this
->
cancelTrusts
(
$res_c
);
// 处理委托交易线程
//$res_t = Db::name('stock_trust')->where('status','已委托')->where("add_time", "between",[time() - $time, time()])->whereDay('trust_date')->select()->toArray();
$res_t
=
Db
::
name
(
'stock_trust'
)
->
where
(
'status'
,
'已委托'
)
->
select
();
...
...
application/market/home/Trade.php
View file @
0b0f7c70
...
...
@@ -79,7 +79,7 @@ class Trade extends Common
if
(
!
$data
||
count
(
$data
)
===
0
)
return
ajaxmsg
(
'没有数据'
,
0
,
$data
);
foreach
(
$data
as
$k
=>
$item
){
//查询当天交易的数量 T+1 交易
$todayCount
=
Delivery
::
get_delivery_order
(
$subid
,
$item
[
"gupiao_code"
]);
//
$todayCount = Delivery::get_delivery_order($subid,$item["gupiao_code"]);
$data
[
$k
][
'canbuy_count'
]
=
$item
[
'canbuy_count'
];
//查询股票最新行情
$Qdata
=
z_market
(
$item
[
"gupiao_code"
],
$item
[
'market'
]);
...
...
@@ -260,8 +260,8 @@ class Trade extends Common
$mid
=
isLogin
(
$token
);
if
(
!
$mid
)
return
json
([
'status'
=>
0
,
'message'
=>
'登陆后才能进行查看'
]);
$sub_id
=
input
(
'id'
,
''
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$startDate
=
input
(
'
start_date
'
,
''
);
$endDate
=
input
(
'end
_date
'
,
''
);
$startDate
=
input
(
'
beginday
'
,
''
);
$endDate
=
input
(
'end
day
'
,
''
);
$page
=
input
(
'page'
,
1
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$submodel
=
new
StockSubAccount
;
$res
=
$submodel
->
get_account_by_id
(
$sub_id
);
...
...
@@ -346,8 +346,8 @@ class Trade extends Common
$mid
=
isLogin
(
$token
);
if
(
!
$mid
)
return
json
([
'status'
=>
0
,
'message'
=>
'登陆后才能进行查看'
]);
$sub_id
=
input
(
'id'
,
''
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$startDate
=
input
(
'
start_date
'
,
''
);
$endDate
=
input
(
'end
_date
'
,
''
);
$startDate
=
input
(
'
beginday
'
,
''
);
$endDate
=
input
(
'end
day
'
,
''
);
$page
=
input
(
'page'
,
1
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$submodel
=
new
StockSubAccount
;
$res
=
$submodel
->
get_account_by_id
(
$sub_id
);
...
...
@@ -366,8 +366,8 @@ class Trade extends Common
$mid
=
isLogin
(
$token
);
if
(
!
$mid
)
return
json
([
'status'
=>
0
,
'message'
=>
'登陆后才能进行查看'
]);
$sub_id
=
input
(
'id'
,
''
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$startDate
=
input
(
'
start_date
'
,
''
);
$endDate
=
input
(
'end
_date
'
,
''
);
$startDate
=
input
(
'
beginday
'
,
''
);
$endDate
=
input
(
'end
day
'
,
''
);
$page
=
input
(
'page'
,
1
,
[
'trim'
,
FILTER_SANITIZE_NUMBER_INT
]);
$submodel
=
new
StockSubAccount
;
$res
=
$submodel
->
get_account_by_id
(
$sub_id
);
...
...
application/market/model/Deal_stock.php
View file @
0b0f7c70
...
...
@@ -73,12 +73,14 @@ class Deal_stock extends Model{
if
(
empty
(
$endday
)){
$endday
=
time
();}
else
{
$endday
=
strtotime
(
$endday
);}
if
(
empty
(
$beginday
)){
$beginday
=
strtotime
(
date
(
"Y-m-d"
,
time
()));}
else
{
$beginday
=
strtotime
(
$beginday
);}
$sql
=
" deal_date >= "
.
$beginday
.
" and deal_date <= "
.
$endday
;
if
(
$beginday
==
$endday
){
$sql
=
" deal_date >= "
.
$beginday
;
}
$res
=
Db
::
name
(
'stock_deal_stock'
)
->
where
([
'sub_id'
=>
$sub_id
])
->
where
(
'status'
,
'<>'
,
0
)
->
where
(
'deal_date'
,
'>='
,
$beginday
)
->
where
(
'deal_date'
,
'<='
,
$endday
)
->
where
(
$sql
)
->
order
(
'id desc'
)
->
paginate
(
$offset
,
false
,
[
'query'
=>
request
()
->
param
()])
->
select
();
...
...
application/market/model/Delivery.php
View file @
0b0f7c70
...
...
@@ -60,11 +60,14 @@ class Delivery extends Model{
public
function
get_delivery_order
(
$sub_id
,
$beginday
=
""
,
$endday
=
""
,
$offset
=
15
){
if
(
empty
(
$endday
)){
$endday
=
time
();}
else
{
$endday
=
strtotime
(
$endday
)
+
86400
;}
if
(
empty
(
$beginday
)){
$beginday
=
strtotime
(
date
(
"Y-m-d"
,
time
()));}
else
{
$beginday
=
strtotime
(
$beginday
);}
$sql
=
" deal_date >= "
.
$beginday
.
" and deal_date <= "
.
$endday
;
if
(
$beginday
==
$endday
){
$sql
=
" deal_date >= "
.
$beginday
;
}
$res
=
Db
::
name
(
'stock_delivery_order'
)
->
where
([
'sub_id'
=>
$sub_id
])
->
where
([
'status'
=>
1
])
->
where
(
'deal_date'
,
'>='
,
$beginday
)
->
where
(
'deal_date'
,
'<='
,
$endday
)
->
where
(
$sql
)
->
order
(
'id desc'
)
->
paginate
(
$offset
,
false
,
[
'query'
=>
request
()
->
param
()])
->
select
();
...
...
application/market/model/Trust.php
View file @
0b0f7c70
...
...
@@ -237,10 +237,13 @@ class Trust extends Model{
public
function
get_trust
(
$sub_id
,
$beginday
,
$endday
,
$offset
=
15
){
if
(
empty
(
$endday
)){
$endday
=
time
();}
else
{
$endday
=
strtotime
(
$endday
);}
if
(
empty
(
$beginday
)){
$beginday
=
strtotime
(
date
(
"Y-m-d"
,
time
()));}
else
{
$beginday
=
strtotime
(
$beginday
);}
$sql
=
" trust_date >= "
.
$beginday
.
" and trust_date <="
.
$endday
;
if
(
$beginday
==
$endday
){
$sql
=
" trust_date >= "
.
$beginday
;
}
$res
=
Db
::
name
(
'stock_trust'
)
->
where
([
'sub_id'
=>
$sub_id
])
->
where
(
'trust_date'
,
'>='
,
$beginday
)
->
where
(
'trust_date'
,
'<='
,
$endday
)
->
where
(
$sql
)
->
order
(
'id desc'
)
->
paginate
(
$offset
,
false
,
[
'query'
=>
request
()
->
param
()])
->
select
();
...
...
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