Commit 2c02709f authored by hujun's avatar hujun

不同城市客方

parent 0b8a3c2a
...@@ -90,7 +90,7 @@ class FindShop extends Basic ...@@ -90,7 +90,7 @@ class FindShop extends Basic
$id = $findShopModel->addFindShop($updateParams); $id = $findShopModel->addFindShop($updateParams);
$pushService = new PushMessageService(); $pushService = new PushMessageService();
$pushService->pushFindShopMessage($params["user_id"]); $pushService->pushFindShopMessage($params["user_id"], $params["site_id"]);
} }
if ($id > 0) { if ($id > 0) {
return $this->response("200", "数据保存成功", ["id" => $id]); return $this->response("200", "数据保存成功", ["id" => $id]);
......
...@@ -84,7 +84,7 @@ class OrderLog extends Basic ...@@ -84,7 +84,7 @@ class OrderLog extends Basic
$oImgModel->addImgAll($insert_id, 1, $march_in_img); $oImgModel->addImgAll($insert_id, 1, $march_in_img);
$pushMarchIn = new PushMessageService(); $pushMarchIn = new PushMessageService();
$pushMarchIn->pushMarchInMessage($params["report_id"], 1, $this->agentId); //推送 $pushMarchIn->pushMarchInMessage($params["report_id"], 1, $this->agentId, $this->siteId); //推送
//评价经纪人 //评价经纪人
$push_client = new PushClientService(); $push_client = new PushClientService();
...@@ -182,7 +182,7 @@ class OrderLog extends Basic ...@@ -182,7 +182,7 @@ class OrderLog extends Basic
$is_ok = $this->service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"], $is_ok = $this->service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"],
$params["order_id"], $params["order_no"], $params["collecting_bill"], $params["house_number"], $params["industry_type"], $params["order_id"], $params["order_no"], $params["collecting_bill"], $params["house_number"], $params["industry_type"],
$remark, $transfer_img, $source, $income_time, $params["is_dividend"], $last_transfer_time, $pay_id, $remark, $transfer_img, $source, $income_time, $params["is_dividend"], $last_transfer_time, $pay_id,
$receipt_number, $transfer_name, $received_money, $type_ext, $params['bargain_id'], $is_open); $receipt_number, $transfer_name, $received_money, $type_ext, $params['bargain_id'], $is_open, $this->siteId);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", ["bill_id" => $is_ok]); return $this->response("200", "request success", ["bill_id" => $is_ok]);
......
...@@ -75,7 +75,7 @@ class OrderLogService ...@@ -75,7 +75,7 @@ class OrderLogService
public function addCollectingBill($agent_id, $agent_name, $report_id, $order_id, $order_no, $collecting_bill, $house_number, public function addCollectingBill($agent_id, $agent_name, $report_id, $order_id, $order_no, $collecting_bill, $house_number,
$industry_type, $remark, $transfer_img, $source, $income_time, $is_dividend, $industry_type, $remark, $transfer_img, $source, $income_time, $is_dividend,
$last_transfer_time, $pay_id, $receipt_number, $transfer_name, $received_money, $last_transfer_time, $pay_id, $receipt_number, $transfer_name, $received_money,
$type_ext, $bargain_id, $is_open) $type_ext, $bargain_id, $is_open, $site_id)
{ {
$bill_arr = $params = []; $bill_arr = $params = [];
$father_id = 0; $father_id = 0;
...@@ -122,7 +122,7 @@ class OrderLogService ...@@ -122,7 +122,7 @@ class OrderLogService
} }
$pushMarchIn = new PushMessageService(); $pushMarchIn = new PushMessageService();
$pushMarchIn->pushMarchInMessage($params["report_id"], 2, $agent_id, $type); //推送 $pushMarchIn->pushMarchInMessage($params["report_id"], 2, $agent_id, $type, $site_id); //推送
} }
//todo if bill_arr not null, save database table //todo if bill_arr not null, save database table
if (!empty($bill_arr)) { if (!empty($bill_arr)) {
......
...@@ -20,6 +20,7 @@ use app\model\MPushMessage; ...@@ -20,6 +20,7 @@ use app\model\MPushMessage;
use app\model\OrderModel; use app\model\OrderModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\PushFeed; use app\model\PushFeed;
use app\model\UserAgentModel;
use app\model\Users; use app\model\Users;
...@@ -79,11 +80,12 @@ class PushMessageService ...@@ -79,11 +80,12 @@ class PushMessageService
* @param $type * @param $type
* @param $operation_id * @param $operation_id
* @param $type_source @付款类型 * @param $type_source @付款类型
* @param $site_id
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function pushMarchInMessage($report_id, $type, $operation_id, $type_source = 0) public function pushMarchInMessage($report_id, $type, $operation_id, $type_source = 0, $site_id)
{ {
$report = new OReportModel(); $report = new OReportModel();
...@@ -99,9 +101,10 @@ class PushMessageService ...@@ -99,9 +101,10 @@ class PushMessageService
$operation_name = $agent->getAgentsById($operation_id,'name'); $operation_name = $agent->getAgentsById($operation_id,'name');
$data['message'] = "{$operation_name} 提交【{$report_data['house_title']}】商铺收款"; $data['message'] = "{$operation_name} 提交【{$report_data['house_title']}】商铺收款";
$m_user = new Users(); // $m_user = new Users();
$client_agent = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data['user_id']]); // $client_agent = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data['user_id']]);
$client_agent = $this->getUserAgent($report_data['user_id'], $site_id);
if (!empty($client_agent)) { if (!empty($client_agent)) {
$agent_id[] = $client_agent; //客方 $agent_id[] = $client_agent; //客方
} }
...@@ -435,7 +438,7 @@ class PushMessageService ...@@ -435,7 +438,7 @@ class PushMessageService
$m_agent = new AAgents(); $m_agent = new AAgents();
//提交人 //提交人
$agent_data = $m_agent->getAgentsStoreById(['a.id'=>$agent_id], 'a.name,b.store_name'); $agent_data = $m_agent->getAgentsStoreById(['a.id'=>$agent_id], 'a.name,b.store_name,a.site_id');
if (empty($agent_data)) { if (empty($agent_data)) {
return false; return false;
} }
...@@ -460,9 +463,10 @@ class PushMessageService ...@@ -460,9 +463,10 @@ class PushMessageService
if ($report_id) { if ($report_id) {
$m_report = new OReportModel(); $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]); $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(); // $m_user = new Users();
$user_agent_id = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data[0]['user_id']]); // $user_agent_id = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data[0]['user_id']]);
//客方 //客方
$user_agent_id = $this->getUserAgent($report_data[0]['user_id'], $agent_data['site_id']);
if ($user_agent_id) { if ($user_agent_id) {
$agent_id_arr[] = $user_agent_id; $agent_id_arr[] = $user_agent_id;
} }
...@@ -493,12 +497,16 @@ class PushMessageService ...@@ -493,12 +497,16 @@ class PushMessageService
return $result; return $result;
} }
/**
public function pushFindShopMessage($user_id) * @param $user_id
* @param $site_id
*/
public function pushFindShopMessage($user_id, $site_id)
{ {
$data['message'] = "你的客户(ID:{$user_id})提交了委托找铺需求,请到电脑端查看"; $data['message'] = "你的客户(ID:{$user_id})提交了委托找铺需求,请到电脑端查看";
$m_user = new Users(); // $m_user = new Users();
$client_agent = $m_user->getUserByWhereValue('agent_id', ['id'=>$user_id]); // $client_agent = $m_user->getUserByWhereValue('agent_id', ['id'=>$user_id]);
$client_agent = $this->getUserAgent($user_id, $site_id);
$agent_id = []; $agent_id = [];
if (count($client_agent) > 0) { if (count($client_agent) > 0) {
$agent_id[] = $client_agent; $agent_id[] = $client_agent;
...@@ -509,4 +517,19 @@ class PushMessageService ...@@ -509,4 +517,19 @@ class PushMessageService
$this->record($push_type, 0, $agent_id, 0, $data); $this->record($push_type, 0, $agent_id, 0, $data);
return; return;
} }
/**
* 获取所有客方id
*
* @param $user_id
* @param $site_id
* @return array
*/
public function getUserAgent($user_id, $site_id)
{
$m_user_agent = new UserAgentModel();
$where['user_id'] = $user_id;
$where['site_id'] = $site_id;
return $m_user_agent->getUserAgentColumn('agent_id', $where);
}
} }
\ No newline at end of file
...@@ -3978,7 +3978,7 @@ class Finance extends Basic ...@@ -3978,7 +3978,7 @@ class Finance extends Basic
$service_ = new OrderLogService(); $service_ = new OrderLogService();
$is_ok = $service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"], $is_ok = $service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"],
$params["order_id"], $params["order_no"], $params["collecting_bill"], $params["house_number"], $params["industry_type"], $params["order_id"], $params["order_no"], $params["collecting_bill"], $params["house_number"], $params["industry_type"],
$remark, $transfer_img, $source,$income_time,$params["is_dividend"],$last_transfer_time,$pay_id, $receipt_number,$transfer_name, $received_money, $type_ext, $params['bargain_id'], $is_open); $remark, $transfer_img, $source,$income_time,$params["is_dividend"],$last_transfer_time,$pay_id, $receipt_number,$transfer_name, $received_money, $type_ext, $params['bargain_id'], $is_open, $this->siteId);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", [ "bill_id" => $is_ok ]); return $this->response("200", "request success", [ "bill_id" => $is_ok ]);
......
...@@ -49,5 +49,15 @@ class UserAgentModel extends Model ...@@ -49,5 +49,15 @@ class UserAgentModel extends Model
} }
/**
* @param $field
* @param $params
* @return array
*/
public function getUserAgentColumn($field, $params) {
$params['is_del'] = 0;
return $this->db_->field($field)
->where($params)
->column($field);
}
} }
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