public ActionResult RichText(int id = 0) { //string token = AccessTokenContainer.GetAccessToken(AccessTokenContainer.GetFirstOrDefaultAppId()); string token = WxHelper.GetToken(webview_appid, webview_appsecret, false); ViewBag.appid = AccessTokenContainer.GetFirstOrDefaultAppId(); ViewBag.ticket = JsApiTicketContainer.GetJsApiTicket(JsApiTicketContainer.GetFirstOrDefaultAppId()); ViewBag.timestamp = JSSDKHelper.GetTimestamp(); ViewBag.nonceStr = JSSDKHelper.GetNoncestr(); ViewBag.signature = JSSDKHelper.GetSignature(ViewBag.ticket, ViewBag.nonceStr, ViewBag.timestamp, GetPageUrl()); ViewBag.pageUrl = GetPageUrl(); if (id == 0) { ViewBag.description = ""; } else { EntGoods good = EntGoodsBLL.SingleModel.GetModel(id); if (good == null) { ViewBag.description = ""; return(Content("产品不存在或已删除")); } ViewBag.description = good.description; } return(View()); }
/// <summary> /// 拼享惠产品描述编辑 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult PinRichText(int id = 0) { string token = WxHelper.GetToken(webview_appid, webview_appsecret, false); ViewBag.appid = AccessTokenContainer.GetFirstOrDefaultAppId(); ViewBag.ticket = JsApiTicketContainer.GetJsApiTicket(JsApiTicketContainer.GetFirstOrDefaultAppId()); ViewBag.timestamp = JSSDKHelper.GetTimestamp(); ViewBag.nonceStr = JSSDKHelper.GetNoncestr(); ViewBag.signature = JSSDKHelper.GetSignature(ViewBag.ticket, ViewBag.nonceStr, ViewBag.timestamp, Server.UrlDecode(GetPageUrl())); ViewBag.pageUrl = GetPageUrl(); if (id == 0) { //string temp = RedisUtil.Get<string>(PinGoodsBLL.key_new_pin_goods); ViewBag.description = ""; //temp ?? ""; } else { PinGoods good = PinGoodsBLL.SingleModel.GetModel(id); if (good == null) { ViewBag.description = ""; return(Content("产品不存在或已删除")); } ViewBag.description = good.description; } return(View("RichText")); }
/// <summary> /// 微信授权用户注册 /// 根据自己的业务重写即可 /// </summary> /// <returns></returns> public bool WxRegistere(string accessToken, string openId, string unionId) { using (MAction m = new MAction("WXUser")) { #region [OpenId/UnionId是否存在] var fill = !string.IsNullOrEmpty(unionId) ? m.Fill("UnionId='" + unionId + "'") : m.Fill("OpenId='" + openId + "'"); #endregion #region 微信用户拉取信息拉取 var UserInfo = WxHelper.GetUserInfo(accessToken, openId); //拉取用户微信信息 Log.WriteLogToTxt("通过accessToken+openid拉取用户信息:" + JsonHelper.ToJson(UserInfo)); var IsUserInfo = WxHelper.GetUserInfo(openId); //用于判断是否关注了公众号的用户信息 Log.WriteLogToTxt("通过openId拉取的用户信息:" + JsonHelper.ToJson(IsUserInfo)); #endregion //下面是你的具体业务,我就不写了哈。 long userId; if (fill) { //用户已存在,你可以根据你的业务需求重写编写 return(true); } else { //注册方法 //m.Set("字段名",vaule); var result = m.Insert(); return(result); } } }
public ActionResult PlatStoreDescriptionRichText(int id = 0) { //string token = AccessTokenContainer.GetAccessToken(AccessTokenContainer.GetFirstOrDefaultAppId()); string token = WxHelper.GetToken(webview_appid, webview_appsecret, false); ViewBag.appid = AccessTokenContainer.GetFirstOrDefaultAppId(); ViewBag.ticket = JsApiTicketContainer.GetJsApiTicket(JsApiTicketContainer.GetFirstOrDefaultAppId()); ViewBag.timestamp = JSSDKHelper.GetTimestamp(); ViewBag.nonceStr = JSSDKHelper.GetNoncestr(); ViewBag.signature = JSSDKHelper.GetSignature(ViewBag.ticket, ViewBag.nonceStr, ViewBag.timestamp, GetPageUrl()); log4net.LogHelper.WriteInfo(this.GetType(), $"token={token};appid={ViewBag.appid};ticket={ViewBag.ticket};timestamp={ ViewBag.timestamp};nonceStr={ViewBag.nonceStr};signature={ViewBag.signature};pageUrl={GetPageUrl()}"); if (id == 0) { // string temp = RedisUtil.Get<string>("temp_psd_description_0"); ViewBag.description = "";//temp ?? ""; } else { PlatStore platStore = PlatStoreBLL.SingleModel.GetModel(id); if (platStore == null || platStore.State == -1) { ViewBag.description = ""; return(Content("店铺不存在或已删除")); } ViewBag.description = platStore.StoreDescription; } return(View()); }
protected void Page_Load(object sender, EventArgs e) { //获取access_token //string getaccesstoken = RequestType.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + SiteConfig.Instance.AppID + "&secret=" + SiteConfig.Instance.AppSecret); //ConvertParams open = JsonConvert.DeserializeObject<ConvertParams>(getaccesstoken); //string jsapi = RequestType.HttpGet("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + open.access_token + "&type=jsapi"); //GetJsToken ticket = JsonConvert.DeserializeObject<GetJsToken>(jsapi); //拼接string //jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg&noncestr=Wm3WZYTPz0wzccnW×tamp=1414587457&url=http://mp.weixin.qq.com?params=value //string str = "jsapi_ticket=" + ticket.ticket + "&noncestr=" + GenerateNonceStr() + "×tamp=" + GenerateTimeStamp() + "&url=" + Request.Url.ToString(); //GetAccessToken token = new GetAccessToken(); string signature = WxHelper.Getsignature(WxHelper.getNoncestr(), WxHelper.getTimestamp(), getAccessToken(), getTicket(), SiteConfig.Instance.AppID, SiteConfig.Instance.AppSecret); ConvertJSParams model = new ConvertJSParams(); model.appId = SiteConfig.Instance.AppID; model.timestamp = WxHelper.getTimestamp(); model.nonceStr = WxHelper.getNoncestr(); model.signature = signature; model.ticket = getTicket(); model.url = Request.Url.ToString(); wxJsApiParam = JsonConvert.SerializeObject(model); }
// GET: Menu public ActionResult Index() { string accessToken = WxHelper.GetWXAccessToken(WxConfig.AppId, WxConfig.Secret); string url = " https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + accessToken; string postDataStr = "{\"button\":[{\"type\":\"click\",\"name\":\"今日歌曲\",\"key\":\"V1001_TODAY_MUSIC\"},{\"name\":\"菜单\",\"sub_button\":[{\"type\":\"view\",\"name\":\"扫一扫\",\"url\":\"http://1x687f9296.iok.la/ScanCode/Index\"},{\"type\":\"view\",\"name\":\"视频\",\"url\":\"http://v.qq.com/\"},{\"type\":\"click\",\"name\":\"赞一下我们\",\"key\":\"V1001_GOOD\"}]}]}"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] payload; payload = System.Text.Encoding.UTF8.GetBytes(postDataStr); request.ContentLength = payload.Length; Stream writer = request.GetRequestStream(); writer.Write(payload, 0, payload.Length); writer.Close(); //var retString = request.GetResponse() as HttpWebResponse; System.IO.Stream stream = request.GetResponse().GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(stream); string retString = reader.ReadToEnd(); reader.Close(); stream.Close(); return(Content(retString.ToString())); }
public ActionResult GetShareQRCode(int id = 0) { CustomPage pageModel = CustomPageBLL.SingleModel.GetModel(id); if (pageModel == null) { return(ApiResult(false, "页面不存在")); } if (!string.IsNullOrEmpty(pageModel.qrcode)) { return(ApiResult(true, pageModel.qrcode)); } string scene = $"{id}"; string postData = JsonConvert.SerializeObject(new { scene = scene, page = "pages/index/pagePreview", width = 210, auto_color = true, line_color = new { r = "0", g = "0", b = "0" } }); string appid = WebConfigurationManager.AppSettings["xiaowei_appid"]; string appsecret = WebConfigurationManager.AppSettings["xiaowei_appsecret"]; string access_token = WxHelper.GetToken(appid, appsecret, false); string errorMessage = ""; string qrCode = CommondHelper.HttpPostSaveImg("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + access_token, postData, ref errorMessage); if (string.IsNullOrEmpty(qrCode)) { return(ApiResult(false, $"获取二维码失败!{errorMessage}")); } pageModel.qrcode = qrCode; CustomPageBLL.SingleModel.Update(pageModel, "qrcode"); return(ApiResult(true, qrCode)); }
public Response <string> SendWxTextCardMessage(string _title, string _description, string _url, string _btntxt, string _touser = "******") { WxHelper wx = new WxHelper(_accessor.HttpContext); WxTextCardMessage msg = new WxTextCardMessage(Convert.ToInt32(wx.AgentId), _title, _description, _url, _btntxt); return(wx.SendWxTextCardMessage(msg)); }
/// <summary> /// snsapi_base 只能通过code获取openid,snsapi_userinfo 可通过code获取用户信息 /// </summary> /// <param name="scope"></param> /// <returns></returns> public ActionResult GetAuthorizeCode(string state) { string code = Request["code"]; if (code == null) { string url = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={2}#wechat_redirect", WxConfig.AppId, HttpUtility.UrlEncode(WxConfig.CurrentHost + Request.Url.AbsolutePath), state); //WxHelper.HttpGetRequest(url); return(Redirect(url)); } else { string openidUrl = string.Format("https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code ", WxConfig.AppId, WxConfig.Secret, code); string baseResult = WxHelper.HttpGetRequest(openidUrl); WxModel wxModel = JsonConvert.DeserializeObject <WxModel>(baseResult); log.LogHelper.WriteLog("获取access_token", baseResult); if (!string.IsNullOrWhiteSpace(wxModel.errcode)) { return(Content("参数错误")); } string userInfOUrl = string.Format("https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN ", wxModel.access_token, wxModel.openid); string userInfoResult = WxHelper.HttpGetRequest(userInfOUrl); log.LogHelper.WriteLog("获取用户信息", userInfoResult); WxUserInfo wxUserInfo = JsonConvert.DeserializeObject <WxUserInfo>(userInfoResult); Session["UserInfo"] = wxUserInfo; if (!string.IsNullOrWhiteSpace(wxUserInfo.errcode)) { return(Content("参数错误")); } return(Content(userInfoResult)); } }
/// <summary> /// 获取已选消息配置 /// </summary> /// <returns></returns> public Dictionary <string, IEnumerable <MdmMsgConfig> > GetSectedMsgConfig() { var basConfig = new WxHelper().GetBasConfig(AbpSession.BG_NO); if (basConfig == null) { throw new Exception("请维护集团基础配置"); } string buNo = basConfig.IS_APT_GROUP == 1 ? AbpSession.BG_NO : AbpSession.ORG_NO; var list = _mdmMsgConfigRepository.GetAllList(m => m.BU_NO == buNo); if (list == null || list.Count == 0) { throw new Exception("暂无消息提醒"); } var lookup = list.ToLookup(m => m.APT_TYPE); Dictionary <string, IEnumerable <MdmMsgConfig> > dic = new Dictionary <string, IEnumerable <MdmMsgConfig> >(); foreach (var item in lookup) { string n = item.Key + ""; dic.Add(n, item.AsEnumerable()); } return(dic); }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { // 注册全局异常过滤器 options.Filters.Add <GlobalExceptionAttribute>(); }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddDbContext <CatDbContext>(a => a.UseMySql(Configuration.GetConnectionString("CatContext"), b => b.MigrationsAssembly("JdCat.Cat.Model"))); services.AddSingleton <IConnectionMultiplexer>(ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConn"))); services.AddScoped <IBusinessRepository, BusinessRepository>(); services.AddScoped <IProductRepository, ProductRepository>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IOrderRepository, OrderRepository>(); services.AddScoped <ISessionDataRepository, SessionDataRepository>(); services.AddScoped <IMpRepository, MpRepository>(); services.AddScoped <ICardRepository, CardRepository>(); services.AddScoped <IUtilRepository, UtilRepository>(); // 系统参数 var config = new AppData(); config.Init(Configuration); services.AddSingleton(config); //InputData.Key = config.ServerKey; AppSetting.SetAppData(config); // 微信 WxHelper.Init(config); // 跨域 var urls = Configuration["Cores"].Split(','); services.AddCors(options => options.AddPolicy("AllowSameDomain", builder => builder.WithOrigins(urls).AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin().AllowCredentials()) ); }
public TravelApplyController(TravelApplyService travelApplyService, IHttpContextAccessor accessor) { _service = travelApplyService; _accessor = accessor; wx = new WxHelper(_accessor.HttpContext, "travelApply"); userInfo = wx.CheckAndGetUserInfo(); }
/// <summary> /// 检测用回复粉丝消息 /// </summary> /// <param name="code">授权码</param> /// <param name="openId">用户openid</param> private async void ReturnMsg(string code, string openId) { try { var util = HttpContext.RequestServices.GetService <IUtilRepository>(); var token = await WxHelper.GetAuthTokenAsync(code, await util.GetOpenTokenAsync()); var url = $"https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={token.authorization_info.authorizer_access_token}"; var content = new { touser = openId, msgtype = "text", text = new { content = code + "_from_api" } }; var result = await UtilHelper.RequestAsync(url, content); var sendData = JsonConvert.SerializeObject(content); Log.Debug(result); } catch (Exception e) { Log.Debug("回复消息错误:", e); } }
// GET: QrCode public FileResult GetQrCode(string code, int type = 0) { string Token = WxHelper.GetToken(type); //log4net.LogHelper.WriteInfo(this.GetType(), $"Token:{Token}"); // 20分钟不登陆二维码失效! //return Content(ReultCode); for (int i = 0; i < 5; i++) { string ReultCode = WxHelper.CreateQrCodeResult(Token, 60 * 20, code); if (ReultCode.IndexOf("ticket") > -1) { //log4net.LogHelper.WriteInfo(this.GetType(), ReultCode); CreateQrCodeResult createqrcoderesult = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <CreateQrCodeResult>(ReultCode); if (createqrcoderesult != null) { //string Logo = "http://j.vzan.cc/miniapp/img/green_logo.png"; string Logo = "http:" + WebSiteConfig.MiniappZyUrl + "/img/green_logo.jpg"; MemoryStream ms = new MemoryStream(); Bitmap bmp = QRCodeHelp.Instance.GetQrCodeImg(Logo, createqrcoderesult.url); bmp.Save(ms, ImageFormat.Jpeg); bmp.Dispose(); return(File(ms.ToArray(), "image/jpg")); } } } return(null); }
/// <summary> /// 初始化服务 /// </summary> public ResFileMstrService(IResFileMstrRepository resFileMstrRepository, WxHelper wxHelper, IMdmBuMstrRepository mdmBuMstrRepository, InitHelper initHelper) { _resFileMstrRepository = resFileMstrRepository; _wxHelper = wxHelper; _mdmBuMstrRepository = mdmBuMstrRepository; _initHelper = initHelper; }
public Response <string> SendWxTextMessage(string text, string _touser = "******") { WxHelper wx = new WxHelper(_accessor.HttpContext); WxTextMessage msg = new WxTextMessage(Convert.ToInt32(wx.AgentId), text, _touser); return(wx.SendWxTextMsg(msg)); }
public MemberManageController(IHttpContextAccessor accessor) { //serv = clientService; _accessor = accessor; wx = new WxHelper(_accessor.HttpContext, "reimburse"); userInfo = wx.CheckAndGetUserInfo(); }
public void Valid(WeChatRequest model) { Logger.Info(Json(model)); string respMessage = ""; //获取请求来的 echostr 参数 string echoStr = model.echostr; //通过验证 if (WxHelper.CheckSignature(model)) { respMessage = echoStr; } if (HttpContext.Request.HttpMethod.ToUpper() == "POST") { //从请求的数据流中获取请求信息 using (Stream stream = HttpContext.Request.InputStream) { byte[] postBytes = new byte[stream.Length]; stream.Read(postBytes, 0, (int)stream.Length); string postString = System.Text.Encoding.UTF8.GetString(postBytes); Handle(postString, model); } } if (string.IsNullOrEmpty(respMessage)) { return; } //将随机生成的 echostr 参数 原样输出 Response.Write(respMessage); //截止输出流 Response.End(); }
// GET: ScanCode public ActionResult Index() { string accessToken = WxHelper.GetWXAccessToken(WxConfig.AppId, WxConfig.Secret); if (accessToken != "err") { string jsapi = WxHelper.GetWXJsapi_Ticket(accessToken); if (jsapi != "err") { LogHelper.WriteFile(Server.MapPath("~/Logs/jsapi.txt"), jsapi); string noncestr = OperateHelper.GenerateNonceStr(); string timestamp = OperateHelper.Timestamp(); string url = WxConfig.CurrentHost + Request.Url.AbsolutePath; string str = string.Format("jsapi_ticket={0}&noncestr={1}×tamp={2}&url={3}", jsapi, noncestr, timestamp, url); string sign = OperateHelper.SHA1(str).ToLower(); LogHelper.WriteFile(Server.MapPath("~/Logs/jsapi.txt"), str); WxModel wx = new WxModel() { appId = WxConfig.AppId, nonceStr = noncestr, timestamp = timestamp, signature = sign, }; return(View(wx)); } return(Content("apierr")); } else { return(Content("err")); } }
/// <summary> /// 添加通知人 /// </summary> /// <param name="e"></param> /// <returns></returns> private async Task AddListenerAsync(WxEvent e) { if (!int.TryParse(e.EventKey, out int businessId)) { return; } var count = Context.WxListenUsers.Count(a => a.BusinessId == businessId); if (count >= 4) { return; // 添加人数不能大于4 } // 已存在的不再添加 if ((await Context.WxListenUsers.CountAsync(a => a.BusinessId == businessId && a.openid == e.FromUserName)) > 0) { return; } var business = await GetAsync <Business>(businessId); var token = await GetTokenAsync(business.WeChatAppId, business.WeChatSecret); var result = await WxHelper.GetUserInfoAsync(e.FromUserName, token); var user = JsonConvert.DeserializeObject <WxListenUser>(result); user.BusinessId = businessId; await Context.AddAsync(user); await Context.SaveChangesAsync(); }
public void TestMethod1() { var AesIV = "r7BXXKkLb8qrSNn05n0qiA=="; var AesKey = "tiihtNczf5v6AKRyjwEUhQ=="; string text = "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZM" + "QmRzooG2xrDcvSnxIMXFufNstNGTyaGS" + "9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+" + "3hVbJSRgv+4lGOETKUQz6OYStslQ142d" + "NCuabNPGBzlooOmB231qMM85d2/fV6Ch" + "evvXvQP8Hkue1poOFtnEtpyxVLW1zAo6" + "/1Xx1COxFvrc2d7UL/lmHInNlxuacJXw" + "u0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn" + "/Hz7saL8xz+W//FRAUid1OksQaQx4CMs" + "8LOddcQhULW4ucetDf96JcR3g0gfRK4P" + "C7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB" + "6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns" + "/8wR2SiRS7MNACwTyrGvt9ts8p12PKFd" + "lqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYV" + "oKlaRv85IfVunYzO0IKXsyl7JCUjCpoG" + "20f0a04COwfneQAGGwd5oa+T8yO5hzuy" + "Db/XcxxmK01EpqOyuxINew=="; string ss = new WxHelper().AESDecrypt(text, AesKey, AesIV); Console.Write(ss); }
public BudgetController(BudgetService service, IHttpContextAccessor accessor) { _service = service; _accessor = accessor; wx = new WxHelper(_accessor.HttpContext); userInfo = wx.CheckAndGetUserInfo(); }
/// <summary> /// 初始化服务 /// </summary> public TagMstrService(ITagMstrRepository tagMstrRepository, WxHelper wxHelper, InitHelper initHelper) { _tagMstrRepository = tagMstrRepository; _wxHelper = wxHelper; _initHelper = initHelper; }
public static WxPayData OrderQuery(WxPayData reqParams) { string strUrl = "https://api.mch.weixin.qq.com/pay/orderquery"; //检测请求必填参数 if (!reqParams.HasSetValue("transaction_id") && !reqParams.HasSetValue("out_trade_no")) { throw new WxPayException("查询订单中,transaction_id、out_trade_no至少填一个!"); } //其他请求参数 reqParams.SetValue("appid", WxPayConfig.APPID); reqParams.SetValue("mch_id", WxPayConfig.MCHID); reqParams.SetValue("nonce_str", WxHelper.GenerateNonceStr()); reqParams.SetValue("sign", reqParams.MakeSign()); //请求参数转XML string xml = reqParams.ToXml(); //发送请求,得到相应 string response = HttpHelper.WxPayPost(strUrl, xml); var result = new WxPayData(); result.FromXml(response); return(result); }
public static WxPayData DownloadBill(WxPayData reqParams) { string strUrl = "https://api.mch.weixin.qq.com/pay/downloadbill"; //检测请求必填参数 if (!reqParams.HasSetValue("bill_date")) { throw new WxPayException("下载对账单中,缺少必填参数 bill_date!"); } //其他请求参数 reqParams.SetValue("appid", WxPayConfig.APPID); reqParams.SetValue("mch_id", WxPayConfig.MCHID); reqParams.SetValue("nonce_str", WxHelper.GenerateNonceStr()); reqParams.SetValue("sign", reqParams.MakeSign()); //请求参数转XML string xml = reqParams.ToXml(); //发送请求,得到相应 string response = HttpHelper.WxPayPost(strUrl, xml); var result = new WxPayData(); result.FromXml(response); return(result); }
protected void start_thread() { while (true) { try { ConvertParams data = WxHelper.GetAccessToken(SiteConfig.Instance.AppID, SiteConfig.Instance.AppSecret); if (data != null) { var model = db1.wx_settings.Where(c => c.ID == 1).FirstOrDefault(); string ticketzj = WxHelper.Getjsapi_ticket(data.access_token); model.access_token = data.access_token; model.jsapi_ticket = ticketzj; model.updateTime = DateTime.Now; db1.SaveChanges(); // 休眠7000秒 Thread.Sleep((data.expires_in - 200) * 1000); } else { // 如果access_token为null,60秒后再获取 Thread.Sleep(60 * 1000); } } catch (Exception) { Thread.Sleep(60 * 1000); } } }
public ActionResult Login([FromBody] dynamic code) { Wx_Login login = WxHelper.Login(code.code.ToString()); if (login.Errcode == 0) { var dalWxUser = DalFactory.GetInstance <IDalWxUser>(); var wxUser = dalWxUser.GetByOpenId(login.Openid); if (wxUser == null) { dalWxUser.Insert(new Wx_User { Applet_OpenId = login.Openid, UnionId = login.unionid }); } return(JsonResultHelper.Success(login)); } else { return(JsonResultHelper.Error(login)); } }
/// <summary> /// 初始化服务 /// </summary> public AptDriveConfigService(IAptDriveConfigRepository aptDriveConfigRepository, WxHelper wxHelper, IMdmBuMstrRepository mdmBuMstrRepository, InitHelper initHelper) { _aptDriveConfigRepository = aptDriveConfigRepository; _mdmBuMstrRepository = mdmBuMstrRepository; _wxHelper = wxHelper; _initHelper = initHelper; }
public IHttpActionResult GetWxUser(string code, string iv, string encryptedData) { WxHelper wh = new WxHelper(); dynamic res = wh.GetWxUser(code, iv, encryptedData); return(Ok(res)); }
/// <summary> /// 删除卡券 /// </summary> /// <returns></returns> public async Task <IActionResult> RemoveCard([FromQuery] string cardId, [FromServices] IUtilRepository rep) { var token = await rep.GetTokenAsync(Business.WeChatAppId, Business.WeChatSecret); await WxHelper.RemoveCardAsync(token, cardId); return(Ok("删除成功")); }