Пример #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public OrdersJMEntity SaveForm(int?keyValue, OrdersJMEntity entity)
 {
     try
     {
         return(service.SaveForm(keyValue, entity));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
 public ActionResult SaveForm(int?keyValue, OrdersJMEntity entity)
 {
     ordersjmbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
Пример #3
0
        public ActionResult upgradeLevel(int?tid)
        {
            var agentEntity = agentBll.GetEntityByOpenId(CurrentWxUser.OpenId);

            if (agentEntity != null)
            {
                //var ordersEntityOld = ordersJMBll.GetList("{\"AgentId\":\"" + agentEntity.Id + "\",\"PayStatus\":\"" + 0 + "\"}");
                //if (ordersEntityOld.Count()>0)
                //{
                //    //存在未付款的升级订单

                //}

                LogHelper.AddLog("upgradeLevel tid=" + tid);//记录日志
                decimal price = 0;
                string  LV    = "";
                if (tid == 2)
                {
                    price = 399;
                    LV    = "黄金代理";
                }
                else if (tid == 3)
                {
                    price = 1999;
                    LV    = "钻石代理";
                }
                var sp_billno = string.Format("{0}{1}", "JM-", DateTime.Now.ToString("yyyyMMddHHmmss"));

                OrdersJMEntity ordersEntity = new OrdersJMEntity()
                {
                    Price    = price,
                    LV       = LV,
                    OrderSn  = sp_billno,
                    OpenId   = CurrentWxUser.OpenId,
                    NickName = CurrentWxUser.NickName,
                    AgentId  = agentEntity.Id,
                    Pid      = agentEntity.Pid,
                    Tid      = agentEntity.Tid
                };

                ordersEntity = ordersJMBll.SaveForm(null, ordersEntity);//创建JM升级订单表

                var nonceStr  = TenPayV3Util.GetNoncestr();
                var timeStamp = TenPayV3Util.GetTimestamp();

                //商品Id,用户自行定义
                var xmlDataInfoH5 = new TenPayV3UnifiedorderRequestData(WeixinConfig.AppID, tenPayV3Info.MchId, LV, sp_billno,
                                                                        Convert.ToInt32(Convert.ToDecimal(price) * 100), //1
                                                                        Request.UserHostAddress, WeixinConfig.TenPayV3Notify, TenPayV3Type.JSAPI, CurrentWxUser.OpenId, tenPayV3Info.Key, nonceStr);
                var result = TenPayV3.Unifiedorder(xmlDataInfoH5);                                                       //调用统一订单接口
                LogHelper.AddLog(result.ResultXml);                                                                      //记录日志
                var package = string.Format("prepay_id={0}", result.prepay_id);
                if (result.return_code == "SUCCESS")
                {
                    WFTWxModel jsApiPayData = new WFTWxModel()
                    {
                        appId     = WeixinConfig.AppID,
                        timeStamp = timeStamp,
                        nonceStr  = nonceStr,
                        package   = package,
                        paySign   = TenPayV3.GetJsPaySign(WeixinConfig.AppID, timeStamp, nonceStr, package, WeixinConfig.Key)
                    };
                    ViewBag.WxModel = jsApiPayData;
                    LogHelper.AddLog(JsonConvert.SerializeObject(jsApiPayData));//记录日志
                }
            }
            return(View());
        }