コード例 #1
0
ファイル: CashOutAPI.cs プロジェクト: BriseLee/test
        /// <summary>
        /// 调用出金接口
        /// </summary>
        /// <param name="type">要调用的出金接口,0表示通联,1表示融宝</param>
        /// <param name="money"></param>
        /// <returns></returns>
        public static RequestResult CachOut(string type, TRealAccounts account, TAgents agent, TAccountMoney money)
        {
            PayEntity entity = new PayEntity();
            if (account != null)
            {
                entity.Phone = account.Phone;
                entity.Name = account.Name;
                entity.IDCardNO = account.IDCardNo;
            }
            else
            {
                entity.IDCardNO = agent.IdCardNo;
                entity.Phone = agent.TelePhone;
                entity.Name = agent.SavingsName;
            }

            RequestResult result = new RequestResult();

            if (money.BankName == null)
            {
                result.IsSuccess = false;
                result.ErrMsg = "银行名不能为空!";
                return result;
            }

            switch (type)
            {
                case "0":
                    result = allinpayMethod(entity.Name, money.AccountNo, "PERSONAL", (money.CreateMoney * 100).ToString(), money.BankName + money.BranchName, "");
                    break;
                case "1":
                    string dateTime = DateTime.Now.ToString("yyMMddhhmmss");
                    if (money.BranchName == null)
                    {
                        result.IsSuccess = false;
                        result.ErrMsg = "支行名不能为空!";
                        break;
                    }
                    int index = money.BranchName.IndexOf("分行");
                    if (index == -1)
                    {
                        result.IsSuccess = false;
                        result.ErrMsg = "分行必须填写!";
                        break;
                    }
                    string fen = money.BranchName.Substring(0, index + 2);
                    result = goldMoney(dateTime, money.CreateMoney.Value.ToString("N"), dateTime,
                              money.AccountNo, entity.Name, money.BankName,
                              fen, money.BranchName, money.ProvincialName,
                              money.CityName, entity.Phone, "身份证",
                              entity.IDCardNO, money.MoneyOrderNum, "", "私", "CNY", dateTime);
                    break;
                default:
                    break;
            }
            return result;
        }
