コード例 #1
0
        /// <summary>
        /// 获取类目
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCategoryData()
        {
            try
            {
                var amodel = OpenAuthorizerInfoBLL.SingleModel.GetModel("authorizer_appid='wx9cb1d8be83da075b'");
                if (amodel != null)
                {
                    var result = XcxApis.XcxApis_get_category(amodel.authorizer_access_token);
                    if (result != null)
                    {
                        if (result.category_list.Count > 0)
                        {
                            var classdata = result.category_list.Where(w => w.first_class == "生活服务" && w.second_class == "综合生活服务平台").ToList();
                            if (classdata != null && classdata.Count > 0)
                            {
                                var ftclass = classdata[0].first_class;
                                var ftid    = classdata[0].first_id;
                                var sdclass = classdata[0].second_class;
                                var sdid    = classdata[0].second_id;
                            }
                        }
                        return(Json(new { code = 1, msg = "获取成功", obj = result }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { code = -1, msg = "获取失败", obj = result }, JsonRequestBehavior.AllowGet));
                    }
                }

                return(Json(new { code = -1, msg = "请先授权" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { code = 0, msg = "操作异常,msg=" + ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        /// <summary>
        /// 提交小程序代码审核
        /// </summary>
        /// <returns></returns>
        public ActionResult SubmitAudit()
        {
            try
            {
                var amodel = OpenAuthorizerInfoBLL.SingleModel.GetModel("authorizer_appid='wx9cb1d8be83da075b'");
                if (amodel != null)
                {
                    var cresult = XcxApis.XcxApis_get_category(amodel.authorizer_access_token);
                    if (cresult.errcode == 0)
                    {
                        if (cresult.category_list.Count > 0)
                        {
                            var classdata = cresult.category_list.Where(w => w.first_class == "生活服务" && w.second_class == "综合生活服务平台").ToList();
                            if (classdata != null && classdata.Count > 0)
                            {
                                var ftclass = classdata[0].first_class;
                                var ftid    = classdata[0].first_id;
                                var sdclass = classdata[0].second_class;
                                var sdid    = classdata[0].second_id;

                                SubmitModel data = new SubmitModel();
                                data.item_list = new List <ItemListModel> {
                                    new ItemListModel()
                                    {
                                        address      = "pages/launch/launch",
                                        tag          = "同城 114 分类信息 便民 本地 生活",
                                        first_class  = ftclass,
                                        second_class = sdclass,
                                        first_id     = ftid,
                                        second_id    = sdid,
                                        title        = "招聘求职、房产租售、二手车/物品",
                                    }
                                };
                                var result = XcxApis.XcxApis_submit_audit(amodel.authorizer_access_token, data);
                                if (result.errcode == 0)
                                {
                                    return(Json(new { code = 1, msg = "提交成功", obj = result }, JsonRequestBehavior.AllowGet));
                                }
                                else
                                {
                                    return(Json(new { code = -1, msg = "提交失败", obj = result }, JsonRequestBehavior.AllowGet));
                                }
                            }
                            else
                            {
                                return(Json(new { code = -1, msg = "没有【生活服务》综合生活服务平台】服务分类", obj = classdata }, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            return(Json(new { code = -1, msg = "没有添加服务分类", obj = cresult }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json(new { code = -1, msg = cresult.errmsg, obj = cresult }, JsonRequestBehavior.AllowGet));
                    }
                }


                return(Json(new { code = -1, msg = "请先授权" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    code = 0,
                    msg = "操作异常,msg=" + ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }