作者 何书鹏
1 个管道 的构建 通过 耗费 2 秒

获取sessionkey

<?php
return array(
0 =>
array(
'name' => 'qq',
'title' => 'QQ',
'type' => 'array',
'content' =>
array(
'app_id' => '',
'app_secret' => '',
'scope' => 'get_user_info',
),
'value' =>
array(
'app_id' => '100000000',
'app_secret' => '123456',
'scope' => 'get_user_info',
),
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
1 =>
array(
'name' => 'wechat',
'title' => '微信',
'type' => 'array',
'content' =>
array(
'app_id' => '',
'app_secret' => '',
'callback' => '',
'scope' => 'snsapi_base',
),
'value' =>
array(
'app_id' => '100000000',
'app_secret' => '123456',
'scope' => 'snsapi_userinfo',
),
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
2 =>
array(
'name' => 'weibo',
'title' => '微博',
'type' => 'array',
'content' =>
array(
'app_id' => '',
'app_secret' => '',
'scope' => 'get_user_info',
),
'value' =>
array(
'app_id' => '100000000',
'app_secret' => '123456',
'scope' => 'get_user_info',
),
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
3 =>
array(
'name' => 'bindaccount',
'title' => '账号绑定',
'type' => 'radio',
'content' =>
array(
1 => '开启',
0 => '关闭',
),
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '是否开启账号绑定',
'extend' => '',
),
4 =>
array(
'name' => 'status',
'title' => '前台第三方登录开关',
'type' => 'checkbox',
'content' =>
array(
'qq' => 'QQ',
'wechat' => '微信',
'weibo' => '微博',
),
'value' => 'qq,wechat,weibo',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '前台第三方登录的开关',
'extend' => '',
),
5 =>
array(
'name' => 'rewrite',
'title' => '伪静态',
'type' => 'array',
'content' =>
array(),
'value' =>
array(
'index/index' => '/third$',
'index/connect' => '/third/connect/[:platform]',
'index/callback' => '/third/callback/[:platform]',
'index/bind' => '/third/bind/[:platform]',
'index/unbind' => '/third/unbind/[:platform]',
),
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
),
);
return [
[
'name' => 'qq',
'title' => 'QQ',
'type' => 'array',
'content' => [
'app_id' => '',
'app_secret' => '',
'scope' => 'get_user_info',
],
'value' => [
'app_id' => '100000000',
'app_secret' => '123456',
'scope' => 'get_user_info',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'wechat',
'title' => '微信',
'type' => 'array',
'content' => [
'app_id' => '',
'app_secret' => '',
'callback' => '',
'scope' => 'snsapi_base',
],
'value' => [
'app_id' => 'wxd88427f7f68c3da4',
'app_secret' => '8f655b9f970c95373bb4a1b08db75ac5',
'scope' => 'snsapi_userinfo',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'weibo',
'title' => '微博',
'type' => 'array',
'content' => [
'app_id' => '',
'app_secret' => '',
'scope' => 'get_user_info',
],
'value' => [
'app_id' => '100000000',
'app_secret' => '123456',
'scope' => 'get_user_info',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'bindaccount',
'title' => '账号绑定',
'type' => 'radio',
'content' => [
1 => '开启',
0 => '关闭',
],
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '是否开启账号绑定',
'extend' => '',
],
[
'name' => 'status',
'title' => '前台第三方登录开关',
'type' => 'checkbox',
'content' => [
'qq' => 'QQ',
'wechat' => '微信',
'weibo' => '微博',
],
'value' => 'qq,wechat,weibo',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '前台第三方登录的开关',
'extend' => '',
],
[
'name' => 'rewrite',
'title' => '伪静态',
'type' => 'array',
'content' => [],
'value' => [
'index/index' => '/third$',
'index/connect' => '/third/connect/[:platform]',
'index/callback' => '/third/callback/[:platform]',
'index/bind' => '/third/bind/[:platform]',
'index/unbind' => '/third/unbind/[:platform]',
],
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
];
... ...
... ... @@ -11,6 +11,7 @@ use think\Validate;
use addons\third\model\Third;
use app\api\model\Realname;
use app\api\model\UserKeyword;
use app\common\controller\Wechat;
/**
* 会员接口
... ... @@ -416,8 +417,8 @@ class User extends Api
/**
* @ApiWeigh (93)
* @ApiTitle (code获取session_key)
* @ApiSummary (code获取session_key)
* @ApiTitle (code获取session_key和openid)
* @ApiSummary (code获取session_key和openid)
* @ApiMethod (POST)
* @ApiParams (name="code", type="string", required=true, description="小程序code")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
... ...
... ... @@ -14,9 +14,10 @@ class Wechat extends Controller
* 小程序配置
*/
public static function miniProgram(){
$wechat = get_addon_config('third')['wechat'];
$config = [
'app_id' => config('miniprogram.basic')['app_id'],
'secret' => config('miniprogram.basic')['secret'],
'app_id' => $wechat['app_id'],
'secret' => $wechat['app_secret'],
// 下面为可选项
// 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
... ...
... ... @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<title>My Website</title>
<title>人力招聘</title>
<!-- Bootstrap Core CSS -->
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
... ... @@ -108,7 +108,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./" target="_blank">My Website</a>
<a class="navbar-brand" href="./" target="_blank">人力招聘</a>
</div>
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right">
... ... @@ -183,7 +183,7 @@
<a href="javascript:;" data-id="22" class="list-group-item">劳务管理-个人信息</a>
<a href="javascript:;" data-id="27" class="list-group-item">编辑资料</a>
<a href="javascript:;" data-id="32" class="list-group-item">实名认证</a>
<a href="javascript:;" data-id="33" class="list-group-item">code获取session_key</a>
<a href="javascript:;" data-id="33" class="list-group-item">code获取session_key和openid</a>
<a href="javascript:;" data-id="34" class="list-group-item">用户授权登录</a>
<a href="javascript:;" data-id="35" class="list-group-item">用户授权获取手机号</a>
<a href="javascript:;" data-id="36" class="list-group-item">工时补贴介绍</a>
... ... @@ -3377,7 +3377,7 @@
<div class="panel-heading" id="heading-33">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion33" href="#collapseOne33"> code获取session_key <span class="text-muted">/api/user/get_session_key</span></a>
<a data-toggle="collapse" data-parent="#accordion33" href="#collapseOne33"> code获取session_key和openid <span class="text-muted">/api/user/get_session_key</span></a>
</h4>
</div>
<div id="collapseOne33" class="panel-collapse collapse">
... ... @@ -3395,7 +3395,7 @@
<div class="tab-pane active" id="info33">
<div class="well">
code获取session_key </div>
code获取session_key和openid </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
... ... @@ -6700,9 +6700,9 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-11-24 20:34:58 </div>
Generated on 2020-11-25 10:50:47 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">My Website</a>
<a href="./" target="_blank">人力招聘</a>
</div>
</div>
... ...