コード例 #2
0
        public ActionResult AddInfors()
        {
            int id = 0;  //Id
            string name = ""; //登陆名
            string Type = "";  //type
            string msg = "";  //提示信息
            bool fruit = false;  //结果

            APIDataDataContext db = APIDataContextProxy.APIDB;
            var Name = Converter.ToString(Request["Name"], "");  //姓名
            var Account = Converter.ToString(Request["Account"], "");   //账号
            var AccountType = Converter.ToInt(Request["AccountType"], -1);  //账号类型    0为"模拟" 1为"实盘";
            var Phone = Converter.ToString(Request["Phone"], "");   //联系方式
            var Email = Converter.ToString(Request["Email"], "");   //email
            var Status = Converter.ToInt(Request["Status"], -1);      //状态
            var CityCode = Request["CityCode"];     //地区
            var Address = Converter.ToString(Request["Address"], "");    //地址
            var agentid = Converter.ToInt(Request["agentid"], -1);    //所属会员id
            var OpenerID = Converter.ToInt(Request["staffs"], 0);      //开户专员
            DateTime dt = DateTime.Now;
            var OpenTime = dt;  //开户时间
            var LastLoginTime = dt;   //最后登陆时间
            var LastLoginIP = "";   //登陆的ip
            var IDCardNo = Converter.ToString(Request["IDCardNo"], "");   //身份证号
            var Bankid = Converter.ToInt(Request["Bankid"], 0);  //开户银行
            var SavingsAccount = Converter.ToString(Request["SavingsAccount"], "");  //储蓄账号
            var AllowTrade = Converter.ToInt(Request["AllowTrade"], -1);    //交易操作
            var AllowFinance = Converter.ToInt(Request["AllowFinance"], -1);  //资金操作
            var GroupID = Converter.ToInt(Request["GroupID"], -1);   //用户分组
            var AccountMoney = Converter.ToFloat(Request["AccountMoney"], 0);     //账户余额
            //var Password = Converter.ToString(Request["password"], "");   //密码
            var Branch = Converter.ToString(Request["Branch"], "");//开户行支行

            #region 数据校验
            bool isValid = true;
            int i = 0;
            if (string.IsNullOrEmpty(Name))
            {
                msg += (++i).ToString() + "、客户名称不能为空!<br />";
                isValid = false;
            }
            if (string.IsNullOrEmpty(Account))
            {
                msg += (++i).ToString() + "、账号不能为空!<br />";
                isValid = false;
            }
            int count = db.TRealAccounts.Count(t => t.Account == Account);
            if (count > 0)
            {
                msg += (++i).ToString() + "、该帐号已经存在!<br />";
                isValid = false;
            }
            if (!string.IsNullOrEmpty(Phone))
            {
                count = db.TRealAccounts.Count(t => t.Phone == Phone);
                if (count > 0)
                {
                    msg += (++i).ToString() + "、该联系方式已经存在!<br />";
                    isValid = false;
                }
            }
            if (!string.IsNullOrEmpty(Email))
            {
                count = db.TRealAccounts.Count(t => t.Email == Email);
                if (count > 0)
                {
                    msg += (++i).ToString() + "、该联系邮箱已经存在!<br />";
                    isValid = false;
                }
            }
            //if (string.IsNullOrEmpty(Password))
            //{
            //    msg += (++i).ToString()+"、密码不能为空!<br />";
            //    isValid = false;
            //}
            if (string.IsNullOrEmpty(IDCardNo))
            {
                msg += (++i).ToString() + "、身份证号不能为空!<br />";
                isValid = false;
            }
            if (Bankid <= 0)
            {
                msg += (++i).ToString() + "、开户银行不能为空!<br />";
            }
            if (string.IsNullOrEmpty(SavingsAccount))
            {
                msg += (++i).ToString() + "、银行卡号不能为空!<br />";
                isValid = false;
            }
            //if (string.IsNullOrEmpty(CityCode))
            //{
            //    msg += (++i).ToString() + "、开户行所在地不能为空!<br />";
            //    isValid = false;
            //}
            //if (string.IsNullOrEmpty(Branch))
            //{
            //    msg += (++i).ToString() + "、开户行支行不能为空!<br />";
            //    isValid = false;
            //}
            #endregion

            if (isValid)
            {
                TRealAccounts trs = new TRealAccounts();
                trs.Name = Name;
                trs.Account = Account;
                trs.AccountType = AccountType;
                trs.Phone = Phone;
                trs.Email = Email;
                trs.PassWord = Account;
                trs.Status = Status;
                trs.CityID = (from c in db.TCities where c.CityCode == CityCode select c.ID).FirstOrDefault();
                trs.Address = Address;
                if (agentid > 0)
                    trs.AgendID = agentid;
                else
                    trs.AgendID = (from c in db.TAgents select c.ID).FirstOrDefault();
                trs.OpenerID = OpenerID;
                trs.OpenTime = Convert.ToDateTime(OpenTime);
                trs.LastLoginTime = Convert.ToDateTime(LastLoginTime);
                trs.LastLoginIP = LastLoginIP;
                trs.IDCardNo = IDCardNo;
                trs.BankID = Bankid;
                trs.SavingsAccount = SavingsAccount;
                trs.AllowTrade = Convert.ToBoolean(AllowTrade);
                trs.AllowFinance = Convert.ToBoolean(AllowFinance);
                trs.GroupID = GroupID;
                trs.AccountMoney = AccountMoney;
                trs.Branch = Branch;
                db.TRealAccounts.InsertOnSubmit(trs);
                db.SubmitChanges();
                TOperationLog OLog = new TOperationLog();

                OLog.BeforeValue = "";
                OLog.UpdateValue = ObjectToJson.ModelToJson(trs);
                //写入操作日志
                OLog.UserID = Convert.ToInt32(Session["ID"]);
                OLog.UserType = 2;//0 用户 1 会员 2 员工
                OLog.CreateDate = DateTime.Now;
                OLog.PageName = "新增用户";
                Converter.InsertOperationLog(OLog);
                //存入日志
                id = Convert.ToInt32(Session["ID"]); //id
                Type = Session["Type"].ToString();  //类型
                msg = "添加用户成功";
                fruit = true;
                Converter.InsertLog(id, name, Type, msg, fruit);

                return Content("{result:'success',msg:'添加成功!'}");

            }
            else
            {
                //存入日志
                id = Convert.ToInt32(Session["ID"]); //id
                Type = Session["Type"].ToString();  //类型
                //msg = "添加用户失败";
                fruit = false;
                Converter.InsertLog(id, name, Type, "添加用户失败", fruit);

                return Content("{result:'fail',msg:'" + msg + "'}");

            }
        }
