Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
170845b0
Commit
170845b0
authored
Aug 31, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app已经登录的情况下小程序登录
parent
0cb581fd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
8 deletions
+29
-8
AdvService.php
application/models/Business/Common/AdvService.php
+0
-2
MemberService.php
application/models/Business/User/MemberService.php
+22
-1
CodeConfig.php
application/models/Error/CodeConfig.php
+3
-1
loginWithWechatInfo.php
public/test/user/loginWithWechatInfo.php
+4
-4
No files found.
application/models/Business/Common/AdvService.php
View file @
170845b0
...
@@ -170,8 +170,6 @@ class AdvServiceModel extends \Business\AbstractModel{
...
@@ -170,8 +170,6 @@ class AdvServiceModel extends \Business\AbstractModel{
}
else
{
}
else
{
$advs
=
array
();
$advs
=
array
();
}
}
//$storeAdvPosition = $storeAdvPositionDao->find(array('ap_id'=>\Our\ApiConst::storeAdvPositionTop));
}
}
return
$advs
;
return
$advs
;
}
}
...
...
application/models/Business/User/MemberService.php
View file @
170845b0
...
@@ -653,20 +653,41 @@ class MemberServiceModel extends \Business\AbstractModel
...
@@ -653,20 +653,41 @@ class MemberServiceModel extends \Business\AbstractModel
$memberMappingDao
=
\DAO\MemberMappingModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$memberMappingDao
=
\DAO\MemberMappingModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
if
(
$where
[
'userType'
]
==
\Our\ApiConst
::
wechatUserType
){
if
(
$where
[
'userType'
]
==
\Our\ApiConst
::
wechatUserType
){
$condition
[
'openid'
]
=
$this
->
getUnionId
(
$where
[
'encryptedData'
],
$where
[
'iv'
],
$where
[
'session_key'
]);
$condition
[
'openid'
]
=
$this
->
getUnionId
(
$where
[
'encryptedData'
],
$where
[
'iv'
],
$where
[
'session_key'
]);
$condition
[
'user_type'
]
=
array
(
'in'
,
array
(
\Our\ApiConst
::
wechatUserType
,
\Our\ApiConst
::
userFromWx
));
}
else
{
}
else
{
$condition
[
'openid'
]
=
$where
[
'openid'
];
$condition
[
'openid'
]
=
$where
[
'openid'
];
$condition
[
'user_type'
]
=
$where
[
'userType'
];
}
}
$condition
[
'user_type'
]
=
$where
[
'userType'
];
$memberMappings
=
$memberMappingDao
->
getList
(
$condition
,
'member_id'
);
$memberMappings
=
$memberMappingDao
->
getList
(
$condition
,
'member_id'
);
//$memberMapping = \Our\RedisHelper::cachedFunction(\Redis\Db0\MemberMappingRedisModel::getInstance(),array(&$memberMappingDao, 'find'),array($condition,'member_id'),\Our\ApiConst::tenDaySecond);
//$memberMapping = \Our\RedisHelper::cachedFunction(\Redis\Db0\MemberMappingRedisModel::getInstance(),array(&$memberMappingDao, 'find'),array($condition,'member_id'),\Our\ApiConst::tenDaySecond);
if
(
$memberMappings
){
if
(
$memberMappings
){
$memberIds
=
array_column
(
$memberMappings
,
'member_id'
);
$memberIds
=
array_column
(
$memberMappings
,
'member_id'
);
$member
=
$memberDao
->
getMemberForLogin
(
$memberIds
);
$member
=
$memberDao
->
getMemberForLogin
(
$memberIds
);
if
(
$where
[
'userType'
]
==
\Our\ApiConst
::
wechatUserType
){
$this
->
checkMemberMappingExist
(
$member
[
'member_id'
],
$condition
[
'openid'
]
,
$where
[
'userType'
]);
}
return
$member
;
return
$member
;
}
}
return
false
;
return
false
;
}
}
public
function
checkMemberMappingExist
(
$memberId
,
$openid
,
$userType
){
$memberMappingDao
=
\DAO\MemberMappingModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$condition
[
'member_id'
]
=
$memberId
;
$condition
[
'openid'
]
=
$openid
;
$condition
[
'user_type'
]
=
$userType
;
$userMapping
=
$memberMappingDao
->
find
(
$condition
);
if
(
$userMapping
){
return
true
;
}
$condition
[
'gmt_create'
]
=
TIMESTAMP
;
$result
=
$memberMappingDao
->
insert
(
$condition
);
if
(
!
$result
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
saveUserMappingFailed
);
}
return
true
;
}
public
function
getUnionId
(
$encryptedData
,
$vi
,
$sessionKey
){
public
function
getUnionId
(
$encryptedData
,
$vi
,
$sessionKey
){
$wxInfo
=
\Our\ArrayConst
::
wechatInfo
;
$wxInfo
=
\Our\ArrayConst
::
wechatInfo
;
$pc
=
\WxAes\WXBizDataCrypt
::
getInstance
(
$wxInfo
[
'appid'
],
$sessionKey
);
$pc
=
\WxAes\WXBizDataCrypt
::
getInstance
(
$wxInfo
[
'appid'
],
$sessionKey
);
...
...
application/models/Error/CodeConfig.php
View file @
170845b0
...
@@ -93,6 +93,7 @@ class CodeConfigModel {
...
@@ -93,6 +93,7 @@ class CodeConfigModel {
const
emptyLog
=
10106
;
const
emptyLog
=
10106
;
const
writeLogFailed
=
10107
;
const
writeLogFailed
=
10107
;
const
wrongTimeForReadLog
=
10108
;
const
wrongTimeForReadLog
=
10108
;
const
saveUserMappingFailed
=
10109
;
//访问错误
//访问错误
const
illegalAccess
=
200001
;
const
illegalAccess
=
200001
;
...
@@ -752,7 +753,8 @@ class CodeConfigModel {
...
@@ -752,7 +753,8 @@ class CodeConfigModel {
self
::
elasticsError
=>
'全文索引连接出错'
,
self
::
elasticsError
=>
'全文索引连接出错'
,
self
::
emptyLog
=>
'日志内容不能为空'
,
self
::
emptyLog
=>
'日志内容不能为空'
,
self
::
writeLogFailed
=>
'日志写入失败'
,
self
::
writeLogFailed
=>
'日志写入失败'
,
self
::
wrongTimeForReadLog
=>
'读日志时写入时间段查询开始时间不能大于结束时间'
self
::
wrongTimeForReadLog
=>
'读日志时写入时间段查询开始时间不能大于结束时间'
,
self
::
saveUserMappingFailed
=>
'保存用户关联关系失败'
);
);
}
}
...
...
public/test/user/loginWithWechatInfo.php
View file @
170845b0
...
@@ -11,11 +11,11 @@
...
@@ -11,11 +11,11 @@
<form
action=
"/user/loginWithWechatInfo"
method=
"post"
>
<form
action=
"/user/loginWithWechatInfo"
method=
"post"
>
用户头像:
<input
name=
"data[avatar]"
value=
"https://tva3.sinaimg.cn/crop.0.1.1242.1242.180/4711809ejw8f387zus4vpj20yi0ykjwd.jpg"
/><br
/>
用户头像:
<input
name=
"data[avatar]"
value=
"https://tva3.sinaimg.cn/crop.0.1.1242.1242.180/4711809ejw8f387zus4vpj20yi0ykjwd.jpg"
/><br
/>
key:
<input
name=
"data[key]"
value=
"
6a620108735f413ab3e86511ff11ca99
"
/><br
/>
key:
<input
name=
"data[key]"
value=
"
f622a447ca6a6283e5bd2be7520a51f7
"
/><br
/>
gender:
<input
name=
"data[gender]"
value=
"1"
/><br
/>
gender:
<input
name=
"data[gender]"
value=
"1"
/><br
/>
encryptedData:
<input
name=
"data[encryptedData]"
value=
"
bqZaZzCkTH2f/muMGecr4K9TLuv9AEF9GFSRjltsH1gUVLnClGy8jH1nZH5qX42Vrz/ZpTZrSTOgTmjinfCv644M32TLFGKK03/W8/h62amSRctMPrGD6jii5Fu+/As6/Ht7uJpvidXqEuE2lOzvx58X0bdFDIwSgWEPoYo8lzo5DQNK23KWuP64prPjlaaLkfJQ2rZyJycDIZ/OmMbjJorpbQXaQFnI3abdqcTU5L65iJIWcw8zqnRMma4cOPHOYQ475eZqRQq+e4zXVu+y4LHzC13L8XnT5AAR81vj1LLzn9/nx8cEy5HQC8v/G22k1p1GdM7Slr5RM7y2PlXH7RHPFSD0qZTQVDzFeQtB1QJaPSsB+VXeTAKGiEvQKuf15E072iJjlnbDCHA4UPzkenB6DdcFfZWSpxU0u8bdpxjopTbl5ZegzgiSIrgSvlCVjNbpkIvhwNnU1piBc1QbnWflg9tJv9UWj0kJuHqwAFXwFLSMQOsZUdR4CZPXZCegePdmVpALvTIhaIXowOfNxQ
=="
/><br
/>
encryptedData:
<input
name=
"data[encryptedData]"
value=
"
/jkMxPHfC/jsaa28FU58R4YQbntGmg8e259shrdBqEcdCWwyinxA2JWWWx7lH6mVJmRnkRMOGhC5SsL013r9p5hkvS+XRMqzBa0lBV8vuUdAglbMXADO0aoyErAz7OzYQ7BnKljWWstR7uMEbjPdciBxyZuImfZBpmxxXR4FktNBQxmvSdKkM8P5F5T2PIdPJeIhif+ADDLolPocSaSKzWpYgao9bvw4pLioBh2COMWqkAgFLqlnagZg4shce74FdnIqdB3m3+/Tm/XugJaJtddv8fP9oabv04hUyGWi1i1a0lT9aGiH1QfMXL0AU8mEfOR4oEcnprFLrqauKQiSe5BIO4N3C3m0H7ecgBAHQ3xgsV/a3x3rMDYi6GVAg7vQ5iHbE6tZpx54WfyZOFJQ6ei//n7wfPTd3Og6LHAKhNbKYHbrn37heUW2htOaSxjNH3TP4nbyv8bea10Pt/NlKaYpLdPJr3k5/nUqVpZjKtvOMQaLKClXqhRYSb2bptm9UB6brELy1ixxU5n9sYM1uw
=="
/><br
/>
iv:
<input
name=
"data[iv]"
value=
"
eyEWI+8+Jhr70bfhWo7Zgg
=="
/><br
/>
iv:
<input
name=
"data[iv]"
value=
"
0fTG64HSN8QP6+yFlzv+9A
=="
/><br
/>
nickname:
<input
name=
"data[nickname]"
value=
"lindongming"
/><br
/>
nickname:
<input
name=
"data[nickname]"
value=
"lindongming
123
"
/><br
/>
<input
type=
"submit"
value=
"提交"
>
<input
type=
"submit"
value=
"提交"
>
</form>
</form>
</body>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment