public CustModel GetCustByMobile(string mobile)
{
const string sql = "select * from cust_info where mobile=@mobile;";
try
{
var custModel = Helper.Query<CustModel>(sql, new { mobile }).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();
}
return custModel;
}
catch (Exception ex)
{
return null;
}
}