Commit 3f3e8284 authored by zhuwei's avatar zhuwei

1

parent 8595c221
......@@ -369,7 +369,7 @@ class CostParameter extends Basic
/**
* 编辑
* 总部成本编辑
* @return \think\Response
*/
public function editCompanyData()
......@@ -378,23 +378,28 @@ class CostParameter extends Basic
// $params = array(
// "type" => '1',
// "setting_date" => '2019-07-23',
// "save_json" => '[{"type":1},{"id":1}]',
// );
$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);
if(!checkTimeData($params['setting_date'])){
return $this->response("101", '非法时间');
}
$save_json = json_decode($params['save_json'],true);
foreach ($save_json as $k => $v) {
$f_params['type'] = $v['type'];
$f_params['setting_date'] = $params['setting_date'];
$store_data_res = $this->m_company_data->findByOne('id',$f_params);
if ($store_data_res) {//修改
$this->updateCompanyData($store_data_res['id'],$v);
} else {//新增
$this->saveCompanyData($v);
}
}
return $this->response("200", "成功");
}
......
......@@ -48,6 +48,7 @@ class FStoreCostExt extends BaseModel
->limit($pageSize)
->page($pageNo)
->select();
echo $this->getLastSql();
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment