添加在拨号时,检查话费剩余时间判断。

dev
曾超新 5 years ago
parent cd25c606fc
commit a877e4f28f
  1. 1
      frontend/config/params.php
  2. 24
      frontend/controllers/PhoneController.php

@ -5,5 +5,6 @@ return [
'token' => 'ff7dc73536475c11981a1c52531f2ff7',
'phone_url' => 'http://user.banmacar.com/api/phone/op',
'sms_url' => 'http://user.banmacar.com/api/sms/single-send',
'myinfo_url' => 'http://user.banmacar.com/api/user/myinfo',
],
];

@ -16,6 +16,7 @@ use common\models\NetworkPhoneAssignT;
use common\models\NetworkPhoneSubT;
use common\models\NetworkPhoneT;
use GuzzleHttp\Client;
use Yii;
use yii\console\Request;
use yii\web\Response;
@ -723,11 +724,30 @@ class PhoneController extends \yii\web\Controller
$phone = $request->get('phone','');
$user_id = $request->get('user_id',0);
//检查通话剩余分钟
$url = Yii::$app->params['userPanel']['myinfo_url'];
$token = Yii::$app->params['userPanel']['token'];
$client = new Client();
$res = $client->request('GET', $url.'?token='.$token);
$phone_time = 0;
if($res->getStatusCode() == 200) {
$obj = json_decode($res->getBody(), true);
if($obj['code'] == 400) {
$result['msg'] = $obj['msg'];
return $result;
}
$phone_time = intval($obj['data']['phone_time']);
}
if($phone_time <= 0) {
$result['msg'] = '电话剩余话费不足,请联系管理员充值';
return $result;
}
$headers = array(
"Content-Type: application/json;charset=UTF-8",
"Accept:application/json",
);
$uri = "http://api.1ketong.com/ykt-pool/number/ax2/call_out";
$app_key = '0946239060682011';

Loading…
Cancel
Save