コード例 #3
0
ファイル: OperateController.cs プロジェクト: BriseLee/test
        public ActionResult PostClosingEdit()
        {
            APIDataDataContext db = APIDataContextProxy.APIDB;
            int TRealAccountsID = Converter.ToInt(Request["TRealAccountsID"], 0);
            var password = Request["password"];
            TOperationLog OLog = new TOperationLog();
            TRealAccounts realAccount = new TRealAccounts();
            if (!Request.IsAjaxRequest())
                return Json(new { code = 0, msg = "非法请求!" });
            int orderid = Converter.ToInt(Request["orderid"], 0);
            if (orderid == 0)
                return Json(new { code = 0, msg = "订单号错误!" });
            int type = Converter.ToInt(Request["type"], 0);
            if (!(type >= 1 && type <= 3))
                return Json(new { code = 0, msg = "操作类型错误!" });
            try
            {

                var user2 = (from c in db.TRealAccounts where c.ID == TRealAccountsID && c.PassWord == password select c).FirstOrDefault();
                if (user2 == null)
                {
                    return Json(new { code = 0, msg = "客户密码不正确!" });
                }
                var order = (from c in db.TOrders
                             where c.ID == orderid && c.OrderType == 2 && c.OrderState == 2
                             select c).FirstOrDefault();
                if (order == null)
                    return Json(new { code = 0, msg = "订单不存在!" });
                OLog.BeforeValue = ObjectToJson.ModelToJson(order);
                if (type == 1 || type == 2)
                {
                    OLog.PageName = "重新平仓";
                    OLog.UpdateValue = "";
                    bool orderType = Converter.ToInt(Request["OrderType"], 1) == 1 ? true : false;
                    double orderCount = Converter.ToFloat(Request["OrderCount"], order.OrderCount != null ? (float)order.OrderCount.Value : 0f);
                    double openPrice = Converter.ToFloat(Request["OpenPrice"], order.OpenPrice != null ? (float)order.OpenPrice.Value : 0f);
                    double loss = Converter.ToFloat(Request["Loss"], order.Loss != null ? (float)order.Loss.Value : 0f);
                    double profit = Converter.ToFloat(Request["Profit"], order.Profit != null ? (float)order.Profit.Value : 0f);
                    DateTime dtOpen = DateTime.Now;
                    if (!(DateTime.TryParse(Request["OpenTime"] + "", out dtOpen) && order.OpenTime != null))
                        dtOpen = order.OpenTime.Value;
                    DateTime dtClose = DateTime.Now;
                    if (!(DateTime.TryParse(Request["UpdateTime"] + "", out dtOpen) && order.UpdateTime != null))
                        dtClose = order.UpdateTime.Value;
                    double nowPrice = Converter.ToFloat(Request["NowPrice"], order.NowPrice != null ? (float)order.NowPrice.Value : 0f);
                    double deposit = Converter.ToFloat(Request["Deposit"], order.Deposit != null ? (float)order.Deposit.Value : 0f);
                    double interest = Converter.ToFloat(Request["Interest"], order.Interest != null ? (float)order.Interest.Value : 0f);
                    double proloss = Converter.ToFloat(Request["ProfitAndLoss"], order.ProfitAndLoss != null ? (float)order.ProfitAndLoss.Value : 0f);

                    order.Deal = orderType;
                    order.OrderCount = orderCount;
                    order.OpenPrice = openPrice;
                    order.Loss = loss;
                    order.OpenTime = dtOpen;
                    order.Profit = profit;
                    order.NowPrice = nowPrice;
                    order.Deposit = deposit;
                    order.UpdateTime = dtClose;
                    order.Interest = interest;
                    order.ProfitAndLoss = proloss;
                    if (type == 2)
                    {
                        OLog.PageName = "撤销平仓";
                        order.OrderType = 1;
                        order.OrderState = 1;
                        //撤销平仓要改余额
                        List<TAccountMoney> orders = db.TAccountMoney.Where(a => a.TOrderId == orderid).ToList();
                        double? yingkui = 0.0;
                        double? fee = 0.0;
                        foreach (TAccountMoney item in orders)
                        {
                            if (item.TypeId == 4)
                            {
                                yingkui -= item.CreateMoney;
                            }
                            if (item.TypeId == 5)
                            {
                                fee += item.CreateMoney;
                            }
                            db.TAccountMoney.DeleteOnSubmit(item);
                        }
                        realAccount = db.TRealAccounts.Where(r => r.ID == order.TRealAccountsID).FirstOrDefault();
                        OLog.BeforeValue += ObjectToJson.ModelToJson(realAccount);
                        realAccount.AccountMoney = realAccount.AccountMoney + yingkui + fee;
                    }
                    db.SubmitChanges();

                    OLog.UpdateValue = ObjectToJson.ModelToJson(order) + ObjectToJson.ModelToJson(realAccount);
                    //写入操作日志
                    OLog.UserID = Convert.ToInt32(Session["ID"]);
                    OLog.UserType = 2;//0 用户 1 会员 2 员工
                    OLog.CreateDate = DateTime.Now;
                    Converter.InsertOperationLog(OLog);
                }
                else if (type == 3)
                {
                    db.TOrders.DeleteOnSubmit(order);
                    db.SubmitChanges();
                    OLog.PageName = "删除交易";
                    OLog.UpdateValue = "";
                    //写入操作日志
                    OLog.UserID = Convert.ToInt32(Session["ID"]);
                    OLog.UserType = 2;//0 用户 1 会员 2 员工
                    OLog.CreateDate = DateTime.Now;
                    Converter.InsertOperationLog(OLog);
                }

                return Json(new { code = 1, msg = "操作成功!" });
            }
            catch (System.Exception ex)
            {
                return Json(new { code = 0, msg = "服务器内部错误!" });
            }
        }
