protected override void InitApi() { base.InitApi(); if (!string.IsNullOrEmpty(ukey)) { cag = DB.x_agent.SingleOrDefault(o => o.ukey == ukey); if (cag == null && need_user) { throw new XExcep("T用户登陆超时"); } } }
protected override XResp Execute() { var vcode = CacheHelper.Get <string>("code." + uid); if (string.IsNullOrEmpty(code)) { throw new XExcep("T验证码已经过期"); } if (vcode != code) { throw new XExcep("T验证码不正确"); } if (DB.x_agent.Count(o => o.uid == uid) > 0) { throw new XExcep("T用户已经存在"); } var ag = new x_agent { tel = uid, uid = uid, pwd = pwd, time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ukey = Tools.GetRandRom(32, 3) }; DB.x_agent.InsertOnSubmit(ag); SubmitDBChanges(); return(new XResp() { msg = ag.ukey }); }
protected override Web.Com.XResp Execute() { x_agent ag = new x_agent(); if (id > 0) { ag = DB.x_agent.SingleOrDefault(o => o.agent_id == id); if (ag == null) { throw new XExcep("0x0005"); } } else { //判断用户是否已经存在(根据用户名或账户) if (!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(uid)) { ag = DB.x_agent.SingleOrDefault(o => o.name == name || o.uid == uid); if (ag != null) { throw new XExcep("0x0007"); } else { ag = new x_agent(); } } } ag.addr = addr; ag.admin = ad.id; ag.contract = contract; ag.intro = intro; ag.logo = logo.Trim(','); ag.name = name; ag.pwd = pwd; ag.remark = remark; ag.status = status; ag.tel = tel; ag.c_hz = hz; ag.c_zz = zz; ag.time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ag.uid = uid; if (!string.IsNullOrEmpty(point)) { var pt = point.Split(','); if (pt.Length == 2) { ag.pointx = decimal.Parse(pt[0]); ag.pointy = decimal.Parse(pt[1]); } } if (ag.id == 0) { DB.x_agent.InsertOnSubmit(ag); } SubmitDBChanges(); return(new XResp()); }