Exemplo n.º 1
0
        protected override string GetPushJson(U_UploadResult uploadResult, U_Content contentModel)
        {
            string pageUrl = ConfigSugar.GetAppString("OpenHttpAddress") + "/WeChatPush/Salary/Salary?Vguid=" + contentModel.VGUID;  //工资页面
            string url     = string.Format(_oAuthUrl, ConfigSugar.GetAppString("WeChatCorpID"), pageUrl);

            //List<U_WeChatUser> weChatUserList = SearchWeChatUserList();
            //string pushObject = GetPushObject(contentModel, weChatUserList);
            string pushObject     = GetPushObject(contentModel);
            string responeJsonStr = "";

            responeJsonStr  = "{";
            responeJsonStr += "\"touser\": \"" + pushObject + "\",";
            responeJsonStr += "\"toparty\": \"\",";
            responeJsonStr += "\"totag\": \"\",";
            responeJsonStr += "\"msgtype\": \"news\",";
            responeJsonStr += "\"agentid\":\"" + ConfigSugar.GetAppString("WeChatAgentID") + "\",";
            responeJsonStr += "\"news\": {";
            responeJsonStr += "\"articles\":[";
            responeJsonStr += " {";
            responeJsonStr += "\"title\": \"" + contentModel.Title + "\",";
            responeJsonStr += "\"description\": \"" + contentModel.CoverDescption + "\",";
            responeJsonStr += "\"url\": \"" + url + "\",";
            responeJsonStr += "\"picurl\": \"" + ConfigSugar.GetAppString("OpenHttpAddress") + contentModel.CoverImg + "\",";
            responeJsonStr += "}";
            responeJsonStr += "]";
            responeJsonStr += "}";
            responeJsonStr += "}";
            return(responeJsonStr);
        }
Exemplo n.º 2
0
        protected override string GetPushJson(U_UploadResult uploadResult, U_Content contentModel)
        {
            //List<U_WeChatUser> weChatUserList = SearchWeChatUserList();
            //string pushObject = GetPushObject(contentModel, weChatUserList);
            string pushObject     = GetPushObject(contentModel);
            string responeJsonStr = "";

            responeJsonStr  = "{";
            responeJsonStr += "\"touser\": \"" + pushObject + "\",";
            responeJsonStr += "\"toparty\": \"\",";
            responeJsonStr += "\"totag\": \"\",";
            responeJsonStr += "\"msgtype\": \"news\",";
            responeJsonStr += "\"agentid\":\"" + _weChatAgentID + "\",";
            responeJsonStr += "\"news\": {";
            responeJsonStr += "\"articles\":[";
            responeJsonStr += " {";
            responeJsonStr += "\"title\": \"" + contentModel.Title + "\",";
            responeJsonStr += "\"description\": \"" + contentModel.CoverDescption + "\",";
            responeJsonStr += "\"url\": \"" + ConfigSugar.GetAppString("OpenHttpAddress") + "/BasicDataManagement/WeChatExercise/Index\",";
            responeJsonStr += "\"picurl\": \"http://wx.qlogo.cn/mmhead/Q3auHgzwzM5eGibkia18N1q7icAdkgOIS3gvWZYaXTqbq3Tr8iaZM6S5jw/0\",";
            responeJsonStr += "}";
            responeJsonStr += "]";
            responeJsonStr += "}";
            responeJsonStr += "}";
            return(responeJsonStr);
        }
