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
27501deb
Commit
27501deb
authored
Jul 24, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
640d2125
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
19 deletions
+28
-19
CostParameter.php
application/index/controller/CostParameter.php
+12
-5
CostParameterValidate.php
application/index/validate/CostParameterValidate.php
+13
-13
FStoreData.php
application/model/FStoreData.php
+3
-1
No files found.
application/index/controller/CostParameter.php
View file @
27501deb
...
...
@@ -268,7 +268,7 @@ class CostParameter extends Basic
if
((
isset
(
$params
[
'deduct'
]))
&&
(
$params
[
'deduct'
]
>
0
))
$data
[
'deduct'
]
=
$params
[
'deduct'
];
$res
=
$this
->
m_store_data
->
updateStoreData
(
$data
);
return
$res
;
}
...
...
@@ -438,14 +438,21 @@ class CostParameter extends Basic
// $params = array(
// "id_discounts_json" => '[{"id":1,"discounts":1},{"id":1,"discounts":1}]',
// );
if
(
!
$params
[
'id_discounts_json'
])
return
$this
->
response
(
"101"
,
'id_discounts_json不能为空'
);
$checkResult
=
$this
->
validate
(
$params
,
"CostParameterValidate.editDiscounts"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$id_discounts_json
=
json_decode
(
$params
[
'id_discounts_json'
],
true
);
foreach
(
$id_discounts_json
as
$k
=>
$v
)
{
$u_params
=
[];
if
((
isset
(
$v
[
'id'
])
&&
$v
[
'id'
]
>
0
)
&&
(
isset
(
$v
[
'discounts'
])
&&
in_array
(
$v
[
'discounts'
],
[
0
,
1
])))
$f_params
[
'is_discounts'
]
=
$v
[
'discounts'
];
$this
->
updateStoreData
(
$v
[
'id'
],
$f_params
);
$f_params
[
'store_id'
]
=
$v
[
'id'
];
$f_params
[
'setting_date'
]
=
$params
[
'setting_date'
];
$store_data_res
=
$this
->
m_store_data
->
findByOne
(
'id'
,
$f_params
);
if
(
$store_data_res
)
$u_params
[
'is_discounts'
]
=
$v
[
'discounts'
];
$this
->
updateStoreData
(
$store_data_res
[
'id'
],
$u_params
);
}
return
$this
->
response
(
"200"
,
"成功"
);
}
...
...
application/index/validate/CostParameterValidate.php
View file @
27501deb
...
...
@@ -7,28 +7,28 @@ 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'
,
'store_id'
=>
'require|number|gt:0'
,
'setting_date'
=>
'require'
,
'id_discounts_json'
=>
'require'
,
'type'
=>
'require|number|in:0,1,2,3,4,5,6'
,
];
protected
$message
=
[
'store_id.require'
=>
'id为必填字段'
,
'store_id.number'
=>
'id只能为数字'
,
'store_id.gt'
=>
'id必须大于0'
,
'setting_date.require'
=>
'时间为必填字段'
,
'type.require'
=>
'type为必填字段'
,
'type.number'
=>
'type只能为数字'
,
'type.in'
=>
'type值错误'
,
'store_id.require'
=>
'id为必填字段'
,
'store_id.number'
=>
'id只能为数字'
,
'store_id.gt'
=>
'id必须大于0'
,
'setting_date.require'
=>
'时间为必填字段'
,
'id_discounts_json.require'
=>
'时间为必填字段'
,
'type.require'
=>
'type为必填字段'
,
'type.number'
=>
'type只能为数字'
,
'type.in'
=>
'type值错误'
,
];
protected
$scene
=
[
'editCostParameter'
=>
[
'store_id'
,
'setting_date'
],
'getCompanyCostParameterList'
=>
[
'setting_date'
],
'getStoreCostParameterList'
=>
[
'setting_date'
],
'editDiscounts'
=>
[
'id_discounts_json'
,
'setting_date'
],
'editCompanyData'
=>
[
'type'
,
'setting_date'
],
];
...
...
application/model/FStoreData.php
View file @
27501deb
...
...
@@ -55,7 +55,9 @@ class FStoreData extends BaseModel
*/
public
function
updateStoreData
(
$params
)
{
return
$this
->
db_
->
update
(
$params
);
$return
=
$this
->
db_
->
update
(
$params
);
big_log
(
$this
->
getLastSql
());
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