Browse Source

更新unionid

laiguoran 4 years ago
parent
commit
432ac4e512

+ 1 - 1
app/controller/wechat_controller.js

@@ -110,7 +110,7 @@ module.exports = app => {
                     throw '先关注公众号才能绑定项目';
                 }
 
-                const result2 = await ctx.service.projectAccount.bindWx(accountData.id, ctx.session.wechatToken.openid, user.nickname);
+                const result2 = await ctx.service.projectAccount.bindWx(accountData.id, ctx.session.wechatToken.openid, user.nickname, user.unionid);
                 if (!result2) {
                     throw '绑定失败';
                 }

BIN
app/public/images/icon-pc.png


BIN
app/public/images/icon-qrcode.png


+ 3 - 1
app/service/project_account.js

@@ -764,9 +764,10 @@ module.exports = app => {
          * @param {String} id - 账号id
          * @param {Number} openid - openid
          * @param {Number} nickname - 微信名称
+         * @param {Number} unionid - unionid
          * @return {Boolean} - 返回修改结果
          */
-        async bindWx(id, openid, nickname) {
+        async bindWx(id, openid, nickname, unionid) {
             const wx_type = {};
             for (const key in smsTypeConst) {
                 if (smsTypeConst.hasOwnProperty(key)) {
@@ -779,6 +780,7 @@ module.exports = app => {
                 id,
                 wx_openid: openid,
                 wx_name: nickname,
+                wx_unionid: unionid,
                 wx_type: JSON.stringify(wx_type),
             };
 

+ 3 - 3
app/view/login/login.ejs

@@ -32,7 +32,7 @@
                 <!--演示版-->
                 <form class="form-signin" method="post" action="/login" id="normal-form" style="min-width: 360px;position: relative">
                     <!--<div class="change-form" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><i style="padding:5px;font-size: 50px;color: #212529" class="fa fa-qrcode"></i></div>-->
-                    <div class="change-form" data-toggle="tooltip" data-placement="left" title="微信登录" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><img alt="微信扫码登录" style="padding:5px;" width="50px" src="https://auth.dianjia.io/resources/2.0/img/icon-qrcode.png"></div>
+                    <div class="change-form" data-toggle="tooltip" data-placement="left" title="微信登录" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><img alt="微信扫码登录" style="padding:5px;" width="50px" src="/public/images/icon-qrcode.png"></div>
                     <!-- <h4 class="text-center mb-2">纵横云计量</h4> -->
                     <h5 class="text-center mb-2" id="project_name"></h5>
                     <h5 class="text-center mb-4 text-muted">用户登录</h5>
@@ -77,7 +77,7 @@
                 </form>
                 <form class="form-signin" id="code-form" style="min-width: 360px;position: relative;display: none">
                     <!--<div class="change-form" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><i style="padding:5px;font-size: 40px;color: #212529" class="fa fa-laptop"></i></div>-->
-                    <div class="change-form" data-toggle="tooltip" data-placement="left" title="账号登录" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><img alt="账号登录" style="padding:5px;" width="50px" src="https://auth.dianjia.io/resources/2.0/img/icon-pc.png"></div>
+                    <div class="change-form" data-toggle="tooltip" data-placement="left" title="账号登录" style="position: absolute;right: 0;top: 0px;cursor: pointer;"><img alt="账号登录" style="padding:5px;" width="50px" src="/public/images/icon-pc.png"></div>
                     <div id="wx-code" style="text-align: center">
                     </div>
                 </form>
@@ -151,7 +151,7 @@
             id:"wx-code",
             appid: "wx5320cd30cecdbd68",
             scope: "snsapi_login",
-            redirect_uri: "http://jluat.smartcost.com.cn/wxAuth",
+            redirect_uri: "<%- hostUrl %>/wxAuth",
             state: getQueryString('referer'),
             style: "black",
             href: ""

+ 0 - 2
sql/update20210312.sql

@@ -98,5 +98,3 @@ CREATE TABLE `zh_schedule_stage` (
   `tp` decimal(30,8) DEFAULT NULL COMMENT '本期计量完成金额',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='计量进度-计划月份,计量期选中表';
-
-ALTER TABLE `zh_project_account` ADD `wx_unionid` VARCHAR(50) NULL COMMENT '微信绑定unionid(同一个开放平台共用)' AFTER `wx_openid`;