/// <summary> /// 获取商家审核设置模式 小程序发帖时请求 /// </summary> /// <returns></returns> public ActionResult GetCityReviewSetting() { returnObj = new Return_Msg_APP(); string appId = Context.GetRequest("appId", string.Empty); if (string.IsNullOrEmpty(appId)) { returnObj.Msg = "参数错误"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { returnObj.Msg = "小程序未授权"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } PlatMsgConf platMsgConf = PlatMsgConfBLL.SingleModel.GetMsgConf(r.Id); if (platMsgConf == null) { returnObj.Msg = "审核配置异常"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } returnObj.isok = true; returnObj.dataObj = new { obj = platMsgConf }; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 保存审核配置 /// </summary> /// <param name="aid"></param> /// <param name="reviewSetting"></param> /// <returns></returns> public ActionResult SaveConf(int aid = 0, int reviewSetting = 0) { result = new PlatReturnMsg(); if (aid <= 0) { result.Msg = "appId非法"; return(Json(result)); } PlatMsgConf model = PlatMsgConfBLL.SingleModel.GetMsgConf(aid); if (model == null) { result.Msg = "数据不存在"; return(Json(result)); } model.ReviewSetting = reviewSetting; model.UpdateTime = DateTime.Now; if (PlatMsgConfBLL.SingleModel.Update(model, "ReviewSetting,UpdateTime")) { result.isok = true; result.Msg = "操作成功"; return(Json(result)); } else { result.Msg = "操作失败"; return(Json(result)); } }
/// <summary> /// 信息审核配置 /// </summary> /// <param name="aid"></param> /// <returns></returns> public ActionResult Conf(int aid = 0) { if (aid <= 0) { return(View("PageError", new PlatReturnMsg() { Msg = "参数错误!", code = "500" })); } int pageType = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(aid); if (pageType <= 0) { return(View("PageError", new PlatReturnMsg() { Msg = "小程序模板不存在!", code = "500" })); } ViewBag.PageType = pageType; PlatMsgConf model = PlatMsgConfBLL.SingleModel.GetMsgConf(aid); int id = 0; if (model == null) { model = new PlatMsgConf() { Aid = aid, ReviewSetting = 0, UpdateTime = DateTime.Now }; id = Convert.ToInt32(PlatMsgConfBLL.SingleModel.Add(model)); if (id <= 0) { return(View("PageError", new PlatReturnMsg() { Msg = "初始化审核配置异常!", code = "500" })); } } ViewBag.appId = aid; return(View(model)); }
/// <summary> /// 发帖 /// </summary> /// <param name="jsondata"></param> /// <param name="ordertype"></param> /// <param name="paytype"></param> /// <param name="aid"></param> /// <param name="order"></param> /// <param name="MyCardId"></param> /// <returns></returns> public string saveMsg(string jsondata, int ordertype, int paytype, int aid, ref CityMorders order, int userId) { if (string.IsNullOrEmpty(jsondata)) { return("json参数错误"); } SavePlatMsgModel savePlatMsgModelJson = JsonConvert.DeserializeObject <SavePlatMsgModel>(jsondata); if (savePlatMsgModelJson == null) { return("null参数错误"); } double lng = 0.00; double lat = 0.00; //校验手机号码 if (!Regex.IsMatch(savePlatMsgModelJson.Phone, @"\d") || savePlatMsgModelJson.Phone.Length > 11) { return("联系号码不符合"); } if (string.IsNullOrEmpty(savePlatMsgModelJson.Location)) { return("请填写地址"); } if (string.IsNullOrEmpty(savePlatMsgModelJson.MsgDetail)) { return("发布信息不能为空"); } if (!double.TryParse(savePlatMsgModelJson.Lng, out lng) || !double.TryParse(savePlatMsgModelJson.Lat, out lat)) { return("地址坐标错误"); } if (savePlatMsgModelJson.MsgType <= 0) { return("请选择信息类别"); } PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid); if (platMyCard == null) { return("请先注册"); } PlatMsg platMsg = new PlatMsg(); platMsg.AddTime = DateTime.Now; platMsg.Aid = aid; platMsg.Lat = savePlatMsgModelJson.Lat; platMsg.Lng = savePlatMsgModelJson.Lng; platMsg.Location = savePlatMsgModelJson.Location; platMsg.MsgDetail = HttpUtility.HtmlEncode(savePlatMsgModelJson.MsgDetail); platMsg.MsgTypeId = savePlatMsgModelJson.MsgType; platMsg.Phone = savePlatMsgModelJson.Phone; platMsg.MyCardId = platMyCard.Id; platMsg.Imgs = savePlatMsgModelJson.Imgs; PlatMsgConf platMsgConf = PlatMsgConfBLL.SingleModel.GetMsgConf(aid); if (platMsgConf == null) { return("商家配置异常"); } switch (platMsgConf.ReviewSetting) { case 0: //不需要审核 if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.State = 1; platMsg.Review = 0; platMsg.PayState = 1; platMsg.ReviewTime = DateTime.Now; } else { platMsg.State = 0; //支付回成功调后再变更1 platMsg.PayState = 0; //支付回成功调后再变更1 platMsg.ReviewTime = DateTime.Now; platMsg.Review = 0; } break; case 1: //先审核后发布 platMsg.State = 0; //审核通过后变为1 platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.PayState = 1; } else { platMsg.PayState = 0; //支付回成功调后再变更为1 } break; case 2: //先发布后审核 platMsg.ReviewTime = DateTime.Now; if (savePlatMsgModelJson.IsTop == 0) { //不置顶消息 platMsg.State = 1; platMsg.PayState = 1; platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 } else { platMsg.State = 0; //支付回成功调后再变更为1 platMsg.PayState = 0; //支付回成功调后再变更为1 platMsg.Review = 1; //审核通过后变为2 审核不通过变为-1 } break; } if (savePlatMsgModelJson.IsTop == 0) { //表示不置顶的消息 platMsg.TopDay = 0; platMsg.IsTop = 0; platMsg.TopCostPrice = 0; int msgId = Convert.ToInt32(base.Add(platMsg)); if (msgId <= 0) { return("发布信息异常"); } else { return(string.Empty); } } else { //表示置顶消息 需要 生成微信订单,然后微信支付,支付成功后回调将状态变为1可用 if (savePlatMsgModelJson.RuleId <= 0) { return("请选择置顶时间"); } PlatMsgRule platMsgRule = PlatMsgRuleBLL.SingleModel.GetMsgRules(aid, savePlatMsgModelJson.RuleId); if (platMsgRule == null) { return("非法操作(置顶时间有误)"); } platMsg.TopDay = platMsgRule.ExptimeDay; platMsg.TopCostPrice = platMsgRule.Price; platMsg.IsTop = 1; int msgId = Convert.ToInt32(base.Add(platMsg)); if (msgId <= 0) { return("发布信息异常"); } else { order.Articleid = platMsgRule.Id; order.CommentId = msgId; order.MinisnsId = aid; order.payment_free = platMsg.TopCostPrice; order.ShowNote = $"平台版小程序分类信息发置顶帖付款{order.payment_free * 0.01}元"; return(string.Empty); } } }