usercenter.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. package restcontroller.common.usercenter;
  2. import beans.parameter.Parameter;
  3. import com.alibaba.fastjson.JSONObject;
  4. import common.Controller;
  5. import common.ReturnObject_Err;
  6. import common.YosException;
  7. import common.annotation.API;
  8. import common.annotation.CACHEING;
  9. import common.annotation.CACHEING_CLEAN;
  10. import common.annotation.cm;
  11. import common.data.*;
  12. import common.parameter.parameter;
  13. import restcontroller.R;
  14. import restcontroller.webmanage.saletool.store.StoreHelper;
  15. import utility.sms.Sms;
  16. import utility.tools.Encryption;
  17. import utility.wechat.miniprogram.WechatMiniProgram;
  18. import utility.wechat.miniprogram.WechatUserID;
  19. import utility.wechat.wechatservice.WechatService;
  20. import java.util.*;
  21. @API(title = "个人中心")
  22. public class usercenter extends Controller {
  23. public usercenter(JSONObject content) throws YosException {
  24. super(content);
  25. }
  26. /**
  27. * 个人信息查询
  28. *
  29. * @return
  30. */
  31. @API(title = "查询个人信息")
  32. @CACHEING
  33. public String queryUserMsg() throws YosException {
  34. Rows userrows = dbConnect.runSqlQuery("select name,phonenumber,accountno,status from sys_users where userid='" + userid + "'");
  35. if (userrows.isNotEmpty()) {
  36. Row userrow = userrows.get(0);
  37. userrow.put("attinfos", getAttachmentUrl("sys_users", userid));
  38. userrow.put("usertype", usertype);
  39. {
  40. Row hrrow = new Row();
  41. if (usertype == 1) {
  42. hrrow = getHr(userid);
  43. if (!hrrow.isEmpty()) {
  44. hrrow.put("depname", getDepartment(userid).getString("depname"));
  45. }
  46. } else if (usertype == 21 || usertype == 22) {
  47. hrrow = getEnterpriseHr(userid);
  48. }
  49. userrow.put("hr", hrrow);
  50. }
  51. {
  52. Row agenthrrow = getEnterpriseHr(userid);
  53. userrow.put("agenthr", agenthrrow);
  54. }
  55. {
  56. Row agentrow = userInfo.getAgentRow();
  57. userrow.put("agent", agentrow);
  58. }
  59. {
  60. Row enterpriseRow = getEnterpriseByUserid(userid);
  61. userrow.put("enterprise", enterpriseRow);
  62. }
  63. {
  64. Rows openidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_openids where userid='" + userid + "' and systemclient='" + systemclient + "'");
  65. Rows unionidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_unionids where userid='" + userid + "'");
  66. userrow.put("iswechatbinding", openidsRows.isNotEmpty() || unionidsRows.isNotEmpty());
  67. if (unionidsRows.isNotEmpty()) {
  68. userrow.put("wechatuserinfo", JSONObject.parse(unionidsRows.get(0).getString("userinfo")));
  69. } else if (openidsRows.isNotEmpty()) {
  70. userrow.put("wechatuserinfo", JSONObject.parse(openidsRows.get(0).getString("userinfo")));
  71. } else {
  72. userrow.put("wechatuserinfo", new JSONObject());
  73. }
  74. }
  75. return getSucReturnObject().setData(userrow).toString();
  76. } else {
  77. return getErrReturnObject().toString();
  78. }
  79. }
  80. @API(title = "账户密码修改")
  81. public String changePassWord() throws YosException {
  82. String password = content.getString("password");//MD5加密
  83. String newpassword = content.getString("newpassword");//MD5加密
  84. Rows usersrows = dbConnect.runSqlQuery("select password from sys_users where userid=" + userid);
  85. if (usersrows.isEmpty()) {
  86. return getErrReturnObject().setErrMsg("用户信息不存在").toString();
  87. }
  88. if (!password.equals(usersrows.get(0).getString("password"))) {
  89. return getErrReturnObject().setErrMsg("原密码错误!").toString();
  90. }
  91. dbConnect.runSqlUpdate("update sys_users set password='" + newpassword + "' where userid=" + userid);
  92. loguserout(userid);
  93. return getSucReturnObject().toString();
  94. }
  95. static HashMap<String, String> accountno_password = new HashMap<String, String>(16);
  96. static HashMap<String, Date> accountno_date = new HashMap<String, Date>(16);
  97. @API(title = "忘记密码,获取短信验证码", accesstoken = false)
  98. public String forgetPassword_getPassWord() throws YosException {
  99. if (!Parameter.get("system_sms_switch").equalsIgnoreCase("true")) {
  100. return new ReturnObject_Err().setErrMsg("当前系统未开启短信平台").toString();
  101. }
  102. String accountno = content.getString("accountno");//账号
  103. Rows rows = dbConnect.runSqlQuery("select *from sys_users where accountno='" + accountno + "'");
  104. if (rows.isEmpty()) {
  105. return new ReturnObject_Err().setErrMsg("不存在此账号信息").toString();
  106. }
  107. String phonenumber = rows.get(0).getString("phonenumber").trim();
  108. if (phonenumber.equals("")) {
  109. return new ReturnObject_Err().setErrMsg("账号未绑定手机号,请联系管理员").toString();
  110. }
  111. String password = createPassWord();
  112. accountno_password.put(accountno, password);
  113. Calendar calendar = Calendar.getInstance();
  114. calendar.add(Calendar.MINUTE, 5);
  115. accountno_date.put(accountno, calendar.getTime());
  116. if (!Parameter.get("system_sms_switch").equalsIgnoreCase("true")) {
  117. JSONObject object = new JSONObject();
  118. object.put("code", 1);
  119. object.put("msg", "手机验证码为:" + password);
  120. return object.toJSONString();
  121. } else {
  122. JSONObject object = new JSONObject();
  123. Sms sms = new Sms();
  124. sms.sendout(phonenumber, Parameter.get("chuanglan_sms_model_password"), new String[]{password});
  125. object.put("code", 1);
  126. object.put("msg", "手机验证码已发送,请注意查收!");
  127. return object.toJSONString();
  128. }
  129. }
  130. @API(title = "忘记密码,修改密码", accesstoken = false)
  131. public String forgetPassword_changePassWord() throws YosException {
  132. JSONObject object = new JSONObject();
  133. String password = content.getString("password");//MD5加密
  134. String accountno = content.getString("accountno");
  135. String newpassword = content.getString("newpassword");//MD5加密
  136. int resultcode;
  137. if (!accountno_password.containsKey(accountno)) {
  138. resultcode = 1;//没有获取验证码
  139. } else if (accountno_date.get(accountno).before(Calendar.getInstance().getTime())) {
  140. resultcode = 2;//验证码已失效
  141. } else {
  142. //系统验证码
  143. String syspassword = accountno_password.get(accountno);
  144. if (password.equals(new Encryption().Encode_MD5(syspassword))) {
  145. resultcode = 0;//验证码正确
  146. } else {
  147. resultcode = 3;//验证码错误
  148. }
  149. }
  150. if (resultcode == 0) {
  151. dbConnect.runSqlUpdate("update sys_users set password='" + newpassword + "' where accountno='" + accountno + "'");
  152. object.put("code", 1);
  153. object.put("msg", "成功");
  154. } else {
  155. String msg = "";
  156. if (resultcode == 1) {
  157. msg = "请先获取绑定手机号验证码!";
  158. } else if (resultcode == 2) {
  159. msg = "验证码已失效,请重新获取!";
  160. } else {
  161. msg = "无效的验证码!";
  162. }
  163. object.put("code", 0);
  164. object.put("msg", msg);
  165. }
  166. return object.toJSONString();
  167. }
  168. static HashMap<String, String> phonenumber_password = new HashMap<String, String>(16);
  169. static HashMap<String, Date> phonenumber_date = new HashMap<String, Date>(16);
  170. @API(title = "手机号修改,获取短信验证码")
  171. public String updateUserMsg_getPassWord() throws YosException {
  172. if (!Parameter.get("system_sms_switch").equalsIgnoreCase("true")) {
  173. return new ReturnObject_Err().setErrMsg("当前系统未开启短信平台").toString();
  174. }
  175. if (dbConnect.runSqlQuery("select *from sys_site_parameter where siteid='" + siteid + "' and loginmode_phonenumber=1").isEmpty()) {
  176. return new ReturnObject_Err().setErrMsg("当前站点未开启短信登陆").toString();
  177. }
  178. String phonenumber = content.getString("phonenumber");//手机号
  179. String password = createPassWord();
  180. phonenumber_password.put(phonenumber, password);
  181. Calendar calendar = Calendar.getInstance();
  182. calendar.add(Calendar.MINUTE, 5);
  183. phonenumber_date.put(phonenumber, calendar.getTime());
  184. if (!Parameter.get("system_sms_switch").equalsIgnoreCase("true")) {
  185. JSONObject object = new JSONObject();
  186. object.put("code", 1);
  187. object.put("msg", "手机验证码为:" + password);
  188. return object.toJSONString();
  189. } else {
  190. JSONObject object = new JSONObject();
  191. Sms sms = new Sms();
  192. sms.sendout(phonenumber, Parameter.get("chuanglan_sms_model_password"), new String[]{password});
  193. object.put("code", 1);
  194. object.put("msg", "手机验证码已发送,请注意查收!");
  195. return object.toJSONString();
  196. }
  197. }
  198. @API(title = "个人信息修改")
  199. @CACHEING_CLEAN(cms = {@cm(clazz = usercenter.class, method = {"queryUserMsg"})})
  200. public String updateUserMsg() throws YosException {
  201. String name = content.getString("name", "sys_users");
  202. String phonenumber = content.getStringValue("phonenumber", "sys_users");
  203. String email = content.getString("email");
  204. if (phonenumber.isEmpty()) {
  205. ArrayList<String> sqllist = new ArrayList<>();
  206. sqllist.add("update sys_hr set email='" + email + "' where userid=" + userid);
  207. sqllist.add("update sys_enterprise_hr set email='" + email + "' where userid=" + userid);
  208. dbConnect.runSqlUpdate(sqllist);
  209. return getSucReturnObject().toString();
  210. }
  211. if (dbConnect.runSqlQuery("select *from sys_site_parameter where siteid='" + siteid + "' and loginmode_phonenumber=1").isEmpty()) {
  212. ArrayList<String> sqllist = new ArrayList<>();
  213. sqllist.add("update sys_users set name='" + name + "',phonenumber='" + phonenumber + "' where userid=" + userid);
  214. sqllist.add("update sys_hr set email='" + email + "' where userid=" + userid);
  215. sqllist.add("update sys_enterprise_hr set email='" + email + "' where userid=" + userid);
  216. dbConnect.runSqlUpdate(sqllist);
  217. return getSucReturnObject().toString();
  218. } else {
  219. boolean phonenumberischange = dbConnect.runSqlQuery("select *from sys_users where userid=" + userid + " and phonenumber='" + phonenumber + "'").isEmpty();
  220. JSONObject object = new JSONObject();
  221. if (phonenumberischange) {
  222. String password = content.getString("password");//MD5加密
  223. int resultcode;
  224. if (!phonenumber_password.containsKey(phonenumber)) {
  225. resultcode = 1;//没有获取验证码
  226. } else if (phonenumber_date.get(phonenumber).before(Calendar.getInstance().getTime())) {
  227. resultcode = 2;//验证码已失效
  228. } else {
  229. //系统验证码
  230. String syspassword = phonenumber_password.get(phonenumber);
  231. if (password.equals(new Encryption().Encode_MD5(syspassword))) {
  232. resultcode = 0;//验证码正确
  233. } else {
  234. resultcode = 3;//验证码错误
  235. }
  236. }
  237. if (resultcode == 0) {
  238. ArrayList<String> sqllist = new ArrayList<>();
  239. sqllist.add("update sys_users set name='" + name + "', phonenumber='" + phonenumber + "' where userid='" + userid + "'");
  240. sqllist.add("update sys_hr set email='" + email + "' where userid=" + userid);
  241. sqllist.add("update sys_enterprise_hr set email='" + email + "' where userid=" + userid);
  242. dbConnect.runSqlUpdate(sqllist);
  243. object.put("code", 1);
  244. object.put("msg", "成功");
  245. } else {
  246. String msg = "";
  247. if (resultcode == 1) {
  248. msg = "请先获取绑定手机号验证码!";
  249. } else if (resultcode == 2) {
  250. msg = "验证码已失效,请重新获取!";
  251. } else {
  252. msg = "无效的验证码!";
  253. }
  254. object.put("code", 0);
  255. object.put("msg", msg);
  256. }
  257. } else {
  258. ArrayList<String> sqllist = new ArrayList<>();
  259. sqllist.add("update sys_users set name='" + name + "' where userid='" + userid + "'");
  260. sqllist.add("update sys_hr set email='" + email + "' where userid=" + userid);
  261. sqllist.add("update sys_enterprise_hr set email='" + email + "' where userid=" + userid);
  262. dbConnect.runSqlUpdate(sqllist);
  263. object.put("code", 1);
  264. object.put("msg", "成功");
  265. }
  266. return object.toJSONString();
  267. }
  268. }
  269. /**
  270. * 创建验证码
  271. *
  272. * @return
  273. */
  274. private String createPassWord() {
  275. String allChar = "1234567890";
  276. StringBuffer sb = new StringBuffer();
  277. Random random = new Random();
  278. for (int i = 0; i < 6; i++) {
  279. sb.append(allChar.charAt(random.nextInt(allChar.length())));
  280. }
  281. if (parameter.phonenumber_password.containsValue(sb.toString())) {
  282. return createPassWord();
  283. } else {
  284. return sb.toString();
  285. }
  286. }
  287. /**
  288. * 微信绑定
  289. *
  290. * @return
  291. */
  292. @API(title = "微信账号绑定", apiversion = R.ID20240516090402.v1.class, accesstoken = false)
  293. @CACHEING_CLEAN(cms = {@cm(clazz = usercenter.class, method = {"queryUserMsg"})})
  294. public String WechatBinding() throws YosException {
  295. String wechat_code = content.getString("wechat_code");
  296. boolean isbinging = content.getBooleanValue("isbinging");
  297. Long sys_enterprise_hrid = 0L;
  298. if (content.containsKey("sys_enterprise_hrid") && content.getLongValue("sys_enterprise_hrid") > 0) {
  299. sys_enterprise_hrid = content.getLongValue("sys_enterprise_hrid");
  300. Rows rows = dbConnect.runSqlQuery("SELECT * from sys_enterprise_hr WHERE sys_enterprise_hrid='" + sys_enterprise_hrid + "' and siteid ='" + siteid + "'");
  301. if (rows.isNotEmpty()) {
  302. if (rows.get(0).getLong("userid") > 0) {
  303. return getErrReturnObject().setErrMsg("团队成员已被绑定").toString();
  304. }
  305. }
  306. }
  307. WechatMiniProgram wechatMiniProgram = new WechatMiniProgram(systemclient);
  308. WechatUserID wechatUser = wechatMiniProgram.getWechatUserID(wechat_code);
  309. String openid = wechatUser.getOpenid();
  310. String unionid = wechatUser.getUnionid();
  311. if (isbinging) {
  312. Rows openidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_openids where userid='" + userid + "' and systemclient='" + systemclient + "'");
  313. if (openidsRows.isNotEmpty()) {
  314. if (!openidsRows.get(0).getString("openid").equals(openid)) {
  315. return getErrReturnObject().setErrMsg("当前账号已绑定微信,如需绑定其他微信,请先进行解绑操作!").toJSONString();
  316. }
  317. }
  318. Rows unionidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_unionids where userid='" + userid + "'");
  319. if (unionidsRows.isNotEmpty()) {
  320. if (!unionidsRows.get(0).getString("unionid").equals(unionid)) {
  321. return getErrReturnObject().setErrMsg("当前账号已绑定微信,如需绑定其他微信,请先进行解绑操作!").toJSONString();
  322. }
  323. }
  324. }
  325. String wechatuserinfo = "";
  326. if (content.containsKey("wechatuserinfo")) {
  327. wechatuserinfo = content.getString("wechatuserinfo", true);
  328. }
  329. ArrayList<String> sqllist = new ArrayList<>();
  330. if (openid != null && !openid.equals("")) {
  331. if (isbinging) {
  332. Rows openidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_openids where openid='" + openid + "' and systemclient='" + systemclient + "'");
  333. if (openidsRows.isEmpty()) {
  334. SQLFactory sqlFactory = new SQLFactory(this, "绑定微信openid");
  335. sqlFactory.addParameter("wechatapp_openidsid", createTableID("sys_wechatapp_openids"));
  336. sqlFactory.addParameter("systemclient", systemclient);
  337. sqlFactory.addParameter("openid", openid);
  338. sqlFactory.addParameter("userid", userid);
  339. sqlFactory.addParameter("userinfo", wechatuserinfo);
  340. sqllist.add(sqlFactory.getSQL());
  341. }
  342. } else {
  343. if (dbConnect.runSqlQuery("select 1 from sys_wechatapp_openids where openid='" + openid + "' and userid='" + userid + "' and systemclient='" + systemclient + "'").isEmpty()) {
  344. return getErrReturnObject().setErrMsg("解绑失败,当前微信账号无权限解绑").toString();
  345. }
  346. sqllist.add("delete from sys_wechatapp_openids where openid='" + openid + "' and userid='" + userid + "' and systemclient='" + systemclient + "'");
  347. }
  348. }
  349. if (unionid != null && !unionid.equals("")) {
  350. if (isbinging) {
  351. Rows openidsRows = dbConnect.runSqlQuery("select * from sys_wechatapp_unionids where unionid='" + unionid + "' and systemclient='" + systemclient + "'");
  352. if (openidsRows.isEmpty()) {
  353. SQLFactory sqlFactory = new SQLFactory(this, "绑定微信unionid");
  354. sqlFactory.addParameter("wechatapp_unionidsid", createTableID("sys_wechatapp_unionids"));
  355. sqlFactory.addParameter("unionid", unionid);
  356. sqlFactory.addParameter("userid", userid);
  357. sqlFactory.addParameter("userinfo", wechatuserinfo);
  358. sqllist.add(sqlFactory.getSQL());
  359. }
  360. } else {
  361. if (dbConnect.runSqlQuery("select 1 from sys_wechatapp_unionids where unionid='" + unionid + "' and userid='" + userid + "'").isEmpty()) {
  362. return getErrReturnObject().setErrMsg("解绑失败,当前微信账号无权限解绑").toString();
  363. }
  364. sqllist.add("delete from sys_wechatapp_unionids where unionid='" + unionid + "' and userid='" + userid + "'");
  365. }
  366. }
  367. //绑定
  368. if (isbinging && sys_enterprise_hrid > 0) {
  369. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_enterprise_hr");
  370. updateSQL.setSiteid(siteid);
  371. updateSQL.setUniqueid(sys_enterprise_hrid);
  372. updateSQL.setValue("userid", userid);
  373. updateSQL.update();
  374. if (usertype == 99) {
  375. new StoreHelper().updateUserType22(this);
  376. }
  377. }
  378. //解绑
  379. if (!isbinging && sys_enterprise_hrid > 0) {
  380. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_enterprise_hr");
  381. updateSQL.setSiteid(siteid);
  382. updateSQL.setUniqueid(sys_enterprise_hrid);
  383. updateSQL.setValue("userid", 0);
  384. updateSQL.update();
  385. if (usertype == 22) {
  386. new StoreHelper().updateUserType99(this);
  387. }
  388. }
  389. dbConnect.runSqlUpdate(sqllist);
  390. return getSucReturnObject().toString();
  391. }
  392. @API(title = "微信账号绑定成员", apiversion = R.ID20240524090002.v1.class)
  393. @CACHEING_CLEAN(cms = {@cm(clazz = usercenter.class, method = {"queryUserMsg"})})
  394. public String WechatBindingHr() throws YosException {
  395. Long hrid = content.getLongValue("hrid");
  396. Rows rows = dbConnect.runSqlQuery("select * from sys_hr WHERE hrid=" + hrid + " and siteid='" + siteid + "'");
  397. if (rows.isEmpty()) {
  398. return getErrReturnObject().setErrMsg("人员不存在").toString();
  399. }
  400. Row hrRow = rows.get(0);
  401. if (hrRow.getLong("userid") > 0) {
  402. return getErrReturnObject().setErrMsg("微信已绑定").toString();
  403. }
  404. rows = dbConnect.runSqlQuery("select * from sys_hr WHERE userid=" + userid + " and siteid='" + siteid + "'");
  405. if(rows.isNotEmpty()){
  406. return getErrReturnObject().setErrMsg("微信已绑定").toString();
  407. }
  408. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_hr");
  409. updateSQL.setSiteid(siteid);
  410. updateSQL.setUniqueid(hrid);
  411. updateSQL.setValue("userid", userid);
  412. System.err.println(updateSQL.getSQL());
  413. updateSQL.update();
  414. if (usertype == 99) {
  415. new StoreHelper().updateUserType1(this);
  416. }
  417. return getSucReturnObject().toString();
  418. }
  419. @API(title = "微信公众号绑定", accesstoken = false)
  420. public String WechatServceBinding() throws YosException {
  421. String accesstoken = content.getStringValue("accesstoken");
  422. String systemclient = content.getStringValue("systemclient");
  423. String wechat_code = content.getStringValue("wechat_code");
  424. if (systemclient.equals("") || wechat_code.equals("")) {
  425. return getErrReturnObject().toString();
  426. }
  427. long wechat_Userid = 0;
  428. WechatService wechatService = new WechatService(systemclient);
  429. WechatUserID wechatUserID = wechatService.getWechatUserID(wechat_code);
  430. String unionid = wechatUserID.getUnionid();
  431. if (unionid != null && !unionid.equals("")) {
  432. Rows unionidRows = dbConnect.runSqlQuery("select userid from sys_wechatapp_unionids where unionid='" + unionid + "'");
  433. if (unionidRows.isNotEmpty()) {
  434. wechat_Userid = unionidRows.get(0).getLong("userid");
  435. }
  436. }
  437. String openid = wechatUserID.getOpenid();
  438. // if (wechat_Userid == 0 && openid != null && !openid.equals("")) {
  439. // Rows openidRows = dbConnect.runSqlQuery("select userid from sys_wechatapp_openids where systemclient='" + systemclient + "'and openid='" + openid + "'");
  440. // if (openidRows.isNotEmpty()) {
  441. // wechat_Userid = openidRows.get(0).getLong("userid");
  442. // }
  443. // }
  444. if (wechat_Userid == 0 && !accesstoken.equals("") && parameter.tokenlist.containsKey(accesstoken)) {
  445. Rows userRows = dbConnect.runSqlQuery("select userid from sys_usersite where usersiteid=" + parameter.tokenlist.get(accesstoken));
  446. if (userRows.isNotEmpty()) {
  447. wechat_Userid = userRows.get(0).getLong("userid");
  448. }
  449. }
  450. if (wechat_Userid > 0) {
  451. ArrayList<String> sqlist = new ArrayList<>();
  452. if (unionid != null && !unionid.equals("")) {
  453. SQLFactory unionidinsertsql = new SQLFactory(this, "绑定微信unionid");
  454. unionidinsertsql.addParameter("wechatapp_unionidsid", createTableID("sys_wechatapp_unionids"));
  455. unionidinsertsql.addParameter("unionid", unionid);
  456. unionidinsertsql.addParameter("userid", wechat_Userid);
  457. unionidinsertsql.addParameter("userinfo", "");
  458. sqlist.add(unionidinsertsql.getSQL());
  459. }
  460. if (openid != null && !openid.equals("")) {
  461. SQLFactory openidinsertsql = new SQLFactory(this, "绑定微信openid");
  462. openidinsertsql.addParameter("wechatapp_openidsid", createTableID("sys_wechatapp_openids"));
  463. openidinsertsql.addParameter("systemclient", systemclient);
  464. openidinsertsql.addParameter("openid", openid);
  465. openidinsertsql.addParameter("userid", wechat_Userid);
  466. openidinsertsql.addParameter("userinfo", "");
  467. sqlist.add(openidinsertsql.getSQL());
  468. }
  469. if (sqlist.size() == 2) {
  470. dbConnect.runSqlUpdate(sqlist);
  471. return getSucReturnObject().toString();
  472. }
  473. }
  474. return getErrReturnObject().toString();
  475. }
  476. }