Example #1
0
        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="custid"></param>
        ///// <param name="openid"></param>
        ///// <returns></returns>
        //public int RelationFans(string custid,string openid) {
        //    var sql = "select * from wechat_friend where openid=@openid;";
        //    return 1;
        //}
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginInfo">登录账户</param>
        /// <returns>用户信息</returns>
        public CustModel CustLogin(CustLoginInfo loginInfo)
        {
            const string sql = "select * from `cust_info` where mobile=@mobile and password=@password;";
            var custModel = Helper.Query<CustModel>(sql, new
            {
                mobile = loginInfo.Mobile,
                password = loginInfo.Password
            }).FirstOrDefault();

            //获取微信信息
            if (custModel != null)
            {
                custModel.Wechat = Helper.Query<CustWechat>("select a.* from wechat_friend as a inner join cust_wechat as b on a.openid=b.openid where b.custid=@custid;", new
                {
                    custid = custModel.Innerid
                }).FirstOrDefault();

                //获取是否参与过会员体验
                custModel.isbate = Helper.Query<int>("select count(1) from cust_wxpay_info where custid=@custid and type=2;", new
                {
                    custid = custModel.Innerid
                }).FirstOrDefault();
            }

            return custModel;
        }