作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改sessionkey

... ... @@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/User.php" afterPath="$PROJECT_DIR$/application/api/controller/User.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
... ... @@ -17,8 +16,8 @@
<file leaf-file-name="User.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="12">
<caret line="1544" column="37" lean-forward="false" selection-start-line="1544" selection-start-column="37" selection-end-line="1544" selection-end-column="37" />
<state relative-caret-position="198">
<caret line="1571" column="0" lean-forward="true" selection-start-line="1571" selection-start-column="0" selection-end-line="1571" selection-end-column="0" />
<folding>
<element signature="e#365#484#0#PHP" expanded="false" />
<element signature="e#490#1228#0#PHP" expanded="false" />
... ... @@ -76,8 +75,8 @@
<element signature="e#48316#49343#0#PHP" expanded="false" />
<element signature="e#49349#50107#0#PHP" expanded="false" />
<element signature="e#50112#52499#0#PHP" expanded="false" />
<element signature="e#53813#54412#0#PHP" expanded="false" />
<element signature="e#55365#56080#0#PHP" expanded="false" />
<element signature="e#54457#55056#0#PHP" expanded="false" />
<element signature="e#56009#56724#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -162,9 +161,9 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="628" />
<option name="y" value="56" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="-101" />
<option name="y" value="57" />
<option name="width" value="1776" />
<option name="height" value="974" />
</component>
... ... @@ -276,7 +275,7 @@
<workItem from="1574469667436" duration="25235000" />
<workItem from="1574641631900" duration="15479000" />
<workItem from="1574669596135" duration="11747000" />
<workItem from="1574727687281" duration="5262000" />
<workItem from="1574727687281" duration="5519000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -289,7 +288,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="235533000" />
<option name="totallyTimeSpent" value="235790000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
... ... @@ -301,7 +300,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="628" y="56" width="1776" height="974" extended-state="0" />
<frame x="-101" y="57" width="1776" height="974" extended-state="1" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15792541" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32912987" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
... ... @@ -726,8 +725,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="12">
<caret line="1544" column="37" lean-forward="false" selection-start-line="1544" selection-start-column="37" selection-end-line="1544" selection-end-column="37" />
<state relative-caret-position="198">
<caret line="1571" column="0" lean-forward="true" selection-start-line="1571" selection-start-column="0" selection-end-line="1571" selection-end-column="0" />
<folding>
<element signature="e#365#484#0#PHP" expanded="false" />
<element signature="e#490#1228#0#PHP" expanded="false" />
... ... @@ -785,8 +784,8 @@
<element signature="e#48316#49343#0#PHP" expanded="false" />
<element signature="e#49349#50107#0#PHP" expanded="false" />
<element signature="e#50112#52499#0#PHP" expanded="false" />
<element signature="e#53813#54412#0#PHP" expanded="false" />
<element signature="e#55365#56080#0#PHP" expanded="false" />
<element signature="e#54457#55056#0#PHP" expanded="false" />
<element signature="e#56009#56724#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -1562,7 +1562,7 @@ class User extends Api
$appSecret = $rule['secret'];
$response = "https://api.weixin.qq.com/sns/jscode2session?appid=$appId&secret=$appSecret&js_code=$code&grant_type=authorization_code";
$response = $this->http_get($response);
$response = json_decode($response, true);
if (!empty($response['errcode'])) {
$this->error(['code'=>'2','msg'=>'操作失败:'.$response['errcode']]);
... ... @@ -1570,6 +1570,20 @@ class User extends Api
$this->success('获取成功',$response);
}
//curl get请求
public function http_get($url){
$curl = curl_init();//启动一个CURL会话
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, false);//不开启header
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回
$result = curl_exec($curl); //执行操作
curl_close($curl);
return $result;
}
/**
* @ApiTitle (获取用户手机号)
* @ApiSummary (获取用户手机号)
... ...
... ... @@ -165,6 +165,7 @@
<div class="child collapse" id="个人中心">
<a href="javascript:;" data-id="13" class="list-group-item">小程序登录</a>
<a href="javascript:;" data-id="29" class="list-group-item">购物车列表</a>
<a href="javascript:;" data-id="42" class="list-group-item"></a>
<a href="javascript:;" data-id="41" class="list-group-item">获取sessionkey</a>
<a href="javascript:;" data-id="40" class="list-group-item">消费记录</a>
<a href="javascript:;" data-id="39" class="list-group-item"></a>
... ... @@ -192,7 +193,7 @@
<a href="javascript:;" data-id="17" class="list-group-item">图片列表</a>
<a href="javascript:;" data-id="16" class="list-group-item">搜索页</a>
<a href="javascript:;" data-id="15" class="list-group-item">地区分类</a>
<a href="javascript:;" data-id="42" class="list-group-item">获取用户手机号</a>
<a href="javascript:;" data-id="43" class="list-group-item">获取用户手机号</a>
</div>
</div>
</div>
... ... @@ -1956,6 +1957,98 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-42">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion42" href="#collapseOne42"> <span class="text-muted">/api/user/http_get</span></a>
</h4>
</div>
<div id="collapseOne42" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab42">
<li class="active"><a href="#info42" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox42" data-toggle="tab">在线测试</a></li>
<li><a href="#sample42" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info42">
<div class="well">
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox42">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/http_get" method="get" name="form42" id="form42">
<div class="form-group">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="42">提交</button>
<button type="reset" class="btn btn-info" rel="42">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers42"></pre>
<pre id="response42"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample42">
<div class="row">
<div class="col-md-12">
<pre id="sample_response42"></pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-41">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
... ... @@ -5820,26 +5913,26 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-42">
<div class="panel-heading" id="heading-43">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion42" href="#collapseOne42"> 获取用户手机号 <span class="text-muted">/api/user/getMobile</span></a>
<a data-toggle="collapse" data-parent="#accordion43" href="#collapseOne43"> 获取用户手机号 <span class="text-muted">/api/user/getMobile</span></a>
</h4>
</div>
<div id="collapseOne42" class="panel-collapse collapse">
<div id="collapseOne43" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab42">
<li class="active"><a href="#info42" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox42" data-toggle="tab">在线测试</a></li>
<li><a href="#sample42" data-toggle="tab">返回示例</a></li>
<ul class="nav nav-tabs" id="doctab43">
<li class="active"><a href="#info43" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox43" data-toggle="tab">在线测试</a></li>
<li><a href="#sample43" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info42">
<div class="tab-pane active" id="info43">
<div class="well">
获取用户手机号 </div>
<div class="panel panel-default">
... ... @@ -5890,13 +5983,13 @@
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox42">
<div class="tab-pane" id="sandbox43">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/getMobile" method="POST" name="form42" id="form42">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/getMobile" method="POST" name="form43" id="form43">
<div class="form-group">
<label class="control-label" for="sessionKey">sessionKey</label>
<input type="string" class="form-control input-sm" id="sessionKey" required placeholder="sessionkey" name="sessionKey">
... ... @@ -5910,8 +6003,8 @@
<input type="string" class="form-control input-sm" id="iv" required placeholder="iv" name="iv">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="42">提交</button>
<button type="reset" class="btn btn-info" rel="42">重置</button>
<button type="submit" class="btn btn-success send" rel="43">提交</button>
<button type="reset" class="btn btn-info" rel="43">重置</button>
</div>
</form>
</div>
... ... @@ -5921,8 +6014,8 @@
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers42"></pre>
<pre id="response42"></pre>
<pre id="response_headers43"></pre>
<pre id="response43"></pre>
</div>
</div>
</div>
... ... @@ -5937,10 +6030,10 @@
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample42">
<div class="tab-pane" id="sample43">
<div class="row">
<div class="col-md-12">
<pre id="sample_response42">{
<pre id="sample_response43">{
"code": 1,
"msg": "成功",
"time": "1571492001",
... ... @@ -5962,7 +6055,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-11-26 10:00:33 </div>
Generated on 2019-11-26 10:04:48 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...