コード例 #4
0
ファイル: OperateController.cs プロジェクト: BriseLee/test
        /// <summary>
        /// 调整资金
        /// </summary>
        /// <param name="type">0表示客户,1表示会员</param>
        /// <param name="createMoney">调整金额</param>
        /// <param name="id">客户或会员的ID</param>
        /// <param name="typeid">存款或取款</param>
        /// <returns></returns>
        public ActionResult MoneyChange(int type, double createMoney, int id, int typeid)
        {
            APIDataDataContext db = APIDataContextProxy.APIDB;
            {
                try
                {
                    TRealAccounts realAccount = new TRealAccounts();
                    TAgents agent = new TAgents();
                    TOperationLog OLog = new TOperationLog();
                    OLog.BeforeValue = "";
                    TAccountMoney accountMoney = new TAccountMoney() { CreateMoney = createMoney, TypeId = typeid, CreateTime = DateTime.Now, Status = 2, BankState=1,PlatformState=1,Examine=1 };
                    if (type == 0)
                    {
                        realAccount = db.TRealAccounts.Where(t => t.ID == id).FirstOrDefault();
                        accountMoney.OriginalMoney = realAccount.AccountMoney;
                        accountMoney.NowMoney = realAccount.AccountMoney + (typeid == 1 ? createMoney : (-1) * createMoney);
                        accountMoney.RealAccountId = id;
                        realAccount.AccountMoney = accountMoney.NowMoney;
                        if (typeid == 3 && realAccount.AccountMoney < 0)
                        {
                            return Json("余额不足!");
                        }
                    }
                    else
                    {
                        agent = db.TAgents.Where(t => t.ID == id).FirstOrDefault();
                        accountMoney.OriginalMoney = agent.AccountMoney;
                        accountMoney.NowMoney = agent.AccountMoney + (typeid == 1 ? createMoney : (-1) * createMoney);
                        accountMoney.AgentId = id;
                        agent.AccountMoney = (double)accountMoney.NowMoney;
                        if (typeid == 3 && agent.AccountMoney < 0)
                        {
                            return Json("余额不足!");
                        }
                    }
                    db.TAccountMoney.InsertOnSubmit(accountMoney);
                    db.SubmitChanges();
                    OLog.UpdateValue = ObjectToJson.ModelToJson(accountMoney);

                    //写入操作日志
                    OLog.UserID = Convert.ToInt32(Session["ID"]);
                    OLog.UserType = 2;//0 用户 1 会员 2 员工
                    OLog.CreateDate = DateTime.Now;
                    OLog.PageName = "调整金额";
                    Converter.InsertOperationLog(OLog);
                    return Json(1);

                }
                catch
                {
                    return Json("服务器内部错误!");
                }
            }
        }
