/// <summary> /// 生成带参数的二维码 /// </summary> /// <param name="guid">Web socket唯一标识</param> /// <param name=""></param> /// <returns></returns> public byte[] CreateWxCode(Dictionary <string, string> dic)//string guid,string costCenterCode, string cardno, int barCodeSize) { try { string token = GetAccessToken(); byte[] d = WxPayApi.GetWxAppQRCode(token, string.Format("{0},{1},{2}", dic.ContainsKey("costCenterCode")? dic["costCenterCode"]:"", dic.ContainsKey("cardno") ? dic["cardno"] : "", dic.ContainsKey("guid") ? dic["guid"] : "")); if (d.Length < 1000) { token = GetAccessToken("isNew"); d = WxPayApi.GetWxAppQRCode(token, string.Format("{0},{1},{2}", dic.ContainsKey("costCenterCode") ? dic["cosCenterCode"] : "", dic.ContainsKey("cardno") ? dic["cardno"] : "", dic.ContainsKey("guid") ? dic["guid"] : "")); if (d.Length < 1000) { throw new Exception("生成二维码失败"); } } return(d); } catch (Exception ex) { throw ex; } }