/// <summary> /// 添加栏目表单数据 /// </summary> /// <param name="fields"></param> /// <param name="form"></param> public void SetData(IEnumerable <ColumnField> fields, JObject form) { foreach (var columnField in fields) { var formFieldName = columnField.Name.ToFieldNameLower(); var value = form.ContainsKey(formFieldName) ? form[formFieldName] : ""; switch (columnField.OptionType) { case ReactFormItemType.Input: case ReactFormItemType.Editor: case ReactFormItemType.TextArea: case ReactFormItemType.Select: case ReactFormItemType.Upload: case ReactFormItemType.Tags: case ReactFormItemType.Cascader: AddFieldAndValue(columnField.Name, value.ToStr()); break; case ReactFormItemType.Password: AddFieldAndValue(columnField.Name, Md5Helper.GetMD5_32(value.ToStr())); break; case ReactFormItemType.Switch: break; case ReactFormItemType.Radio: break; case ReactFormItemType.DataPicker: if (value.ToStr().IsNotEmpty()) { AddFieldAndValue(columnField.Name, value.ToStr().ToDateTime()); } else { AddFieldAndValue(columnField.Name, null); } break; case ReactFormItemType.CheckBox: break; case ReactFormItemType.RangePicker: break; case ReactFormItemType.Region: break; default: throw new Exception("无处理分类逻辑"); } } }
public void SetContentData(IEnumerable <ColumnField> fields, ContentData form) { AddFieldAndValue("Num", form.Num); AddFieldAndValue("CreateDate", form.CreateDate); AddFieldAndValue("UpdateDate", form.UpdateDate); AddFieldAndValue("CreateAccountNum", form.CreateAccountNum); AddFieldAndValue("UpdateAccountNum", form.UpdateAccountNum); AddFieldAndValue("IsDel", form.IsDel); AddFieldAndValue("Status", form.Status); AddFieldAndValue("SiteNum", form.SiteNum); AddFieldAndValue("ColumnNum", form.ColumnNum); AddFieldAndValue("CategoryNum", form.CategoryNum); AddFieldAndValue("SeoTitle", form.SeoTitle); AddFieldAndValue("SeoKeyword", form.SeoKeyword); AddFieldAndValue("SeoDesc", form.SeoDesc); AddFieldAndValue("ClickCount", form.ClickCount); AddFieldAndValue("IsTop", form.IsTop); foreach (var columnField in fields) { var formFieldName = columnField.Name.ToFieldNameLower(); var value = form.ContainsKey(formFieldName) ? form[formFieldName] : ""; switch (columnField.OptionType) { case ReactFormItemType.Input: case ReactFormItemType.Editor: case ReactFormItemType.TextArea: case ReactFormItemType.Select: case ReactFormItemType.Upload: case ReactFormItemType.Tags: case ReactFormItemType.Cascader: AddFieldAndValue(columnField.Name, value.ToStr()); break; case ReactFormItemType.Password: AddFieldAndValue(columnField.Name, Md5Helper.GetMD5_32(value.ToStr())); break; case ReactFormItemType.Switch: break; case ReactFormItemType.Radio: break; case ReactFormItemType.CheckBox: break; case ReactFormItemType.DataPicker: break; case ReactFormItemType.RangePicker: break; case ReactFormItemType.Region: break; default: throw new Exception("无处理分类逻辑"); } } }
/// <summary> /// 生成管理员密码 /// </summary> /// <param name="password"></param> /// <returns></returns> public string PasswordToMd5(string password) { return(Md5Helper.GetMD5_32(password + "123")); }