Commit f15e5d3e authored by hujun's avatar hujun

退款推送

parent 850feff8
......@@ -185,6 +185,9 @@ class PayLogService
if($del_img){
$this->delOImg(3,$del_img);
}
$service_push = new PushMessageService();
$service_push->pushRefund($agent_id, $report_id, $order_id);
return $insert_id;
}
......
......@@ -314,6 +314,7 @@ class PushMessageService
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
break;
default :
$data['house_id'] = $house_id;
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
}
return $result;
......@@ -377,6 +378,10 @@ class PushMessageService
$type = 'appointment';
$id = $v['user_id'];
break;
case 9:
$title = '退款';
$type = '';
$id = $v['user_id'];
}
$this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden,$v['house_id'], $v['order_id']);
......@@ -388,4 +393,74 @@ class PushMessageService
}
return ;
}
/**
* 退款推送
*
* @param $agent_id
* @param $report_id
* @param $order_id
* @return bool
*/
public function pushRefund($agent_id, $report_id, $order_id) {
try {
$m_agent = new AAgents();
//提交人
$agent_data = $m_agent->getAgentsStoreById(['a.id'=>$agent_id], 'a.name,b.store_name');
if (empty($agent_data)) {
return false;
}
$address = $house_id = '';
$agent_id_arr = [];
if ($order_id) {
$m_order = new OrderModel();
$house_data = $m_order->getHouseInfoByOrderIdOne('b.internal_address,b.id', ['a.id'=>$order_id]);
$address = $house_data['internal_address'];
$house_id = $house_data['id'];
$m_house_agent = new GHousesToAgents();
$house_agent = $m_house_agent->getAgentHouseOne('agents_id', ['houses_id'=>$house_data['id'], 'type'=>2]);
//盘方
foreach ($house_agent as $v) {
if ($v > 0) {
$agent_id_arr[] = $v;
}
}
}
if ($report_id) {
$m_report = new OReportModel();
$report_data = $m_report->getAgentByOrderId('a.report_agent_id,a.user_id,b.store_id,b.district_id', ['a.id'=>$report_id]);
$m_user = new Users();
$user_agent_id = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data[0]['user_id']]);
//客方
if ($user_agent_id) {
$agent_id_arr[] = $user_agent_id;
}
if ($report_data[0]['report_agent_id']) {
//报备人
$agent_id_arr[] = $report_data[0]['report_agent_id'];
$store_agent_id = $m_agent->getAgentsByWhere('id', ['store_id'=>$report_data[0]['store_id'], 'level'=>20]); //报备人店长
$district_agent_id = $m_agent->getAgentsByWhere('id', ['district_id'=>$report_data[0]['district_id'], 'level'=>30]); //报备人总监
if ($store_agent_id) {
$agent_id_arr[] = $store_agent_id;
}
if ($district_agent_id) {
$agent_id_arr[] = $district_agent_id;
}
}
}
$save['order_id'] = $order_id;
$save['message'] = "[{$agent_data['store_name']}-{$agent_data['name']}]提交[{$address},商铺:{$house_id}]退款";
$this->record(9, $house_id, $agent_id_arr, $agent_id, $save);
$result['status'] = true;
} catch (\Exception $e) {
$result['status'] = false;
$result['msg'] = $e->getMessage();
}
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