Commit 89c11cf5 authored by hujun's avatar hujun

修改审核判断逻辑

parent 77cab82e
......@@ -1517,18 +1517,11 @@ class Finance extends Basic
return $this->response(101, '参数错误');
}
$params['content'] = trim($this->params['content']); //撤销原因
$m_financial = new OFinancialAudit();
$data['status'] = 4;
$data['is_del'] = 1; //去除之前的审核记录
$data = $m_financial->editData($data, $this->params['bargain_id'], 'bargain_id');
$result = $m_financial->backOutUpdate($this->params['bargain_id'], $params);
$m_bargain = new OBargainModel();
$update_data['status'] = 20;
$update_data['audit_level'] = 0;
$update_data['content'] = $this->params['content']; //撤销原因
$m_bargain->updateBargain($this->params['bargain_id'], $update_data);
if ($data > 0) {
if ($result) {
$code = 200;
$this->editRecordLog($this->params['bargain_id'], '[撤销成交报告]', 3); //日志记录
$msg = '撤销成功';
......
......@@ -425,7 +425,7 @@ class OBargainModel extends Model
$update_data['account_time'] = date('Y-m-d H:i:s');
} else {
//记录第几级审核-与 OFinancialAudit 表一致
$update_data['audit_level'] = $save_data['audit_level'];
$update_data['audit_level'] = $data['audit_level'];
}
$this->where('id', $bargain_data['id'])->whereOr('father_id', $bargain_data['id'])->update($update_data);
$this->commit();
......@@ -1330,7 +1330,7 @@ class OBargainModel extends Model
if ($id) {
$result = $this->where('id',$id)
->whereOr('father_id', $id)
->insertGetId($data);
->update($data);
} else {
$result = 0;
}
......
......@@ -67,4 +67,39 @@ class OFinancialAudit extends BaseModel
return 0;
}
}
/**
* 撤销数据
*
* @param int $bargain_id
* @param array $params
* @return bool
* @throws \think\exception\PDOException
*/
public function backOutUpdate(int $bargain_id, array $params = []) : bool {
if (empty($bargain_id)) {
return false;
}
$this->startTrans();
$data['status'] = 4;
$data['is_del'] = 1; //去除之前的审核记录
$result_audit = $this->editData($data, $bargain_id, 'bargain_id');
$m_bargain = new OBargainModel();
$update_data['status'] = 20;
$update_data['audit_level'] = 0;
$update_data['content'] = $params['content']; //撤销原因
$result_bargain = $m_bargain->updateBargain($bargain_id, $update_data);
if ($result_bargain) {
$this->commit();
$result = true;
} else {
$this->rollback();
$result = false;
}
return $result;
}
}
\ No newline at end of file
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