Commit 350192e2 authored by hujun's avatar hujun

进场推送

parent 2f2e0c65
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api\untils\GeTuiUntils;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\OrderLogService; use app\api_broker\service\OrderLogService;
use app\model\AAgents;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OMarchInModel; use app\model\OMarchInModel;
use app\model\ORefundModel; use app\model\ORefundModel;
use app\model\OReportModel;
use think\Exception; use think\Exception;
/** /**
...@@ -59,7 +62,22 @@ class OrderLog extends Basic ...@@ -59,7 +62,22 @@ class OrderLog extends Basic
$is_ok = $this->o_march_in_model->addMarchIn($params); $is_ok = $this->o_march_in_model->addMarchIn($params);
$is_ok=1;
if ($is_ok > 0) { if ($is_ok > 0) {
$ge_tui = new GeTuiUntils();
$report = new OReportModel();
$field = 'house_title,user_name';
$report_data = $report->getReportOrder($field, ['a.id'=>$params["report_id"]]);
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('device_id,store_id',$params['reception_id']);
$content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺";
$where['store_id'] = $agent_data['store_id'];
$where['level'] = 20;
$agent_store = $agent->getAgentInfo('id,device_id','',$where);
$ge_tui->public_push_message_for_one($params['reception_id'], $agent_data['device_id'],'进场', $content);
$ge_tui->public_push_message_for_one($agent_store['reception_id'], $agent_store['device_id'],'进场', $content);
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
} else { } else {
return $this->response("101", "request faild"); return $this->response("101", "request faild");
......
...@@ -454,29 +454,43 @@ class AAgents extends BaseModel ...@@ -454,29 +454,43 @@ class AAgents extends BaseModel
->find(); ->find();
} }
/**
* @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 getStoreOrAgentInfo($field ,$params){ public function getStoreOrAgentInfo($field ,$params){
$result = Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("a_store b","a.store_id = b.id","left") ->join("a_store b","a.store_id = b.id","left")
->where($params) ->where($params)
->where('a.level',['=',20],['=',40],'or') ->where('a.level',['=',20],['=',40],'or')
->select(); ->select();
return $result;
} }
/**
/**
* 根据id获取经纪人信息 * 根据id获取经纪人信息
* *
* @param $field * @param $field
* @param $agent_id * @param $agent_id
* @param string $where
* @return array|false|\PDOStatement|string|\think\Model * @return array|false|\PDOStatement|string|\think\Model
* @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 getAgentInfo($field, $agent_id) { public function getAgentInfo($field, $agent_id = '', $params = '') {
return $this->field($field) if ($agent_id != '') {
->where('id',$agent_id) $where['id'] = $agent_id;
} else {
$where = $params;
}
return $this->field($field)
->where($where)
->find(); ->find();
} }
} }
\ No newline at end of file
...@@ -190,10 +190,11 @@ class GHousesToAgents extends BaseModel ...@@ -190,10 +190,11 @@ class GHousesToAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getDevice_id($house_id, $type = 1) { public function getAgentList($house_id, $type = 1) {
return $this->field('b.id,device_id') return $this->field('b.id,device_id,store_name')
->alias('a') ->alias('a')
->join('a_agents b', 'a.agents_id = b.id','left') ->join('a_agents b', 'a.agents_id = b.id','left')
->join('a_store c', 'b.store_id = c.id','left')
->where('houses_id', $house_id) ->where('houses_id', $house_id)
->where('type', $type) ->where('type', $type)
->select(); ->select();
......
...@@ -199,4 +199,21 @@ class OReportModel extends Model ...@@ -199,4 +199,21 @@ class OReportModel extends Model
->select(); ->select();
} }
/**
* 获取报备和订单信息
*
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getReportOrder($field, $where) {
return $this->field($field)
->alias('a')
->join('o_order b','b.f_id=a.id','left')
->where($where)
->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