public IActionResult AddRegister(T_QMDS_Company company, T_QMDS_GroupCompany groupCompany, string username, string password) { try { if (_commercialRepository.CheckUser(username)) { return(new JsonResult(new { result = 2, message = "用户名已存在!" })); } if (groupCompany.GCName != null) { groupCompany.ID = _commercialRepository.ProduceID(1); company.GCID = groupCompany.ID; } company.ID = _commercialRepository.ProduceID(2); company.CreaterID = company.ID; var flag = _commercialRepository.Register(company, groupCompany, username, password); if (flag) { return(new JsonResult(new { result = 1, message = "注册成功!" })); } else { return(new JsonResult(new { result = 0, message = "注册失败!" })); } } catch (Exception exc) { _log.Fatal($"注册失败:错误信息{exc.Message}"); return(new JsonResult(new { result = -1, messge = exc.Message })); } }
public IActionResult ShowWeiXInPay(string openid, string orderNo = "asdfsdgbadfgsdf", string employeeid = null, decimal fAmt = 0) { orderNo = commercialRepository.ProduceID(4); var userAgent = (HttpContext.Request.Headers as Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameRequestHeaders).HeaderUserAgent.ToString().ToLower(); //检测是否给当前页面传递了相关参数 if (string.IsNullOrEmpty(openid)) { ViewData["error"] = "页面传参出错,请返回重试"; Log.Error(this.GetType().ToString(), "This page have not get params, cannot be inited, exit..."); return(View()); } //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数 var jsApiPay = new JsApiPay(); jsApiPay.openid = openid; jsApiPay.total_fee = Convert.ToInt32(fAmt * 100); jsApiPay.notice_url = $"{_setting.DomainName}/registerresult"; jsApiPay.out_trade_no = orderNo; jsApiPay.body = "奖励金"; jsApiPay.attach = employeeid; //JSAPI支付预处理 try { WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(); var wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 Log.Debug(this.GetType().ToString(), "wxJsApiParam : " + wxJsApiParam); ViewData["wxJsApiParam"] = wxJsApiParam; } catch (Exception ex) { ViewData["error"] = $"下单失败,请返回重试,{ex.Message}"; } return(View()); }