Browse Source

bug修复

eganwu 1 year ago
parent
commit
23190c44fe
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/custom/restcontroller/common/usercenter/usercenter.java

+ 7 - 1
src/custom/restcontroller/common/usercenter/usercenter.java

@@ -420,7 +420,7 @@ public class usercenter extends Controller {
     public String WechatBindingHr() throws YosException {
 
         Long hrid = content.getLongValue("hrid");
-        Rows rows = dbConnect.runSqlQuery("select * from sys_hr WHERE hrid="+hrid+" and siteid='" + siteid + "'");
+        Rows rows = dbConnect.runSqlQuery("select * from sys_hr WHERE hrid=" + hrid + " and siteid='" + siteid + "'");
         if (rows.isEmpty()) {
             return getErrReturnObject().setErrMsg("人员不存在").toString();
         }
@@ -429,6 +429,12 @@ public class usercenter extends Controller {
         if (hrRow.getLong("userid") > 0) {
             return getErrReturnObject().setErrMsg("微信已绑定").toString();
         }
+
+        rows = dbConnect.runSqlQuery("select * from sys_hr WHERE userid=" + userid + " and siteid='" + siteid + "'");
+        if(rows.isNotEmpty()){
+            return getErrReturnObject().setErrMsg("微信已绑定").toString();
+        }
+
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_hr");
         updateSQL.setSiteid(siteid);
         updateSQL.setUniqueid(hrid);