Commit 259b29ea authored by hujun's avatar hujun

群推

parent 5f6dd1aa
...@@ -271,7 +271,7 @@ class Member extends Basic ...@@ -271,7 +271,7 @@ class Member extends Basic
$agent_ = new AAgents(); $agent_ = new AAgents();
$agent_data = $agent_->getAgentInfo('device_id',$referrer_id); $agent_data = $agent_->getAgentInfo('device_id',$referrer_id);
$content = '你有新客户【'.$user_nick.'-'.$phone.'】成功注册App'; $content = '你有新客户【'.$user_nick.'-'.$phone.'】成功注册App';
$ge_tui->public_push_message_for_one($referrer_id,$agent_data['device_id'],$content); $ge_tui->public_push_message_for_one($referrer_id,$agent_data['device_id'],'邀请注册',$content);
} }
$insert_data['referrer_id'] = $referrer_id; $insert_data['referrer_id'] = $referrer_id;
$insert_data['referrer_source'] = $referrer_source; $insert_data['referrer_source'] = $referrer_source;
......
...@@ -62,6 +62,28 @@ class OrderLogService ...@@ -62,6 +62,28 @@ class OrderLogService
} }
//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)) {
/*推送 客方,盘方,独家方,店长 start*/
$ge_tui = new GeTuiUntils();
$agent_ = new AAgents();
$report = new OReportModel();
$order = new OrderModel();
$order_agent_device = $agent_->getAgentEelationByOrderId($order_id); //独家和盘方
$report_agent_device = $report->getAgentByReportId($report_id); //客方
$name = $agent_->getAgentsById($agent_id, 'name');
$store_data = $agent_->getStoreAgentId($agent_id);//店长
$order_data = $order->getOrderById('house_title',$order_id);
$content = "恭喜【{$store_data['store_name']}】店【{$name}】成交【{$order_data['house_title']}】商铺一套";
$ge_tui->public_push_message_for_one($store_data['id'],$store_data['device_id'], '成交商铺',$content);
$ge_tui->public_push_message_for_one($report_agent_device['id'],$report_agent_device['device_id'],'成交商铺',$content);
foreach ($order_agent_device as $v) {
$ge_tui->public_push_message_for_one($v['id'],$v['device_id'],'成交商铺',$content);
}
/*推送 客方,盘方,独家方,店长 end*/
return $this->payLogModel->addPayLog($bill_arr); return $this->payLogModel->addPayLog($bill_arr);
} }
return $father_id; return $father_id;
......
...@@ -559,4 +559,70 @@ class AAgents extends BaseModel ...@@ -559,4 +559,70 @@ class AAgents extends BaseModel
'status' => 0 'status' => 0
])->count(); ])->count();
} }
/**
* 根据order_id获得独家和盘方
*
* @param $order_id
* @return array|false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentEelationByOrderId($order_id) {
$order = new OrderModel();
$house_id = $order->where('id',$order_id)->value('house_id');
$data = [];
if (!empty($house_id)) {
$agent_device = $this->alias('a')
->field('a.id,a.device_id')
->join('g_houses_to_agents b', 'a.id = b.agents_id','left')
->where('houses_id',$house_id)
->where('type','in', '2,3')
->where('is_del',0)
->select();
foreach ($agent_device as $k=>$v) {
$data[$k] = $v->getData();
}
}
return $data;
}
/**
* 多个id获取经纪人信息
*
* @param array $agent_id
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentAllById($agent_id = [], $field = '*') {
return Db::table($this->table)->field($field)
->where('id','in',implode(',',$agent_id))
->where('status',0)
->select();
}
/**
* 店长
*
* @param $agent_id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getStoreAgentId($agent_id) {
$store_id = $this->where('id', $agent_id)->value('store_id');
return $this->alias('a')
->field('b.store_name,a.id,a.device_id')
->join('a_store b', 'a.store_id=b.id')
->where('b.id',$store_id)
->where('level','in','20,30')
->find();
}
} }
\ No newline at end of file
...@@ -48,9 +48,13 @@ class OPayLogModel extends Model ...@@ -48,9 +48,13 @@ class OPayLogModel extends Model
/** /**
* 查询付款记录 * 查询付款记录
* @param string $filed *
* @param $filed
* @param $params * @param $params
* @return 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 selectPayLogByOrderNo($filed , $params) public function selectPayLogByOrderNo($filed , $params)
{ {
...@@ -77,6 +81,9 @@ class OPayLogModel extends Model ...@@ -77,6 +81,9 @@ class OPayLogModel extends Model
/** /**
* @param $params * @param $params
* @return 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 getAddPayLogNumGroupTime($params){ public function getAddPayLogNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day"; $field = "count(1) as num,DATE(create_time) as day";
...@@ -94,6 +101,13 @@ class OPayLogModel extends Model ...@@ -94,6 +101,13 @@ class OPayLogModel extends Model
->select(); ->select();
} }
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogNum($params){ public function getAddPayLogNum($params){
$field = "count(1) as num"; $field = "count(1) as num";
$where_ = []; $where_ = [];
...@@ -114,6 +128,14 @@ class OPayLogModel extends Model ...@@ -114,6 +128,14 @@ class OPayLogModel extends Model
->select(); ->select();
} }
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogOrderList($field,$params){ public function getAddPayLogOrderList($field,$params){
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if(isset($params["agent_id"])){
......
...@@ -20,6 +20,9 @@ class OReportModel extends Model ...@@ -20,6 +20,9 @@ class OReportModel extends Model
protected $table = 'o_report'; protected $table = 'o_report';
protected $db; protected $db;
/**
* OReportModel constructor.
*/
function __construct() function __construct()
{ {
$this->db = Db::name($this->table); $this->db = Db::name($this->table);
...@@ -27,8 +30,9 @@ class OReportModel extends Model ...@@ -27,8 +30,9 @@ class OReportModel extends Model
/** /**
* 添加报备 * 添加报备
*
* @param $params * @param $params
* @return array * @return int|string
*/ */
public function addReport($params) public function addReport($params)
{ {
...@@ -46,9 +50,13 @@ class OReportModel extends Model ...@@ -46,9 +50,13 @@ class OReportModel extends Model
/** /**
* 查询报备信息 * 查询报备信息
*
* @param string $filed * @param string $filed
* @param $params * @param $params
* @return 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 selectReportById($filed = "id", $params) public function selectReportById($filed = "id", $params)
{ {
...@@ -78,7 +86,9 @@ class OReportModel extends Model ...@@ -78,7 +86,9 @@ class OReportModel extends Model
* @param $params * @param $params
* @param $pageNo * @param $pageNo
* @param $pageSize * @param $pageSize
* @return false|\PDOStatement|string|\think\Collection * @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/ */
public function selectReportList($filed = "id", $params, $pageNo, $pageSize) public function selectReportList($filed = "id", $params, $pageNo, $pageSize)
{ {
...@@ -222,6 +232,14 @@ class OReportModel extends Model ...@@ -222,6 +232,14 @@ class OReportModel extends Model
} }
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddReportNumGroupTime($params) public function getAddReportNumGroupTime($params)
{ {
$field = "count(1) as num,DATE(create_time) as day"; $field = "count(1) as num,DATE(create_time) as day";
...@@ -240,6 +258,13 @@ class OReportModel extends Model ...@@ -240,6 +258,13 @@ class OReportModel extends Model
->select(); ->select();
} }
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddReportNum($params) public function getAddReportNum($params)
{ {
$field = "count(1) as num"; $field = "count(1) as num";
...@@ -264,6 +289,14 @@ class OReportModel extends Model ...@@ -264,6 +289,14 @@ class OReportModel extends Model
return $result; return $result;
} }
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddReportOrderList($field, $params) public function getAddReportOrderList($field, $params)
{ {
$where_ = []; $where_ = [];
...@@ -304,4 +337,24 @@ class OReportModel extends Model ...@@ -304,4 +337,24 @@ class OReportModel extends Model
->where($where) ->where($where)
->find(); ->find();
} }
/**
* 根据order_id获得客方
*
* @param $report_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentByReportId($report_id) {
$user_id = $this->db->field('user_id')
->where('id',$report_id)
->value('user_id');
$user = new Users();
$agent_id = $user->where('id',$user_id)->value('agent_id');
$agent_data = $this->db->table('a_agents')->field('id,device_id')->where('id',$agent_id)->find();
return $agent_data;
}
} }
\ No newline at end of file
...@@ -137,4 +137,17 @@ class OrderModel extends Model ...@@ -137,4 +137,17 @@ class OrderModel extends Model
} }
/**
* @param $field
* @param $order_id
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getOrderById($field, $order_id) {
return $this->field($field)
->where('id',$order_id)
->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