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
24917866
Commit
24917866
authored
Jun 19, 2024
by
twj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
期权计划表
parent
34ed11aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
3 deletions
+119
-3
application/money/admin/Esopplanrecord.php
application/money/admin/Esopplanrecord.php
+117
-0
application/money/model/EsopPlanRecord.php
application/money/model/EsopPlanRecord.php
+2
-3
No files found.
application/money/admin/Esop
lay
record.php
→
application/money/admin/Esop
plan
record.php
View file @
24917866
...
...
@@ -49,20 +49,20 @@ class EsopplanRecord extends Admin
->
setSearch
([
'mid'
=>
'用户ID'
,
'member.name'
=>
'姓名'
,
'member.mobile'
=>
'手机号'
])
// 设置搜索框
->
addColumns
([
// 批量添加数据列
[
'id'
,
'ID'
],
[
'esop_plan_id'
,
'期权计划id'
],
[
'esop_plan_id'
,
'期权计划id'
],
[
'name'
,
'姓名'
],
[
'title'
,
'股票'
],
[
'affect'
,
'金额'
],
[
'surplus'
,
'余额'
],
[
'type'
,
'类型'
],
[
'info'
,
'详情'
],
[
'create_ip'
,
'创建IP'
],
[
'affect'
,
'金额'
],
[
'surplus'
,
'余额'
],
[
'type'
,
'类型'
],
[
'info'
,
'详情'
],
[
'create_ip'
,
'创建IP'
],
[
'create_time'
,
'创建时间'
,
'datetime'
],
])
->
hideCheckbox
()
->
setTableName
(
'esop_plan'
)
->
addTopButton
(
'custem'
,
$btn_excel
)
->
addOrder
(
'id,create_time
,release_time
'
)
->
addOrder
(
'id,create_time'
)
->
setRowList
(
$data_list
)
->
fetch
();
// 渲染模板
}
...
...
@@ -71,6 +71,47 @@ class EsopplanRecord extends Admin
*/
public
function
releaseEsop
()
{
$where
=
[];
//正在执行的期权计划
$where
[
'status'
]
=
1
;
//开始释放期权日期不大于当前日期
$where
[
'release_time'
]
=
[
'<='
,
date
(
"Y-m-d"
)];
//已释放天数小于总天数,已释放期权小于期权总值,待行权值大于0
$esop_plan_list
=
EsopPlanModel
::
where
(
$where
)
->
where
(
"remain_account>0 and release_account<plan_account and days<duration"
)
->
select
();
foreach
(
$esop_plan_list
as
$k
=>
$v
)
{
//更加明细记录判断执行的当天是否已释放过
$esop_plan_record_today
=
EsopPlanRecordModel
::
where
(
"FROM_UNIXTIME(createtime,'%Y-%m-%d')=curdate()"
)
->
where
([
'type'
=>
1
,
'esop_plan_id'
=>
$v
[
'id'
]])
->
find
();
if
(
!
$esop_plan_record_today
)
{
//计算释放期权金额
$affect
=
intval
(
$v
[
'plan_account'
]
/
$v
[
'duration'
]);
//如果是最后一天,取余数
if
(
$v
[
'duration'
]
-
$v
[
'days'
]
==
1
)
{
$affect
=
$v
[
'plan_account'
]
%
$v
[
'duration'
];
}
//释放期权,更新期权表
$updateData
[]
=
[
'account'
=>
$v
[
'account'
]
+
$affect
,
'days'
=>
$v
[
'days'
]
+
1
,
'remain_account'
=>
$v
[
'plan_account'
]
-
$affect
,
'release_account'
=>
$v
[
'release_account'
]
+
$affect
];
EsopPlanModel
::
where
([
'id'
=>
$v
[
'id'
]])
->
update
(
$updateData
);
//写入明细表
$arr
[]
=
[
'mid'
=>
$v
[
'mid'
],
'stock_id'
=>
$v
[
'stock_id'
],
'esop_plan_id'
=>
$v
[
'id'
],
'affect'
=>
$affect
,
'surplus'
=>
$v
[
'account'
]
+
$affect
,
'heatos'
=>
1
,
'type'
=>
1
,
'info'
=>
"自动行权,期权增加"
.
(
$affect
/
100
),
'create_time'
=>
time
(),
'create_ip'
=>
get_client_ip
(
1
)
];
EsopPlanRecordModel
::
create
(
$arr
);
}
}
}
}
application/money/model/EsopPlanRecord.php
View file @
24917866
...
...
@@ -15,9 +15,8 @@
public
static
function
getAll
(
$map
=
[],
$order
=
''
)
{
$data_list
=
self
::
view
(
'esop_plan_record pr'
,
true
)
->
view
(
'member'
,
'mobile, name, id_card'
,
'member.id=p.mid'
,
'left'
)
->
view
(
'stock_list'
,
'title'
,
'stock_list.id=p.stock_id'
,
'left'
)
->
view
(
'esop_plan p'
,
'id'
,
'p.id=pr.esop_plan_id'
)
->
view
(
'member'
,
'mobile, name, id_card'
,
'member.id=pr.mid'
,
'left'
)
->
view
(
'stock_list'
,
'title'
,
'stock_list.id=pr.stock_id'
,
'left'
)
->
where
(
$map
)
->
order
(
$order
)
->
paginate
()
...
...
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