作者 董瑞恩
1 个管道 的构建 通过 耗费 1 秒

interface

... ... @@ -11,6 +11,7 @@ namespace app\portal\controller;
use cmf\controller\HomeBaseController;
use think\Db;
use wxapp\aes\WXBizDataCrypt;
/**
* @title 登录相关接口
... ... @@ -54,4 +55,37 @@ class LoginController extends HomeBaseController{
$this->apiResponse(301,'获取登录凭证失败',$loginData);
}
}
/**
* @title 获取手机号
* @description 获取手机号
* @author 董瑞恩
* @url /portal/login/getPhone
* @method GET
*
* @param name:code type:String require:1 default:无 other: desc:code
* @param name:encrypted_data type:String require:1 default:无 other: desc:encrypted_data
* @param name:iv type:String require:1 default:无 other: desc:iv
*
* @return result:退款接口返回值
*/
public function getPhone(){
$param = $this->request->param();
$loginUrl="https://api.weixin.qq.com/sns/jscode2session?appid=".$this->appId."&secret=".$this->appSecret."&js_code=".$param['code']."&grant_type=authorization_code";
$response=json_decode(file_get_contents($loginUrl),true);
if (!empty($response['errcode'])) {
$this->error('操作失败!');
}
$openid = $response['openid'];
$sessionKey = $response['session_key'];
$pc = new WXBizDataCrypt($this->appId, $sessionKey);
$errCode = $pc->decryptData($param['encrypted_data'], $param['iv'], $wxUserData);
if ($errCode != 0) {
$this->apiResponse(301,'操作失败');
}
$this->apiResponse(200,'success',$wxUserData);
}
}
\ No newline at end of file
... ...
... ... @@ -110,7 +110,7 @@ class OrderController extends HomeBaseController{
//判断是否跨天
if ($endTime < $stateTime){
$stateTime-=86400;
$endTime+=86400;
}
dump(date('Y-m-d H:i:s',$stateTime));
dump(date('Y-m-d H:i:s',$endTime));
... ...
... ... @@ -221,5 +221,4 @@ class UsersController extends HomeBaseController{
});
$response->send();
}
}
\ No newline at end of file
... ...
... ... @@ -24,7 +24,7 @@ class Prpcrypt
public function decrypt($aesCipher, $aesIV)
{
if (!function_exists('mcrypt_module_open')) {
if (function_exists('mcrypt_module_open')) {
try {
$module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
... ...