Parcourir la Source

微信登录时根据openid获取用户名称来进行下一步操作

zhaozhiqiang il y a 5 ans
Parent
commit
d6cd0c80f6

+ 9 - 0
codegit/CallCenterApi/CallCenterApi.BLL/archives.cs

126
             return dal.GetCustomerModel(id);
126
             return dal.GetCustomerModel(id);
127
         }
127
         }
128
         /// <summary>
128
         /// <summary>
129
+        /// 根据微信openid获取客户名称
130
+        /// </summary>
131
+        /// <param name="openid"></param>
132
+        /// <returns></returns>
133
+        public string GetCustomerName(string openid)
134
+        {
135
+            return dal.GetCustomerName(openid);
136
+        }
137
+        /// <summary>
129
         /// 修改客户操作信息
138
         /// 修改客户操作信息
130
         /// </summary>
139
         /// </summary>
131
         /// <returns></returns>
140
         /// <returns></returns>

+ 44 - 0
codegit/CallCenterApi/CallCenterApi.DAL/archives.cs

375
             return ds;
375
             return ds;
376
         }
376
         }
377
         /// <summary>
377
         /// <summary>
378
+        /// 根据微信openid获取客户名称
379
+        /// </summary>
380
+        /// <param name="openid"></param>
381
+        /// <returns></returns>
382
+        public string GetCustomerName(string openid)
383
+        {
384
+            string name = "";
385
+            StringBuilder strSql = new StringBuilder();
386
+            strSql.Append("select * from T_Cus_CustomerBaseNew");
387
+            strSql.Append(" where F_WxOpenId=@F_WxOpenId");
388
+            SqlParameter[] parameters = {
389
+                    new SqlParameter("@F_WxOpenId", SqlDbType.NVarChar ,300)
390
+            };
391
+            parameters[0].Value = openid;
392
+
393
+            var ds = DbHelperSQL.Query(strSql.ToString(), parameters);
394
+
395
+            Model.T_Cus_CustomerBaseNew ar = new Model.T_Cus_CustomerBaseNew();
396
+            if (ds.Tables[0].Rows.Count > 0)
397
+            {
398
+                ar = DataRowT_Cus_CustomerBaseNew(ds.Tables[0].Rows[0]);
399
+                name = ar.F_CustomerCode;
400
+            }
401
+            return name;
402
+        }
403
+        /// <summary>
404
+        /// 得到一个物资状态对象实体
405
+        /// </summary>
406
+        public CallCenterApi.Model.T_Cus_CustomerBaseNew DataRowT_Cus_CustomerBaseNew(DataRow row)
407
+        {
408
+            Model.T_Cus_CustomerBaseNew model = new Model.T_Cus_CustomerBaseNew();//主表字段
409
+            if (row != null)
410
+            {
411
+               
412
+                if (row["F_CustomerCode"] != null)
413
+                {
414
+                    model.F_CustomerCode = row["F_CustomerCode"].ToString();
415
+                }
416
+
417
+            }
418
+            return model;
419
+            return model;
420
+        }
421
+        /// <summary>
378
         /// 外部客户操作信息添加
422
         /// 外部客户操作信息添加
379
         /// </summary>
423
         /// </summary>
380
         /// <returns></returns>
424
         /// <returns></returns>

+ 13 - 7
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/archives/archivesController.cs

350
                 
350
                 
351
                 //根据获取到的状态id修改物资状态
351
                 //根据获取到的状态id修改物资状态
352
                 var upstate = archivesbll.updateState(Convert.ToInt32(customerBorrow.archivesid), stateid);
352
                 var upstate = archivesbll.updateState(Convert.ToInt32(customerBorrow.archivesid), stateid);
353
+                //获取用户名称
354
+                var customername = "";
355
+                if (archivesbll.GetCustomerName(customerBorrow.openid) != "")
356
+                {
357
+                    customername = archivesbll.GetCustomerName(customerBorrow.openid);
358
+                }
353
 
359
 
354
                 ///添加客户操作信息
360
                 ///添加客户操作信息
355
                 model.archivesid = customerBorrow.archivesid;//物品编号
361
                 model.archivesid = customerBorrow.archivesid;//物品编号
356
                 model.BorrowOreturn = customerBorrow.BorrowOreturn;//区分借阅还是归还
362
                 model.BorrowOreturn = customerBorrow.BorrowOreturn;//区分借阅还是归还
357
                 model.BorrowDate = DateTime.Now;//客户操作时间
363
                 model.BorrowDate = DateTime.Now;//客户操作时间
358
-                model.BorrowPeople = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode ; //操作人customerBorrow.BorrowPeople
364
+                model.BorrowPeople = customername;// CurrentUser.UserData.F_UserCode ; //操作人customerBorrow.BorrowPeople
359
                 var archivesid = customerBorrow.archivesid;
365
                 var archivesid = customerBorrow.archivesid;
360
                 if (archivesbll.AddCustomerBorrow(model) > 0)
366
                 if (archivesbll.AddCustomerBorrow(model) > 0)
361
                 {
367
                 {
362
                     var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
368
                     var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
363
-                    Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;
369
+                    Operationlogmodel.Operator = customername;// CurrentUser.UserData.F_UserCode;
364
                     Operationlogmodel.OperationDate = DateTime.Now;
370
                     Operationlogmodel.OperationDate = DateTime.Now;
365
                     Operationlogmodel.OperationContent = "添加了一条借阅归还信息";
371
                     Operationlogmodel.OperationContent = "添加了一条借阅归还信息";
366
                     Operationlogmodel.archivesid = archivesid;
372
                     Operationlogmodel.archivesid = archivesid;
367
                     AddorUpdOperationlog(Operationlogmodel);
373
                     AddorUpdOperationlog(Operationlogmodel);
368
-                    return Success("添加成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
374
+                    return Success("添加成功" + ",操作人:" + customername);
369
                 }
375
                 }
370
                 else
376
                 else
371
                 {
377
                 {
372
-                    return Error("添加失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
378
+                    return Error("添加失败" + ",操作人:" + customername);
373
                 }
379
                 }
374
             }
380
             }
375
             else
381
             else
643
             
649
             
644
                
650
                
645
             var model = new CallCenterApi.Model.Operationlog();
651
             var model = new CallCenterApi.Model.Operationlog();
646
-            model.Operator = CurrentUser.UserData.F_UserCode;//操作人
652
+            model.Operator = Operationlog.Operator;//操作人
647
             model.OperationContent = Operationlog.OperationContent;//操作内容
653
             model.OperationContent = Operationlog.OperationContent;//操作内容
648
             model.OperationDate = DateTime.Now;//操作时间
654
             model.OperationDate = DateTime.Now;//操作时间
649
             model.archivesid = Operationlog.archivesid;
655
             model.archivesid = Operationlog.archivesid;
650
             if (archivesbll.AddOperationlog(model) > 0)
656
             if (archivesbll.AddOperationlog(model) > 0)
651
-                return Success("添加成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
652
-            return Error("添加失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
657
+                return Success("添加成功" + ",操作人:" + Operationlog.Operator);
658
+            return Error("添加失败" + ",操作人:" + Operationlog.Operator);
653
             
659
             
654
         }
660
         }
655
 
661
 

+ 4 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Input/customerBorrowInput.cs

33
         /// 判断是添加还是修改
33
         /// 判断是添加还是修改
34
         /// </summary>
34
         /// </summary>
35
         public int isadd { get; set; }
35
         public int isadd { get; set; }
36
+        /// <summary>
37
+        /// 微信登录的openid
38
+        /// </summary>
39
+        public string openid { get; set; }
36
     }
40
     }
37
 }
41
 }