| 
					
				 | 
			
			
				@@ -68,6 +68,18 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 更新用户信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @date:2023/10/20 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  get updateValidate() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const that = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      user_id: that.ctx.rules.default(that.service.shop.getWebUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        .number(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * [wxuserValidate 微信用户写入] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @return {[type]} [description] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -202,7 +214,7 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * [login 用户登录] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * [login 用户登录 - 账号密码] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @return {[type]} [description] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async login() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -214,7 +226,7 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // include: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //   { model: that.app.model.ProxyApplyLogs, as: 'proxyApplyLogs', attributes: [ 'verify_status' ] }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        attributes: [ 'user_id', 'account_name', 'nickname', 'headimgurl', 'openid', 'intergral', 'is_proxy', 'partner_id' ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        attributes: [ 'user_id', 'account_name', 'nickname', 'headimgurl', 'openid', 'intergral', 'is_proxy', 'partner_id', 'is_office', 'is_family' ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         raw: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (!user) throw new Error('登录失败,请检查账号密码是否正确'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -256,7 +268,7 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * [wxRegisterAdnLogin 微信登录和注册] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * [wxRegisterAdnLogin 用户登录 - 微信注册登录] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @return {[type]} [description] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async wxRegisterAdnLogin() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -306,7 +318,7 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // console.log('==========inviteCode========== : ' + inviter_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const options = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       where: { openid: userInfo.openid }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      attributes: [ 'user_id', 'account_name', 'nickname', 'headimgurl', 'openid', 'partner_id' ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      attributes: [ 'user_id', 'account_name', 'nickname', 'headimgurl', 'openid', 'partner_id', 'is_office', 'is_family' ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       raw: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let user = await that.useModel.findOne(options); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -361,6 +373,8 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       headimgurl: result.dataValues.headimgurl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       openid: result.dataValues.openid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       unionid: result.dataValues.unionid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      is_office: result.dataValues.is_office, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      is_family: result.dataValues.is_family, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -937,5 +951,29 @@ module.exports = class UserController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 更新用户信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @date:2023/10/20 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  async updateUserInfo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const that = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const data = await that.ctx.validate(that.updateValidate, await that.ctx.anyParse()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 2023/10/20  更新用户信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const dataParam = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (data.is_office) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dataParam.is_office = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (data.is_family) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dataParam.is_family = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dataParam.update_ttime = that.app.szjcomo.date('Y-m-d H:i:s'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const updateBean = await that.app.comoBean.instance(dataParam, { where: { user_id: data.user_id } }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const result = await that.service.base.update(updateBean, that.useModel, '微信用户信息更新失败,请重试'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } catch (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return that.ctx.appJson(that.app.szjcomo.appResult(e.message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 |