コード例 #5
0
        public ActionResult AddTRealAccounts()
        {
            int id = 0;  //Id
            string name = ""; //登陆名
            string Type = "";  //type
            string msg = "";  //提示信息
            bool fruit = false;  //结果
            TOperationLog OLog = new TOperationLog();

            APIDataDataContext db = APIDataContextProxy.APIDB;
            var Name = Converter.ToString(Request["Name"],"");
            var Account = Converter.ToString(Request["Account"], "");
            var AccountType = Converter.ToInt(Request["AccountType"], -1);
            var Phone = Converter.ToString(Request["Phone"], "");
            var Email = Converter.ToString(Request["Email"], "");
            var Status = Converter.ToInt(Request["Status"], -1);
            var CityCode = Converter.ToInt(Request["CityCode"], -1);
            var Address = Converter.ToString(Request["Address"], "");
            var LastLoginIP = "193.454.34";
            var LastLoginTime = DateTime.Now;
            var AllowTrade = Converter.ToInt(Request["AllowTrade"], -1);
            var AllowFinance = Converter.ToInt(Request["AllowFinance"], -1);
            var GroupID = Converter.ToInt(Request["GroupID"], -1);
            if (Name != "" && Account != "" && AccountType != -1 && Phone != "" && Email != "" && Status != -1 && CityCode != -1 && Address != "" && LastLoginIP != "" && LastLoginIP != "" && AllowTrade != -1 && AllowFinance != -1)
            {
                TRealAccounts t = new TRealAccounts();
                t.Name = Name;
                t.Account = Account;
                t.AccountType = AccountType;
                t.Phone = Phone;
                t.Email = Email;
                t.Status = Status;
                t.CityID = CityCode;
                t.Address = Address;
                t.LastLoginIP = LastLoginIP;
                t.LastLoginTime = Convert.ToDateTime(LastLoginTime);
                t.AllowTrade = Convert.ToBoolean(AllowTrade);
                t.AllowFinance = Convert.ToBoolean(AllowFinance);
                t.GroupID = GroupID;
                db.TRealAccounts.InsertOnSubmit(t);
                db.SubmitChanges();

                OLog.BeforeValue = "";
                OLog.UpdateValue = ObjectToJson.ModelToJson(t);
                //写入操作日志
                OLog.UserID = Convert.ToInt32(Session["ID"]);
                OLog.UserType = 2;//0 用户 1 会员 2 员工
                OLog.CreateDate = DateTime.Now;
                OLog.PageName = "新增模拟账户";
                Converter.InsertOperationLog(OLog);
                //存入日志
                id = Convert.ToInt32(Session["ID"]); //id
                Type = Session["Type"].ToString();  //类型
                msg = "添加用户成功";
                fruit = true;
                Converter.InsertLog(id, name, Type, msg, fruit);

                return Content("{result:'success',msg:'添加成功!'}");

            }
            else
            {
                //存入日志
                id = Convert.ToInt32(Session["ID"]); //id
                Type = Session["Type"].ToString();  //类型
                msg = "添加用户失败";
                fruit = false;
                Converter.InsertLog(id, name, Type, msg, fruit);

                return Content("{result:'fail',msg:'请输入完整的参数!'}");

            }
        }
