Commit 913d7b02 authored by hujun's avatar hujun

open time

parent c627004b
......@@ -301,7 +301,7 @@ class OrderLog extends Basic
if (!isset($params["submit_agent_id"]) || !isset($params["submit_agent_name"]) || !isset($params["report_id"]) ||
!isset($params["order_id"]) || !isset($params["order_no"]) || !isset($params["trade_type"]) ||
//!isset($params["estimated_receipt_date"]) ||
!isset($params["house_number"]) || !isset($params["is_open"]) || !isset($params["industry_type"]) ||
!isset($params["house_number"]) || !isset($params["industry_type"]) ||
!isset($params["price"]) || !isset($params["commission"]) || !isset($params["commission_arr"])) {
return $this->response("101", "请求参数错误");
}
......
......@@ -3,6 +3,7 @@
namespace app\api_broker\service;
use app\model\OImg;
use app\model\OPayLogModel;
use app\model\OPayLogOpen;
use app\model\OPayLogOpenLog;
......@@ -17,12 +18,14 @@ class PayLogOpenService
private $payLogOpenModel;
private $oImgModel;
private $payLogOpenLogModel;
private $payLogModel;
public function __construct()
{
$this->payLogOpenModel = new OPayLogOpen();
$this->oImgModel = new OImg();
$this->payLogOpenLogModel = new OPayLogOpenLog();
$this->payLogModel = new OPayLogModel();
}
/**
......@@ -78,13 +81,22 @@ class PayLogOpenService
public function addOpenCheck($open_id, $status, $remark, $operation_id, $operation_name)
{
$id = $this->payLogOpenLogModel->getAllList('open_id', 0, ['status' => $status, 'open_id' => $open_id]); //检查当前状态是否审核过
if (empty($id)) {
if (empty($id[0]['id'])) {
$num = $this->payLogOpenLogModel->addOpenCheck(
$this->OpenLogCheckBin($open_id, $status, $remark, $operation_id, $operation_name)
);
if ($num > 0) {
$this->payLogOpenModel->editData(['status' => $status], $open_id); //更新状态
$pay_log_id = $this->payLogOpenModel->getFieldOneValue('pay_log_id', ['id'=>$open_id]);
if ($pay_log_id) {
$update_data['id'] = $pay_log_id;
$update_data['is_open'] = 1;
$update_data['open_time'] = date('Y-m-d H:i:s');
$this->payLogModel->updatePayLog($update_data);
}
//todo 推送
$this->pushCheck($open_id, $status);
}
......@@ -124,7 +136,7 @@ class PayLogOpenService
}
$push_service = new PushMessageService();
$push_service->record(13, 0, $push_agent, 0, ['message' => $message]);
$push_service->record(13, 0, [$push_agent['agent_id']], 0, ['message' => $message]);
return true;
}
......
......@@ -3653,25 +3653,16 @@ class Finance extends Basic
$pay_data['current_agent_name'] = rtrim($name,',');
}
if ($pay_data['type'] == 10 || $pay_data['type'] == 30) {
if (isset($house_data[0]['f_id'])) {
if (($pay_data['type'] == 10 || $pay_data['type'] == 30) && isset($house_data[0]['f_id'])) {
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$house_data[0]['f_id']]);
$pay_data['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
}
}
$pay_data['site_id'] = '';
if ($pay_data['agent_id']) {
// $m_agent = new AAgents();
// $pay_data['site_id'] = $m_agent->getPhoneById($pay_data['agent_id'], 'site_id');
$redis_service = new RedisCacheService();
$agent_data = $redis_service->getRedisCache(2, $pay_data['agent_id']);
$pay_data['site_id'] = $agent_data['site_id'];
}
if (empty($pay_data['open_time']) && $pay_data['is_open'] == 1) {
$pay_data['open_time'] = $pay_data['create_time'];
}
} catch (\Exception $e) {
$msg = '内部错误:'.$e->getMessage();
}
......@@ -3701,7 +3692,6 @@ class Finance extends Basic
unset($this->params['receipt_number']);
unset($this->params['transfer_name']);
unset($this->params['pay_type']);
// return $this->response(101, '调整后收款不能修改');
} else {
$save_data['transfer_name'] = isset($this->params['transfer_name']) ? $this->params['transfer_name']:'';
$save_data['money'] = $this->params['money'];
......@@ -3713,12 +3703,6 @@ class Finance extends Basic
}
}
// $m_pay_log = new OPayLogAdjustment();
// $id = $m_pay_log->getFieldValue('id', ['paylog_id'=>$this->params['pay_id']]);
// if ($id) {
// return $this->response(101, '收款存在调整不能修改');
// }
if (($id[0]['type'] == 10 && $this->params['type'] == 30) || ($id[0]['type'] == 30 && $this->params['type'] == 10)) {
$save_data['type'] = $this->params['type'];
}
......
......@@ -202,8 +202,8 @@ class PayLogOpen extends Basic
$disc_time = $this->m_pay_open_log->getFieldOneValue('create_time', $log_where);
if ($v['status'] == 3) {
$pay_log_data = $m_pay_log->selectPayLogByOrderNo('create_time', ['id'=>$v['pay_log_id']]);
$check_time = isset($pay_log_data[0]['create_time']) ? $pay_log_data[0]['create_time'] : '';
$pay_log_data = $m_pay_log->selectPayLogByOrderNo('open_time', ['id'=>$v['pay_log_id']]);
$check_time = isset($pay_log_data[0]['open_time']) ? $pay_log_data[0]['open_time'] : '';
} else {
$check_time = '';
}
......
......@@ -120,4 +120,21 @@ class OPayLogOpen extends BaseModel
->where($params)
->find();
}
/**
* @param $params
* @param string $field
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getOpenLog($params, $field = 'a.id')
{
return $this->db_->field($field)
->alias('a')
->join('o_paylog_open_log b', 'a.id=b.open_id', 'left')
->where($params)
->find();
}
}
\ 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