|
|
@@ -24,6 +24,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
24
|
24
|
private readonly BLL.T_Cus_CustomerBaseNew customerBaseBLL = new BLL.T_Cus_CustomerBaseNew();
|
|
25
|
25
|
private readonly BLL.T_Cus_CustomerFinance finbll = new BLL.T_Cus_CustomerFinance();
|
|
26
|
26
|
private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
|
|
|
27
|
+ private readonly BLL.ManagementUser muserbll = new BLL.ManagementUser();
|
|
|
28
|
+ private readonly BLL.T_Cus_CustomerBaseNew cusbll = new BLL.T_Cus_CustomerBaseNew();
|
|
27
|
29
|
//private readonly BLL.T_Cus_RegionCategory bllCus = new T_Cus_RegionCategory();
|
|
28
|
30
|
|
|
29
|
31
|
///// <summary>
|
|
|
@@ -68,6 +70,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
68
|
70
|
#endregion
|
|
69
|
71
|
if (login.UserType == 1)
|
|
70
|
72
|
{
|
|
|
73
|
+ #region usertype=1
|
|
|
74
|
+
|
|
71
|
75
|
Dictionary<string, string> paras = new Dictionary<string, string>();
|
|
72
|
76
|
string sql = " select * from T_Sys_UserAccount (NOLOCK) where F_UserCode=@F_UserCode and F_PassWord=@F_PassWord and F_DeleteFlag = 0 ";
|
|
73
|
77
|
paras.Add("@F_UserCode", login.UserCode);
|
|
|
@@ -79,7 +83,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
79
|
83
|
//var user = userAccountBLL.GetModel(login.UserCode); //20180926 次方法查询有漏洞
|
|
80
|
84
|
var user = userAccountBLL.DataTableToList(dt).ToList().FirstOrDefault();
|
|
81
|
85
|
user.F_WxOpenId = login.OpenId;
|
|
82
|
|
- int UserType = 0;string rolecode = "";
|
|
|
86
|
+ int UserType = 0; string rolecode = "";
|
|
83
|
87
|
|
|
84
|
88
|
//部门
|
|
85
|
89
|
Model.T_Sys_Department modelDep = new BLL.T_Sys_Department().GetModel(user.F_DeptId);
|
|
|
@@ -90,8 +94,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
90
|
94
|
if (rolemodel != null)
|
|
91
|
95
|
rolecode = rolemodel.F_RoleCode;
|
|
92
|
96
|
#endregion
|
|
93
|
|
- #region 部门角色
|
|
94
|
|
- //部门角色(-1管理员,1接待部,2案场经理、项目负责人,3销售部总经理、物业部总经理、工程总经理、设计总经理,4区域客服,5业主(客户档案))
|
|
|
97
|
+ #region 部门角色
|
|
|
98
|
+ //部门角色(-1管理员,1接待部,2案场经理、项目负责人,3销售部总经理、物业部总经理、工程总经理、设计总经理,4区域客服,5业主(客户档案))
|
|
95
|
99
|
if (user.F_RoleId == 17 || user.F_RoleId == 57)
|
|
96
|
100
|
{
|
|
97
|
101
|
//-1管理员
|
|
|
@@ -134,7 +138,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
134
|
138
|
openid = login.OpenId,
|
|
135
|
139
|
usercode = login.UserCode,
|
|
136
|
140
|
usertype = UserType,
|
|
137
|
|
- rolecode=rolecode,
|
|
|
141
|
+ rolecode = rolecode,
|
|
138
|
142
|
};
|
|
139
|
143
|
|
|
140
|
144
|
if (userAccountBLL.Update(user))
|
|
|
@@ -143,43 +147,102 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
143
|
147
|
return Error("绑定失败");
|
|
144
|
148
|
}
|
|
145
|
149
|
return Error("账号或密码错误,请重新登录");
|
|
|
150
|
+ #endregion
|
|
146
|
151
|
}
|
|
147
|
152
|
else if (login.UserType == 5)
|
|
148
|
153
|
{
|
|
149
|
|
- //客户档案登录 - 用戶信息不存在时,登录客户档案业主账号
|
|
150
|
|
- Dictionary<string, string> paras_Customer = new Dictionary<string, string>();
|
|
151
|
|
- // F_RelationShipClassID IN (1,2) 用户类型:0来电用户; 1准业主; 2不是准业主或是亲戚朋友
|
|
152
|
|
- //首次密码默认为身份证后6位信息
|
|
153
|
|
- //F_CustomerClassID >= 0 为业主或租户,且F_RelationShipClassID = 0为会员账号 2、登录最早的信息
|
|
154
|
|
- string sql_Customer = " select * from dbo.T_Cus_CustomerBaseNew (NOLOCK) where F_CustomerCode=@F_UserCode and F_WxPassword=@F_PassWord and F_DeleteFlag = 0 ORDER BY F_CreatedOn ASC ";
|
|
155
|
|
- paras_Customer.Add("@F_UserCode", login.UserCode);
|
|
156
|
|
- paras_Customer.Add("@F_PassWord", login.Password);
|
|
157
|
|
- var dt_Customer = DbHelperSQL.Query(sql_Customer, paras_Customer).Tables[0];
|
|
|
154
|
+ //判断登录的用户是客户表的还是管理员表的
|
|
|
155
|
+ Model.T_Cus_CustomerBaseNew cusmodelwx = cusbll.GetModelWx(login.UserCode, login.Password);
|
|
|
156
|
+ Model.ManagementUser manuserwx = muserbll.GetManageCustomerModelwx(login.UserCode, login.Password);
|
|
158
|
157
|
|
|
159
|
|
- if (dt_Customer != null && dt_Customer.Rows.Count > 0)
|
|
|
158
|
+ if (cusmodelwx != null)
|
|
160
|
159
|
{
|
|
161
|
|
- //var customer = customerBaseBLL.GetModel(login.UserCode); //20180926 次方法查询有漏洞
|
|
162
|
|
- var customer = customerBaseBLL.DataTableToList(dt_Customer).ToList().FirstOrDefault();
|
|
163
|
|
- customer.F_WxOpenId = login.OpenId;
|
|
|
160
|
+ #region usertype=5
|
|
|
161
|
+ //客户档案登录 - 用戶信息不存在时,登录客户档案业主账号
|
|
|
162
|
+ Dictionary<string, string> paras_Customer = new Dictionary<string, string>();
|
|
|
163
|
+ // F_RelationShipClassID IN (1,2) 用户类型:0来电用户; 1准业主; 2不是准业主或是亲戚朋友
|
|
|
164
|
+ //首次密码默认为身份证后6位信息
|
|
|
165
|
+ //F_CustomerClassID >= 0 为业主或租户,且F_RelationShipClassID = 0为会员账号 2、登录最早的信息
|
|
|
166
|
+ string sql_Customer = " select * from dbo.T_Cus_CustomerBaseNew (NOLOCK) where F_CustomerCode=@F_UserCode and F_WxPassword=@F_PassWord and F_DeleteFlag = 0 ORDER BY F_CreatedOn ASC ";
|
|
|
167
|
+ paras_Customer.Add("@F_UserCode", login.UserCode);
|
|
|
168
|
+ paras_Customer.Add("@F_PassWord", login.Password);
|
|
|
169
|
+ var dt_Customer = DbHelperSQL.Query(sql_Customer, paras_Customer).Tables[0];
|
|
|
170
|
+
|
|
|
171
|
+ if (dt_Customer != null && dt_Customer.Rows.Count > 0)
|
|
|
172
|
+ {
|
|
|
173
|
+ //var customer = customerBaseBLL.GetModel(login.UserCode); //20180926 次方法查询有漏洞
|
|
|
174
|
+ var customer = customerBaseBLL.DataTableToList(dt_Customer).ToList().FirstOrDefault();
|
|
|
175
|
+ customer.F_WxOpenId = login.OpenId;
|
|
|
176
|
+
|
|
|
177
|
+ #region 新加 - 登录后同时获取用户账号,openid,和角色
|
|
|
178
|
+ //5--业主(客户档案会员)
|
|
|
179
|
+ //int UserType = 5;
|
|
|
180
|
+ var obj = new
|
|
|
181
|
+ {
|
|
|
182
|
+ openid = login.OpenId,
|
|
|
183
|
+ usercode = login.UserCode,
|
|
|
184
|
+ companyname = customer.F_CompanyName,
|
|
|
185
|
+ companyaddress = customer.F_CompanyAddress,
|
|
|
186
|
+ };
|
|
|
187
|
+ #endregion
|
|
|
188
|
+ if (customerBaseBLL.Update(customer))
|
|
|
189
|
+ return Success("绑定成功!", obj);
|
|
|
190
|
+ else
|
|
|
191
|
+ return Error("绑定失败!");
|
|
|
192
|
+ }
|
|
|
193
|
+ return Error("账号或密码错误或者没有注册,请重新登录");
|
|
|
194
|
+ #endregion
|
|
164
|
195
|
|
|
165
|
|
- #region 新加 - 登录后同时获取用户账号,openid,和角色
|
|
166
|
|
- //5--业主(客户档案会员)
|
|
167
|
|
- //int UserType = 5;
|
|
168
|
|
- var obj = new
|
|
|
196
|
+ }
|
|
|
197
|
+ else if (manuserwx != null)
|
|
|
198
|
+ {
|
|
|
199
|
+ if (manuserwx.ifdeler == 1)
|
|
169
|
200
|
{
|
|
170
|
|
- openid = login.OpenId,
|
|
171
|
|
- usercode = login.UserCode,
|
|
172
|
|
- companyname = customer.F_CompanyName,
|
|
173
|
|
- companyaddress=customer.F_CompanyAddress,
|
|
174
|
|
- };
|
|
|
201
|
+ return Error("该用户已被禁用");
|
|
|
202
|
+ }
|
|
|
203
|
+ #region UserType == 2
|
|
|
204
|
+ int UserType = 2;
|
|
|
205
|
+ Dictionary<string, string> paras_Customer = new Dictionary<string, string>();
|
|
|
206
|
+ string sql_Customer = " select * from ManagementUser (NOLOCK) where username=@username and userpower=@userpower and ifdeler = 0 ";
|
|
|
207
|
+ paras_Customer.Add("@username", login.UserCode);
|
|
|
208
|
+ paras_Customer.Add("@userpower", login.Password);
|
|
|
209
|
+ var dt_Customer = DbHelperSQL.Query(sql_Customer, paras_Customer).Tables[0];
|
|
|
210
|
+
|
|
|
211
|
+ if (dt_Customer != null && dt_Customer.Rows.Count > 0)
|
|
|
212
|
+ {
|
|
|
213
|
+ //var customer = customerBaseBLL.GetModel(login.UserCode); //20180926 次方法查询有漏洞
|
|
|
214
|
+ var customer = muserbll.DataTableToList(dt_Customer).ToList().FirstOrDefault();
|
|
|
215
|
+
|
|
|
216
|
+ customer.openid = login.OpenId;
|
|
|
217
|
+ if (customer.ifdeler == 0)
|
|
|
218
|
+ {
|
|
|
219
|
+ #region 新加 - 登录后同时获取用户账号,openid,和角色
|
|
|
220
|
+
|
|
|
221
|
+ var obj = new
|
|
|
222
|
+ {
|
|
|
223
|
+ openid = login.OpenId,
|
|
|
224
|
+ username = login.UserCode,
|
|
|
225
|
+ userpower = login.Password,
|
|
|
226
|
+ usertype = UserType
|
|
|
227
|
+ };
|
|
|
228
|
+ #endregion
|
|
|
229
|
+ if (muserbll.Update(customer))
|
|
|
230
|
+ return Success("绑定成功!", obj);
|
|
|
231
|
+ else
|
|
|
232
|
+ return Error("绑定失败!");
|
|
|
233
|
+ }
|
|
|
234
|
+ else
|
|
|
235
|
+ {
|
|
|
236
|
+ return Error("该账户被禁用!");
|
|
|
237
|
+ }
|
|
|
238
|
+ }
|
|
175
|
239
|
#endregion
|
|
176
|
|
- if (customerBaseBLL.Update(customer))
|
|
177
|
|
- return Success("绑定成功!", obj);
|
|
178
|
|
- else
|
|
179
|
|
- return Error("绑定失败!");
|
|
180
|
240
|
}
|
|
181
|
|
- return Error("账号或密码错误或者没有注册,请重新登录");
|
|
|
241
|
+ else {
|
|
|
242
|
+ return Error("用户名或密码错误!");
|
|
|
243
|
+ }
|
|
182
|
244
|
}
|
|
|
245
|
+
|
|
183
|
246
|
return Error("绑定失败");
|
|
184
|
247
|
}
|
|
185
|
248
|
|