Skip to content

Commit 6abfb3f

Browse files
committed
fix get imageurl error
1 parent 795a975 commit 6abfb3f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

wechatrobot/Api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,14 @@ def GetAllGroupMembersBySql(self) -> Dict:
177177
def GetPictureBySql(self , wxid) -> Dict:
178178
if not self.db_handle:
179179
self.db_handle = self.GetDBHandle()
180-
sql = f"select usrName,bigHeadImgUrl from ContactHeadImgUrl where usrName='{wxid}';"
180+
sql = f"select usrName,smallHeadImgUrl,bigHeadImgUrl from ContactHeadImgUrl where usrName='{wxid}';"
181181
result = self.QueryDatabase(db_handle=self.db_handle,sql=sql)
182182
try:
183-
return result['data'][1][1]
183+
if result["data"][1][2] != "":
184+
return result["data"][1][2]
185+
if result["data"][1][1] != "":
186+
return result["data"][1][1]
187+
return None
184188
except:
185189
return None
186190

wechatrobot/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.3"
1+
__version__ = "0.0.3_dev"

0 commit comments

Comments
 (0)