Commit 3f3e8284 authored by zhuwei's avatar zhuwei

1

parent 8595c221
...@@ -369,7 +369,7 @@ class CostParameter extends Basic ...@@ -369,7 +369,7 @@ class CostParameter extends Basic
/** /**
* 编辑 * 总部成本编辑
* @return \think\Response * @return \think\Response
*/ */
public function editCompanyData() public function editCompanyData()
...@@ -378,23 +378,28 @@ class CostParameter extends Basic ...@@ -378,23 +378,28 @@ class CostParameter extends Basic
// $params = array( // $params = array(
// "type" => '1', // "type" => '1',
// "setting_date" => '2019-07-23', // "setting_date" => '2019-07-23',
// "save_json" => '[{"type":1},{"id":1}]',
// ); // );
$checkResult = $this->validate($params, "CostParameterValidate.editCompanyData"); $checkResult = $this->validate($params, "CostParameterValidate.editCompanyData");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
} }
if(!checkTimeData($params['setting_date'])){
$f_params['type'] = $params['type']; return $this->response("101", '非法时间');
$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);
} }
$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", "成功"); return $this->response("200", "成功");
} }
......
...@@ -48,6 +48,7 @@ class FStoreCostExt extends BaseModel ...@@ -48,6 +48,7 @@ class FStoreCostExt extends BaseModel
->limit($pageSize) ->limit($pageSize)
->page($pageNo) ->page($pageNo)
->select(); ->select();
echo $this->getLastSql();
return $result; 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