Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
f0c4afc2
ShopXO
项目概览
starsw001
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0c4afc2
编写于
3月 02, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
api小程序授权优化
上级
65d50792
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
47 addition
and
19 deletion
+47
-19
application/api/controller/Answer.php
application/api/controller/Answer.php
+2
-2
application/api/controller/Buy.php
application/api/controller/Buy.php
+1
-1
application/api/controller/Cart.php
application/api/controller/Cart.php
+1
-1
application/api/controller/Common.php
application/api/controller/Common.php
+2
-2
application/api/controller/Goods.php
application/api/controller/Goods.php
+1
-1
application/api/controller/Message.php
application/api/controller/Message.php
+1
-1
application/api/controller/Order.php
application/api/controller/Order.php
+1
-1
application/api/controller/User.php
application/api/controller/User.php
+34
-6
application/api/controller/Useraddress.php
application/api/controller/Useraddress.php
+1
-1
application/api/controller/Usergoodsbrowse.php
application/api/controller/Usergoodsbrowse.php
+1
-1
application/api/controller/Usergoodsfavor.php
application/api/controller/Usergoodsfavor.php
+1
-1
application/api/controller/Userintegral.php
application/api/controller/Userintegral.php
+1
-1
未找到文件。
application/api/controller/Answer.php
浏览文件 @
f0c4afc2
...
...
@@ -44,7 +44,7 @@ class Answer extends Common
public
function
Index
()
{
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
// 参数
$params
=
input
();
...
...
@@ -90,7 +90,7 @@ class Answer extends Common
public
function
Add
()
{
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
$params
=
$this
->
data_post
;
$params
[
'user'
]
=
$this
->
user
;
...
...
application/api/controller/Buy.php
浏览文件 @
f0c4afc2
...
...
@@ -37,7 +37,7 @@ class Buy extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Cart.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class Cart extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Common.php
浏览文件 @
f0c4afc2
...
...
@@ -95,13 +95,13 @@ class Common extends Controller
}
/**
* [Is
_
Login 登录校验]
* [IsLogin 登录校验]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-03-09T11:43:48+0800
*/
protected
function
Is
_
Login
()
protected
function
IsLogin
()
{
if
(
empty
(
$this
->
user
))
{
...
...
application/api/controller/Goods.php
浏览文件 @
f0c4afc2
...
...
@@ -97,7 +97,7 @@ class Goods extends Common
public
function
Favor
()
{
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
// 开始操作
$params
=
$this
->
data_post
;
...
...
application/api/controller/Message.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class Message extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Order.php
浏览文件 @
f0c4afc2
...
...
@@ -35,7 +35,7 @@ class Order extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/User.php
浏览文件 @
f0c4afc2
...
...
@@ -113,7 +113,14 @@ class User extends Common
*/
public
function
WechatUserAuth
()
{
$result
=
(
new
\
base\Wechat
(
MyC
(
'common_app_mini_weixin_appid'
),
MyC
(
'common_app_mini_weixin_appsecret'
)))
->
GetAuthSessionKey
(
input
(
'authcode'
));
// 参数
if
(
empty
(
$this
->
data_post
[
'authcode'
]))
{
return
DataReturn
(
'授权码为空'
,
-
1
);
}
// 授权
$result
=
(
new
\
base\Wechat
(
MyC
(
'common_app_mini_weixin_appid'
),
MyC
(
'common_app_mini_weixin_appsecret'
)))
->
GetAuthSessionKey
(
$this
->
data_post
[
'authcode'
]);
if
(
$result
!==
false
)
{
return
DataReturn
(
'授权登录成功'
,
0
,
$result
);
...
...
@@ -131,14 +138,35 @@ class User extends Common
*/
public
function
WechatUserInfo
()
{
// 参数
$params
=
input
();
// 参数校验
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'openid'
,
'error_msg'
=>
'openid为空'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'encrypted_data'
,
'error_msg'
=>
'解密数据为空'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'iv'
,
'error_msg'
=>
'iv数据为空'
,
]
];
$ret
=
ParamsChecked
(
$this
->
data_post
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 先从数据库获取用户信息
$user
=
UserService
::
UserInfo
(
'weixin_openid'
,
$
params
[
'openid'
]);
$user
=
UserService
::
UserInfo
(
'weixin_openid'
,
$
this
->
data_post
[
'openid'
]);
if
(
empty
(
$user
))
{
$result
=
(
new
\
base\Wechat
(
MyC
(
'common_app_mini_weixin_appid'
),
MyC
(
'common_app_mini_weixin_appsecret'
)))
->
DecryptData
(
$
params
[
'encrypted_data'
],
$params
[
'iv'
],
$params
[
'openid'
]);
$result
=
(
new
\
base\Wechat
(
MyC
(
'common_app_mini_weixin_appid'
),
MyC
(
'common_app_mini_weixin_appsecret'
)))
->
DecryptData
(
$
this
->
data_post
[
'encrypted_data'
],
$this
->
data_post
[
'iv'
],
$this
->
data_post
[
'openid'
]);
if
(
is_array
(
$result
))
{
...
...
@@ -186,7 +214,7 @@ class User extends Common
public
function
Center
()
{
// 登录校验
$this
->
Is
_
Login
();
$this
->
IsLogin
();
// 订单总数
$where
=
[
'user_id'
=>
$this
->
user
[
'id'
],
'is_delete_time'
=>
0
,
'user_is_delete_time'
=>
0
];
...
...
application/api/controller/Useraddress.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class UserAddress extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Usergoodsbrowse.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class UserGoodsBrowse extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Usergoodsfavor.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class UserGoodsFavor extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
application/api/controller/Userintegral.php
浏览文件 @
f0c4afc2
...
...
@@ -34,7 +34,7 @@ class UserIntegral extends Common
parent
::
__construct
();
// 是否登录
$this
->
Is
_
Login
();
$this
->
IsLogin
();
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录