Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
1cfdb83f
Commit
1cfdb83f
authored
Jul 23, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
57ce75b9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
24 deletions
+92
-24
CostParameter.php
application/index/controller/CostParameter.php
+77
-22
CostParameterValidate.php
application/index/validate/CostParameterValidate.php
+10
-2
FCompanyData.php
application/model/FCompanyData.php
+5
-0
No files found.
application/index/controller/CostParameter.php
View file @
1cfdb83f
...
...
@@ -269,7 +269,6 @@ class CostParameter extends Basic
$params
=
$this
->
params
;
$params
=
array
(
"store_id"
=>
'1'
,
"setting_date"
=>
'2019-07-01'
,
);
...
...
@@ -277,44 +276,99 @@ class CostParameter extends Basic
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//费用类型 0上海总部成本 1杭州总部成本 2深圳总部成本 3广州总部成本 4北京总部成本 5同联发展基金 6总经理基薪
$f_params
[
'setting_date'
]
=
$params
[
'setting_date'
];
$f_field
=
'type,fixed_fee,apply_for_fee,discounts'
;
$company_data
=
$this
->
m_company_data
->
selectCompanyData
(
$f_field
,
$f_params
);
$list
=
[];
if
(
!
$company_data
){
$company_data
=
[];
$type_list
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
];
foreach
(
$type_list
as
$k
=>
$v
)
{
// `fixed_fee` decimal(9,2) DEFAULT '0.00' COMMENT '本月固定成本 如果type为同联发展基金和总经理基薪逻辑独立判断',
// `apply_for_fee` decimal(7,2) DEFAULT '0.00' COMMENT '本月报销费用',
// `discounts` tinyint(2) DEFAULT '0' COMMENT '百分比 5% 存 5 ',
$list_
[
'type'
]
=
$v
;
//
$f_params
[
'type'
]
=
$v
;
$f_params
[
'setting_date'
]
=
$params
[
'setting_date'
];
$f_field
=
'type,fixed_fee,apply_for_fee,discounts'
;
$list_
=
$this
->
m_company_data
->
selectCompanyData
(
$f_field
,
$f_params
);
if
(
!
$company_data
)
$list_
[
'type'
]
=
$v
;
//费用类型 0上海总部成本 1杭州总部成本 2深圳总部成本 3广州总部成本 4北京总部成本 5同联发展基金 6总经理基薪
$list_
[
'fixed_fee'
]
=
0
;
//本月固定成本
$list_
[
'apply_for_fee'
]
=
0
;
//本月报销费用
$list_
[
'apply_for_fee'
]
=
0
;
//本月报销费用
(其他费用)
$list_
[
'discounts'
]
=
0
;
//百分比
$list
=
$list_
;
}
$company_data
[]
=
$list_
;
}
$result
[
"list"
]
=
$
list
;
$result
[
"list"
]
=
$
company_data
;
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
public
function
editCompanyCostParameter
()
/**
* 编辑
* @return \think\Response
*/
public
function
editCompanyData
()
{
$params
=
$this
->
params
;
$params
=
array
(
"type"
=>
'1'
,
"setting_date"
=>
'2019-07-23'
,
);
// $params = array(
// "type" => '1',
// "setting_date" => '2019-07-23',
// );
$checkResult
=
$this
->
validate
(
$params
,
"CostParameterValidate.editCompanyData"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$f_params
[
'type'
]
=
$params
[
'type'
];
$f_params
[
'setting_date'
]
=
$params
[
'setting_date'
];
$store_data_res
=
$this
->
m_company_data
->
findByOne
(
'id'
,
$params
);
if
(
$store_data_res
)
{
//修改
$this
->
updateCompanyData
(
$store_data_res
[
'id'
],
$params
);
}
else
{
//新增
$this
->
saveCompanyData
(
$params
);
}
return
$this
->
response
(
"200"
,
"成功"
);
}
/**
* 更新总部成本设置
* @param $id
* @param $params
* @return int|string
*/
public
function
updateCompanyData
(
$id
,
$params
){
$data
[
'id'
]
=
$id
;
if
((
isset
(
$params
[
'fixed_fee'
]))
&&
(
$params
[
'fixed_fee'
]
>
0
))
$data
[
'fixed_fee'
]
=
$params
[
'fixed_fee'
];
if
((
isset
(
$params
[
'apply_for_fee'
]))
&&
(
$params
[
'apply_for_fee'
]
>
0
))
$data
[
'apply_for_fee'
]
=
$params
[
'apply_for_fee'
];
if
((
isset
(
$params
[
'discounts'
]))
&&
(
$params
[
'discounts'
]
>
0
))
$data
[
'discounts'
]
=
$params
[
'discounts'
];
$res
=
$this
->
m_company_data
->
updateCompanyData
(
$data
);
return
$res
;
}
/**
* 新增总部成本设置
* @param $params
* @return mixed
*/
public
function
saveCompanyData
(
$params
){
$data
[
'type'
]
=
$params
[
'type'
];
$data
[
'setting_date'
]
=
$params
[
'setting_date'
];
$data
[
'is_del'
]
=
0
;
$data
[
'operator_id'
]
=
$this
->
userId
;
if
((
isset
(
$params
[
'fixed_fee'
]))
&&
(
$params
[
'fixed_fee'
]
>
0
))
$data
[
'fixed_fee'
]
=
$params
[
'fixed_fee'
];
if
((
isset
(
$params
[
'apply_for_fee'
]))
&&
(
$params
[
'apply_for_fee'
]
>
0
))
$data
[
'apply_for_fee'
]
=
$params
[
'apply_for_fee'
];
if
((
isset
(
$params
[
'discounts'
]))
&&
(
$params
[
'discounts'
]
>
0
))
$data
[
'discounts'
]
=
$params
[
'discounts'
];
$res
=
$this
->
m_company_data
->
saveCompanyData
(
$data
);
return
$res
;
}
}
\ No newline at end of file
application/index/validate/CostParameterValidate.php
View file @
1cfdb83f
...
...
@@ -9,6 +9,8 @@ class CostParameterValidate extends Validate {
protected
$rule
=
[
'store_id'
=>
'require|number|gt:0'
,
'setting_date'
=>
'require'
,
'type'
=>
'require|number|in:0,1,2,3,4,5,6'
,
];
protected
$message
=
[
...
...
@@ -17,11 +19,16 @@ class CostParameterValidate extends Validate {
'store_id.gt'
=>
'id必须大于0'
,
'setting_date.require'
=>
'时间为必填字段'
,
'type.require'
=>
'type为必填字段'
,
'type.number'
=>
'type只能为数字'
,
'type.in'
=>
'type值错误'
,
];
protected
$scene
=
[
'editCostParameter'
=>
[
'store_id'
,
'setting_date'
],
'getCompanyCostParameterList'
=>
[
'setting_date'
],
'editCostParameter'
=>
[
'store_id'
,
'setting_date'
],
'getCompanyCostParameterList'
=>
[
'setting_date'
],
'editCompanyData'
=>
[
'type'
,
'setting_date'
],
];
}
\ No newline at end of file
application/model/FCompanyData.php
View file @
1cfdb83f
...
...
@@ -55,4 +55,9 @@ class FCompanyData extends BaseModel
->
select
();
return
$result
;
}
public
function
updateCompanyData
(
$params
)
{
return
$this
->
db_
->
update
(
$params
);
}
}
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