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

interface

@@ -11,6 +11,7 @@ namespace app\portal\controller; @@ -11,6 +11,7 @@ namespace app\portal\controller;
11 11
12 use cmf\controller\HomeBaseController; 12 use cmf\controller\HomeBaseController;
13 use think\Db; 13 use think\Db;
  14 +use wxapp\aes\WXBizDataCrypt;
14 15
15 /** 16 /**
16 * @title 登录相关接口 17 * @title 登录相关接口
@@ -54,4 +55,37 @@ class LoginController extends HomeBaseController{ @@ -54,4 +55,37 @@ class LoginController extends HomeBaseController{
54 $this->apiResponse(301,'获取登录凭证失败',$loginData); 55 $this->apiResponse(301,'获取登录凭证失败',$loginData);
55 } 56 }
56 } 57 }
  58 +
  59 + /**
  60 + * @title 获取手机号
  61 + * @description 获取手机号
  62 + * @author 董瑞恩
  63 + * @url /portal/login/getPhone
  64 + * @method GET
  65 + *
  66 + * @param name:code type:String require:1 default:无 other: desc:code
  67 + * @param name:encrypted_data type:String require:1 default:无 other: desc:encrypted_data
  68 + * @param name:iv type:String require:1 default:无 other: desc:iv
  69 + *
  70 + * @return result:退款接口返回值
  71 + */
  72 + public function getPhone(){
  73 + $param = $this->request->param();
  74 + $loginUrl="https://api.weixin.qq.com/sns/jscode2session?appid=".$this->appId."&secret=".$this->appSecret."&js_code=".$param['code']."&grant_type=authorization_code";
  75 + $response=json_decode(file_get_contents($loginUrl),true);
  76 + if (!empty($response['errcode'])) {
  77 + $this->error('操作失败!');
  78 + }
  79 + $openid = $response['openid'];
  80 + $sessionKey = $response['session_key'];
  81 +
  82 + $pc = new WXBizDataCrypt($this->appId, $sessionKey);
  83 + $errCode = $pc->decryptData($param['encrypted_data'], $param['iv'], $wxUserData);
  84 + if ($errCode != 0) {
  85 + $this->apiResponse(301,'操作失败');
  86 + }
  87 +
  88 + $this->apiResponse(200,'success',$wxUserData);
  89 +
  90 + }
57 } 91 }
@@ -110,7 +110,7 @@ class OrderController extends HomeBaseController{ @@ -110,7 +110,7 @@ class OrderController extends HomeBaseController{
110 110
111 //判断是否跨天 111 //判断是否跨天
112 if ($endTime < $stateTime){ 112 if ($endTime < $stateTime){
113 - $stateTime-=86400; 113 + $endTime+=86400;
114 } 114 }
115 dump(date('Y-m-d H:i:s',$stateTime)); 115 dump(date('Y-m-d H:i:s',$stateTime));
116 dump(date('Y-m-d H:i:s',$endTime)); 116 dump(date('Y-m-d H:i:s',$endTime));
@@ -221,5 +221,4 @@ class UsersController extends HomeBaseController{ @@ -221,5 +221,4 @@ class UsersController extends HomeBaseController{
221 }); 221 });
222 $response->send(); 222 $response->send();
223 } 223 }
224 -  
225 } 224 }
@@ -24,7 +24,7 @@ class Prpcrypt @@ -24,7 +24,7 @@ class Prpcrypt
24 public function decrypt($aesCipher, $aesIV) 24 public function decrypt($aesCipher, $aesIV)
25 { 25 {
26 26
27 - if (!function_exists('mcrypt_module_open')) { 27 + if (function_exists('mcrypt_module_open')) {
28 try { 28 try {
29 29
30 $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); 30 $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');