コード例 #6
0
ファイル: ServiceController.cs プロジェクト: BriseLee/test
        //注册
        public string Regist()
        {
            APIDataDataContext db = APIDataContextProxy.APIDB;
            string Name = SoftwareAPI.Utils.Converter.ToString(Request["Name"], "");
            string Sexs = SoftwareAPI.Utils.Converter.ToString(Request["Sex"], "");
            int AccountType = SoftwareAPI.Utils.Converter.ToInt(Request["AccountType"], 0);//帐号类型 0模拟 1 实盘
            string Phone = SoftwareAPI.Utils.Converter.ToString(Request["Phone"], "");//手机
            string Email = SoftwareAPI.Utils.Converter.ToString(Request["Email"], "");//邮箱
            int CityID = SoftwareAPI.Utils.Converter.ToInt(Request["CityID"], 0);//地区;
            string Address = SoftwareAPI.Utils.Converter.ToString(Request["Address"], "");//地址;
            int AgendID = SoftwareAPI.Utils.Converter.ToInt(Request["AgendID"], 0);//所属会员;
            string PassWord = SoftwareAPI.Utils.Converter.ToString(Request["PassWord"], "");//密码
            string Account = "";//生成
            bool Sex = false;
            sysPreference = db.TSysPreference.FirstOrDefault();
            if (AccountType == 0 && sysPreference.AllowDemo == false)
            {
                JObject jo = new JObject();
                jo["success"] = 10003;
                jo["token"] = "";
                jo["msg"] = "该平台禁止模拟账户注册!";
                return jo.ToString();
            }
            if (Sexs.ToLower() == "true")
            {
                Sex = true;
            }
            string IP = GetUserIp;//密码
            var user = (from c in db.TRealAccounts where c.Email.ToUpper() == Email.ToUpper() || c.Phone.ToUpper() == Phone.ToUpper() select c).FirstOrDefault();
            if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(PassWord))
            {
                JObject jo = new JObject();
                jo["success"] = 10003;
                jo["token"] = "";
                jo["msg"] = "请输入完整!";
                return jo.ToString();
            }
            if (user != null)
            {
                JObject jo = new JObject();
                jo["success"] = 10004;
                jo["token"] = "";
                jo["msg"] = "该用户已经注册过了!";
                return jo.ToString();
            }
            else
            {
                //查询平台设置
                var sys = (from c in db.TSysPreference select c).FirstOrDefault();
                string beforename = "";//帐号前缀
                if (AccountType == 1)//真实帐号
                {
                    beforename = sys.LCPrefix;
                }
                else //模拟帐号
                {
                    beforename = sys.DCPrefix;
                }
                Account = beforename + DateTime.Now.ToString("yyyyMMddHHmmss");
                var group = (from c in db.TUserGroup orderby c.IsDefault descending select c).FirstOrDefault();
                //添加新用户
                user = new TRealAccounts();
                //Account
                user.Name = Name;
                user.Sex = Sex;
                user.Account = Account;
                user.AccountType = AccountType;
                user.Phone = Phone;
                user.Email = Email;
                user.CityID = CityID;
                user.Address = Address;
                if (AgendID == 0)
                    user.AgendID = (from c in db.TAgents orderby c.Depth ascending select c.ID ).FirstOrDefault();
                else
                    user.AgendID = AgendID;

                user.PassWord = PassWord;
                user.AccountMoney = 0;
                if (AccountType != 1)
                {
                    try
                    {
                        if (sysPreference.DefaultDemoFin > 0)
                        {
                            user.AccountMoney = sysPreference.DefaultDemoFin;
                            user.AccountBeginMoney = sysPreference.DefaultDemoFin;//赠金
                            TAccountMoney tam = new TAccountMoney();
                            tam.MoneyOrderNum = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                            tam.RealAccountId = Converter.ToInt(user.ID);
                            tam.TypeId = 2;
                            tam.OriginalMoney = user.AccountMoney;
                            tam.CreateMoney = sysPreference.DefaultDemoFin;
                            tam.NowMoney = sysPreference.DefaultDemoFin;
                            if (tam.NowMoney < 0)
                            {
                                tam.NowMoney = 0;
                            }
                            tam.CreateTime = DateTime.Now;
                            tam.UpDateTime = DateTime.Now;
                            tam.Status = 2;
                            tam.TOrderId = 0;
                            db.TAccountMoney.InsertOnSubmit(tam);

                        }
                    }
                    catch { }

                }
                //user.AccountType = AccountType;
                user.LastLoginIP = IP;
                user.LastLoginTime = DateTime.Now;
                try
                {
                    user.GroupID = group.ID;
                }
                catch
                {
                    user.GroupID = 0;
                }
                db.TRealAccounts.InsertOnSubmit(user);
                db.SubmitChanges();

                user.Account = beforename + user.ID.ToString("000000");
                db.SubmitChanges();
                //Account = beforename + DateTime.Now.ToString("yyyyMMddHHmmss");
                //查询accesstoken 是否有
                Access access = (from c in db.Access where c.userid == user.ID select c).FirstOrDefault();
                string token = "";
                if (access != null)// 数据库有accesstoken
                {
                    token = access.access_token;
                }
                else
                {
                    access = new Access();
                    access.userid = user.ID;
                    string access_token = FormsAuthentication.HashPasswordForStoringInConfigFile(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MD5");
                    access.access_token = access_token;
                    access.expires_in = 0;
                    access.scope = "0";
                    access.datetime = DateTime.Now;
                    access.platform_name = sys.FullName;
                    access.deviceid = 0;
                    db.Access.InsertOnSubmit(access);
                    db.SubmitChanges();
                }

                JObject job = new JObject();
                job["token"] = access.access_token;
                job["Account"] = user.Account;
                job["MinVolume"] = group.MinVolume;
                job["MaxVolume"] = group.MaxVolume;
                job["EntrustDeadLine"] = group.EntrustDeadLine;

                JObject jo = new JObject();
                jo["success"] = "TRUE";
                jo["content"] = job;
                jo["msg"] = "登陆成功!";
                return jo.ToString();
            }
        }