Commit 11b187e2 authored by hujun's avatar hujun

数据格式修改

parent 000d2ed6
......@@ -37,21 +37,16 @@ class GeTuiUtils
* @param $data
* @return array
*/
public function pushMessageToIgt($push_id, $type = 'other', $title, $payload)
/**
* @param $push_id
* @param $title
* @param $payload
* @return array
*/
public function pushMessageToIgt($push_id, $title, $payload)
{
$igt = new \IGeTui(self::IGT_HOST, self::IGT_APP_KEY, self::IGT_MASTER_SECRET);
/* $payload['title'] = $title;
$payload['type'] = $type; //0系统,1用户消息
$payload['msg_content'] = $data['msg_content'];
$payload['to_id'] = $data['to_id']; //接收人
$payload['from_id'] = $data['from_id']; //发送人
$payload['to_name'] = $data['to_name'];//接收人名字
$payload['from_name'] = $data['from_name'];//发送人名字
$payload['target_type'] = $data['target_type']; //1文字,2.图片 3.楼盘*/
try {
//模板
$template = $this->onlineAllTemplate($payload, $title, "1231231");
......
......@@ -64,20 +64,33 @@ class RPush
{
$title = "收到一条消息";
$arr = array(
'target_type' => $target_type,
'target' => $target,
'msg' => [ "type" => "txt", "msg" => $msg_content ],
'from' => $from,
'ext' => [ "msg_type" => $type, "user_name" => $user_name ]
);
$data = json_encode($arr);
// $arr = array(
// 'target_type' => $target_type,
// 'target' => $target,
// 'msg' => [ "type" => "txt", "msg" => $msg_content ],
// 'from' => $from,
// 'ext' => [ "msg_type" => $type, "user_name" => $user_name ]
// );
$payload = json_encode(array(
'title' => $title,
'content' => $msg_content,
'type' => $target_type,
'name' => $title,
'imageUrl' => '',
'target' => $target,
'from' => $from,
'msg_type' => 1, // 1文本 2图片3楼盘
'ext' => ["user_name" => $user_name ]
));
// $data = json_encode($arr);
$pushMessageToIgt = new GeTuiUtils();
$push_arr = $target;
$response = $pushMessageToIgt->pushMessageToIgt($push_arr, $type = 'other', $title, $data);
$response = $pushMessageToIgt->pushMessageToIgt($push_arr, $title, $payload);
/* $curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
......
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