コード例 #1
0
 public IHttpActionResult GetIsExit(string v1, bool isNew = false, string where = null)
 {
     try
     {
         if (isNew)
         {
             List <Wheres> list = new List <Wheres>();
             //条件
             if (string.IsNullOrEmpty(where))
             {
                 return(notFound("请求失败"));
             }
             list = JsonHelper.Deserialize <List <Wheres> >(where);
             _User user = new _User();
             if (where.Contains("openId"))
             {
                 var m = wechat_bll.QuerySingleByWheres(list);
                 if (m != null)
                 {
                     List <Wheres> wheres = new List <Wheres>()
                     {
                         new Wheres("wechatId", "=", m.objectId)
                     };
                     var n = auth_bll.QuerySingleByWheres(wheres);
                     if (n != null)
                     {
                         List <Wheres> whes = new List <Wheres>()
                         {
                             new Wheres("authDataId", "=", n.objectId)
                         };
                         user = bll.QuerySingleByWheres(whes);
                     }
                 }
             }
             else
             {
                 user = bll.QuerySingleByWheres(list);
             }
             if (user != null)
             {
                 if (user.authData == null)
                 {
                     return(ok(new { objectId = user.objectId, credit = user.credit }));
                 }
                 else
                 {
                     return(ok(new { objectId = user.objectId, openId = user.authData.wechat.openId, inopenId = user.authData.wechat.inopenId, credit = user.credit, username = user.username, sign_in = user.sign_in }));
                 }
             }
             else
             {
                 return(notFound("用户不存在"));
             }
         }
         else
         {
             List <Wheres> list = new List <Wheres>();
             //条件
             if (!string.IsNullOrEmpty(where))
             {
                 list = JsonHelper.Deserialize <List <Wheres> >(where);
             }
             int count = bll.QueryCount(list);
             return(ok(new { count = count }));
         }
     }
     catch (Exception e)
     {
         return(execept(e.Message));
     }
 }