Commit ea26e994 authored by clone's avatar clone

bug

parent 27e1270b
...@@ -77,16 +77,16 @@ class AppChat extends Basic ...@@ -77,16 +77,16 @@ class AppChat extends Basic
*/ */
public function userChat() public function userChat()
{ {
/* $params = array( $params = $this->params;
"user_id" => 118, $params = array(
"mobile" => "15821506182", "user_id" => 80,
"source" => 1 //1经纪人 2用户 "mobile" => "15821506182",
"device_id" => "ssss1231231123123", "source" => 1, //1经纪人 2用户
"push_id" => "ssss1231231123123" "device_id" => "ssss1231231123123",
"push_id" => "ssss1231231123123"
);*/ );
$params = $this->params;
if (!isset($params['user_id']) || !isset($params['mobile']) || !isset($params['source']) || !isset($params['push_id'])) { if (!isset($params['user_id']) || !isset($params['mobile']) || !isset($params['source']) || !isset($params['push_id'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误"); return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
...@@ -321,10 +321,10 @@ class AppChat extends Basic ...@@ -321,10 +321,10 @@ class AppChat extends Basic
public function getChatRelation() public function getChatRelation()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"target" => "121" "target" => "121"
);*/ );*/
if (!isset($params['target']) ) { if (!isset($params['target'])) {
return $this->response("300", "参数不全"); return $this->response("300", "参数不全");
} }
$target = $params["target"]; $target = $params["target"];
......
...@@ -83,6 +83,7 @@ class ChatService ...@@ -83,6 +83,7 @@ class ChatService
return [ "code" => "101", "msg" => "没有找到用户信息" ]; return [ "code" => "101", "msg" => "没有找到用户信息" ];
} else { } else {
$id = $this->insertChatUser($source, $user_id, $mobile, $only_id); $id = $this->insertChatUser($source, $user_id, $mobile, $only_id);
echo $id;
//todo 保存或更新push_id //todo 保存或更新push_id
if ($id > 0) { if ($id > 0) {
$this->savePushId($id, $device_id, $push_id); $this->savePushId($id, $device_id, $push_id);
...@@ -107,7 +108,7 @@ class ChatService ...@@ -107,7 +108,7 @@ class ChatService
$params["push_id"] = $push_id; $params["push_id"] = $push_id;
$params["is_forbidden"] = 0; $params["is_forbidden"] = 0;
$params["create_time"] = date("Y-m-d H:i:s", time()); $params["create_time"] = date("Y-m-d H:i:s", time());
$params["updated_at"] = date("Y-m-d H:i:s", time()); $params["update_time"] = date("Y-m-d H:i:s", time());
$this->chatUserExtModel->addChatUserExt($params); $this->chatUserExtModel->addChatUserExt($params);
return true; return true;
} }
......
...@@ -35,7 +35,7 @@ class ChatUser extends Model ...@@ -35,7 +35,7 @@ class ChatUser extends Model
{ {
Db::startTrans(); Db::startTrans();
try { try {
$res = $this->save($params); $res = $this->insertGetId($params);
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
namespace app\model; namespace app\model;
use think\Db;
class ChatUserExt extends BaseModel class ChatUserExt extends BaseModel
{ {
// 设置当前模型对应的完整数据表名称 // 设置当前模型对应的完整数据表名称
...@@ -63,4 +65,45 @@ class ChatUserExt extends BaseModel ...@@ -63,4 +65,45 @@ class ChatUserExt extends BaseModel
return $res; return $res;
} }
/**
* bin
* @param $params
* @return array
*/
private function wxInfoBin($params)
{
$arr = [];
if (isset($params["id"])) {
$arr["id"] = $params["id"];
} else {
$arr["create_time"] = date("Y-m-d H:i:s", time());
}
if (isset($params["wx_open_id"])) {
$arr["wx_open_id"] = $params["wx_open_id"];
}
if (isset($params["wx_union_id"])) {
$arr["wx_union_id"] = $params["wx_union_id"];
}
if (isset($params["buyer_nick"])) {
$arr["buyer_nick"] = $params["buyer_nick"];
}
if (isset($params["buyer_img"])) {
$arr["buyer_img"] = $params["buyer_img"];
}
if (isset($params["sex"])) {
$arr["sex"] = $params["sex"];
}
if (isset($params["province"])) {
$arr["province"] = $params["province"];
}
if (isset($params["city"])) {
$arr["city"] = $params["city"];
}
if (isset($params["source"])) {
$arr["source"] = $params["source"];
}
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
} }
\ 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