Example #1
0
        public void Delete(ActionRequest req, ActionResponse res)
        {
            string msg = "";

            try
            {
                //权限判断,是否有登录(根据业务确定是否 限制为管理员)
                if (!Session.IsLogin) // (!Session.IsAdmin)
                {
                    res.Error(VERIFY_ERROR);
                    return;
                }

                ActReqParam param;
                if (!req.TryGetParam(ENTITY_REQ, out param))
                {
                    res.Error("参数" + ENTITY_REQ + "错误");
                    return;
                }
                int obId = 0;
                if (!param.TryGetInt(0, "obId", out obId))
                {
                    res.Error("参数" + ENTITY_REQ + "属性obId错误");
                    return;
                }

                //用户相关

                /*
                 * long userId = 0;
                 * if (!param.TryGetLong(0, "userId", out userId))
                 * {
                 *  res.Error("参数" + ENTITY_REQ + "的属性userId错误");
                 * }
                 */

                int code = 0;
                code = DeleteEntity(obId, out msg);
                //code = DeleteEntity(obId, userId, out msg);   //用户相关

                ActionResult ar = res.AddResult(RESULT, RESULT_FIELDS);
                ar.AddValues(code, msg);
            }
            catch (Exception ex)
            {
                msg = "ext.obModel.delete 接口调用异常";
                Logger.Error(ex, msg);
                res.Error(msg);
            }
        }