Commit 00a30979 authored by hujun's avatar hujun

恢复成交报告

parent 1f3ba80f
...@@ -3896,4 +3896,41 @@ class Finance extends Basic ...@@ -3896,4 +3896,41 @@ class Finance extends Basic
$data['log'] = $m_refund_log->getListAll('operation_name,create_time,status', ['refund_id'=>$this->params['refund_id'], 'is_del'=>0]); $data['log'] = $m_refund_log->getListAll('operation_name,create_time,status', ['refund_id'=>$this->params['refund_id'], 'is_del'=>0]);
return $this->response($code, $msg, $data); return $this->response($code, $msg, $data);
} }
/**
* 撤销列表-恢复成交报告
*
* @return \think\Response
*/
public function recoveryBargain() {
$code = 101;
if (empty($this->params['id'])) {
return $this->response($code, '参数错误');
}
$msg = '';
$where[] = ['EXP', 'a.id ='.$this->params['id'].' OR a.father_id='.$this->params['id']];
$agent_arr = $this->m_bargain->agentBargainAll('a.create_time,a.agent_id,b.store_id,b.district_id', $where);
foreach ($agent_arr as $k=>$v) {
try {
$this->totalOfficialReceipts($v['agent_id'], $v['district_id'], $v['store_id'], $v['create_time']);
$code = 200;
} catch (\Exception $e) {
$msg = '恢复失败:'.$e->getMessage();
break;
}
}
if ($code == 200) {
$data['status'] = 10;
$data['audit_level'] = 0;
$where_2[] = ['EXP', 'id ='.$this->params['id'].' OR father_id='.$this->params['id']];
$is_ok = $this->m_bargain->updateBargainByWhere($data, $where_2);
if (!$is_ok) {
$code = 101;
$msg = '恢复成交报告状态失败';
}
}
return $this->response($code, $msg);
}
} }
...@@ -1572,19 +1572,17 @@ class OBargainModel extends Model ...@@ -1572,19 +1572,17 @@ class OBargainModel extends Model
/** /**
* @param $field * @param $field
* @param $where * @param $where
* @return array|false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function agentBargainAll($field, $where) { public function agentBargainAll($field, $where) {
try { return $this->db_->alias('a')
$data = $this->db_->alias('a') ->field($field)
->field($field) ->join('a_agents b', 'a.agent_id = b.id', 'left')
->join('a_agents b', 'a.agent_id = b.id', 'left') ->where($where)
->where($where) ->select();
->select();
} catch (\Exception $e) {
$data = [];
}
return $data;
} }
/** /**
...@@ -1596,6 +1594,15 @@ class OBargainModel extends Model ...@@ -1596,6 +1594,15 @@ class OBargainModel extends Model
return $this->db_->where($where)->value($field); return $this->db_->where($where)->value($field);
} }
/**
* @param $field
* @param $where
* @return mixed
*/
public function getFieldColumn($field, $where) {
return $this->db_->where($where)->column($field);
}
/** /**
* @param $field * @param $field
* @param $where * @param $where
......
...@@ -282,6 +282,7 @@ Route::group('index', [ ...@@ -282,6 +282,7 @@ Route::group('index', [
'refundPayLog' => ['index/Finance/refundPayLog', ['method' => 'POST']],//退款 'refundPayLog' => ['index/Finance/refundPayLog', ['method' => 'POST']],//退款
'checkRefund' => ['index/Finance/checkRefund', ['method' => 'POST']],//退款审核 'checkRefund' => ['index/Finance/checkRefund', ['method' => 'POST']],//退款审核
'refundDetail' => ['index/Finance/refundDetail', ['method' => 'GET']],//退款详情 'refundDetail' => ['index/Finance/refundDetail', ['method' => 'GET']],//退款详情
'recoveryBargain' => ['index/Finance/recoveryBargain', ['method' => 'POST']],//撤销列表-恢复成交报告
'performanceInfo' => ['index/PerformanceInfo/performanceInfo', ['method' => 'post|get']],//业绩明细 'performanceInfo' => ['index/PerformanceInfo/performanceInfo', ['method' => 'post|get']],//业绩明细
'getPerformanceInfoExcel' => ['index/PerformanceInfo/getPerformanceInfoExcel', ['method' => 'post|get']],//业绩明细 'getPerformanceInfoExcel' => ['index/PerformanceInfo/getPerformanceInfoExcel', ['method' => 'post|get']],//业绩明细
......
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