- TmpGetSelfInfo

This commit is contained in:
gazebo
2018-09-21 16:13:50 +08:00
parent c8107677c4
commit 906c2af1c0
6 changed files with 84 additions and 1 deletions

View File

@@ -56,6 +56,25 @@ func GetUserInfo(mobile string) (storeUserInfo *StoreUserInfo, err error) {
return storeUserInfo, err
}
func GetSelfInfo(openID string) (storeUserInfo *StoreUserInfo, err error) {
sql := `
SELECT t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid, t3.tel parent_mobile,
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"openID":"', IF(t2.openid IS NULL, "", t2.openid), '","tel":"', t2.tel, '","nickname":"', IF(t2.nickname IS NULL, "", t2.nickname), '"}')), "]") members_str
FROM weixins t1
LEFT JOIN weixins t2 ON t2.parentid = t1.id
LEFT JOIN weixins t3 ON t1.parentid = t3.id
WHERE t1.openid = ?
GROUP BY t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid;
`
storeUserInfo = new(StoreUserInfo)
if err = dao.GetRow(nil, storeUserInfo, sql, openID); err == nil {
if storeUserInfo.MembersStr != "" {
err = utils.UnmarshalUseNumber([]byte(storeUserInfo.MembersStr), &storeUserInfo.Members)
}
}
return storeUserInfo, err
}
func UnbindMobile(mobile string) (num int64, err error) {
return dao.UpdateEntityByKV(nil, &model.WeiXins{}, map[string]interface{}{
"JxStoreID": nil,