baidu mini app

This commit is contained in:
gongfuxiang 2019-07-16 23:39:22 +08:00
parent c0de45f085
commit acfcdacbfe
10 changed files with 37 additions and 34 deletions

View File

@ -231,14 +231,18 @@ class User extends Common
//$_POST['config'] = MyC('baidu_mini_program_config');
$_POST['config'] = [
'key' => 'C9Gg744cBqQ3zvbC5uOPMg9yWpmuQ8O7',
'secret' => 'Uibe5l1p4Wxjq5Gqp1xDucWBVfBH9i30',
// 'id' => '16634987',
// 'key' => 'G8x7Q2oSIo2Egcps7QB8fQGCQrUDjwNN',
// 'secret' => 'T5PXvGwDxci6GVAeQErigGvTRK48MVRz',
'id' => '14675874',
'key' => 'G8x7Q2oSIo2Egcps7QB8fQGCQrUDjwNN',
'secret' => 'T5PXvGwDxci6GVAeQErigGvTRK48MVRz',
];
$result = (new \base\BaiduAuth())->GetAuthUserInfo($_POST);
//print_r($result);die;
if($result['status'] == 0)
{
return UserService::AuthUserProgram($result, 'baidu_openid');
return UserService::AuthUserProgram($result['data'], 'baidu_openid');
}
return DataReturn($result['msg'], -10);
}

View File

@ -15,7 +15,7 @@
return [
// 开发模式
'is_develop' => false,
'is_develop' => true,
// 默认编码
'default_charset' => 'utf-8',

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@ class BaiduAuth
'client_id' => $params['config']['key'],
'sk' => $params['config']['secret'],
];
$result = $this->HttpRequest('https://openapi.baidu.com/nalogin/getSessionKeyByCode', $data);
$result = $this->HttpRequest('https://spapi.baidu.com/oauth/jscode2sessionkey', $data);
if(empty($result['openid']))
{
return ['status'=>-1, 'msg'=>$result['error_description']];

View File

@ -329,7 +329,7 @@ button[disabled].bg-primary {
right: 10rpx;
bottom: 35%;
line-height: 30rpx;
border-radius: 50%;
border-radius: 50% !important;
}
.common-online-service image {
width: 60rpx;

View File

@ -57,7 +57,7 @@ App({
// 请求地址
// request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'https://test.shopxo.net/',
//request_url: 'https://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",

View File

@ -2,7 +2,7 @@
<view class="item bg-white spacing-mb" s-if="data_list.length > 0" s-for="item, index in data_list">
<view class="base">
<view class="oh">
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" bindError="user_avatar_error" />
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" binderror="user_avatar_error" />
<view class="desc fr tl">{{item.content}}</view>
</view>
<view class="cr-888 tr">{{item.add_time}}</view>

View File

@ -30,7 +30,6 @@ Page({
* 登录授权事件
*/
get_user_info_event() {
console.log(1)
app.user_auth_login(this, 'user_auth_back_event');
},
@ -108,14 +107,14 @@ Page({
var params = swan.getStorageSync(app.data.cache_launch_info_key) || null;
console.log(params);
// 数据验证
var validation = [{ fields: 'mobile', msg: '请填写手机号码' }, { fields: 'verify', msg: '请填写验证码' }, { fields: 'weixin_openid', msg: '授权id不能为空' }];
e.detail.value['weixin_openid'] = this.data.user.weixin_openid;
var validation = [{ fields: 'mobile', msg: '请填写手机号码' }, { fields: 'verify', msg: '请填写验证码' }, { fields: 'baidu_openid', msg: '授权id不能为空' }];
e.detail.value['baidu_openid'] = this.data.user.baidu_openid;
e.detail.value['nickname'] = this.data.user.nickname;
e.detail.value['avatar'] = this.data.user.avatar;
e.detail.value['province'] = this.data.user.province;
e.detail.value['city'] = this.data.user.city;
e.detail.value['gender'] = this.data.user.gender;
e.detail.value['app_type'] = 'weixin';
e.detail.value['app_type'] = 'baidu';
e.detail.value['referrer'] = params == null ? this.data.user.referrer || 0 : params.data.referrer || 0;
if (app.fields_check(e.detail.value, validation)) {
swan.showLoading({ title: '处理中...' });

View File

@ -1,7 +1,7 @@
<!-- 头部 -->
<view class="head-box bg-main">
<view class="head-item oh tc">
<image bindtap="preview_event" class="avatar" src="{{avatar}}" mode="widthFix" bindError="user_avatar_error" />
<image bindtap="preview_event" class="avatar" src="{{avatar}}" mode="widthFix" binderror="user_avatar_error" />
<text class="item-name dis-block cr-fff">{{nickname}}</text>
</view>

View File

@ -1 +1 @@
{"appid":"16634987","cloudTesting":{"forcePreview":false},"host":"baiduboxapp","preview":{"packageId":218648},"setting":{"urlCheck":false},"swan":{"baiduboxapp":{"extensionJsVersion":"","swanJsVersion":"3.30.43"}}}
{"appid":"14675874","cloudTesting":{"forcePreview":false},"host":"baiduboxapp","preview":{"packageId":218648},"setting":{"urlCheck":false},"swan":{"baiduboxapp":{"swanJsVersion":"3.30.43","extensionJsVersion":""}}}