コード例 #1
0
        /// <summary>
        /// 关闭或开启同步
        /// </summary>
        /// <returns></returns>

        public ActionResult OpenSyncData()
        {
            _agentDistributionRelationBLL = new AgentDistributionRelationBLL();
            _returnData = new Return_Msg();
            int id            = Context.GetRequestInt("id", 0);
            int opensyncState = Context.GetRequestInt("opensyncstate", 0);

            if (id <= 0)
            {
                _returnData.Msg = "参数错误";
                return(Json(_returnData));
            }

            AgentDistributionRelation model = _agentDistributionRelationBLL.GetModel(id);

            if (model == null)
            {
                _returnData.Msg = "数据过期,请刷新重试";
                return(Json(_returnData));
            }

            model.UpdateTime   = DateTime.Now;
            model.OpenSyncData = opensyncState;
            _returnData.isok   = _agentDistributionRelationBLL.Update(model, "OpenSyncData,UpdateTime");
            _returnData.Msg    = _returnData.isok ? "保存成功" : "保存失败";

            return(Json(_returnData));
        }
コード例 #2
0
        public ActionResult GetDataList()
        {
            _agentDistributionRelationBLL = new AgentDistributionRelationBLL();
            _returnData = new Return_Msg();

            int    pageSize     = Context.GetRequestInt("pageSize", 10);
            int    pageIndex    = Context.GetRequestInt("pageIndex", 1);
            int    aid          = Context.GetRequestInt("aid", 0);
            int    opensyncData = Context.GetRequestInt("opensyncdata", 0);
            string dname        = Context.GetRequest("dname", string.Empty);
            string aname        = Context.GetRequest("aname", string.Empty);

            if (aid <= 0)
            {
                _returnData.Msg = "参数错误";
                return(Json(_returnData));
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxrelation == null)
            {
                _returnData.Msg = "模板不存在";
                return(Json(_returnData));
            }
            Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(xcxrelation.AccountId.ToString());

            if (agentinfo == null)
            {
                _returnData.Msg = "您还未成为代理商";
                return(Json(_returnData));
            }

            int count = 0;
            List <AgentDistributionRelation> list = _agentDistributionRelationBLL.GetSysnDataList(dname, aname, agentinfo.id, opensyncData, pageSize, pageIndex, ref count);

            _returnData.isok    = true;
            _returnData.dataObj = new { data = list, count = count };

            return(Json(_returnData));
        }
コード例 #3
0
ファイル: CrmApiDataBLL.cs プロジェクト: soon14/vzan
        public bool SaveLog(List <CrmData> crmdata, CrmApiData modelConfig)
        {
            TransactionModel             tran = new TransactionModel();
            AgentDistributionRelationBLL agentDistributionRelationBLL = new AgentDistributionRelationBLL();

            if (modelConfig == null)
            {
                return(false);
            }

            if (crmdata == null || crmdata.Count <= 0)
            {
                UpdateCrmApiData(modelConfig);
                return(false);
            }

            string         phones      = "'" + string.Join("','", crmdata.Select(s => s.phone).Distinct()) + "'";
            List <Account> accountList = AccountBLL.SingleModel.GetListByPhones(phones);

            if (accountList == null || accountList.Count <= 0)
            {
                UpdateCrmApiData(modelConfig);
                return(false);
            }

            string accountids = "'" + string.Join("','", accountList.Select(s => s.Id).Distinct()) + "'";
            List <AgentDistributionRelation> agentdistributionlist = agentDistributionRelationBLL.GetListByAgent(accountids);

            if (agentdistributionlist == null || agentdistributionlist.Count <= 0)
            {
                UpdateCrmApiData(modelConfig);
                return(false);
            }

            foreach (CrmData item in crmdata)
            {
                Account accountitem = accountList.FirstOrDefault(f => f.ConsigneePhone == item.phone);
                if (accountitem == null)
                {
                    continue;
                }
                AgentDistributionRelation adbitem = agentdistributionlist.FirstOrDefault(f => f.UserAccountId == accountitem.Id.ToString());
                if (adbitem == null)
                {
                    continue;
                }

                AgentFollowLog followlog = new AgentFollowLog();
                followlog.AddTime    = item.AddTime;
                followlog.UpdateTime = item.AddTime;
                followlog.State      = 1;
                followlog.Type       = 1;
                followlog.SouceFrom  = 1;
                followlog.AgentDistributionRelatioinId = adbitem.Id;
                followlog.Desc = "业务员:" + item.name + ",跟进状态:" + item.statecontent + ",备注:" + item.content;
                tran.Add($"insert into AgentFollowLog(agentdistributionrelatioinid,`desc`,state,addtime,updatetime,type,writer,soucefrom) values ({followlog.AgentDistributionRelatioinId},'{followlog.Desc}',{followlog.State},'{followlog.AddTime.ToString("yyyy-MM-dd HH:mm:ss")}','{followlog.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss")}',{followlog.Type},'',{followlog.SouceFrom})");
            }

            if (tran.sqlArray.Length > 0)
            {
                bool isok = base.ExecuteTransaction(tran.sqlArray);
                if (isok)
                {
                    UpdateCrmApiData(modelConfig);
                }
                return(isok);
            }
            //else
            //{
            //    if (DateTime.Now.CompareTo(DateTime.Parse(modelConfig.CurrentTime).AddDays(1)) > 0)
            //    {
            //        string columns = "pageindex,TotalPageSize,CurrentTime";
            //        modelConfig.PageIndex = 1;
            //        modelConfig.TotalPageSize = 0;
            //        modelConfig.CurrentTime = DateTime.Parse(modelConfig.CurrentTime).AddDays(1).ToShortDateString();

            //        base.Update(modelConfig, columns);
            //    }
            //}

            return(false);
        }
