private void post_news_commend(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); string name = DTRequest.GetString("name"); string avatar = DTRequest.GetString("avatar"); int isPN = DTRequest.GetInt("isPN", 0); int news_id = DTRequest.GetInt("news_id", 0); string cont = DTRequest.GetString("cont"); Model.news_commend model = new Model.news_commend(); model.user_id = uid; model.name = name; model.avatar = avatar; model.ispn = isPN; model.news_id = news_id; model.ishide = 0; model.time = DateTime.Now; model.cont = cont; if (isPN == 1 && new BLL.user().GetCount("id=" + uid + " and phone!=''") == 0) {//判断为产品,需要填写手机号 context.Response.Write("{\"status\":0,\"msg\":\"请先在个人信息中补充联系电话!\"}"); return; } if (new BLL.news_commend().Add(model) > 0) { context.Response.Write("{\"status\":1,\"msg\":\"提交成功!\"}"); } else { context.Response.Write("{\"status\":0,\"msg\":\"提交失败!\"}"); } }
private void pm_exis(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); if (uid == 0) { context.Response.Write("{\"status\":0,\"msg\":\"未登录,请先登录!\"}"); return; } if (new BLL.user_pm().GetCount("user_id=" + uid) > 0) { int val = Convert.ToInt32(new BLL.user_pm().GetList(0, "user_id=" + uid, "").Tables[0].Rows[0]["status"]); if (val == 1) { context.Response.Write("{\"status\":1,\"msg\":\"审核中,请耐心等待!\",\"val\":" + val + "}"); } else if (val == 2) { context.Response.Write("{\"status\":2,\"msg\":\"审核已通过!\",\"val\":" + val + "}"); } else { context.Response.Write("{\"status\":1,\"msg\":\"审核未通过!\",\"val\":" + val + "}"); } } else { context.Response.Write("{\"status\":3,\"msg\":\"正常!\"}"); } }
private void sign_article_click(HttpContext context) { var username = DTRequest.GetString("username"); var password = DTRequest.GetString("password"); BLL.xiehui bll = new BLL.xiehui(); Model.xiehui model = bll.GetModel(username, password, true); if (model == null) { context.Response.Write("{\"status\": 2, \"msg\": \"用户名或密码有误,请重试!\"}"); return; } BLL.article bllArticle = new BLL.article(); var id = DTRequest.GetInt("id", 0); var articleModel = bllArticle.GetModel(id); articleModel.status = 2; articleModel.sign_user_name += username + "|" + DateTime.Now.ToString() + ","; //判断当前用户是否已签收过 var isUserSign = bllArticle.GetList(1, " id=" + id + " and sign_user_name like '%" + username + "|%'", "add_time desc").Tables[0].Rows.Count; if (isUserSign > 0) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,该用户已经签收!\"}"); return; } if (bllArticle.Update(articleModel)) { context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,签收成功!\"}"); return; } context.Response.Write("{\"status\": 0, \"msg\": \"对不起,签收过程中发生错误!\"}"); }
private void call_pm(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); int cid = DTRequest.GetInt("cid", 0); if (new BLL.call_pm().GetCount("user_id=" + uid + " and call_id=" + cid) == 0) { if (new BLL.user().GetModel(uid).point < 30) { context.Response.Write("{\"status\":0,\"msg\":\"积分不足30!\"}"); return; } Model.call_pm call = new Model.call_pm(); call.user_id = uid; call.call_id = cid; call.time = DateTime.Now; new BLL.call_pm().Add(call); Model.point model = new Model.point(); model.user_id = uid; model.value = -30; model.remark = "联系产品经理"; model.add_time = DateTime.Now; new BLL.point().Add(model); new BLL.user().UpdateField(uid, "point=point+" + model.value); context.Response.Write("{\"status\":1,\"msg\":\"成功联系产品经理!\"}"); } else { context.Response.Write("{\"status\":1,\"msg\":\"非首次联系产品经理,不重复扣除积分!\"}"); } }
private void get_news_model(HttpContext context) { int id = DTRequest.GetInt("id", 0); int uid = DTRequest.GetInt("uid", 0); DataTable dt = new BLL.news().GetList(1, "id=" + id, "").Tables[0]; if (dt.Rows.Count > 0) { string time = Convert.ToDateTime(dt.Rows[0]["time"]).ToString("yyyy-MM-dd HH:mm"); dt.Columns.Remove("time"); dt.Columns.Add("time", typeof(string)); dt.Columns.Add("isCollect", typeof(int)); dt.Rows[0]["time"] = time; if (uid != 0) { dt.Rows[0]["isCollect"] = new BLL.news_view().GetCount("user_id=" + uid + " and isPN=2 and type=2 and news_id=" + dt.Rows[0]["id"].ToString()) > 0 ? 1 : 0; } else { dt.Rows[0]["isCollect"] = 0; } context.Response.Write(JsonHelper.DataTableToJSON(dt).TrimEnd(']').TrimStart('[')); } }
private void update_user(HttpContext context) { string openid = DTRequest.GetString("openid"); string name = DTRequest.GetString("name"); int sex = DTRequest.GetInt("sex", 0); string phone = DTRequest.GetString("phone"); string email = DTRequest.GetString("email"); Model.user model = new BLL.user().GetModel(openid); model.nickname = name; model.sex = sex; model.phone = phone; model.email = email; if (new BLL.user().Update(model)) { if ((model.nickname != "" && model.sex != 0 && model.phone != "" && model.email != "") && new BLL.amount().GetCount("type=3 and user_id=" + model.id) == 0) { Model.amount amount = new Model.amount() { user_id = model.id, type = 3, Amount = 1.88M, remark = "填写完整个人信息", time = DateTime.Now }; new BLL.amount().Add(amount); new BLL.user().UpdateField(model.id, "amount=amount+" + amount.Amount); } context.Response.Write("{\"status\":1,\"msg\":\"修改成功!\"}"); } else { context.Response.Write("{\"status\":0,\"msg\":\"修改失败!\"}"); } }
private void get_pro_list(HttpContext context) { int page = DTRequest.GetInt("page", 1); int category = DTRequest.GetInt("category", 0); int uid = DTRequest.GetInt("uid", 0); string keywords = DTRequest.GetString("keywords"); string city = DTRequest.GetString("city"); int count = 0; int pageSize = 8; int sum = 0; if (uid == 0) { sum = new BLL.product().GetCount("status=2 and city=" + (city == "未知" ? "city" : "'" + city + "'") + " and category=" + (category == 0 ? "category" : category.ToString())); } else { sum = new BLL.product().GetCount("status=2 and user_id=" + uid); } if ((page - 1) * pageSize >= sum) { //没有更多数据 context.Response.Write("{\"status\":0,\"msg\":\"没有更多数据\"}"); return; } DataSet ds = new DataSet(); if (uid == 0) { ds = new BLL.product().GetList(pageSize, page, "status=2 and city=" + (city == "未知" ? "city" : "'" + city + "'") + " and category=" + (category == 0 ? "category" : category.ToString()) + " and title like '%" + keywords + "%'", "pass_time desc", out count); } else { ds = new BLL.product().GetList(pageSize, page, "status=2 and user_id=" + uid, "pass_time desc", out count); } DataTable dt = ds.Tables[0]; dt.Columns.Add("zan", typeof(int)); dt.Columns.Add("collect", typeof(int)); dt.Columns.Add("view", typeof(int)); foreach (DataRow dr in dt.Rows) { dr["view"] = new BLL.news_view().GetCount("news_id=" + dr["id"].ToString() + " and isPN=1 and type=1"); dr["collect"] = new BLL.news_commend().GetCount("news_id=" + dr["id"].ToString()); dr["zan"] = new BLL.news_view().GetCount("news_id=" + dr["id"].ToString() + " and isPN=1 and type=2"); } string strJson = DTcms.Common.JsonHelper.DataTableToJSON(ds.Tables[0]); context.Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { rpid = DTRequest.GetInt("rpid", 0); if (rpid == 0) { JscriptMsg("传输参数不正确!", "back"); return; } RptBind("rpd_rpid=" + rpid + "", "rpd_oid"); }
private void get_pm_proList(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); DataTable dt = new BLL.product().GetList(0, "user_id=" + uid, "add_time desc").Tables[0]; foreach (DataRow dr in dt.Rows) { dr["cont"] = dr["cont"].ToString().Length > 50 ? dr["cont"].ToString().Substring(0, 50) + "..." : dr["cont"].ToString(); } context.Response.Write(JsonHelper.DataTableToJSON(dt)); }
private void get_amount_list(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); DataTable dt = new BLL.amount().GetList(0, "user_id=" + uid, "time desc").Tables[0]; dt.Columns.Add("add_time", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["add_time"] = Convert.ToDateTime(dr["time"]).ToString("yyyy-MM-dd HH:mm:ss"); } context.Response.Write(JsonHelper.DataTableToJSON(dt)); }
protected void Page_Load(object sender, EventArgs e) { this.board_id = DTRequest.GetInt("board_id", 0); if (!Page.IsPostBack) { ChkAdminLevel("plugin_forum_moderator", DTEnums.ActionEnum.View.ToString()); //检查权限 TreeBind(); RptBind(" BoardId=" + board_id + " ", " id asc "); //添加where子句和order子句 } }
private void get_pm_model(HttpContext context) { int id = DTRequest.GetInt("id", 0); DataTable dt = new BLL.user_pm().GetList(0, "user_id=" + id, "").Tables[0]; dt.Columns.Add("start", typeof(float)); dt.Columns.Add("call", typeof(int)); DataTable t = new BLL.user().DoSql("select avg(value) as start,count(1) as call from fg_assess"); dt.Rows[0]["start"] = t.Rows[0]["start"] == DBNull.Value ? 0 : t.Rows[0]["start"]; dt.Rows[0]["call"] = t.Rows[0]["call"]; context.Response.Write(JsonHelper.DataTableToJSON(dt).TrimStart('[').TrimEnd(']')); }
private void pm_del_pro(HttpContext context) { int id = DTRequest.GetInt("id", 0); if (new BLL.product().Delete(id)) { context.Response.Write("{\"status\":1,\"msg\":\"删除成功!\"}"); } else { context.Response.Write("{\"status\":0,\"msg\":\"删除失败!\"}"); } }
protected void Page_Load(object sender, EventArgs e) { this.pageSize = GetPageSize(10); //每页数量 _tag = DTRequest.GetInt("tag", 0); rpID = DTRequest.GetInt("id", 0); if (this.rpID == 0) { JscriptMsg("传输参数不正确!", "back"); return; } model = new BLL.ReceiptPay().GetModel(rpID); if (model == null) { JscriptMsg("记录不存在!", "back"); return; } _orderId = DTRequest.GetString("txtOrderId"); _moneyType = DTRequest.GetString("ddlMoneyType"); _sign = DTRequest.GetString("ddlsign"); _money = DTRequest.GetString("txtMoney"); _chk = DTRequest.GetString("txtChk"); _sdate = DTRequest.GetString("txtsDate"); _edate = DTRequest.GetString("txteDate"); _sdate1 = DTRequest.GetString("txtsDate1"); _edate1 = DTRequest.GetString("txteDate1"); _person = DTRequest.GetString("txtPerson"); if (!IsPostBack) { ddlMoneyType.Items.Insert(0, new ListItem(model.rp_type.Value ? "应收金额" : "应付金额", "0")); ddlMoneyType.Items.Insert(1, new ListItem(model.rp_type.Value ? "已收金额" : "已付金额", "1")); ddlMoneyType.Items.Insert(2, new ListItem(model.rp_type.Value ? "未收金额" : "未付金额", "2")); if (_tag == 0) { _moneyType = "2"; _money = "0"; _sign = "<>"; } RptBind(); } txtOrderId.Text = _orderId; ddlMoneyType.SelectedValue = _moneyType; ddlsign.SelectedValue = _sign; txtMoney.Text = _money; txtChk.Text = _chk; txtsDate.Text = _sdate; txteDate.Text = _edate; txtsDate1.Text = _sdate1; txteDate1.Text = _edate1; txtPerson.Text = _person; }
private void is_assess(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); int pm_id = DTRequest.GetInt("pm_id", 0); DataTable dt = new BLL.assess().GetList(0, "user_id=" + uid + " and pm_id=" + pm_id, "").Tables[0]; if (dt.Rows.Count > 0) { context.Response.Write("{\"status\":0,\"msg\":\"已经评价过当前客户经理\",\"val\":\"" + dt.Rows[0]["value"] + "\"}"); } else { context.Response.Write("{\"status\":1,\"msg\":\"尚未评价过当前客户经理\"}"); } }
private void register(HttpContext context) { string avatar = DTRequest.GetString("avatar"); string nickname = DTRequest.GetString("nickname"); string openid = DTRequest.GetString("openid"); int parent_id = DTRequest.GetInt("parent_id", 0); int gender = DTRequest.GetInt("gender", 0); string country = DTRequest.GetString("country"); string province = DTRequest.GetString("province"); string city = DTRequest.GetString("city"); Model.user model = new Model.user(); model.avatar = avatar; model.nickname = nickname; model.openid = openid; model.parent_id = parent_id; model.sex = gender; model.amount = 0M; if (new BLL.user().GetCount("openid='" + openid + "'") == 0 && new BLL.user().Add(model) > 0) //注册 //成功邀请 { if (new BLL.amount().GetCount("type=2 and user_id=" + parent_id) < 10) { Model.amount amount = new Model.amount() { user_id = parent_id, type = 2, Amount = 0.88M, remark = "成功邀请用户", time = DateTime.Now }; new BLL.amount().Add(amount); new BLL.user().UpdateField(parent_id, "amount=amount+" + amount.Amount); } string ret = JsonHelper.DataTableToJSON(new BLL.user().GetList(1, "openid='" + openid + "'", "").Tables[0]); ret = ret.TrimEnd(']').TrimStart('['); context.Response.Write(ret); } else { string ret = JsonHelper.DataTableToJSON(new BLL.user().GetList(1, "openid='" + openid + "'", "").Tables[0]); ret = ret.TrimEnd(']').TrimStart('['); context.Response.Write(ret); } }
protected void Page_Load(object sender, EventArgs e) { _ubaid = DTRequest.GetInt("ubaid", 0); if (_ubaid == 0) { JscriptMsg("传输参数不正确!", "back"); return; } DataTable dt = new BLL.unBusinessApply().GetList(0, "uba_id=" + _ubaid + "", "uba_id").Tables[0]; if (dt == null || dt.Rows.Count == 0) { JscriptMsg("数据不存在!", "back"); return; } dr = dt.Rows[0]; manager = GetAdminInfo(); }
public void CheckUser() { if (DTRequest.GetInt("uId", 0) != 0) { int Uid = DTRequest.GetInt("uId", 0); BLL.users bll = new BLL.users(); Model.users modelUser = bll.GetModel(Uid); if (modelUser != null) { modelUser.is_lock = 0; if (bll.Update(modelUser)) { ToFirstPay(modelUser); //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功');window.location.href='index.aspx'</script>"); } } } }
private void get_news_list(HttpContext context) { int page = DTRequest.GetInt("page", 1); string keywords = DTRequest.GetString("keywords"); int count = 0; int pageSize = 4; int sum = new BLL.news().GetCount(""); if ((page - 1) * pageSize > sum) { //没有更多数据 context.Response.Write("{\"status\":0,\"msg\":\"没有更多数据\"}"); return; } DataSet ds = new BLL.news().GetList(pageSize, page, "title like '%" + keywords + "%'", "sort,time desc", out count); DataTable dt = ds.Tables[0]; dt.Columns.Add("zan", typeof(int)); dt.Columns.Add("collect", typeof(int)); dt.Columns.Add("view", typeof(int)); string[] arr = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { arr[i] = Convert.ToDateTime(dt.Rows[i]["time"].ToString()).ToString("yyyy-MM-dd HH:mm"); } dt.Columns.Remove("time"); dt.Columns.Add("time", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["view"] = new BLL.news_view().GetCount("news_id=" + dr["id"].ToString() + " and isPN=2 and type=1"); dr["collect"] = new BLL.news_commend().GetCount("news_id=" + dr["id"].ToString()); dr["zan"] = new BLL.news_view().GetCount("news_id=" + dr["id"].ToString() + " and isPN=2 and type=2"); dr["time"] = arr[dt.Rows.IndexOf(dr)]; } string strJson = DTcms.Common.JsonHelper.DataTableToJSON(ds.Tables[0]); context.Response.Write(strJson); }
/// <summary> /// 浏览目录文件 /// </summary> private void ListFileManager(HttpContext context, string filePath, string fileTypes) { int Start = DTRequest.GetInt("start", 0); //开始索引 int Size = DTRequest.GetInt("size", 20); //每页大小 int Total = 0; //文件总数 string State = "SUCCESS"; //状态,默认成功 String[] FileList = null; var buildingList = new List <String>(); try { var localPath = Utils.GetMapPath(filePath); buildingList.AddRange(Directory.GetFiles(localPath, "*", SearchOption.AllDirectories) .Where(x => fileTypes.Contains(Path.GetExtension(x).ToLower())) .Select(x => filePath + x.Substring(localPath.Length).Replace("\\", "/"))); Total = buildingList.Count; FileList = buildingList.OrderBy(x => x).Skip(Start).Take(Size).ToArray(); } catch (UnauthorizedAccessException) { State = "文件系统权限不足"; } catch (DirectoryNotFoundException) { State = "路径不存在"; } catch (IOException) { State = "文件系统读取错误"; } finally { Hashtable hash = new Hashtable(); hash["state"] = State; hash["list"] = FileList == null ? null : FileList.Select(x => new { url = x }); hash["start"] = Start; hash["total"] = Total; context.Response.AddHeader("Content-Type", "text/plain; charset=UTF-8"); context.Response.Write(JsonHelper.ObjectToJSON(hash)); context.Response.End(); } }
private void Upload(HttpContext context) { bool iswater = false; //默认不打水印 bool isthumbnail = false; //默认不生成缩略图 int upType = DTRequest.GetInt("type", 0); //上传类型 0图片、1文件、2视频 int width = DTRequest.GetInt("width", siteConfig.thumbnailwidth); int height = DTRequest.GetInt("height", siteConfig.thumbnailheight); HttpPostedFile upFile = context.Request.Files["Filedata"]; if (DTRequest.GetQueryString("IsWater") == "1") { iswater = true; } if (DTRequest.GetQueryString("IsThumbnail") == "1") { isthumbnail = true; } if (null == upFile) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); return; } //开始上传 Model.upLoad model = new UpLoad().fileSaveAs(upFile, upType, isthumbnail, iswater, width, height); if (model.status > 0) { JsonHelper.WriteJson(context, new { status = 1, msg = model.msg, name = model.name, path = model.path, thumb = model.thumb, size = model.size, ext = model.ext }); } else { JsonHelper.WriteJson(context, new { status = 0, msg = model.msg }); } }
private void get_news_commend(HttpContext context) { int news_id = DTRequest.GetInt("id", 0); DataTable dt = new BLL.news_commend().GetList(0, "news_id=" + news_id, "time").Tables[0]; string[] arr = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { arr[i] = Convert.ToDateTime(dt.Rows[i]["time"].ToString()).ToString("yyyy-MM-dd HH:mm"); } dt.Columns.Remove("time"); dt.Columns.Add("time"); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["time"] = arr[i]; } context.Response.Write(JsonHelper.DataTableToJSON(dt)); }
protected void Page_Load(object sender, EventArgs e) { this.board_id = DTRequest.GetInt("board_id", 0); if (board_id == 0) { board_name = "所有版块"; } else { board_name = new BLL.Forum_Board().GetModel(board_id).Name; } if (!Page.IsPostBack) { ChkAdminLevel("plugin_forum_boardactionpoint", DTEnums.ActionEnum.View.ToString()); //检查权限 RptBind(); //添加where子句和order子句 } }
private void pm_assess(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); int pm_id = DTRequest.GetInt("pm_id", 0); int val = DTRequest.GetInt("val", 0); Model.assess model = new Model.assess(); model.user_id = uid; model.pm_id = pm_id; model.value = val; model.time = DateTime.Now; if (new BLL.assess().Add(model) > 0) { context.Response.Write("{\"status\":1,\"msg\":\"评论成功!\"}"); } else { context.Response.Write("{\"status\":0,\"msg\":\"评论失败!\"}"); } }
private void news_view(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); int isPN = DTRequest.GetInt("isPN", 0); int type = DTRequest.GetInt("type", 0); int newsId = DTRequest.GetInt("id", 0); Model.news_view model = new Model.news_view(); model.user_id = uid; model.ispn = isPN; model.type = type; model.news_id = newsId; model.time = DateTime.Now; if (uid == 0 || new BLL.news_view().GetCount("user_id=" + uid + " and isPN=" + isPN + " and type=" + type + " and news_id=" + newsId) == 0) { new BLL.news_view().Add(model); if (model.type == 2) { context.Response.Write("{\"status\":1,\"msg\":\"收藏成功!\"}"); } else { context.Response.Write("{\"status\":1,\"msg\":\"浏览量+1\"}"); } } else {//更新浏览时间,取消收藏 if (type == 1) { context.Response.Write(news_view_update(model)); } else { context.Response.Write(news_collect_cancel(model)); } } }
private void get_proUser_comment(HttpContext context) { int user_id = DTRequest.GetInt("uid", 0); //select * from fg_news_commend where news_id in(select id from fg_product where user_id=1) and isPN=1 order by time desc DataTable dt = new BLL.product().GetUserComment(user_id).Tables[0]; string[] arr = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { arr[i] = Convert.ToDateTime(dt.Rows[i]["time"].ToString()).ToString("yyyy-MM-dd HH:mm"); } dt.Columns.Remove("time"); dt.Columns.Add("time", typeof(string)); dt.Columns.Add("phone", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["time"] = arr[dt.Rows.IndexOf(dr)]; Model.user user = new BLL.user().GetModel(Convert.ToInt32(dr["user_id"])); dr["phone"] = user.phone; } context.Response.Write(JsonHelper.DataTableToJSON(dt)); }
private void get_pro_model(HttpContext context) { int id = DTRequest.GetInt("id", 0); int uid = DTRequest.GetInt("uid", 0); DataTable dt = new BLL.product().GetList(1, "id=" + id, "").Tables[0]; DataRow dr = new BLL.user_pm().GetList(1, "user_id=" + Convert.ToInt32(dt.Rows[0]["user_id"]), "").Tables[0].Rows[0]; if (dt.Rows.Count > 0) { string pass_time = Convert.ToDateTime(dt.Rows[0]["pass_time"]).ToString("yyyy-MM-dd HH:mm"); string add_time = Convert.ToDateTime(dt.Rows[0]["add_time"]).ToString("yyyy-MM-dd HH:mm"); dt.Columns.Remove("pass_time"); dt.Columns.Add("pass_time", typeof(string)); dt.Columns.Remove("add_time"); dt.Columns.Add("add_time", typeof(string)); dt.Columns.Add("isCollect", typeof(int)); dt.Rows[0]["pass_time"] = pass_time; dt.Rows[0]["add_time"] = add_time; dt.Columns.Add("category2", typeof(int)); dt.Rows[0]["category2"] = new BLL.pro_category().GetModel(Convert.ToInt32(dt.Rows[0]["category"])).parent_id; if (uid != 0) { dt.Rows[0]["isCollect"] = new BLL.news_view().GetCount("user_id=" + uid + " and isPN=2 and type=2 and news_id=" + dt.Rows[0]["id"].ToString()) > 0 ? 1 : 0; } else { dt.Rows[0]["isCollect"] = 0; } dt.Columns.Add("pm_id", typeof(int)); dt.Rows[0]["pm_id"] = dr["user_id"]; dt.Columns.Add("pm_name", typeof(string)); dt.Rows[0]["pm_name"] = dr["name"]; dt.Columns.Add("pm_tel", typeof(string)); dt.Rows[0]["pm_tel"] = dr["phone"]; context.Response.Write(JsonHelper.DataTableToJSON(dt).TrimEnd(']').TrimStart('[')); } }
private void go_share(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); Model.share_log share = new Model.share_log(); share.user_id = uid; share.time = DateTime.Now; new BLL.share_log().Add(share); if (new BLL.share_log().GetCount("DateDiff(dd,time,getdate())=0 and user_id=" + uid) == 3) {//当日第三次分享,获得积分 Model.point model = new Model.point(); model.user_id = uid; model.value = 10; model.remark = "每日分享三次到微信群"; model.add_time = DateTime.Now; new BLL.point().Add(model); new BLL.user().UpdateField(uid, "point=point+" + model.value); context.Response.Write("{\"status\":1,\"msg\":\"分享成功并获得积分!\"}"); } else { context.Response.Write("{\"status\":1,\"msg\":\"分享成功!\"}"); } }
private void register_pm(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); string name = DTRequest.GetString("name"); string birthday = DTRequest.GetString("birthday"); int sex = DTRequest.GetInt("sex", 0); string origin = DTRequest.GetString("origin"); string phone = DTRequest.GetString("phone"); string comName = DTRequest.GetString("comName"); string job = DTRequest.GetString("job"); int year = DTRequest.GetInt("year", 0); string jobImg = DTRequest.GetString("jobImg"); string img = DTRequest.GetString("img"); if (uid == 0) { context.Response.Write("{\"status\":0,\"msg\":\"未登录,请登录后重新提交!\"}"); return; } if (name == "") { context.Response.Write("{\"status\":0,\"msg\":\"请输入姓名!\"}"); return; } if (sex == 0) { context.Response.Write("{\"status\":0,\"msg\":\"请选择性别!\"}"); return; } if (origin == "") { context.Response.Write("{\"status\":0,\"msg\":\"请输入籍贯!\"}"); return; } if (phone == "") { context.Response.Write("{\"status\":0,\"msg\":\"请输入电话号码!\"}"); return; } if (comName == "") { context.Response.Write("{\"status\":0,\"msg\":\"请输入公司名称!\"}"); return; } if (job == "") { context.Response.Write("{\"status\":0,\"msg\":\"请输入所在岗位!\"}"); return; } if (jobImg == "" || jobImg == "undefined" || img == "" || img == "undefined") { context.Response.Write("{\"status\":0,\"msg\":\"请上传工牌照片和生活照!\"}"); return; } Model.user_pm model = new Model.user_pm(); model.user_id = uid; model.name = name; model.sex = sex; model.origin = origin; model.phone = phone; model.comname = comName; model.job = job; model.year = year; model.jobimg = jobImg; model.img = img; model.status = 1; model.add_time = DateTime.Now; if (new BLL.user_pm().Add(model) > 0) { new BLL.user().UpdateField(uid, "level=1"); context.Response.Write("{\"status\":1,\"msg\":\"提交成功!\"}"); } else { context.Response.Write("{\"status\":0,\"msg\":\"提交失败,请重新提交!\"}"); } }
//收藏列表,点赞列表 private void get_user_view_list(HttpContext context) { int uid = DTRequest.GetInt("uid", 0); int isPN = DTRequest.GetInt("isPN", 0); int type = DTRequest.GetInt("type", 0); DataTable dt = new BLL.news_view().GetList(0, "type=" + type + " and isPN=" + isPN + " and user_id=" + uid, "time desc").Tables[0]; dt.Columns.Add("title", typeof(string)); dt.Columns.Add("cont", typeof(string)); dt.Columns.Add("day", typeof(string)); foreach (DataRow dr in dt.Rows) { string title, cont; if (isPN == 1) { Model.product model = new BLL.product().GetModel(Convert.ToInt32(dr["news_id"])); title = model.title; if (model.cont.Length > 60) { cont = model.cont.Substring(0, 60) + "..."; } else { cont = model.cont; } } else { Model.news model = new BLL.news().GetModel(Convert.ToInt32(dr["news_id"])); title = model.title; if (model.zhaiyao.Length > 60) { cont = model.zhaiyao.Substring(0, 60) + "..."; } else { cont = model.zhaiyao; } } dr["title"] = title; dr["cont"] = cont; //时间隔计算 DateTime t1 = DateTime.Now; DateTime t2 = Convert.ToDateTime(dr["time"]); TimeSpan ts = t1.Subtract(t2); if (ts.Days > 3) { dr["day"] = Convert.ToDateTime(dr["time"]).ToString("yyyy-MM-dd"); } else if (ts.Days > 0) { dr["day"] = ts.Days + "天前"; } else if (ts.Hours > 0) { dr["day"] = ts.Hours + "小时前"; } else if (ts.Minutes > 0) { dr["day"] = ts.Minutes + "分钟前"; } else if (ts.Seconds > 0) { dr["day"] = ts.Seconds + "秒前"; } else { dr["day"] = "未知"; } } context.Response.Write(JsonHelper.DataTableToJSON(dt)); }