Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wds12580
ShopXO
提交
7bc0f078
ShopXO
项目概览
wds12580
/
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,发现更多精彩内容 >>
提交
7bc0f078
编写于
1月 02, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信小程序登录
上级
bc8782cd
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
62 addition
and
70 deletion
+62
-70
application/api/controller/User.php
application/api/controller/User.php
+4
-0
public/appmini/old/wechat/app.js
public/appmini/old/wechat/app.js
+16
-29
public/appmini/old/wechat/pages/answer-form/answer-form.js
public/appmini/old/wechat/pages/answer-form/answer-form.js
+1
-1
public/appmini/old/wechat/pages/cart/cart.js
public/appmini/old/wechat/pages/cart/cart.js
+7
-7
public/appmini/old/wechat/pages/goods-detail/goods-detail.js
public/appmini/old/wechat/pages/goods-detail/goods-detail.js
+3
-3
public/appmini/old/wechat/pages/login/login.js
public/appmini/old/wechat/pages/login/login.js
+4
-3
public/appmini/old/wechat/pages/message/message.js
public/appmini/old/wechat/pages/message/message.js
+1
-1
public/appmini/old/wechat/pages/user-address-save/user-address-save.js
...i/old/wechat/pages/user-address-save/user-address-save.js
+1
-1
public/appmini/old/wechat/pages/user-address/user-address.js
public/appmini/old/wechat/pages/user-address/user-address.js
+4
-4
public/appmini/old/wechat/pages/user-answer-list/user-answer-list.js
...ini/old/wechat/pages/user-answer-list/user-answer-list.js
+1
-1
public/appmini/old/wechat/pages/user-faovr/user-faovr.js
public/appmini/old/wechat/pages/user-faovr/user-faovr.js
+4
-4
public/appmini/old/wechat/pages/user-goods-browse/user-goods-browse.js
...i/old/wechat/pages/user-goods-browse/user-goods-browse.js
+4
-4
public/appmini/old/wechat/pages/user-integral/user-integral.js
...c/appmini/old/wechat/pages/user-integral/user-integral.js
+1
-1
public/appmini/old/wechat/pages/user-order/user-order.js
public/appmini/old/wechat/pages/user-order/user-order.js
+7
-7
public/appmini/old/wechat/pages/user/user.js
public/appmini/old/wechat/pages/user/user.js
+4
-4
未找到文件。
application/api/controller/User.php
浏览文件 @
7bc0f078
...
...
@@ -96,6 +96,7 @@ class User extends Common
{
return
DataReturn
(
'获取授权信息失败'
,
-
10
);
}
else
{
$result
[
'gender'
]
=
empty
(
$result
[
'gender'
])
?
0
:
(
$result
[
'gender'
]
==
'm'
)
?
2
:
1
;
$result
[
'openid'
]
=
$result
[
'user_id'
];
$result
[
'referrer'
]
=
isset
(
$this
->
data_post
[
'referrer'
])
?
intval
(
$this
->
data_post
[
'referrer'
])
:
0
;
return
UserService
::
AuthUserProgram
(
$result
,
'alipay_openid'
);
...
...
@@ -134,6 +135,9 @@ class User extends Common
if
(
is_array
(
$result
))
{
$result
[
'nick_name'
]
=
isset
(
$result
[
'nickName'
])
?
$result
[
'nickName'
]
:
''
;
$result
[
'avatar'
]
=
isset
(
$result
[
'avatarUrl'
])
?
$result
[
'avatarUrl'
]
:
''
;
$result
[
'gender'
]
=
empty
(
$result
[
'gender'
])
?
0
:
(
$result
[
'gender'
]
==
2
)
?
1
:
2
;
$result
[
'openid'
]
=
$result
[
'openId'
];
$result
[
'referrer'
]
=
isset
(
$this
->
data_post
[
'referrer'
])
?
intval
(
$this
->
data_post
[
'referrer'
])
:
0
;
return
UserService
::
AuthUserProgram
(
$result
,
'weixin_openid'
);
...
...
public/appmini/old/wechat/app.js
浏览文件 @
7bc0f078
...
...
@@ -163,7 +163,7 @@ App({
if
(
params
!=
""
&&
params
.
substr
(
0
,
1
)
!=
"
&
"
)
{
params
=
"
&
"
+
params
;
}
var
user
=
this
.
GetUserCacheI
nfo
();
var
user
=
this
.
get_user_cache_i
nfo
();
var
app_client_user_id
=
user
==
false
?
""
:
user
.
wechat_openid
;
var
user_id
=
user
==
false
?
0
:
user
.
id
;
return
(
...
...
@@ -184,22 +184,21 @@ App({
* method 回调操作对象的函数
* return 有用户数据直接返回, 则回调调用者
*/
GetUserI
nfo
(
object
,
method
)
{
var
user
=
this
.
GetUserCacheI
nfo
();
get_user_i
nfo
(
object
,
method
)
{
var
user
=
this
.
get_user_cache_i
nfo
();
if
(
user
==
false
)
{
// 唤醒用户授权
this
.
UserAuthC
ode
(
object
,
method
);
this
.
user_auth_c
ode
(
object
,
method
);
return
false
;
}
else
{
return
user
;
}
return
user
;
},
/**
* 从缓存获取用户信息
*/
GetUserCacheI
nfo
()
{
get_user_cache_i
nfo
()
{
let
user
=
wx
.
getStorageSync
(
this
.
data
.
cache_user_info_key
);
if
((
user
||
null
)
==
null
)
{
return
false
;
...
...
@@ -207,26 +206,12 @@ App({
return
user
;
},
/**
* 从缓存获美啦取用户信息
*/
GetMeiLaUserCacheInfo
()
{
let
user
=
wx
.
getStorageSync
(
this
.
data
.
cache_user_info_key
);
if
((
user
||
null
)
==
null
)
{
return
null
;
}
if
((
user
.
my_user
||
null
)
==
null
)
{
return
null
;
}
return
user
.
my_user
;
},
/**
* 用户授权
* object 回调操作对象
* method 回调操作对象的函数
*/
UserAuthC
ode
(
object
,
method
)
{
user_auth_c
ode
(
object
,
method
)
{
// 加载loding
wx
.
showLoading
({
title
:
'
授权中...
'
});
var
$this
=
this
;
...
...
@@ -234,8 +219,6 @@ App({
// 请求授权接口
wx
.
getSetting
({
success
(
res
)
{
console
.
log
(
'
app.js 授权部分
'
);
if
(
!
res
.
authSetting
[
'
scope.userInfo
'
])
{
wx
.
navigateTo
({
url
:
"
/pages/login/login
"
...
...
@@ -349,12 +332,16 @@ App({
if
(
res
.
data
.
code
==
0
)
{
wx
.
setStorage
({
key
:
$this
.
data
.
cache_user_info_key
,
data
:
res
.
data
.
data
data
:
res
.
data
.
data
,
success
:
(
res
)
=>
{
if
(
typeof
object
===
'
object
'
&&
(
method
||
null
)
!=
null
)
{
object
[
method
]();
}
},
fail
:
()
=>
{
$this
.
showToast
(
'
用户信息缓存失败
'
);
}
});
if
(
typeof
object
===
'
object
'
&&
(
method
||
null
)
!=
null
)
{
object
[
method
]();
}
}
else
{
$this
.
showToast
(
res
.
data
.
text
);
}
...
...
public/appmini/old/wechat/pages/answer-form/answer-form.js
浏览文件 @
7bc0f078
...
...
@@ -13,7 +13,7 @@ Page({
// 初始化
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/cart/cart.js
浏览文件 @
7bc0f078
...
...
@@ -17,15 +17,15 @@ Page({
},
init
(
e
)
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
'
温馨提示
'
,
content
:
'
绑定手机号码
'
,
confirm
Button
Text
:
'
确认
'
,
cancel
Button
Text
:
'
暂不
'
,
confirmText
:
'
确认
'
,
cancelText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
wx
.
navigateTo
({
...
...
@@ -194,11 +194,11 @@ Page({
if
(
type
==
'
edit
'
)
{
this
.
goods_favor_event
(
id
,
goods_id
,
type
);
}
else
{
wx
.
confirm
({
wx
.
showModal
({
title
:
'
温馨提示
'
,
content
:
'
删除后不可恢复,确定继续吗?
'
,
confirm
Button
Text
:
'
确定
'
,
cancel
Button
Text
:
'
取消
'
,
confirmText
:
'
确定
'
,
cancelText
:
'
取消
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
this
.
cart_delete
(
id
,
type
);
...
...
public/appmini/old/wechat/pages/goods-detail/goods-detail.js
浏览文件 @
7bc0f078
...
...
@@ -200,7 +200,7 @@ Page({
// 收藏事件
goods_favor_event
(
e
)
{
var
user
=
app
.
GetUserI
nfo
(
this
,
'
goods_favor_event
'
);
var
user
=
app
.
get_user_i
nfo
(
this
,
'
goods_favor_event
'
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -252,7 +252,7 @@ Page({
// 加入购物车事件
goods_cart_event
(
e
,
spec
)
{
var
user
=
app
.
GetUserI
nfo
(
this
,
'
goods_cart_event
'
);
var
user
=
app
.
get_user_i
nfo
(
this
,
'
goods_cart_event
'
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -535,7 +535,7 @@ Page({
// 确认
goods_buy_confirm_event
(
e
)
{
var
user
=
app
.
GetUserI
nfo
(
this
,
'
goods_buy_confirm_event
'
);
var
user
=
app
.
get_user_i
nfo
(
this
,
'
goods_buy_confirm_event
'
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/login/login.js
浏览文件 @
7bc0f078
...
...
@@ -22,7 +22,7 @@ Page({
// 设置用户信息
this
.
setData
({
params
:
option
,
user
:
app
.
GetUserCacheI
nfo
()
||
null
user
:
app
.
get_user_cache_i
nfo
()
||
null
});
},
...
...
@@ -30,8 +30,9 @@ Page({
* 登录授权事件
*/
get_user_info_event
(
e
)
{
console
.
log
(
e
,
e
.
detail
.
userInfo
)
app
.
user_auth_login
();
console
.
log
(
e
,
e
.
detail
.
userInfo
);
//app.user_auth_login();
wx
.
navigateBack
();
},
/**
...
...
public/appmini/old/wechat/pages/message/message.js
浏览文件 @
7bc0f078
...
...
@@ -14,7 +14,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/user-address-save/user-address-save.js
浏览文件 @
7bc0f078
...
...
@@ -32,7 +32,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/user-address/user-address.js
浏览文件 @
7bc0f078
...
...
@@ -19,7 +19,7 @@ Page({
// 初始化
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -120,11 +120,11 @@ Page({
}
var
self
=
this
;
wx
.
confirm
({
wx
.
showModal
({
title
:
"
温馨提示
"
,
content
:
"
删除后不可恢复,确定继续吗?
"
,
confirm
Button
Text
:
"
确认
"
,
cancel
Button
Text
:
"
不了
"
,
confirmText
:
"
确认
"
,
cancelText
:
"
不了
"
,
success
:
result
=>
{
if
(
result
.
confirm
)
{
// 加载loding
...
...
public/appmini/old/wechat/pages/user-answer-list/user-answer-list.js
浏览文件 @
7bc0f078
...
...
@@ -16,7 +16,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/user-faovr/user-faovr.js
浏览文件 @
7bc0f078
...
...
@@ -14,7 +14,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -128,11 +128,11 @@ Page({
// 取消
cancel_event
(
e
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
"
温馨提示
"
,
content
:
"
取消后不可恢复,确定继续吗?
"
,
confirm
Button
Text
:
"
确认
"
,
cancel
Button
Text
:
"
不了
"
,
confirmText
:
"
确认
"
,
cancelText
:
"
不了
"
,
success
:
result
=>
{
if
(
result
.
confirm
)
{
// 参数
...
...
public/appmini/old/wechat/pages/user-goods-browse/user-goods-browse.js
浏览文件 @
7bc0f078
...
...
@@ -14,7 +14,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -127,11 +127,11 @@ Page({
// 删除
delete_event
(
e
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
"
温馨提示
"
,
content
:
"
删除后不可恢复?,确定继续吗?
"
,
confirm
Button
Text
:
"
确认
"
,
cancel
Button
Text
:
"
不了
"
,
confirmText
:
"
确认
"
,
cancelText
:
"
不了
"
,
success
:
result
=>
{
if
(
result
.
confirm
)
{
// 参数
...
...
public/appmini/old/wechat/pages/user-integral/user-integral.js
浏览文件 @
7bc0f078
...
...
@@ -14,7 +14,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
public/appmini/old/wechat/pages/user-order/user-order.js
浏览文件 @
7bc0f078
...
...
@@ -49,7 +49,7 @@ Page({
},
init
()
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
);
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
...
...
@@ -291,11 +291,11 @@ Page({
// 取消
cancel_event
(
e
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
"
温馨提示
"
,
content
:
"
取消后不可恢复,确定继续吗?
"
,
confirm
Button
Text
:
"
确认
"
,
cancel
Button
Text
:
"
不了
"
,
confirmText
:
"
确认
"
,
cancelText
:
"
不了
"
,
success
:
result
=>
{
if
(
result
.
confirm
)
{
// 参数
...
...
@@ -344,11 +344,11 @@ Page({
// 收货
collect_event
(
e
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
"
温馨提示
"
,
content
:
"
请确认已收到货物或已完成,操作后不可恢复,确定继续吗?
"
,
confirm
Button
Text
:
"
确认
"
,
cancel
Button
Text
:
"
不了
"
,
confirmText
:
"
确认
"
,
cancelText
:
"
不了
"
,
success
:
result
=>
{
if
(
result
.
confirm
)
{
// 参数
...
...
public/appmini/old/wechat/pages/user/user.js
浏览文件 @
7bc0f078
...
...
@@ -52,16 +52,16 @@ Page({
},
init
(
e
)
{
var
user
=
app
.
GetUserI
nfo
(
this
,
"
init
"
),
var
user
=
app
.
get_user_i
nfo
(
this
,
"
init
"
),
self
=
this
;
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
wx
.
confirm
({
wx
.
showModal
({
title
:
'
温馨提示
'
,
content
:
'
绑定手机号码
'
,
confirm
Button
Text
:
'
确认
'
,
cancel
Button
Text
:
'
暂不
'
,
confirmText
:
'
确认
'
,
cancelText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
wx
.
navigateTo
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录