Commit 0194976d authored by hujun's avatar hujun

11

parent 5294359e
......@@ -13,7 +13,7 @@ use think\Db;
class MPushMessage
{
protected $table = "o_bargain";
protected $table = "m_push_message";
private $db_;
public function __construct()
......@@ -21,6 +21,46 @@ class MPushMessage
$this->db_ = Db::name($this->table);
}
/**
* @param $data
* @param $operation_id
* @param $type
* @return bool
*/
public function addData($data, $operation_id, $type) {
if (isset($data['agent_id'])) {
$insert_data['addressee_id'] = $data['agent_id'];
}
if (isset($data['house_id'])) {
$insert_data['house_id'] = $data['house_id'];
}
if (isset($data['message'])) {
$insert_data['message'] = $data['message'];
}
if (isset($data['user_id'])) {
$insert_data['user_id'] = $data['user_id'];
}
if (isset($data['addressee_id'])) {
$insert_data['addressee_id'] = $data['addressee_id'];
}
$insert_data['type'] = $type;
$insert_data['status'] = 0;
$insert_data['operation_id'] = $operation_id;
$num = $this->db_->insert($insert_data);
if ($num > 0) {
$result = true;
} else {
$result = false;
}
return $result;
}
/**
* 根据楼盘id批量插入数据
*
......@@ -28,12 +68,11 @@ class MPushMessage
* @param int $operation_id 操作人id
* @param int $type 消息类型:0群推 1商铺下架 2修改客方 3盘方修改
* @param $data
* @return int|string
* @return bool
*/
public function addHouseIdArray(array $house_id, int $operation_id, int $type, $data)
public function addHouseIdArray(array $house_id, int $operation_id = 0, int $type, $data)
{
if (is_array($house_id)) {
if (!is_array($house_id)) {
return false;
}
......@@ -58,7 +97,14 @@ class MPushMessage
$insert_data[$k]['operation_id'] = $operation_id;
}
return $this->db_->insertAll($insert_data);
$num = $this->db_->insertAll($insert_data);
if (count($num) > 0) {
$result = true;
} else {
$result = false;
}
return $result;
}
/**
......@@ -68,11 +114,11 @@ class MPushMessage
* @param int $operation_id 操作人id
* @param int $type 消息类型:0群推 1商铺下架 2修改客方 3盘方修改
* @param $data
* @return int|string
* @return bool
*/
public function addAgentIdArray(array $agent_id, int $operation_id, int $type, $data)
{
if (is_array($agent_id)) {
if (!is_array($agent_id)) {
return false;
}
......@@ -97,6 +143,26 @@ class MPushMessage
$insert_data[$k]['operation_id'] = $operation_id;
}
return $this->db_->insertAll($insert_data);
$num = $this->db_->insertAll($insert_data);
if (count($num) > 0) {
$result = true;
} else {
$result = false;
}
return $result;
}
public function selectAgentHouse($house_id) {
$m_house = new GHousesToAgents();
$where['a.house_id'] = $house_id;
$result = $m_house->getHouseAgent('agents_id', $where);
$data = [];
if ($result['status'] != 'fail') {
$data = $result['data'];
}
return $data;
}
}
\ 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