|
@@ -145,6 +145,10 @@ class Sdzxlist extends Start_Controller {
|
|
|
|
|
|
|
|
|
|
|
|
|
private function _zczxttznx(){
|
|
private function _zczxttznx(){
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>'执行失败'
|
|
|
|
|
+ ]);exit;
|
|
|
if($this->input->method() == 'post'){
|
|
if($this->input->method() == 'post'){
|
|
|
$id = $this->input->post('id');
|
|
$id = $this->input->post('id');
|
|
|
$info = $this->sdzxlist->read($id);
|
|
$info = $this->sdzxlist->read($id);
|
|
@@ -153,9 +157,43 @@ class Sdzxlist extends Start_Controller {
|
|
|
$list = [];
|
|
$list = [];
|
|
|
$list['user_id'] = $params['post']['buyer_user_id'];
|
|
$list['user_id'] = $params['post']['buyer_user_id'];
|
|
|
$res = $this->apitt->openZnxWindow($list,$shop);
|
|
$res = $this->apitt->openZnxWindow($list,$shop);
|
|
|
- echo "<pre>";
|
|
|
|
|
- var_dump($res);
|
|
|
|
|
- die;
|
|
|
|
|
|
|
+ if(empty($res)){
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>'获取会话ID失败'
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!isset($res['data']['conversation_id'])){
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>$res['message']
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ $conversation_id = $res['data']['conversation_id'];
|
|
|
|
|
+ $notice = $params['content'];
|
|
|
|
|
+
|
|
|
|
|
+ $rr = $this->apitt->sendZnxMessage($shop,$notice,$conversation_id);
|
|
|
|
|
+ if(empty($rr)){
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>'发送消息失败'
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isset($rr['data']['message_id']))
|
|
|
|
|
+ {
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>1,
|
|
|
|
|
+ 'msg'=>'发送成功'
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>$rr['message']
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}else{
|
|
}else{
|
|
|
echo json_encode([
|
|
echo json_encode([
|
|
|
'code'=>-1,
|
|
'code'=>-1,
|