更换短信接口

dev
曾超新 5 years ago
parent bd70c22332
commit 32f36864c4
  1. 11
      frontend/controllers/CarController.php
  2. 11
      frontend/controllers/PhoneController.php

@ -4544,7 +4544,8 @@ class CarController extends BaseController
$MessageContent = str_replace("\t","",$MessageContent); $MessageContent = str_replace("\t","",$MessageContent);
$url = 'https://sms.yunpian.com/v2/sms/single_send.json'; $url = 'https://sms.yunpian.com/v2/sms/single_send.json';
$params['apikey'] = '453067dc4b9eb0dc0c448674d79e85aa'; $url = 'https://www.banmacar.com/api/single_send';
$params['token'] = '84c5722fd1455582c53b7195ccef44c2';
$params['mobile'] = $UserNumber; $params['mobile'] = $UserNumber;
$params['text'] = $MessageContent; $params['text'] = $MessageContent;
$post_url = http_build_query($params); $post_url = http_build_query($params);
@ -4552,13 +4553,13 @@ class CarController extends BaseController
$msg = MyLib::Post($post_url,$url); $msg = MyLib::Post($post_url,$url);
// $msg = mb_convert_encoding($msg,'UTF8','GBK'); // $msg = mb_convert_encoding($msg,'UTF8','GBK');
// parse_str($msg,$obj); // parse_str($msg,$obj);
$obj = json_decode($msg); $obj = json_decode($msg,true);
$result = array(); $result = array();
// $result['success'] = true; // $result['success'] = true;
if($obj->code == 0){ if($obj['success']) {
$result['msg'] = $obj->msg; $result['msg'] = $obj['msg'];
}else{ }else{
$result['msg'] = $obj->msg.'('.$obj->detail.')'; $result['msg'] = $obj['msg'];
} }
return $result; return $result;
} }

@ -248,7 +248,8 @@ class PhoneController extends \yii\web\Controller
} }
} }
public function actionPushApi()
public function actionPushApi()
{ {
// header("Content-type: text/html; charset=utf-8"); // header("Content-type: text/html; charset=utf-8");
// Yii::$app->response->format = Response::FORMAT_JSON; // Yii::$app->response->format = Response::FORMAT_JSON;
@ -330,13 +331,6 @@ public function actionPushApi()
$network_phone->extend=$extend; $network_phone->extend=$extend;
$network_phone->begin_date=date('Y-m-d'); $network_phone->begin_date=date('Y-m-d');
$network_phone->is_called=$is_called; $network_phone->is_called=$is_called;
$res = $network_phone->save(false); $res = $network_phone->save(false);
@ -474,7 +468,6 @@ public function actionPushApi()
} }
public function actionCallApi() public function actionCallApi()
{ {
header("Content-type: application/json;charset=UTF-8"); header("Content-type: application/json;charset=UTF-8");

Loading…
Cancel
Save