Commit a0dc1fca authored by hujun's avatar hujun

待撤销审核

parent c39ecd75
......@@ -107,7 +107,7 @@ class Finance extends Basic
$data['data'] = [];
$bargain = new OBargainModel();
if (empty($this->params['id'])) {
if (empty($this->params['id']) || empty($this->params['source']) || $this->params['status']) {
$data['code'] = 101;
$data['msg'] = 'Id is null';
} else {
......@@ -116,7 +116,7 @@ class Finance extends Basic
$params['audit_id'] = $this->userId;
$params['audit_level'] = $this->params['check_status'];
$params['remark'] = $this->params['remark'];
$status = $bargain->addCheckBargain($this->params['id'], $params);
$status = $bargain->addCheckBargain($this->params['id'], $params, $this->params['source'], $this->params['status']);
if (empty($status)) {
$data['code'] = 101;
$data['msg'] = '审核失败';
......
......@@ -268,18 +268,21 @@ class OBargainModel extends Model
/**
* 成交报告审核
*
* @param $id
* @param $data
* @return bool|false|int
* @param int $id
* @param array $data
* @param int $source 审核来源 1成交报告申请结单 2退款 3申请撤销成交报告
* @param int $status 成交报告状态 10已提交 11审核成功 20待撤销 21已撤销 30删除
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function addCheckBargain($id, $data) {
public function addCheckBargain(int $id,array $data, int $source, int $status) : array {
$this->startTrans();
$bargain_data = $this->field('id,report_id,agent_id,order_no,order_id')->where([
'id' => $id,
'status' => 10
'status' => $status
])->lock(true)->find();
if ($bargain_data != '') {
......@@ -290,7 +293,7 @@ class OBargainModel extends Model
$save_data['agent_id'] = $bargain_data['agent_id'];
$save_data['order_no'] = $bargain_data['order_no'];
$save_data['order_id'] = $bargain_data['order_id'];
$save_data['source'] = 1;
$save_data['source'] = $source;
$save_data['status'] = 1;
$save_data['remark'] = $data['remark'];
$save_data['audit_id'] = $data['audit_id'];
......@@ -315,10 +318,14 @@ class OBargainModel extends Model
if ($return) {
if ($data['audit_level'] == 3) {
if ($data['audit_level'] == 3 && $source = 10) {
$this->where('id',$bargain_data['id'])->setField('status',11);
}
if ($data['audit_level'] == 3 && $source = 20) {
$this->where('id',$bargain_data['id'])->setField('status',21);
}
$this->commit();
$result = true;
} else {
......
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