
- 新增 Template通道类,实现了一些通用的充值和查询功能 - 修改 Mykjapi 类,增加了一些注释和调试代码 - 更新 Order 控制器,增加了订单号的处理逻辑 - 调整 merchantApi/Order 控制器,优化了参数处理 - 修改 OrderCancel命令,增加了条件判断和日志记录
120 lines
2.6 KiB
PHP
120 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace app\channel\service\system;
|
|
|
|
/**
|
|
* 迈远科技api
|
|
* Class Baidumnpapi
|
|
* @package app\channel\service
|
|
*/
|
|
class Mykjapi extends Core
|
|
{
|
|
# 这几个可以后台设置
|
|
protected $host = '';
|
|
protected $mid = '';
|
|
protected $token = '';
|
|
protected $method = '';
|
|
|
|
#通用充值
|
|
public function phone_mnp($param)
|
|
{
|
|
$mobile = $param['mobile'];
|
|
$url = $this->host .'HrmApi/numberPortingCheck';
|
|
$request = [
|
|
'hashcode'=>$this->mid,
|
|
'mobile'=>$mobile,
|
|
];
|
|
|
|
$request['sign'] = md5($this->mid.$mobile.$this->token.date('Ymd',time()));
|
|
|
|
|
|
|
|
|
|
|
|
$response = $this->curl('post', $url, $request ,true);
|
|
|
|
$response = $this->response($response);
|
|
// var_dump($response);die;
|
|
|
|
//$response['data'] = '{}';
|
|
//$response['msg'] = 'ok';
|
|
if($response['msg'] == 'ok'){
|
|
if(isset($response['array']['mobileresult']['res'])){
|
|
if($response['array']['mobileresult']['res'] == '1'){
|
|
return ['mobile'=>$response['array']['mobileresult']['mobile'],'old_isp'=>$response['array']['mobileresult']['initIsp'],'new_isp'=>$response['array']['mobileresult']['isp'] ];
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
return $response['msg'];
|
|
|
|
}
|
|
|
|
# 查询余额接口
|
|
public function account($day)
|
|
{
|
|
$request = [
|
|
'hashcode'=>$this->mid,
|
|
];
|
|
$request['sign'] = md5($this->mid.$this->token.date('Ymd',time()));
|
|
$url = $this->host . 'HrmApi/balance';
|
|
$response = $this->curl('post', $url, $request,true);
|
|
$response = $this->response($response);
|
|
|
|
$datas = $response['array']['errorRes'];
|
|
if(is_array($datas) && isset($datas['balance']) && $datas['balance'] ){
|
|
$datas['account'] = $datas['balance'];
|
|
}
|
|
|
|
return $datas;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 数据响应格式处理
|
|
public function response($data)
|
|
{
|
|
$log['type'] = 'response';
|
|
$log['data'] = $data;
|
|
$log['config'] = $this->data;
|
|
$this->log($log);
|
|
|
|
$array = $this->json_decode($data);
|
|
if (!$array) {
|
|
$msg = 'error';
|
|
} elseif (isset($array['errorRes']['err_code']) && $array['errorRes']['err_code'] == 200) {
|
|
# 正确
|
|
$msg = 'ok';
|
|
|
|
} else {
|
|
# 错误
|
|
$msg = $array['errorRes']['err_content'] ?? 'error';
|
|
}
|
|
|
|
|
|
|
|
return array
|
|
(
|
|
'msg' => $msg,
|
|
'data' => $data,
|
|
'array' => $array,
|
|
);
|
|
}
|
|
|
|
|
|
|
|
# 提交数据
|
|
private function submit($param, $check)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
} |