Commit 7d89811f authored by hujun's avatar hujun

收款推送

parent 8ef0713e
...@@ -19,6 +19,7 @@ use app\model\MPushMessage; ...@@ -19,6 +19,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\Users;
class PushMessageService class PushMessageService
...@@ -65,29 +66,46 @@ class PushMessageService ...@@ -65,29 +66,46 @@ class PushMessageService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function pushMarchInMessage($report_id = 0, $type = 1) public function pushMarchInMessage($report_id = 0, $type = 1, $operation_id)
{ {
$report = new OReportModel(); $report = new OReportModel();
$field = 'house_title,user_name,report_store_id,report_agent_id'; $field = 'house_title,user_name,report_store_id,report_agent_id,a.user_id,b.house_id';
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]); $report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$agent = new AAgents(); $agent = new AAgents();
$agent_id = [];
if ($type == 1) { if ($type == 1) {
$content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺"; $data['message'] = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺";
$title = '进场';
} else { } else {
$content = "【{$report_data['house_title']}】商铺收款"; $data['message'] = "【{$report_data['house_title']}】商铺收款";
$title = '收款';
} $m_user = new Users();
$client_agent = $m_user->getUserByWhereValue('agent_id', ['id'=>$report_data['user_id']]);
if (!empty($client_agent)) {
$agent_id[] = $client_agent; //客方
}
$agent_house = new GHousesToAgents();
$house_where['houses_id'] = $report_data['house_id'];
$house_where['is_del'] = 0;
$house_where['type'] = 2;
$agent_house_id = $agent_house->getAgentHouseValue('agents_id', $house_where);
if (!empty($agent_house_id)) {
$agent_id[] = $agent_house_id; //
}
}
$where['store_id'] = $report_data['report_store_id']; $where['store_id'] = $report_data['report_store_id'];
$where['level'] = [ 'in', '20,40' ]; $where['level'] = [ 'in', '20,40' ];
$agent_store = $agent->getAgentInfo('id', '', $where); $agent_store = $agent->getAgentInfo('id', '', $where);
$this->pushAgentAllDeviceId($report_data['report_agent_id'], $title, $content); $agent_id[] = $report_data['report_agent_id'];
$this->pushAgentAllDeviceId($agent_store['id'], $title, $content); $agent_id[] = $agent_store['id'];
$this->record(2, 0, $agent_id, $operation_id, $data);
// $this->pushAgentAllDeviceId($report_data['report_agent_id'], $title, $content);
// $this->pushAgentAllDeviceId($agent_store['id'], $title, $content);
return; return;
} }
...@@ -321,6 +339,13 @@ class PushMessageService ...@@ -321,6 +339,13 @@ class PushMessageService
$id = $v['addressee_id']; $id = $v['addressee_id'];
$type = 'down_line'; $type = 'down_line';
$is_forbidden = 1; $is_forbidden = 1;
break;
case 5:
$title = '收款';
break;
case 6:
$title = '进场';
break;
} }
$result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden); $result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden);
......
...@@ -428,6 +428,18 @@ class GHousesToAgents extends BaseModel ...@@ -428,6 +428,18 @@ class GHousesToAgents extends BaseModel
->column($field); ->column($field);
} }
/**
* @param $field
* @param $type
* @param $houses_id
* @param int $is_del
* @return array
*/
public function getAgentHouseValue($field, $where) {
return $this->where($where)
->value($field);
}
/** /**
* @param $field * @param $field
* @param $where * @param $where
......
...@@ -66,6 +66,17 @@ class Users extends Model ...@@ -66,6 +66,17 @@ class Users extends Model
->Column($fields); ->Column($fields);
} }
/**
* @param $param
* @param $fields
* @return array
*/
public function getUserByWhereValue($param, $fields)
{
return $this->where($param)
->value($fields);
}
/** /**
* 查询好友邀请记录-后期加分页 * 查询好友邀请记录-后期加分页
* @param $param * @param $param
......
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