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
2c573125
Commit
2c573125
authored
Jun 20, 2024
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加购买委托
parent
3d6d3313
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
321 additions
and
16 deletions
+321
-16
application/command.php
application/command.php
+3
-1
application/market/command/Trust.php
application/market/command/Trust.php
+303
-0
application/market/model/Trust.php
application/market/model/Trust.php
+15
-15
No files found.
application/command.php
View file @
2c573125
...
@@ -9,4 +9,6 @@
...
@@ -9,4 +9,6 @@
// | Author: yunwuxin <448901948@qq.com>
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
return
[
'app\stock\command\Crontab'
];
return
[
'app\stock\command\Crontab'
,
\ No newline at end of file
'app\stock\command\Trust'
,
];
\ No newline at end of file
application/market/command/Trust.php
0 → 100644
View file @
2c573125
This diff is collapsed.
Click to expand it.
application/market/model/Trust.php
View file @
2c573125
...
@@ -323,7 +323,7 @@ class Trust extends Model{
...
@@ -323,7 +323,7 @@ class Trust extends Model{
{
{
//查询股票最新行情
//查询股票最新行情
$Qdata
=
z_market
(
$data
[
'code'
],
$data
[
'market'
]);
$Qdata
=
z_market
(
$data
[
'code'
],
$data
[
'market'
]);
$price
=
$data
[
'price'
]
<=
0
?
$Qdata
[
'
P
rice'
]
:
$data
[
'price'
];
$price
=
$data
[
'price'
]
<=
0
?
$Qdata
[
'
current_p
rice'
]
:
$data
[
'price'
];
//判断股票价格是否符号购买条件
//判断股票价格是否符号购买条件
if
(
config
(
'stock_buy_price'
)
>
0
)
{
if
(
config
(
'stock_buy_price'
)
>
0
)
{
if
(
$price
<
config
(
'stock_buy_price'
))
{
if
(
$price
<
config
(
'stock_buy_price'
))
{
...
@@ -376,7 +376,7 @@ class Trust extends Model{
...
@@ -376,7 +376,7 @@ class Trust extends Model{
{
{
//查询股票最新行情
//查询股票最新行情
$Qdata
=
z_market
(
$data
[
'code'
],
$data
[
'market'
]);
$Qdata
=
z_market
(
$data
[
'code'
],
$data
[
'market'
]);
$price
=
$data
[
'price'
]
<=
0
?
$Qdata
[
'
P
rice'
]
:
$data
[
'price'
];
$price
=
$data
[
'price'
]
<=
0
?
$Qdata
[
'
current_p
rice'
]
:
$data
[
'price'
];
if
(
config
(
'site_trade_sell'
)
==
0
)
{
if
(
config
(
'site_trade_sell'
)
==
0
)
{
return
array
(
'status'
=>
0
,
'message'
=>
'系统设置不允许卖出股票'
);
return
array
(
'status'
=>
0
,
'message'
=>
'系统设置不允许卖出股票'
);
...
@@ -387,7 +387,7 @@ class Trust extends Model{
...
@@ -387,7 +387,7 @@ class Trust extends Model{
return
[
'status'
=>
0
,
'message'
=>
'可卖股票不足'
];
return
[
'status'
=>
0
,
'message'
=>
'可卖股票不足'
];
}
}
//当股票跌停时买一至买五价格为空
//当股票跌停时买一至买五价格为空
if
(
intval
(
$Qdata
[
"
Bp1"
])
<=
0
||
intval
(
$Qdata
[
'Bv1
'
]
*
100
)
<
$data
[
'count'
]){
if
(
intval
(
$Qdata
[
"
buy_one_price"
])
<=
0
||
intval
(
$Qdata
[
'buy_one_amount
'
]
*
100
)
<
$data
[
'count'
]){
return
[
'status'
=>
0
,
'message'
=>
'当前买盘不足,无法即时成交!'
];
return
[
'status'
=>
0
,
'message'
=>
'当前买盘不足,无法即时成交!'
];
}
}
//检查子账户余额
//检查子账户余额
...
@@ -398,7 +398,7 @@ class Trust extends Model{
...
@@ -398,7 +398,7 @@ class Trust extends Model{
if
(
$data
[
'price'
]
>
0
&&
$data
[
'model'
]
==
1
){
//model = 1 是委托状态
if
(
$data
[
'price'
]
>
0
&&
$data
[
'model'
]
==
1
){
//model = 1 是委托状态
$trade_money
=
intval
(
$data
[
'count'
])
*
intval
(
$data
[
'price'
]);
$trade_money
=
intval
(
$data
[
'count'
])
*
intval
(
$data
[
'price'
]);
}
else
{
}
else
{
$price
=
$Qdata
[
'
P
rice'
];
$price
=
$Qdata
[
'
current_p
rice'
];
//如果没有委托价格使用下面的公式
//如果没有委托价格使用下面的公式
$trade_money
=
intval
(
$data
[
'count'
])
*
intval
(
$price
);
$trade_money
=
intval
(
$data
[
'count'
])
*
intval
(
$price
);
}
}
...
@@ -426,16 +426,16 @@ class Trust extends Model{
...
@@ -426,16 +426,16 @@ class Trust extends Model{
$trade_money
=
$count
*
$price
;
$trade_money
=
$count
*
$price
;
}
else
{
}
else
{
$price
=
0
;
$price
=
0
;
$v_arr
[
1
]
=
$Qdata
[
'
Sv1
'
]
*
100
;
$v_arr
[
1
]
=
$Qdata
[
'
sell_one_amount
'
]
*
100
;
$v_arr
[
2
]
=
$Qdata
[
'
Sv2
'
]
*
100
;
$v_arr
[
2
]
=
$Qdata
[
'
sell_two_amount
'
]
*
100
;
$v_arr
[
3
]
=
$Qdata
[
'
Sv3
'
]
*
100
;
$v_arr
[
3
]
=
$Qdata
[
'
sell_three_amount
'
]
*
100
;
$v_arr
[
4
]
=
$Qdata
[
'
Sv4
'
]
*
100
;
$v_arr
[
4
]
=
$Qdata
[
'
sell_four_amount
'
]
*
100
;
$v_arr
[
5
]
=
$Qdata
[
'
Sv5
'
]
*
100
;
$v_arr
[
5
]
=
$Qdata
[
'
sell_five_amount
'
]
*
100
;
$p_arr
[
1
]
=
$Qdata
[
'
Sp1
'
];
$p_arr
[
1
]
=
$Qdata
[
'
sell_one_price
'
];
$p_arr
[
2
]
=
$Qdata
[
'
Sp2
'
];
$p_arr
[
2
]
=
$Qdata
[
'
sell_two_price
'
];
$p_arr
[
3
]
=
$Qdata
[
'
Sp3
'
];
$p_arr
[
3
]
=
$Qdata
[
'
sell_three_price
'
];
$p_arr
[
4
]
=
$Qdata
[
'
Sp4
'
];
$p_arr
[
4
]
=
$Qdata
[
'
sell_four_price
'
];
$p_arr
[
5
]
=
$Qdata
[
'
Sp5
'
];
$p_arr
[
5
]
=
$Qdata
[
'
sell_five_price
'
];
$tmd
=
0
;
$tmd
=
0
;
foreach
(
$v_arr
as
$key
=>
$v
){
foreach
(
$v_arr
as
$key
=>
$v
){
$tmd
=
$tmd
+
$v
;
$tmd
=
$tmd
+
$v
;
...
@@ -464,7 +464,7 @@ class Trust extends Model{
...
@@ -464,7 +464,7 @@ class Trust extends Model{
$res
=
Db
::
name
(
'stock_list'
)
->
where
([
'code'
=>
$code
,
'status'
=>
1
])
->
find
();
$res
=
Db
::
name
(
'stock_list'
)
->
where
([
'code'
=>
$code
,
'status'
=>
1
])
->
find
();
//判断是否超过该只股票限额
//判断是否超过该只股票限额
$pos
=
Db
::
name
(
'stock_position'
)
->
where
([
'sub_id'
=>
$subid
,
'gupiao_code'
=>
$code
,
'buying'
=>
0
])
->
sum
(
'stock_count'
);
$pos
=
Db
::
name
(
'stock_position'
)
->
where
([
'sub_id'
=>
$subid
,
'gupiao_code'
=>
$code
,
'buying'
=>
0
])
->
sum
(
'stock_count'
);
if
(
isset
(
$res
[
'quota'
])
&&
(
$res
[
'quota'
]
<
((
$pos
*
$Qdata
[
'
P
rice'
])
+
$trade_money
)))
{
if
(
isset
(
$res
[
'quota'
])
&&
(
$res
[
'quota'
]
<
((
$pos
*
$Qdata
[
'
current_p
rice'
])
+
$trade_money
)))
{
return
[
'status'
=>
0
,
'message'
=>
'该股票超过了单支股票最大购买限额'
];
return
[
'status'
=>
0
,
'message'
=>
'该股票超过了单支股票最大购买限额'
];
}
}
return
;
return
;
...
...
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