コード例 #4
0
ファイル: webviewController.cs プロジェクト: soon14/vzan
        /// <summary>
        /// 保存注册信息
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveUserInfo()
        {
            Return_Msg data          = new Return_Msg();
            string     password      = Utility.IO.Context.GetRequest("password", string.Empty);
            string     phone         = Utility.IO.Context.GetRequest("phone", string.Empty);
            string     code          = Utility.IO.Context.GetRequest("code", string.Empty);
            string     address       = Utility.IO.Context.GetRequest("address", string.Empty);
            string     sourcefrom    = Utility.IO.Context.GetRequest("sourcefrom", "代理分销推广");
            int        agentqrcodeid = Utility.IO.Context.GetRequestInt("agentqrcodeid", 0);
            int        opentype      = Utility.IO.Context.GetRequestInt("opentype", 0);
            string     username      = Utility.IO.Context.GetRequest("username", "");
            string     appid         = Utility.IO.Context.GetRequest("appid", "");

            data.isok = false;
            //if (agentqrcodeid>0 && string.IsNullOrEmpty(username))
            //{
            //    _msg.Msg = "请输入姓名";
            //    return Json(_msg, JsonRequestBehavior.AllowGet);
            //}
            if (string.IsNullOrEmpty(phone))
            {
                data.Msg = "请输入手机号";
                return(Json(data));
            }
            if (string.IsNullOrEmpty(code))
            {
                data.Msg = "请输入验证码";
                return(Json(data));
            }
            if (string.IsNullOrEmpty(password))
            {
                data.Msg = "请输入密码";
                return(Json(data));
            }
            if (agentqrcodeid <= 0)
            {
                data.Msg = "参数错误";
                return(Json(data));
            }

            //是否校验手机号,0检验,1不校验
            //校验验证码
            data = CommondHelper.CheckVaildCode(phone, code);
            if (!data.isok)
            {
                return(Json(data));
            }
            Account account = AccountBLL.SingleModel.GetModelByPhone(phone);

            //如果是代理分销扫描注册,则判断绑定的手机号是否已经注册过账号,如果没有则注册一个账号
            if (account == null)
            {
                account = AccountBLL.SingleModel.WeiXinRegister("", 0, "", true, address, phone, sourcefrom, password);
            }
            else
            {
                //修改已经注册过的用户信息
                AccountBLL.SingleModel.UpdateUserInfo(account.Id.ToString(), phone, password, address);
            }

            if (account != null)
            {
                //用户已绑定手机号,判断是否有单页版
                XcxAppAccountRelation usertemplate = XcxAppAccountRelationBLL.SingleModel.GetModelByaccound(account.Id.ToString());
                if (usertemplate == null)
                {
                    //免费开通单页版
                    XcxAppAccountRelationBLL.SingleModel.AddFreeTemplate(account);
                }

                //如果是扫分销代理码注册,则开通代理,
                AgentDistributionRelationBLL agentDistributionRelationBLL = new AgentDistributionRelationBLL();
                data.Msg = agentDistributionRelationBLL.CreateDistributionAgent(account.Id.ToString(), agentqrcodeid, opentype, username);
                if (data.Msg != "")
                {
                    return(Json(data));
                }

                data.isok = true;
                data.Msg  = "注册成功";
            }
            else
            {
                data.isok = false;
                data.Msg  = "注册失败";
            }
            string key = string.Format(_resetPasswordkey, phone);

            RedisUtil.Remove(key);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
 /// <summary>
 /// 实例化对象
 /// </summary>
 public customerdistributionController()
 {
     _agentDistributionRelationBLL = new AgentDistributionRelationBLL();
 }