Exemplo n.º 1
0
        /// <summary>
        /// 添加或修改应用
        /// </summary>
        /// <returns></returns>
        public JsonResult InsertUpdateApp(JMP.MDL.jmp_app mod)
        {
            object retJson = new { success = 0, msg = "操作失败" };

            JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app();



            //string xgzfc = "";
            if (string.IsNullOrEmpty(mod.a_paymode_id))
            {
                retJson = new { success = 0, msg = "请选择支付类型" };
            }
            else
            {
                if (mod.a_apptype_id == 0)
                {
                    retJson = new { success = 0, msg = "请选择应用类型" };
                }
                else
                {
                    if (mod.a_id > 0)
                    {
                        #region 修改应用
                        JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app();
                        modapp = bll.GetModel(mod.a_id);
                        //克隆对象
                        // object modclone = CloneObject.Clone(modapp);
                        var modclone = modapp.Clone();
                        if (mod.a_apptype_id != modapp.a_apptype_id)
                        {
                            modapp.a_auditstate = 0;              //应用审核状态(0未审核)
                            modapp.a_rid        = 0;              //风险等级配置表id
                        }
                        modapp.a_name        = mod.a_name;        //应用名称
                        modapp.a_platform_id = mod.a_platform_id; //关联平台ID
                        modapp.a_paymode_id  = mod.a_paymode_id;  //关联支付类型ID
                        modapp.a_apptype_id  = mod.a_apptype_id;  //关联应用类型ID
                        modapp.a_notifyurl   = mod.a_notifyurl;   //回掉地址
                        modapp.a_user_id     = mod.a_user_id;     //开发者ID
                        modapp.a_showurl     = mod.a_showurl;     //同步地址
                        modapp.a_appurl      = mod.a_appurl;      //应用审核地址
                        modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介
                        if (mod.a_auditstate != 0)
                        {
                            if (string.IsNullOrEmpty(mod.a_auditor))
                            {
                                mod.a_auditor = UserInfo.UserName;
                            }
                        }
                        else
                        {
                            mod.a_auditor = "";
                        }
                        if (bll.Update(modapp))
                        {
                            Logger.ModifyLog("修改应用", modclone, modapp);

                            retJson = new { success = 1, msg = "修改成功" };
                        }
                        else
                        {
                            retJson = new { success = 0, msg = "修改失败" };
                        }
                        #endregion
                    }
                    else
                    {
                        #region 添加应用
                        mod.a_state      = 1;
                        mod.a_auditstate = 0;
                        mod.a_key        = "";
                        mod.a_secretkey  = "";
                        mod.a_time       = DateTime.Now;
                        int cg = bll.Add(mod);
                        if (cg > 0)
                        {
                            Logger.CreateLog("添加应用", mod);

                            //while (true)
                            //{
                            mod.a_key = DESEncrypt.Encrypt(mod.a_user_id + ";" + cg + ";" + DateTime.Now.ToString("yyyyMMddssmmfff"));
                            //if (!bll.Existss(mod.a_key))
                            //{
                            //    break;
                            //}
                            //}
                            mod.a_secretkey = DESEncrypt.Encrypt(cg + ";" + mod.a_key + ";" + DateTime.Now.ToString("yyyyMMddssmmfff"));
                            mod.a_id        = cg;
                            if (bll.Update(mod))
                            {
                                Logger.OperateLog("修改应用key", mod.a_key);

                                retJson = new { success = 1, msg = "添加成功" };
                            }
                            else
                            {
                                retJson = new { success = 0, msg = "添加失败" };
                            }
                        }
                        else
                        {
                            retJson = new { success = 0, msg = "添加失败" };
                        }
                        #endregion
                    }
                }
            }
            return(Json(retJson));
        }
Exemplo n.º 2
0
        public JsonResult InsertUpdateApp(JMP.MDL.jmp_app mod)
        {
            object retJson = new { success = 0, msg = "操作失败" };

            JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app();

            if (mod.a_apptype_id == 0)
            {
                retJson = new { success = 0, msg = "请选择应用类型" };
            }
            else
            {
                if (mod.a_id > 0)
                {
                    #region 修改应用

                    JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app();

                    modapp = bll.GetModel(mod.a_id);
                    var modclone = modapp.Clone();

                    modapp.a_name        = mod.a_name;        //应用名称
                    modapp.a_platform_id = mod.a_platform_id; //关联平台ID
                    modapp.a_paymode_id  = mod.a_paymode_id;  //关联支付类型ID
                    modapp.a_apptype_id  = mod.a_apptype_id;  //关联应用类型ID
                    modapp.a_notifyurl   = mod.a_notifyurl;   //回掉地址
                    modapp.a_showurl     = mod.a_showurl;     //同步地址
                    modapp.a_appurl      = mod.a_appurl;      //应用审核地址
                    modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介
                    //mod.a_auditstate = modapp.a_auditstate;//应用审核状态
                    //mod.a_key = modapp.a_key;
                    //mod.a_state = modapp.a_state;
                    //mod.a_secretkey = modapp.a_secretkey;
                    //mod.a_time = modapp.a_time;
                    //mod.a_user_id = modapp.a_user_id;
                    //mod.a_rid = modapp.a_rid;
                    if (bll.Update(modapp))
                    {
                        Logger.ModifyLog("修改应用", modclone, mod);
                        retJson = new { success = mod.a_id, msg = "修改成功" };
                    }
                    else
                    {
                        retJson = new { success = 0, msg = "修改失败" };
                    }
                    #endregion
                }
                else
                {
                    #region 添加应用
                    mod.a_rid        = 0;
                    mod.a_auditor    = "";
                    mod.a_state      = 1;
                    mod.a_auditstate = 0;
                    mod.a_key        = "";
                    mod.a_secretkey  = "";
                    mod.a_time       = DateTime.Now;
                    mod.a_user_id    = UserInfo.UserId;
                    int cg = bll.Add(mod);
                    if (cg > 0)
                    {
                        AddLocLog.AddUserLog(UserInfo.UserId, 3, RequestHelper.GetClientIp(), "添加应用", "添加应用");

                        mod.a_key = DESEncrypt.Encrypt(mod.a_user_id + ";" + cg + ";" + DateTime.Now.ToString("yyyyMMddssmmfff"));

                        mod.a_secretkey = DESEncrypt.Encrypt(cg + ";" + mod.a_key + ";" + DateTime.Now.ToString("yyyyMMddssmmfff"));
                        mod.a_id        = cg;
                        if (bll.Update(mod))
                        {
                            Logger.CreateLog("新增应用", mod);
                            retJson = new { success = 1, msg = "添加成功" };
                        }
                        else
                        {
                            retJson = new { success = 0, msg = "添加失败" };
                        }
                    }
                    else
                    {
                        retJson = new { success = 0, msg = "添加失败" };
                    }
                    #endregion
                }
            }
            return(Json(retJson));
        }