Exemplo n.º 3
0
        protected override string GetPushJson(U_UploadResult uploadResult, U_Content contentModel)
        {
            string exerciseUrl = ConfigSugar.GetAppString("OpenHttpAddress") + "/BasicDataManagement/WeChatExercise/Index?exerciseVguid=" + contentModel.ExercisesVGUID;//跳转习题界面Url

            string url = string.Format(_oAuthUrl, ConfigSugar.GetAppString("WeChatCorpID"), exerciseUrl);
            ////企业获取Code
            //string code = GetCorpCode();

            //List<U_WeChatUser> weChatUserList = SearchWeChatUserList();
            //string pushObject = GetPushObject(contentModel, weChatUserList);
            string pushObject     = GetPushObject(contentModel);
            string responeJsonStr = "";

            responeJsonStr  = "{";
            responeJsonStr += "\"touser\": \"" + pushObject + "\",";
            responeJsonStr += "\"toparty\": \"\",";
            responeJsonStr += "\"totag\": \"\",";
            responeJsonStr += "\"msgtype\": \"news\",";
            responeJsonStr += "\"agentid\":\"" + ConfigSugar.GetAppString("WeChatAgentID") + "\",";
            responeJsonStr += "\"news\": {";
            responeJsonStr += "\"articles\":[";
            responeJsonStr += " {";
            responeJsonStr += "\"title\": \"" + contentModel.Title + "\",";
            responeJsonStr += "\"description\": \"" + contentModel.CoverDescption + "\",";
            //responeJsonStr += "\"url\": \" " + url + "\",";
            responeJsonStr += "\"url\": \"" + url + "\",";
            responeJsonStr += "\"picurl\": \"" + ConfigSugar.GetAppString("OpenHttpAddress") + contentModel.CoverImg + "\",";
            responeJsonStr += "}";
            responeJsonStr += "]";
            responeJsonStr += "}";
            responeJsonStr += "}";
            return(responeJsonStr);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存用户信息
        /// </summary>
        /// <param name="userModel"></param>
        /// <param name="isEdit"></param>
        /// <returns></returns>
        public bool SaveUserInfo(Sys_User userModel, bool isEdit)
        {
            bool     result        = false;
            Sys_User userInfoModel = new Sys_User();

            if (isEdit)//编辑
            {
                userInfoModel               = _us.GetUserInfoByVguid(userModel.Vguid.ToString());
                userInfoModel.ChangeDate    = DateTime.Now;
                userInfoModel.ChangeUser    = Common.CurrentUser.GetCurrentUser().LoginName;
                userInfoModel.Company       = userModel.Company;
                userInfoModel.Department    = userModel.Department;
                userInfoModel.Email         = userModel.Email;
                userInfoModel.Enable        = userModel.Enable;
                userInfoModel.LoginName     = userModel.LoginName;
                userInfoModel.MobileNnumber = userModel.MobileNnumber;
                userInfoModel.Remark        = userModel.Remark;
                userInfoModel.Role          = userModel.Role;
                userInfoModel.UserName      = userModel.UserName;
                userInfoModel.WorkPhone     = userModel.WorkPhone;
                result = _us.SaveUserInfo(userInfoModel, isEdit);
            }
            else//新增
            {
                userModel.Vguid       = Guid.NewGuid();
                userModel.CreatedUser = Common.CurrentUser.GetCurrentUser().LoginName;
                userModel.CreatedDate = DateTime.Now;
                userModel.ChangeDate  = DateTime.Now;
                userModel.Password    = ConfigSugar.GetAppString("DefaultPassword");
                result = _us.SaveUserInfo(userModel, isEdit);
            }

            return(result);
        }
        public ActionResult CodeGenerate(string code)
        {
            string         accessToken = Common.WeChatPush.WeChatTools.GetAccessoken();
            U_WeChatUserID userInfo    = new U_WeChatUserID();
            string         userInfoStr = Common.WeChatPush.WeChatTools.GetUserInfoByCode(accessToken, code);

            userInfo = Common.JsonHelper.JsonToModel <U_WeChatUserID>(userInfoStr); //用户ID
            //userInfo.UserId = "WangCunBiao";
            var    personInfoModel = _wl.GetUserInfo(userInfo.UserId);              //获取人员表信息
            string file            = personInfoModel.Vguid + ".jpg";
            string forder          = "UploadFile/WeChatQRCode";
            string filePath        = Path.Combine(forder, file);

            string fileName = Server.MapPath(filePath);

            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }
            var configStr = _codeGenerateLogic.GetPersonConfiguration(personInfoModel);

            QRCodeHelper.GenerateQRCode(configStr, "/Areas/WeChatPush/Views/_img/logo1.png", forder, file);
            ViewData["Vguid"] = personInfoModel.Vguid;
            ViewData["url"]   = ConfigSugar.GetAppString("OpenHttpAddress") + forder + "/" + file;
            return(View());
        }
        /// <summary>
        /// 获取营收信息
        /// </summary>
        /// <param name="driverModel"></param>
        /// <returns></returns>
        public API_PaymentMonthly GetRevenueAPI_PaymentMonthlyData(Driver driverModel)
        {
            API_PaymentMonthly payment = new API_PaymentMonthly();

            try
            {
                WebClient wc = new WebClient();
                //测试数据
                //driverModel.OrganizationID = 17904;
                //driverModel.Id = 55;
                //driverModel.EmployeeNo = "993594";
                var data = "{" +
                           "\"OrganizationId\":\"{OrganizationId}\",".Replace("{OrganizationId}", driverModel.OrganizationID.ToString()) +
                           "\"DriverID\":\"{DriverID}\",".Replace("{DriverID}", driverModel.Id.ToString()) +
                           "\"EmployeeNo\":\"{EmployeeNo}\"".Replace("{EmployeeNo}", driverModel.EmployeeNo.ToString()) +
                           "}";
                wc.Headers.Clear();
                wc.Headers.Add("Content-Type", "application/json;charset=utf-8");
                wc.Encoding = System.Text.Encoding.UTF8;
                var result = wc.UploadString(new Uri(ConfigSugar.GetAppString("RevenueSytemPaymentMonthlyPath")), data);
                result = result.Replace("[]", "{}");
                API_Result apiResult = result.JsonToModel <API_Result>();
                if (apiResult.success)
                {
                    payment = apiResult.data;
                }
                Common.LogHelper.LogHelper.WriteLog(string.Format("{0}-{1}:{2}", driverModel.Name, driverModel.Id, result));
            }
            catch (Exception ex)
            {
                Common.LogHelper.LogHelper.WriteLog(string.Format("{0}-{1}:{2}", driverModel.Name, driverModel.Id, ex.ToString()));
            }
            return(payment);
        }
        public static SqlSugarClient GetInstance()
        {
            string connection = ConfigSugar.GetAppString("msSqlLinck");
            var    db         = new SqlSugarClient(connection);

            return(db);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 保存上传保养信息的Excel
        /// </summary>
        /// <param name="salaryTable"></param>
        /// <param name="notExists"></param>
        /// <returns></returns>
        public bool SaveUpLoadMaintence(DataTable salaryTable)
        {
            DataTable dt = new DataTable();
            var       db = SugarDao_MsSql.GetInstance();

            db.Delete <Car_Maintain>(it => it.PushVGUID == null);   //删除推送为空的数据
            dt = db.Queryable <Car_Maintain>().Where("1=2").ToDataTable();
            db.Dispose();
            string connectionString = ConfigSugar.GetAppString("msSqlLinck");

            using (SqlBulkCopy sqlbulkcopy = new SqlBulkCopy(connectionString, SqlBulkCopyOptions.UseInternalTransaction))
            {
                try
                {
                    sqlbulkcopy.BulkCopyTimeout      = 60;
                    sqlbulkcopy.DestinationTableName = "Car_Maintain";
                    for (int i = 0; i < salaryTable.Columns.Count; i++)
                    {
                        sqlbulkcopy.ColumnMappings.Add(salaryTable.Columns[i].ColumnName, dt.Columns[i].ColumnName);
                    }
                    sqlbulkcopy.WriteToServer(salaryTable);
                    return(true);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(ex.ToString());
                    throw;
                }
                finally
                {
                    //db.Dispose();
                }
            }
        }
Exemplo n.º 9
0
        protected string GetPushJson(U_UploadResult uploadResult, List <U_Content> contentModels)
        {
            string pushUrl        = string.Empty;
            string url            = string.Empty;
            string responeJsonStr = "";
            List <U_WeChatUser> weChatUserList = SearchWeChatUserList();
            string pushObject = GetPushObject(contentModels[0], weChatUserList);

            responeJsonStr  = "{";
            responeJsonStr += "\"touser\": \"" + pushObject + "\",";
            responeJsonStr += "\"toparty\": \"\",";
            responeJsonStr += "\"totag\": \"\",";
            responeJsonStr += "\"msgtype\": \"news\",";
            responeJsonStr += "\"agentid\":\"" + ConfigSugar.GetAppString("WeChatAgentID") + "\",";
            responeJsonStr += "\"news\": {";
            responeJsonStr += "\"articles\":[";
            foreach (var content in contentModels)
            {
                pushUrl         = ConfigSugar.GetAppString("OpenHttpAddress") + "/WeChatPush/PushDetail/PushDetail?Vguid=" + content.VGUID;//跳转推送内容界面Url
                url             = string.Format(_oAuthUrl, ConfigSugar.GetAppString("WeChatCorpID"), pushUrl);
                responeJsonStr += " {";
                responeJsonStr += "\"title\": \"" + content.Title + "\",";
                responeJsonStr += "\"description\": \"" + content.CoverDescption + "\",";
                responeJsonStr += "\"url\": \"" + url + "\",";
                responeJsonStr += "\"picurl\": \"" + ConfigSugar.GetAppString("OpenHttpAddress") + content.CoverImg + "\"";
                responeJsonStr += "}";
                responeJsonStr += ",";
            }
            responeJsonStr += "]";
            responeJsonStr += "}";
            responeJsonStr += "}";
            return(responeJsonStr);
        }
        //
        // GET: /ValidateLogin/

        public ActionResult Index()
        {
            string resulMess = "";
            string vguid     = Request["vguid"];
            string token     = Request["token"];

            if (!string.IsNullOrEmpty(vguid) && !string.IsNullOrEmpty(token))
            {
                string toolKitValidateUrl = ConfigSugar.GetAppString("ToolKitValidateUrl");
                string url               = string.Format(toolKitValidateUrl + "?userVguid={0}&tokenVal={1}", vguid, token);
                string htmlResult        = HttpGet(url);
                var    actionResultModel = htmlResult.JsonToModel <ActionResultModel <string> >();
                if (actionResultModel.isSuccess)//登录令牌验证成功
                {
                    //UserServer us = new UserServer();
                    //RoleTypeServer rts = new RoleTypeServer();
                    bool isExist = false;//us.IsExistUserAccountByVGUID(vguid);
                    if (isExist)
                    {
                        bool isHavePersion = false;//rts.IsHaveMoudePermision(vguid);
                        if (isHavePersion)
                        {
                            //将用户信息保存到Cookie中
                            //T_User userModel = us.GetUserDetailModelByVguid(vguid);
                            //var cm = CookiesManager<T_User>.GetInstance();
                            //cm.Add(BiomobieAppSystem.Common.CostCookies.COOKIES_KEY_LOGIN, userModel, cm.Hour * 8);
                            resulMess = "";
                        }
                        else
                        {
                            resulMess = "您在本系统中未被分配任何模块访问权限,请联系本系统的管理人员!";
                        }
                    }
                    else
                    {
                        resulMess = "系统中不存在此用户信息!";
                    }
                }
                else//登录令牌验证失败
                {
                    resulMess = "您的登录令牌无效!";
                }
            }
            else
            {
                resulMess = "您的登录令牌无效!";
            }

            if (!string.IsNullOrEmpty(resulMess))
            {
                ViewBag.Message = resulMess;
                return(View());
            }
            else
            {
                return(RedirectToAction("Index", "Main"));
            }
        }
 /// <summary>
 /// 根据配置的系统参数结合具体人员形成最后的url地址加参数的形式
 /// </summary>
 /// <param name="personnelInfo"></param>
 /// <returns></returns>
 public string GetSysConfiguration(Business_Personnel_Information personnelInfo)
 {
     using (var db = SugarDao_MsSql.GetInstance())
     {
         var    configurations = db.Queryable <Master_Configuration>().Where(i => i.CreateUser == "QRCode" && i.ModifyUser == null).OrderBy(i => i.ID).ToList();
         string symbol         = ConfigSugar.GetAppString("Symbol") ?? "^";
         var    configParas    = configurations.Select(configuration => configuration.ConfigValue + symbol + configuration.ConfigDescription.Trim() + "?" + GetPersonConfiguration(personnelInfo, configuration.ID.ToString())).ToList();
         return(string.Join("|", configParas));
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 被动响应给微信的数据加密
        /// </summary>
        /// <param name="wcp"></param>
        /// <param name="postString"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static string EncryptMessage(U_WeChatCallbackParameter wcp, string postString, string message)
        {
            WXBizMsgCrypt wxcpt     = new WXBizMsgCrypt(ConfigSugar.GetAppString("WeChatCallbackToken"), ConfigSugar.GetAppString("WeChatCallbackEncodingAESKey"), ConfigSugar.GetAppString("CorpID"));
            string        result    = postString;
            int           errorCode = wxcpt.EncryptMsg(message, wcp.timestamp, wcp.nonce, ref result);

            if (errorCode != 0)
            {
                //错误记录日志
                LogHelper.WriteLog(errorCode.ToString());
            }
            return(result);
        }
        /// <summary>
        /// 同步人员数据
        /// </summary>
        public static void UpdatePersonData()
        {
            while (true)
            {
                bool result = false;
                int  time   = 0;
                if (DateTime.Now.Hour == 3)//时间为三点的时候time初始化
                {
                    time = 0;
                }
                if (DateTime.Now.Hour == 2 && time == 0)//时间为凌晨两点并且time为0的时候执行同步操作
                {
                    //  LogManager.WriteLog(LogFile.Trace, DateTime.Now.ToString("yyyy-MM-dd") + "开始启动定时同步离职人员服务");
                    try
                    {
                        U_AccessToken accessTokenModel = new U_AccessToken();
                        accessTokenModel.UserKey      = ConfigSugar.GetAppString("WeChatCorpID");
                        accessTokenModel.UserPassword = ConfigSugar.GetAppString("WeChatSecret");

                        UpdatePersonLogic             _updatePersonLogic = new UpdatePersonLogic();
                        List <V_UserNotexistsmiddata> personList         = new List <V_UserNotexistsmiddata>();
                        personList = _updatePersonLogic.GetPeosonList();   //获取离职人员列表(存在于Person表而不存在与middata表的人员列表)
                        _updatePersonLogic.UpdateStatus2Focus(personList); //首先将人员状态改为已关注
                        if (personList.Count >= 10)
                        {
                            result = _updatePersonLogic.UpdatePersonStatus(personList, 3);   //状态更改为未匹配
                        }
                        else if (personList.Count > 0)
                        {
                            result = _updatePersonLogic.DisableWeChatData(accessTokenModel, personList);  //同时将微信禁用
                            if (result)
                            {
                                result = _updatePersonLogic.UpdatePersonStatus(personList, 4);  //状态更改为已离职
                            }
                        }
                        //  result = _updatePersonLogic.DeletePersonData(personList);
                        //if (result)
                        //{
                        //    //删除微信通讯录中人员
                        //  result = _updatePersonLogic.DeleteWeChatData(accessTokenModel, personList);
                        //}
                        //   LogManager.WriteLog(LogFile.Trace, DateTime.Now.ToString("yyyy-MM-dd") + "定时同步离职人员服务启动完成");
                    }
                    catch (Exception exp)
                    {
                        LogManager.WriteLog(LogFile.Error, "同步离职人员数据:" + result + "/n" + exp.ToString());
                    }
                    time++;
                }
            }
        }
        /// <summary>
        /// 通过OAuth验证企业获取code
        /// </summary>
        /// <returns></returns>
        public string GetCorpCode()
        {
            string          url      = string.Format(_oAuthUrl, ConfigSugar.GetAppString("WeChatCorpID"), ConfigSugar.GetAppString("OpenHttpAddress") + "/BasicDataManagement/WeChatExercise/Index");
            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (Stream resStream = response.GetResponseStream())
            {
                StreamReader reader   = new StreamReader(resStream, Encoding.UTF8);
                string       respText = reader.ReadToEnd();
                resStream.Close();
                return(respText);
            }
        }
Exemplo n.º 15
0
        public override string ExecuteButtonHandle()
        {
            string response                   = string.Empty;
            string revenueQueryReply          = _rl.GetRevenueQueryReply();                                   //获取营收数据查询成功回复
            string revenueQueryRefuse         = _rl.GetRevenueQueryRefuse();                                  //获取您不是司机,无法查询营收数据
            string revenueQueryTimeUp         = _rl.GetRevenueQueryTimesRefuse();                             //获取查询营收数据超过次数回复
            int    revenueSearchTimes         = int.Parse(_rl.GetRevenueSearchTimes());                       //获取每月可查收营收数据次数
            int    queryTimes                 = _rl.GetUserCurrentMonthQueryTimes(_eventHandle.FromUserName); //获取当前用户当月查询营收次数
            var    revenueQueryExceptionReply = _cs.GetConfigList()[12].ConfigValue;                          //营收异常回复
            var    queryReply                 = _cs.GetConfigList()[15].ConfigValue;                          //微信和短信都为勾选时回复

            string isSmsPush     = _ss.GetIsSmsPush();
            string isWeChatPush  = _ss.GetIsWeChatPush();
            string isRevenuePush = _ss.GetIsRevenuePush();

            if (isSmsPush == "0" && isWeChatPush == "0" && isRevenuePush == "0")
            {
                response = queryReply;
            }
            else if (queryTimes < revenueSearchTimes)
            {
                int result = _rl.SaveRevenueMsg(_eventHandle.FromUserName);
                if (result == 0)
                {
                    response = revenueQueryExceptionReply;//营收异常回复
                }
                if (result == 1)
                {
                    response = revenueQueryReply;//营收数据已经通过短信发送到您的手机,请及时查收
                }
                else if (result == 3)
                {
                    response = revenueQueryRefuse;//您不是司机,无法查询营收数据
                }
                else
                {
                    response = "查询失败!";
                }
            }
            else
            {
                response = revenueQueryTimeUp;//获取查询营收数据超过次数回复
            }
            string sReplyMsg   = string.Format(WeChatReplyType.Message_Text, _eventHandle.FromUserName, _eventHandle.ToUserName, DateTime.Now.Ticks, response);
            string sEncryptMsg = Cryptography.AES_encrypt(sReplyMsg, ConfigSugar.GetAppString("WeChatCallbackEncodingAESKey"), ConfigSugar.GetAppString("CorpID"));

            response = WeChatCallbackLogic.EncryptMessage(_eventHandle.U_WeChatCallbackParameter, sEncryptMsg, sReplyMsg);
            return(response);
        }
Exemplo n.º 16
0
 /// <summary>
 /// 开启微信回调模式
 /// </summary>
 /// <returns></returns>
 public string OpenWeChatCallbackMode(U_WeChatCallbackParameter wcp)
 {
     //数据不为空,表示验证开启微信回调模式
     //数据为空,表示微信数据正常回调
     if (!string.IsNullOrEmpty(wcp.echostr))
     {
         string corpid  = "";
         string echostr = Cryptography.AES_decrypt(wcp.echostr, ConfigSugar.GetAppString("WeChatCallbackEncodingAESKey"), ref corpid);
         return(echostr);
     }
     else
     {
         WeChatHandle wch = WeChatEventFactory.GetWeChatHandle(wcp, Request.InputStream);
         return(wch.ExecuteEventHandle());
     }
 }
        public JsonResult GetPaySignWX(string driverId, string organizationId, string revenueFee, Guid personVguid, Guid pushContentVguid, int revenueType, string factPayAmount)
        {
            var models    = new ActionResultModel <string>();
            var modelData = new QRCodeRevenueInfo();
            var url       = ConfigSugar.GetAppString("QRCodeRevenue");
            //Developer,Product 开发,正式
            var data = "{" +
                       "\"OperatorDeviceName\":\"{OperatorDeviceName}\",".Replace("{OperatorDeviceName}", "WXQYH") +
                       "\"OrganizationId\":\"{OrganizationId}\",".Replace("{OrganizationId}", organizationId) +
                       "\"DriverID\":\"{DriverID}\",".Replace("{DriverID}", driverId) +
                       "\"RunEnvironment\":\"{RunEnvironment}\",".Replace("{RunEnvironment}", "Product") +
                       "\"FactPayAmount\":\"{FactPayAmount}\"".Replace("{FactPayAmount}", factPayAmount) +
                       "}";

            try
            {
                WebClient wc = new WebClient();
                wc.Headers.Clear();
                wc.Headers.Add("Content-Type", "application/json;charset=utf-8");
                wc.Encoding = System.Text.Encoding.UTF8;
                var resultData = wc.UploadString(new Uri(url), data);
                modelData = resultData.JsonToModel <QRCodeRevenueInfo>();
                if (modelData.Code == "0")
                {
                    //接口调用成功,获取支付界面url
                    models.isSuccess   = true;
                    models.respnseInfo = modelData.data.BillQRCodeURL + "," + modelData.data.BillNo;
                    //var key = PubGet.GetUserKey + driverId;
                    //CacheManager<QRCodeRevenue>.GetInstance().Add(key, modelData.data, 8 * 60 * 60 * 1000);
                    SavePaymentHistory(driverId, revenueFee, personVguid, pushContentVguid, revenueType, modelData.data);
                }
                else
                {
                    //接口调用失败,支付二维码失效
                    WeChatRevenueServer.sendQRCodeMessage(modelData.data.BillNo);
                    models.isSuccess   = false;
                    models.respnseInfo = "接口调用失败";
                }
                LogHelper.WriteLog(string.Format("Data:{0},result:{1}", data, resultData));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(string.Format("Data:{0},result:{1},error:{2}", data, modelData.message, ex.ToString()));
            }
            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 18
0
        /// <summary>
        /// 生成controller
        /// </summary>
        private void BuildController(string controllerDir, string controllerPath, string controllerDomainPath, XDocument doc)
        {
            //写入控制器
            if (!FileSugar.IsExistFile(controllerPath))
            {
                FileSugar.CreateDirectory(controllerDir);
                ContainFileToCsproj(@"Areas\{0}\Controllers\{1}App\{1}Controller.cs".ToFormat(_data.AreaName, _data.ControllerName), _solutionDir, _projectName, doc);
            }

            //获取controller.cshtml的Model
            BuildControllerModel controllerModel = new BuildControllerModel()
            {
                areaName       = _data.AreaName,
                controllerName = _data.ControllerName,
                actionName     = _data.ActionName,
                siteName       = ConfigSugar.GetAppString("siteName")
            };

            var apiList    = _db.Queryable <SysBest_DataApi>().ToList();//获取所有api
            int addressId  = _data.Id;
            int languageId = _languageId;
            var eleList    = _db.Queryable <SysBest_Element>().Where(it => it.AddressId == addressId && it.LanguageId == languageId).ToList();

            var eleApidList = eleList.Where(it => it.ApiId != null && it.ApiId > 0).Select(it => it.ApiId).Distinct().ToList();//获取所有元素

            //获取元素表里面的数据接口
            controllerModel.apiList = apiList.Join(eleApidList, api => api.Id, ele => ele, (api, ele) => api).ToList();
            //获取属性表里面的数据接口
            controllerModel.apiList.AddRange(GetDataApiWithEleEventByEleId(eleList));
            controllerModel.apiList = controllerModel.apiList.Distinct().ToList();

            string controllerCode = GetTemplateCodeByName("controller.cshtml", controllerModel);

            FileSugar.WriteFile(controllerPath, controllerCode);

            //写入Domain
            if (!FileSugar.IsExistFile(controllerDomainPath))
            {
                var domainCode = GetTemplateCodeByName("controller_domain.cshtml", new { controllerName = _data.ControllerName, areaName = _data.AreaName });
                FileSugar.WriteFile(controllerDomainPath, domainCode);
                ContainFileToCsproj(@"Areas\{0}\Controllers\{1}App\Domain\{1}Domain.cs".ToFormat(_data.AreaName, _data.ControllerName), _solutionDir, _projectName, doc);
            }
        }
        public ActionResult PushDetail(string code)
        {
            string pushContentVguid = Request.QueryString["Vguid"]; //"55ca3608-93d3-4245-b6f7-e4af76482edd";//
            var    pushContentModel = _pl.GetPushDetail(pushContentVguid);
            string openHttpAddress  = ConfigSugar.GetAppString("OpenHttpAddress");
            bool   isValidTime      = false;//未过有效期

            if (pushContentModel != null)
            {
                if (pushContentModel.PeriodOfValidity != null)
                {
                    if (DateTime.Now > pushContentModel.PeriodOfValidity)
                    {
                        isValidTime = true;//已过有效期
                    }
                }
            }
            string accessToken = Common.WeChatPush.WeChatTools.GetAccessoken();
            string userInfoStr = Common.WeChatPush.WeChatTools.GetUserInfoByCode(accessToken, code);
            var    userInfo    = JsonHelper.JsonToModel <U_WeChatUserID>(userInfoStr); //用户ID

            _pl.UpdateIsRead(userInfo.UserId, pushContentVguid);                       //更新用户是否阅读推送
            if (pushContentModel.MessageType == 5)                                     //培训推送
            {
                if (pushContentModel.RevenueType != 0)
                {
                    ViewBag.countDownConfig = pushContentModel.RevenueType;
                }
                else
                {
                    string countDownStr    = _pl.GetCountDown();
                    double countDownConfig = double.Parse(countDownStr);//double.Parse(ConfigSugar.GetAppString("CountDown"));//倒计时配置
                    ViewBag.countDownConfig = countDownConfig;
                }
            }

            ViewBag.isValidTime          = isValidTime;
            ViewBag.code                 = code;
            ViewBag.openHttpAddress      = openHttpAddress;
            ViewData["PushContentModel"] = pushContentModel;
            return(View());
        }
        protected override string GetPushJson(U_UploadResult uploadResult, U_Content contentModel)
        {
            //List<U_WeChatUser> weChatUserList = SearchWeChatUserList();
            //string pushObject = GetPushObject(contentModel, weChatUserList);
            string pushObject     = GetPushObject(contentModel);
            string responeJsonStr = "";

            responeJsonStr  = "{";
            responeJsonStr += "\"touser\": \"" + pushObject + "\",";
            responeJsonStr += "\"toparty\": \"\",";
            responeJsonStr += "\"totag\": \"\",";
            responeJsonStr += "\"msgtype\": \"image\",";
            responeJsonStr += "\"agentid\":\"" + ConfigSugar.GetAppString("WeChatAgentID") + "\",";
            responeJsonStr += "\"image\": {";
            responeJsonStr += "\"media_id\":\"" + uploadResult.media_id + "\"";
            responeJsonStr += "},";
            responeJsonStr += "\"safe\":\"0\"";
            responeJsonStr += "}";
            return(responeJsonStr);
        }
        public string getWeChatQRCode(Business_CleaningCompany cleaning)
        {
            string file     = cleaning.CompanyName + ".jpg";
            string forder   = "UploadFile/WeChatQRCode";
            string filePath = Path.Combine(forder, file);
            string fileName = Server.MapPath(filePath);

            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }
            string guid  = cleaning.Vguid.ToString();
            string url   = ConfigSugar.GetAppString("CleaningAddress");
            string appid = ConfigSugar.GetAppString("CorpID");

            url = url + "?VGUID=" + guid;
            var configStr = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + url + "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";

            QRCodeHelper.GenerateQRCode(configStr, "/Areas/WeChatPush/Views/_img/logo1.png", forder, file);
            return(filePath);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string userId  = Convert.ToString(Request["userId"]);                //Toolkit系统传过来的用户识别码
            string tokenId = Convert.ToString(Request["tokenId"]);               //用户点击登录时产生的登录时的随机令牌

            if (!string.IsNullOrEmpty(userId) && !string.IsNullOrEmpty(tokenId))
            {
                string toolKitPath      = ConfigSugar.GetAppString("ToolKitValidateUrl"); //配置主系统的站点地址
                string url              = string.Format(toolKitPath + "?userid={0}&tokenid={1}", userId, tokenId);
                System.Net.WebClient wc = new System.Net.WebClient();
                wc.UseDefaultCredentials = true;
                string html = wc.DownloadString(url);

                if (html == "True")
                {
                    //UserBLL userBLL = new BLL.UserBLL();
                    //UserModel userModel = userBLL.GetModel(userId);
                    //if (userModel != null)
                    //{
                    //    Response.Redirect("FramePage/Main.aspx");
                    //}
                    //else
                    //{
                    //    string script = string.Format(@"<script>alert('系统中没有此账号信息,请联系管理员!');  window.close();</script>");
                    //    Response.Write(script);
                    //}
                }
                else
                {
                    string script = string.Format(@"<script>alert('您没有权限访问此系统!'); window.close();</script>");
                    Response.Write(script);
                }
            }
            else
            {
                string script = string.Format(@"<script>alert('您没有权限访问此系统!');window.close();</script>");
                Response.Write(script);
            }
        }
Exemplo n.º 23
0
        public void SynchronousReceivableSystem(Business_Personnel_Information personModel, Business_PaymentHistory_Information paymentHistoryInfo, Business_PaymentHistory_Information paymentHistoryInfoOld)
        {
            //获取司机ID和车辆ID
            try
            {
                var driverModel = _rl.GetDriverMsg(personModel);

                WebClient wc   = new WebClient();
                var       data = "{" +
                                 "\"BillLable\":\"WX\"," +
                                 "\"DriverID\":\"{DriverID}\",".Replace("{DriverID}", driverModel.Id.ToString()) +
                                 "\"JobNumber\":\"{JobNumber}\",".Replace("{JobNumber}", driverModel.EmployeeNo) +
                                 "\"Name\":\"{Name}\",".Replace("{Name}", personModel.Name == null ? "" : personModel.Name) +
                                 "\"OriginalId\":\"{OriginalId}\",".Replace("{OriginalId}", driverModel.OriginalId.ToString()) +
                                 "\"OrganizationID\":\"{OrganizationID}\",".Replace("{OrganizationID}", driverModel.OrganizationID.ToString()) +
                                 "\"PayDate\":\"{PayDate}\",".Replace("{PayDate}", paymentHistoryInfo.PayDate.ToString("yyyy-MM-dd HH:mm:ss")) +
                                 "\"TransactionId\":\"{TransactionId}\",".Replace("{TransactionId}", paymentHistoryInfo.TransactionID) +
                                 "\"PaymentBrokers\":\"WeiChat\"," +
                                 "\"Channel_Id\":\"1465779302\"," +
                                 "\"SubjectId\":\"1465779302_{0}\",".Replace("{0}", driverModel.OrganizationID.ToString()) +
                                 "\"PaymentAmount\":{PaymentAmount}, ".Replace("{PaymentAmount}", paymentHistoryInfoOld.RevenueReceivable.ToString()) +
                                 "\"CopeFee\":{CopeFee},".Replace("{CopeFee}", (paymentHistoryInfo.ActualAmount * paymentHistoryInfoOld.RevenueReceivable).ToString()) +
                                 "\"ActualAmount\":{ActualAmount},".Replace("{ActualAmount}", paymentHistoryInfo.ActualAmount.ToString()) +
                                 "\"ReceiptCategory\":11," +
                                 "\"Remark\":\"WeiChat\"," +
                                 "\"CompanyAccount\":0" +
                                 "}";
                wc.Headers.Clear();
                wc.Headers.Add("Content-Type", "application/json;charset=utf-8");
                wc.Encoding = System.Text.Encoding.UTF8;
                var result = wc.UploadString(new Uri(ConfigSugar.GetAppString("RevenueSytemSyncPath")), data);
                Common.LogHelper.LogHelper.WriteLog(string.Format("{0}-{1}:{2}", personModel.Name, paymentHistoryInfo.TransactionID, result));
            }
            catch (Exception ex)
            {
                Common.LogHelper.LogHelper.WriteLog(string.Format("{0}-{1}:{2}", personModel.Name, paymentHistoryInfo.TransactionID, ex.ToString()));
            }
        }
Exemplo n.º 24
0
        public static void sendQRCodeMessage(string billNo)
        {
            var resultData = "";
            var url        = ConfigSugar.GetAppString("ClosePayQRCode");
            //Developer,Product 开发,正式
            var data = "{" +
                       "\"billNo\":\"{billNo}\",".Replace("{billNo}", billNo) +
                       "\"RunEnvironment\":\"{RunEnvironment}\"".Replace("{RunEnvironment}", "Product") +
                       "}";

            try
            {
                WebClient wc = new WebClient();
                wc.Headers.Clear();
                wc.Headers.Add("Content-Type", "application/json;charset=utf-8");
                wc.Encoding = System.Text.Encoding.UTF8;
                resultData  = wc.UploadString(new Uri(url), data);
                //var modelData = resultData.JsonToModel<QRCodeRevenueInfo>();
                //if (modelData.Code == "0")
                //{
                //    //接口调用成功,跳转进入支付界面
                //    models.isSuccess = true;
                //    models.respnseInfo = modelData.QRCodeRevenue.BillQRCodeURL;
                //}
                //else
                //{
                //    //接口调用失败,支付二维码失效
                //    sendQRCodeMessage(modelData.QRCodeRevenue.BillNo);
                //    models.isSuccess = false;
                //    models.respnseInfo = modelData.message;
                //}
                LogHelper.WriteLog(string.Format("Data:{0},result:{1}", data, resultData));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(string.Format("Data:{0},result:{1},error:{2}", data, resultData, ex.ToString()));
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 微信二次验证
        /// </summary>
        /// <param name="code">微信用户Code</param>
        /// <returns></returns>
        public ActionResult WeChatSecondValidation(string code)
        {
            U_WeChatUserID userInfo    = new U_WeChatUserID();
            U_UserInfo     userDetail  = new U_UserInfo();
            string         accessToken = Common.WeChatPush.WeChatTools.GetAccessoken();
            //UserInfoUrl
            string userInfoStr = Common.WeChatPush.WeChatTools.GetUserInfoByCode(accessToken, code);

            userInfo = Common.JsonHelper.JsonToModel <U_WeChatUserID>(userInfoStr);//用户ID
            string GetUserInfoByUserID = Common.WeChatPush.WeChatTools.GetUserInfoByUserID(accessToken, userInfo.UserId);

            userDetail = Common.JsonHelper.JsonToModel <U_UserInfo>(GetUserInfoByUserID);//用户信息
            string openHttpAddress = ConfigSugar.GetAppString("OpenHttpAddress");

            Common.LogHelper.LogHelper.WriteLog("用户打开注册二次验证页面:Code为-" + code + "-UserID为-" + userInfo.UserId + "-打开注册页面时间为:" + DateTime.Now);

            ViewBag.openHttpAddress = openHttpAddress;
            ViewBag.accessToken     = accessToken;
            ViewBag.Code            = code;
            ViewBag.userInfo        = userInfo;
            ViewBag.userDetail      = userDetail;
            return(View());
        }
        /// <summary>
        /// 发送短信验证码
        /// </summary>
        /// <param name="accessTokenModel">授权对象</param>
        /// <param name="contentModel">消息模板</param>
        /// <returns></returns>
        public override string Push(U_AccessToken accessTokenModel, U_Content contentModel)
        {
            HttpClient httpClient = new HttpClient();

            //将服务凭证转换为Base64编码格式
            byte[] auth   = Encoding.UTF8.GetBytes(string.Format("{0}:{1}", ConfigSugar.GetAppString("SMSAppKey"), ConfigSugar.GetAppString("MasterSecret")));
            String auth64 = Convert.ToBase64String(auth);

            //创建并指定服务凭证,认证方案为Basic
            httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", auth64);

            ///发送短信验证码参数
            U_Para para = new U_Para();

            para.mobile  = contentModel.PushObject[0].PhoneNumber.Trim();
            para.temp_id = 1;
            //将参数转换为Json字符串
            string json = para.ModelToJson();

            //构造HTTP 字符内容对象
            System.Net.Http.StringContent sc = new System.Net.Http.StringContent(json);
            //移除Content-Type内容
            sc.Headers.Remove("Content-Type");
            //Content-Type内容设置为JSON类型
            sc.Headers.Add("Content-Type", "application/json");
            //发送短信
            Task <HttpResponseMessage> taskHrm = httpClient.PostAsync(_verificationCodeUrl, sc);

            Task.WaitAll(taskHrm);
            //获取返回值
            Task <string> taskStr = taskHrm.Result.Content.ReadAsStringAsync();

            Task.WaitAll(taskStr);
            httpClient.Dispose();
            UpdatePushStatus(contentModel);
            return(taskStr.Result);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 发送短信验证码
        /// </summary>
        /// <param name="accessTokenModel">授权对象</param>
        /// <param name="contentModel">消息模板</param>
        /// <returns></returns>
        public override string Push(U_AccessToken accessTokenModel, U_Content contentModel)
        {
            HttpClient httpClient = new HttpClient();

            //将服务凭证转换为Base64编码格式
            byte[] auth   = Encoding.UTF8.GetBytes(string.Format("{0}:{1}", ConfigSugar.GetAppString("SMSAppKey"), ConfigSugar.GetAppString("MasterSecret")));
            String auth64 = Convert.ToBase64String(auth);

            //创建并指定服务凭证,认证方案为Basic
            httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", auth64);
            U_Notification_Teamp_Para ntp = new U_Notification_Teamp_Para();

            //将短信营收实体转换微信
            ntp.Notification = contentModel.Message;

            /*U_Temp_Para tp = new U_Temp_Para();*/

            U_Para para = new U_Para();

            para.mobile    = contentModel.PushObject[0].PhoneNumber.Trim();
            para.temp_id   = Convert.ToInt32(ConfigSugar.GetAppString("Notification_Temp_ID"));
            para.temp_para = ntp;

            string json = Common.JsonHelper.ModelToJson <U_Para>(para);

            System.Net.Http.StringContent sc = new System.Net.Http.StringContent(json);
            sc.Headers.Remove("Content-Type");
            sc.Headers.Add("Content-Type", "application/json");
            Task <HttpResponseMessage> taskHrm = httpClient.PostAsync(_noticeUrl, sc);

            Task.WaitAll(taskHrm);
            Task <string> taskStr = taskHrm.Result.Content.ReadAsStringAsync();

            Task.WaitAll(taskStr);
            UpdatePushStatus(contentModel);
            return(taskStr.Result);
        }
        /// <summary>
        /// 从微信后台获取人员的状态,并且将状态同步至数据库中
        /// </summary>
        public static void UpdatePersonStatus()
        {
            bool result = false;
            int  time   = 0;

            while (true)
            {
                if (DateTime.Now.Hour == 2)
                {
                    time = 0;
                }
                if (DateTime.Now.Hour != 1 || time != 0)
                {
                    continue;                                       //时间为凌晨1点并且time为0的时候执行同步操作
                }
                try
                {
                    U_AccessToken accessTokenModel = new U_AccessToken();
                    accessTokenModel.UserKey      = ConfigSugar.GetAppString("WeChatCorpID");
                    accessTokenModel.UserPassword = ConfigSugar.GetAppString("WeChatSecret");
                    var accessToken = WeChatTools.GetAccessoken(accessTokenModel);
                    var departments = WeChatTools.GetDepartment(accessToken);     //获取所有的部门
                    UpdatePersonLogic _updatePersonLogic = new UpdatePersonLogic();
                    foreach (var item in departments.department)
                    {
                        var users = WeChatTools.GetUsers(accessToken, item.id.ToString());  //根据部门获取所有的人员
                        result = _updatePersonLogic.UpdatePersonStatus(users.userlist);
                    }
                }
                catch (Exception exp)
                {
                    LogManager.WriteLog(LogFile.Error, "同步人员状态:" + result + "/n" + exp);
                }
                time++;
            }
        }
Exemplo n.º 29
0
        public static SqlSugarClient GetInstance()
        {
            string connection = ConfigSugar.GetAppString("LandaV9Link");

            return(new SqlSugarClient(connection));
        }
Exemplo n.º 30
0
        /// <summary>
        /// 保存要发送的营收信息
        /// </summary>
        /// <param name="paymentModel"></param>
        /// <param name="userID"></param>
        /// <returns></returns>
        public bool SaveRevenueMsg(API_PaymentMonthly paymentModel, string userID)
        {
            bool      isZero  = false;
            bool      result  = false;
            U_Revenue revenue = new U_Revenue();
            var       revenueQueryExceptionReply = _cs.GetConfigList()[12].ConfigValue;

            if (paymentModel == null)
            {
                revenue.HistoricalArrears     = "0";
                revenue.TheBalance            = "0";
                revenue.AmountDue             = "0";
                revenue.CurrentPayment        = "0";
                revenue.CurrentAccountBalance = "0";
                isZero = true;
            }
            else if (paymentModel.DebtAmount == 0 && paymentModel.DueAmount == 0 && paymentModel.PaidAmount == 0)
            {
                isZero = true;
            }
            else
            {
                //if (paymentModel.DebtAmount > 0)//正值(欠款)
                //{

                //revenue.TheBalance = (paymentModel.DebtAmount * -1).ToString("F2");
                //revenue.HistoricalArrears = (paymentModel.DebtAmount * -1) >= 0 ? "0" : paymentModel.DebtAmount.ToString("F2");
                ////}
                ////else//负值(结余)
                ////{
                ////    revenue.HistoricalArrears = (-paymentModel.DebtAmount).ToString("##.##");
                ////    revenue.TheBalance = paymentModel.DebtAmount.ToString("##.##");
                ////}
                //revenue.AmountDue = paymentModel.DueAmount.ToString("F2");
                //revenue.CurrentPayment = paymentModel.PaidAmount.ToString("F2");
                //revenue.CurrentAccountBalance = (paymentModel.PaidAmount - paymentModel.DueAmount + (paymentModel.DebtAmount * -1)).ToString("F2");


                revenue.TheBalance        = paymentModel.DebtAmount.ToString("F2");
                revenue.HistoricalArrears = paymentModel.DebtAmount >= 0 ? "0" : paymentModel.DebtAmount.ToString("F2");
                //}
                //else//负值(结余)
                //{
                //    revenue.HistoricalArrears = (-paymentModel.DebtAmount).ToString("##.##");
                //    revenue.TheBalance = paymentModel.DebtAmount.ToString("##.##");
                //}
                revenue.AmountDue             = paymentModel.DueAmount.ToString("F2");
                revenue.CurrentPayment        = paymentModel.PaidAmount.ToString("F2");
                revenue.CurrentAccountBalance = (paymentModel.PaidAmount - paymentModel.DueAmount + paymentModel.DebtAmount).ToString("F2");
            }

            string isSmsPush     = _ss.GetIsSmsPush();
            string isWeChatPush  = _ss.GetIsWeChatPush();
            string isRevenuePush = _ss.GetIsRevenuePush();

            string weChatRevenueTemp = ConfigSugar.GetAppString("WeChatRevenueTemp");//获取微信发送营收数据模板

            //{"HistoricalArrears":"0","TheBalance":"0","AmountDue":"0","CurrentPayment":"0","CurrentAccountBalance":"0"}
            //只通过短信发送营收信息
            if (isSmsPush == "1")
            {
                U_RevenueMonth revenueMonth = new U_RevenueMonth();
                revenueMonth.AmountDue             = revenue.AmountDue;
                revenueMonth.CurrentAccountBalance = revenue.CurrentAccountBalance;
                revenueMonth.CurrentPayment        = revenue.CurrentPayment;
                revenueMonth.HistoricalArrears     = revenue.HistoricalArrears;
                revenueMonth.TheBalance            = revenue.TheBalance;
                revenueMonth.Month = DateTime.Now.Month.ToString();
                Business_WeChatPush_Information weChatPush = new Business_WeChatPush_Information();
                weChatPush.PushType         = 2;
                weChatPush.Title            = "营收短信";
                weChatPush.MessageType      = 8;
                weChatPush.Timed            = false;
                weChatPush.TimedSendTime    = null;
                weChatPush.Important        = false;
                weChatPush.Message          = Common.JsonHelper.ModelToJson <U_RevenueMonth>(revenueMonth);
                weChatPush.PeriodOfValidity = null;
                weChatPush.PushDate         = DateTime.Now;
                weChatPush.Status           = 3;
                weChatPush.CreatedDate      = DateTime.Now;
                weChatPush.ChangeDate       = DateTime.Now;
                weChatPush.VGUID            = Guid.NewGuid();

                //推送接收者
                Business_WeChatPushDetail_Information weChatPushDetail = new Business_WeChatPushDetail_Information();
                weChatPushDetail.PushObject  = userID;
                weChatPushDetail.Vguid       = Guid.NewGuid();
                weChatPushDetail.CreatedDate = DateTime.Now;
                weChatPushDetail.ChangeDate  = DateTime.Now;
                weChatPushDetail.Type        = "短信营收";
                weChatPushDetail.Business_WeChatPushVguid = weChatPush.VGUID;
                if (!isZero)
                {
                    result = _ss.SaveRevenueMsg(weChatPush, weChatPushDetail);
                }
            }
            if (isWeChatPush == "1")//只通过微信发送营收信息
            {
                Business_WeChatPush_Information weChatPush = new Business_WeChatPush_Information();
                weChatPush.PushType         = 1;
                weChatPush.Title            = "营收微信";
                weChatPush.MessageType      = 1;
                weChatPush.Timed            = false;
                weChatPush.TimedSendTime    = null;
                weChatPush.Important        = false;
                weChatPush.Message          = isZero ? revenueQueryExceptionReply : string.Format(weChatRevenueTemp, revenue.HistoricalArrears, revenue.TheBalance, revenue.AmountDue, revenue.CurrentPayment, revenue.CurrentAccountBalance, DateTime.Now.Month);
                weChatPush.PeriodOfValidity = null;
                weChatPush.PushDate         = null;
                weChatPush.Status           = 3;
                weChatPush.CreatedDate      = DateTime.Now;
                weChatPush.ChangeDate       = DateTime.Now;
                weChatPush.VGUID            = Guid.NewGuid();

                //推送接收者
                Business_WeChatPushDetail_Information weChatPushDetail = new Business_WeChatPushDetail_Information();
                weChatPushDetail.PushObject  = userID;
                weChatPushDetail.Vguid       = Guid.NewGuid();
                weChatPushDetail.CreatedDate = DateTime.Now;
                weChatPushDetail.ChangeDate  = DateTime.Now;
                weChatPushDetail.Type        = "微信营收";
                weChatPushDetail.Business_WeChatPushVguid = weChatPush.VGUID;
                result = _ss.SaveRevenueMsg(weChatPush, weChatPushDetail);
            }
            if (isRevenuePush == "1")//只通过营收发送营收信息
            {
                Business_WeChatPush_Information weChatPush = new Business_WeChatPush_Information();
                weChatPush.PushType      = 1;
                weChatPush.Title         = "营收信息";
                weChatPush.MessageType   = 11;
                weChatPush.Timed         = false;
                weChatPush.TimedSendTime = null;
                weChatPush.RevenueType   = 2;
                DateTime now = DateTime.Now;                         //当前时间
                DateTime d1  = new DateTime(now.Year, now.Month, 1); //当前月的第一天
                DateTime d2  = d1.AddMonths(1).AddDays(-1);          //当前月的最后一天
                weChatPush.PeriodOfValidity = d2;
                weChatPush.CoverDescption   = "个人营收账单明细";

                weChatPush.CoverImg = "/_img/微信图片.jpg";

                weChatPush.PushDate = DateTime.Now;
                weChatPush.Status   = 3;

                weChatPush.CreatedDate = DateTime.Now;
                weChatPush.ChangeDate  = DateTime.Now;
                weChatPush.VGUID       = Guid.NewGuid();

                //推送接收者
                Business_WeChatPushDetail_Information weChatPushDetail = new Business_WeChatPushDetail_Information();
                weChatPushDetail.PushObject  = userID;
                weChatPushDetail.Vguid       = Guid.NewGuid();
                weChatPushDetail.CreatedDate = DateTime.Now;
                weChatPushDetail.ChangeDate  = DateTime.Now;
                weChatPushDetail.Type        = "营收发送";
                weChatPushDetail.Business_WeChatPushVguid = weChatPush.VGUID;
                result = _ss.SaveRevenueMsg(weChatPush, weChatPushDetail);
            }

            //else if (isWeChatPush == "1" && isSmsPush == "1")
            //{
            //    Business_WeChatPush_Information weChatPush = new Business_WeChatPush_Information();
            //    weChatPush.PushType = 1;
            //    weChatPush.Title = "营收微信";
            //    weChatPush.MessageType = 1;
            //    weChatPush.Timed = false;
            //    weChatPush.TimedSendTime = null;
            //    weChatPush.Important = false;
            //    weChatPush.Message = isZero ? revenueQueryExceptionReply : string.Format(weChatRevenueTemp, revenue.HistoricalArrears, revenue.TheBalance, revenue.AmountDue, revenue.CurrentPayment, revenue.CurrentAccountBalance, DateTime.Now.Month);
            //    weChatPush.PeriodOfValidity = null;
            //    weChatPush.PushDate = null;
            //    weChatPush.Status = 3;
            //    weChatPush.CreatedDate = DateTime.Now;
            //    weChatPush.ChangeDate = DateTime.Now;
            //    weChatPush.VGUID = Guid.NewGuid();

            //    //推送接收者
            //    Business_WeChatPushDetail_Information weChatPushDetail = new Business_WeChatPushDetail_Information();
            //    weChatPushDetail.PushObject = userID;
            //    weChatPushDetail.Vguid = Guid.NewGuid();
            //    weChatPushDetail.CreatedDate = DateTime.Now;
            //    weChatPushDetail.ChangeDate = DateTime.Now;
            //    weChatPushDetail.Type = "微信营收";
            //    weChatPushDetail.Business_WeChatPushVguid = weChatPush.VGUID;
            //    result = _ss.SaveRevenueMsg(weChatPush, weChatPushDetail);
            //    if (result)
            //    {
            //        U_RevenueMonth revenueMonth = new U_RevenueMonth();
            //        revenueMonth.AmountDue = revenue.AmountDue;
            //        revenueMonth.CurrentAccountBalance = revenue.CurrentAccountBalance;
            //        revenueMonth.CurrentPayment = revenue.CurrentPayment;
            //        revenueMonth.HistoricalArrears = revenue.HistoricalArrears;
            //        revenueMonth.TheBalance = revenue.TheBalance;
            //        revenueMonth.Month = DateTime.Now.Month.ToString();
            //        Business_WeChatPush_Information weChatPush1 = new Business_WeChatPush_Information();
            //        weChatPush1.PushType = 2;
            //        weChatPush1.Title = "营收短信";
            //        weChatPush1.MessageType = 8;
            //        weChatPush1.Timed = false;
            //        weChatPush1.TimedSendTime = null;
            //        weChatPush1.Important = false;
            //        weChatPush1.Message = Common.JsonHelper.ModelToJson(revenueMonth);
            //        weChatPush1.PeriodOfValidity = null;
            //        weChatPush1.PushDate = DateTime.Now;
            //        weChatPush1.Status = 3;
            //        weChatPush1.CreatedDate = DateTime.Now;
            //        weChatPush1.ChangeDate = DateTime.Now;
            //        weChatPush1.VGUID = Guid.NewGuid();

            //        //推送接收者
            //        Business_WeChatPushDetail_Information weChatPushDetail1 = new Business_WeChatPushDetail_Information();
            //        weChatPushDetail1.PushObject = userID;
            //        weChatPushDetail1.Vguid = Guid.NewGuid();
            //        weChatPushDetail1.CreatedDate = DateTime.Now;
            //        weChatPushDetail1.ChangeDate = DateTime.Now;
            //        weChatPushDetail1.Type = "短信营收";
            //        weChatPushDetail1.Business_WeChatPushVguid = weChatPush1.VGUID;
            //        if (!isZero)
            //        {
            //            result = _ss.SaveRevenueMsg(weChatPush1, weChatPushDetail1);
            //        }

            //    }
            //}
            if (isWeChatPush == "0" && isSmsPush == "0" && isRevenuePush == "0")
            {
                var queryReply = _cs.GetConfigList()[15].ConfigValue;
                Business_WeChatPush_Information weChatPush = new Business_WeChatPush_Information();
                weChatPush.PushType         = 1;
                weChatPush.Title            = "营收微信";
                weChatPush.MessageType      = 1;
                weChatPush.Timed            = false;
                weChatPush.TimedSendTime    = null;
                weChatPush.Important        = false;
                weChatPush.Message          = queryReply;
                weChatPush.PeriodOfValidity = null;
                weChatPush.PushDate         = null;
                weChatPush.Status           = 3;
                weChatPush.CreatedDate      = DateTime.Now;
                weChatPush.ChangeDate       = DateTime.Now;
                weChatPush.VGUID            = Guid.NewGuid();

                //推送接收者
                Business_WeChatPushDetail_Information weChatPushDetail = new Business_WeChatPushDetail_Information();
                weChatPushDetail.PushObject  = userID;
                weChatPushDetail.Vguid       = Guid.NewGuid();
                weChatPushDetail.CreatedDate = DateTime.Now;
                weChatPushDetail.ChangeDate  = DateTime.Now;
                weChatPushDetail.Type        = "微信营收";
                weChatPushDetail.Business_WeChatPushVguid = weChatPush.VGUID;
                result = _ss.SaveRevenueMsg(weChatPush, weChatPushDetail);
            }
            return(result);
        }