예제 #1
0
        private EOrder CreateBuyCourseOrder(string userOpenId, ECoursePrice coursePrice)
        {
            EOrder order = null;

            try
            {
                order = new EOrder
                {
                    CreateDateTime = DateTime.Now,
                    CustOpenId     = userOpenId,
                    OrderStatus    = OrderStatus.Created,
                    OrderType      = OrderType.UserCourse,
                    OrderId        = EduCodeGenerator.GetOrderOrder(),
                };
                _dbContext.Add(order);

                EOrderLine line = new EOrderLine
                {
                    OrderId  = order.OrderId,
                    ItemCode = coursePrice.PriceCode,
                    ItemName = $"课时购买{coursePrice.PriceCode}_{coursePrice.CourseScheduleType}",
                    Price    = coursePrice.Price,
                    Qty      = coursePrice.Qty,
                    Ext1     = (int)coursePrice.CourseScheduleType,
                };
                _dbContext.Add(line);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(order);
        }
예제 #2
0
        public AlipayFundTransToaccountTransferResponse TransferAmount(string toUserAliPayAccount, string userOpenId, double amount)
        {
            EAliPayApplication app          = StaticDataSrv.GetAliPayApplication();
            IAopClient         aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId,
                                                                   app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false);

            AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();

            var TransferId = EduCodeGenerator.TransferOrderNo();

            AlipayFundTransToaccountTransferModel model = new AlipayFundTransToaccountTransferModel();

            model.Amount        = amount.ToString("0.00");
            model.OutBizNo      = TransferId;
            model.PayeeType     = "ALIPAY_LOGONID";
            model.PayeeAccount  = toUserAliPayAccount;
            model.PayerShowName = "云艺书院奖励金";
            request.SetBizModel(model);
            AlipayFundTransToaccountTransferResponse response = aliyapClient.Execute(request);



            return(response);

            //if (PayTargetMode == PayTargetMode.AliPayAccount)
            //    model.PayeeType = "ALIPAY_LOGONID";
            //else
            //    model.PayeeType = "ALIPAY_USERID";

            //model.PayeeAccount = toAliPayAccount;
            //if (!string.IsNullOrEmpty(ShowName))
            //{
            //    model.PayerShowName = ShowName;
            //}
            //else
            //{
            //    string profix = "";
            //    if (target == TransferTarget.ParentAgent)
            //        profix = "(上级佣金)";
            //    else if (target == TransferTarget.Agent)
            //        profix = "(代理费)";
            //    else if (target == TransferTarget.User)
            //        profix = "(打款)";
            //    else if (target == TransferTarget.L3Agent)
            //        profix = "(三级)";
            //    else if (target == TransferTarget.MidStore)
            //        profix = "(码商)";
            //    model.PayerShowName = profix + "服务费";
            //}

            //if (order != null)
            //    model.Remark = string.Format("#{0}-订单金额:{1}-订单ID:{2}", order.AgentName, order.TotalAmount, order.OrderNo);

            //request.SetBizModel(model);

            //AlipayFundTransToaccountTransferResponse response = aliyapClient.Execute(request);

            //return response;
        }
예제 #3
0
        public void NewTecFromUser(EUserInfo user)
        {
            int count = _dbContext.DBTecInfo.Count(t => t.UserOpenId == user.OpenId);

            if (count == 0)
            {
                int No      = 0;
                var lastTec = _dbContext.DBTecInfo.OrderByDescending(a => a.Id).FirstOrDefault();
                if (lastTec != null)
                {
                    No = (int)lastTec.Id;
                }
                No++;
                //教师信息
                ETecInfo tec = new ETecInfo
                {
                    Sex             = user.Sex,
                    Code            = EduCodeGenerator.GetTecCode(No),
                    Name            = user.Name,
                    UserOpenId      = user.OpenId,
                    WxName          = user.wx_Name,
                    Phone           = user.Phone,
                    CreatedDateTime = DateTime.Now,
                    UpdatedDateTime = DateTime.Now,
                };

                //教师技能
                _dbContext.Database.ExecuteSqlRaw(TecSrv.sql_DeleteALLTecSkill(tec.Code));

                CourseSrv courseSrv  = new CourseSrv(this._dbContext);
                var       courseList = courseSrv.GetCourseType();
                foreach (var course in courseList)
                {
                    ETecSkill ts = new ETecSkill
                    {
                        CourseType = (CourseType)course.Key,
                        SkillLevel = SkillLevel.None,
                        TecCode    = tec.Code,
                    };

                    _dbContext.DBTecSkill.Add(ts);
                }

                _dbContext.DBTecInfo.Add(tec);
                _dbContext.Database.ExecuteSqlRaw(UserSrv.sql_UpdateUserRole(UserRole.Teacher, user.OpenId));
                _dbContext.SaveChanges();
            }
        }
예제 #4
0
        public IActionResult OnPostCreateLessonQR(ELessonQR qr)
        {
            ResultNormal result = new ResultNormal();

            try
            {
                var code = EduCodeGenerator.Tool_LessonQRCode();
                var url  = $"http://edu.iqianba.cn/Tools/QRScan?code={code}";
                qr.Code           = code;
                qr.CreateDateTime = DateTime.Now;
                string filePath = EduEnviroment.DicPath_Tools_LessonQR + $"{code}.png";
                qr.QRFilePath = EduEnviroment.VirPath_Tools_LessonQR + $"{code}_logo.png";

                string filePathWithLogo = EduEnviroment.DicPath_Tools_LessonQR + $"{code}_logo.png";

                var desc = new List <string>();
                if (!string.IsNullOrEmpty(qr.Name))
                {
                    desc.Add(qr.Name);
                }

                QRHelper.GenQR(url, filePath, desc);
                var logoUrl = "http://edu.iqianba.cn/images/logo_120.png";

                QRHelper.AddLogoForQR(logoUrl, new Bitmap(filePath), filePathWithLogo);

                _ToolsSrv.AddQR(qr);
                _ToolsSrv.SaveChanges();

                result.SuccessMsg = qr.QRFilePath;
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }
            return(new JsonResult(result));
        }