1,接入最新添加短信、邮件模版API并修改部分逻辑代码

2,接入最新获取默认模版API并修改部分逻辑代码
3,新建短信、邮件模版新增国内、国际模版选择
4,重构新建模版、编辑模版模块代码
5,梳理最新获取已有模版列表API修改
This commit is contained in:
“DaisyWu” 2024-07-09 16:04:56 +08:00
parent 3373b16d74
commit 7cd575009b
12 changed files with 339 additions and 232 deletions

View File

@ -114,7 +114,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
onTap: () {
Navigator.pushNamed(
context, Routers.customSMSTemplateListPage,
arguments: <String, int>{'type': type});
arguments: <String, int>{'channelType': type});
},
child: Row(
children: <Widget>[

View File

@ -1,5 +1,145 @@
import 'dart:convert';
class NewSMSTemplateEntity {
NewSMSTemplateEntity({
this.errorCode,
this.description,
this.errorMsg,
this.dataList,
});
NewSMSTemplateEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
if (json['data'] != null) {
dataList = <LangData>[];
json['data'].forEach((v) {
dataList!.add(LangData.fromJson(v));
});
}
}
int? errorCode;
String? description;
String? errorMsg;
List<LangData>? dataList;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (dataList != null) {
data['data'] = dataList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LangData {
LangData({
this.langType,
this.langName,
this.templates,
});
LangData.fromJson(Map<String, dynamic> json) {
langType = json['langType'];
langName = json['langName'];
if (json['templates'] != null) {
templates = <TemplateData>[];
json['templates'].forEach((v) {
templates!.add(TemplateData.fromJson(v));
});
}
}
int? langType;
String? langName;
List<TemplateData>? templates;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['langType'] = langType;
data['langName'] = langName;
if (templates != null) {
data['templates'] = templates!.map((v) => v.toJson()).toList();
}
return data;
}
}
class TemplateData {
TemplateData({
this.langType,
this.langName,
this.templateType,
this.templateName,
this.template,
this.templatePreviewCode,
});
TemplateData.fromJson(Map<String, dynamic> json) {
langType = json['langType'];
langName = json['langName'];
templateType = json['templateType'];
templateName = json['templateName'];
template = json['template'];
templatePreviewCode = json['templatePreviewCode'] != null
? jsonEncode(json['templatePreviewCode'])
: null;
}
int? langType;
String? langName;
int? templateType;
String? templateName;
String? template;
String? fixedKey;
String? templatePreviewCode; // Changed to String
String? regards = '';
String? tips = '';
int? id;
String? name;
int? channelType;
bool? isUpdate = false;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['langType'] = langType;
data['langName'] = langName;
data['templateType'] = templateType;
data['templateName'] = templateName;
data['template'] = template;
if (templatePreviewCode != null) {
data['templatePreviewCode'] = jsonDecode(templatePreviewCode!);
}
return data;
}
// New method to replace template variables with values from templatePreviewCode
String generatePreview() {
if (template == null || templatePreviewCode == null) {
return '';
}
// Decode the templatePreviewCode string back to a map
final Map<String, String> previewCodeMap =
Map<String, String>.from(jsonDecode(templatePreviewCode!));
String previewTemplate = template!;
previewCodeMap.forEach((String key, String value) {
previewTemplate = previewTemplate.replaceAll(
key, value + (value.length > 2 ? '\n' : ''));
});
return previewTemplate;
}
}
/*
class NewSMSTemplateEntity {
NewSMSTemplateEntity({
this.errorCode,
@ -99,3 +239,4 @@ class SMSTemplateData {
return previewTemplate;
}
}
*/

View File

@ -14,14 +14,19 @@ class NewSMSTemplateLogic extends BaseGetXController {
//-- 1: 2:
Future<void> getDefaultTemplate() async {
final NewSMSTemplateEntity entity = await ApiRepository.to
.getDefaultTemplate(type: state.templateType.value);
final NewSMSTemplateEntity entity =
await ApiRepository.to.getDefaultTemplate();
if (entity.errorCode!.codeIsSuccessful) {
state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
state.langTemplateList.value = entity.dataList ?? <LangData>[];
state.templateList.value =
entity.dataList![state.selectedLangIndex.value].templates ??
<TemplateData>[];
if (state.templateList.isNotEmpty) {
state.currentTemplate.value = state.templateList.firstWhere(
(SMSTemplateData element) =>
element.name == state.templateList[0].name,
(TemplateData element) =>
element.name ==
state.templateList[state.selectedTemplateIndex.value].name,
);
state.currentTemplate.refresh();
}
@ -35,12 +40,13 @@ class NewSMSTemplateLogic extends BaseGetXController {
return;
}
final LoginEntity entity = await ApiRepository.to.addTemplateService(
type: state.templateType.value,
name: state.templateNameTf.text,
fixedKey: state.currentTemplate.value.fixedKey ?? '',
contentType: state.currentTemplate.value.contentType ?? 0,
regards: state.templateOneTf.text,
tips: state.templateTwoTf.text);
channelType: state.channelType.value,
name: state.templateNameTf.text,
langType: state.currentTemplate.value.langType ?? 0,
regards: state.templateOneTf.text,
tips: state.templateTwoTf.text,
templateType: state.currentTemplate.value.templateType ?? 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('添加成功');
Get.back(result: true);
@ -75,15 +81,6 @@ class NewSMSTemplateLogic extends BaseGetXController {
//
List<TextSpan> buildElectronicKeySpan({required bool isPreview}) {
//
if (state.templateType.value == 1) {
return _buildSMSElectronicKey(isPreview);
} else {
return _buildEmailElectronicKey(isPreview);
}
}
List<TextSpan> _buildSMSElectronicKey(bool isPreview) {
final List<TextSpan> textSpans = <TextSpan>[];
//
if (isPreview) {
@ -110,6 +107,15 @@ class NewSMSTemplateLogic extends BaseGetXController {
textSpans.addAll(_buildDefaultTemplate(isPreview));
}
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}\n',
style: state.defaultStyle,
),
);
}
return textSpans;
}
@ -150,70 +156,6 @@ class NewSMSTemplateLogic extends BaseGetXController {
}
}
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
return textSpans;
}
List<TextSpan> _buildEmailElectronicKey(bool isPreview) {
final List<TextSpan> textSpans = <TextSpan>[];
//
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '${state.templateOneTf.text}\n',
style: state.defaultStyle,
),
);
} else {
String template = state.currentTemplate.value.template ?? '';
template = template.replaceAll('', '\n');
// ${}
final RegExp variableRegExp = RegExp(r'\{([^}]+)\}');
final Iterable<Match> matches = variableRegExp.allMatches(template);
int start = 0;
for (final Match match in matches) {
//
if (match.start > start) {
textSpans.add(
TextSpan(
text: template.substring(start, match.start),
style: state.defaultStyle,
),
);
}
//
textSpans.add(
TextSpan(
text: match.group(0),
style: state.highStyle,
),
);
start = match.end;
}
//
if (start < template.length) {
textSpans.add(
TextSpan(
text: template.substring(start),
style: state.defaultStyle,
),
);
}
}
return textSpans;
}
@ -229,89 +171,85 @@ class NewSMSTemplateLogic extends BaseGetXController {
),
);
}
//
if ((state.templateType.value == 1) ||
(state.templateType.value == 2 && isPreview == false)) {
if (isPreview) {
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
textSpans.add(
TextSpan(
text: state.currentTemplate.value.generatePreview(),
style: state.defaultStyle,
),
);
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
}
return textSpans;
}
// ${}
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
final String template = state.currentTemplate.value.template ?? '';
//
int startIndex = 0;
for (final Match match in variableRegExp.allMatches(template)) {
//
final String nonVariableText =
template.substring(startIndex, match.start);
//
final String replacedNonVariableText =
nonVariableText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
if (isPreview) {
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
textSpans.add(
TextSpan(
text: replacedNonVariableText,
text: state.currentTemplate.value.generatePreview(),
style: state.defaultStyle,
),
);
//
final String variableText = match.group(0) ?? '';
textSpans.add(
TextSpan(
text: variableText,
style: state.highStyle,
),
);
//
startIndex = match.end;
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
}
return textSpans;
}
//
final String remainingText = template.substring(startIndex);
// ${}
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
final String template = state.currentTemplate.value.template ?? '';
//
int startIndex = 0;
for (final Match match in variableRegExp.allMatches(template)) {
//
final String nonVariableText =
template.substring(startIndex, match.start);
//
final String replacedRemainingText =
remainingText.replaceAllMapped(RegExp(r'|。'), (Match match) {
final String replacedNonVariableText =
nonVariableText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
textSpans.add(
TextSpan(
text: replacedRemainingText,
text: replacedNonVariableText,
style: state.defaultStyle,
),
);
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
//
final String variableText = match.group(0) ?? '';
textSpans.add(
TextSpan(
text: variableText,
style: state.highStyle,
),
);
//
startIndex = match.end;
}
//
final String remainingText = template.substring(startIndex);
//
final String replacedRemainingText =
remainingText.replaceAllMapped(RegExp(r'|。'), (Match match) {
return '${match.group(0)}\n';
});
textSpans.add(
TextSpan(
text: replacedRemainingText,
style: state.defaultStyle,
),
);
//
if (isPreview) {
textSpans.add(
TextSpan(
text: '\n${state.templateTwoTf.text}',
style: state.defaultStyle,
),
);
}
return textSpans;

View File

@ -30,10 +30,10 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: state.isUpdate.value == false
? state.templateType.value == 1
? state.channelType.value == 1
? '新建短信模版'.tr
: '新建邮件模版'.tr
: state.templateType.value == 1
: state.channelType.value == 1
? '编辑短信模版'.tr
: '编辑邮件模版'.tr,
haveBack: true,
@ -84,12 +84,21 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
Obx(() => state.isUpdate.value == false
? CommonItem(
leftTitel: TranslationLoader.lanKeys!.type!.tr,
rightTitle: state.currentTemplate.value.typeName ?? '',
isHaveLine: false,
rightTitle: state.currentTemplate.value.templateName ?? '',
isHaveLine: true,
isHaveDirection: true,
action: _showSelectTemplateType,
)
: Container()),
Obx(() => state.isUpdate.value == false
? CommonItem(
leftTitel: '模版类型',
rightTitle: state.currentTemplate.value.langName ?? '',
isHaveLine: false,
isHaveDirection: true,
action: _showSelectLangType,
)
: Container()),
],
);
}
@ -123,18 +132,16 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
child: _buildTemplateWithType(isPreview: false),
)),
SizedBox(height: 10.h),
Obx(() => Visibility(
visible: state.templateType.value == 1,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h),
height: 100,
child: Stack(
alignment: Alignment.bottomRight,
children: <Widget>[
_buildTextField(state.templateTwoTf),
],
),
))),
Container(
margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h),
height: 100,
child: Stack(
alignment: Alignment.bottomRight,
children: <Widget>[
_buildTextField(state.templateTwoTf),
],
),
)
],
),
);
@ -169,7 +176,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
),
child: _buildTemplateWithType(isPreview: true),
)),
if (state.templateType.value == 1)
if (state.channelType.value == 1)
Padding(
padding: EdgeInsets.only(
left: 25.w,
@ -201,7 +208,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
} else {
return RichText(
text: TextSpan(
children: state.currentTemplate.value.typeName == '电子钥匙'
children: state.currentTemplate.value.templateName == '电子钥匙'
? logic.buildElectronicKeySpan(isPreview: isPreview)
: logic.buildPasswordSpan(isPreview: isPreview),
),
@ -228,8 +235,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
),
onChanged: (String value) {
setState(() {
controller.text = value;
logic.updateSmsCost(value); //
logic.updateSmsCost(controller.text); //
});
},
);
@ -269,7 +275,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
void _showSelectTemplateType() {
final List<String> titleList = state.templateList
.map((SMSTemplateData template) => template.typeName ?? '')
.map((TemplateData template) => template.templateName ?? '')
.toList();
ShowBottomSheetTool().showSingleRowPicker(
context,
@ -279,8 +285,35 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
data: titleList,
clickCallBack: (int index, Object str) {
state.selectedTemplateIndex.value = index;
state.currentTemplate.value = state.templateList[index];
state.currentTemplate.value.typeName = str.toString();
state.currentTemplate.value.templateName = str.toString();
state.selectedTemplateIndex.refresh();
state.currentTemplate.refresh();
},
);
}
void _showSelectLangType() {
// langName
final List<String> langNames = state.langTemplateList
.map((LangData langData) => langData.langName ?? '')
.toList();
ShowBottomSheetTool().showSingleRowPicker(
context,
normalIndex: 0,
title: TranslationLoader.lanKeys!.type!.tr,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
data: langNames,
clickCallBack: (int index, Object str) {
state.selectedLangIndex.value = index;
state.currentTemplate.value = state
.langTemplateList[state.selectedLangIndex.value]
.templates![state.selectedTemplateIndex.value];
state.currentTemplate.value.langName = str.toString();
state.selectedLangIndex.refresh();
state.currentTemplate.refresh();
},
);

View File

@ -12,7 +12,7 @@ class NewSMSTemplateState {
templateNameTf.text = currentTemplate.value.name ?? '';
templateOneTf.text = currentTemplate.value.regards ?? '';
templateTwoTf.text = currentTemplate.value.tips ?? '';
templateType.value = currentTemplate.value.type ?? 0;
channelType.value = currentTemplate.value.channelType ?? 0;
isUpdate.value = map['isUpdate'];
}
}
@ -30,10 +30,13 @@ class NewSMSTemplateState {
final TextEditingController templateNameTf = TextEditingController();
RxBool isVip = false.obs;
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs; //
RxList<TemplateData> templateList = <TemplateData>[].obs;
Rx<TemplateData> currentTemplate = TemplateData().obs; //
RxList<LangData> langTemplateList = <LangData>[].obs; //
RxInt selectedLangIndex = 0.obs; //
RxInt selectedTemplateIndex = 0.obs; //
RxBool isShowDate = false.obs; //
RxInt templateType = 0.obs; //1 2
RxInt channelType = 0.obs; //1 2
RxInt smsCost = 0.obs; //
RxString preContent = ''.obs; //
RxBool isUpdate = false.obs; //

View File

@ -29,7 +29,7 @@ class CustomSMSTemplateListEntity {
class CustomSMSTemplateListData {
CustomSMSTemplateListData(
{this.type,
{this.channelType,
this.list,
this.pageNo,
this.pageSize,
@ -37,7 +37,7 @@ class CustomSMSTemplateListData {
this.total});
CustomSMSTemplateListData.fromJson(Map<String, dynamic> json) {
type = json['type'];
channelType = json['channelType'];
if (json['list'] != null) {
list = <CustomSMSTemplateItem>[];
json['list'].forEach((v) {
@ -49,7 +49,7 @@ class CustomSMSTemplateListData {
pages = json['pages'];
total = json['total'];
}
int? type;
int? channelType;
List<CustomSMSTemplateItem>? list;
int? pageNo;
int? pageSize;
@ -58,7 +58,7 @@ class CustomSMSTemplateListData {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['type'] = type;
data['channelType'] = channelType;
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
@ -73,58 +73,51 @@ class CustomSMSTemplateListData {
class CustomSMSTemplateItem {
CustomSMSTemplateItem(
{this.id,
this.userId,
this.type,
this.contentType,
this.channelType,
this.templateType,
this.name,
this.regards,
this.tips,
this.fixedKey,
this.createdAt,
this.updatedAt,
this.template,
this.fixedTemplate});
this.langType,
this.template});
CustomSMSTemplateItem.fromJson(Map<String, dynamic> json) {
id = json['id'];
userId = json['user_id'];
type = json['type'];
contentType = json['content_type'];
channelType = json['channelType'];
templateType = json['templateType'];
name = json['name'];
regards = json['regards'];
tips = json['tips'];
fixedKey = json['fixed_key'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
langType = json['langType'];
template = json['template'];
fixedTemplate = json['fixed_template'];
}
int? id;
int? userId;
int? type;
int? contentType;
int? channelType;
int? templateType;
String? name;
String? regards;
String? tips;
String? fixedKey;
String? createdAt;
String? updatedAt;
int? langType;
String? template;
String? fixedTemplate;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['user_id'] = userId;
data['type'] = type;
data['content_type'] = contentType;
data['channelType'] = channelType;
data['templateType'] = templateType;
data['name'] = name;
data['regards'] = regards;
data['tips'] = tips;
data['fixed_key'] = fixedKey;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
data['langType'] = langType;
data['template'] = template;
data['fixed_template'] = fixedTemplate;
return data;
}
}

View File

@ -20,7 +20,7 @@ class CustomSMSTemplateListLogic extends BaseGetXController {
}
final CustomSMSTemplateListEntity entity = await ApiRepository.to
.getSMSTemplateList(
channelType: state.type.value,
channelType: state.channelType.value,
pageNo: pageNo,
pageSize: int.parse(pageSize));
if (entity.errorCode!.codeIsSuccessful) {

View File

@ -42,7 +42,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
barTitle: state.channelType.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: EasyRefreshTool(
@ -66,11 +66,11 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () async {
final SMSTemplateData templateData = SMSTemplateData();
templateData.type = state.type.value;
final TemplateData templateData = TemplateData();
templateData.channelType = state.channelType.value;
templateData.isUpdate = false;
templateData.typeName =
templateData.contentType == 1 ? '电子钥匙' : '密码';
templateData.templateName =
templateData.templateType == 1 ? '电子钥匙' : '密码';
final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: {
'currentTemplate': templateData,
@ -197,15 +197,16 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
CustomSMSTemplateItem itemData) {
return GestureDetector(
onTap: () async {
final SMSTemplateData templateData = SMSTemplateData();
final TemplateData templateData = TemplateData();
templateData.name = itemData.name;
templateData.regards = itemData.regards;
templateData.tips = itemData.tips;
templateData.id = itemData.id;
templateData.template = itemData.template;
templateData.contentType = itemData.contentType;
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
templateData.type = itemData.type;
templateData.templateType = itemData.templateType;
templateData.templateName =
templateData.templateName == 1 ? '电子钥匙' : '密码';
templateData.channelType = itemData.channelType;
templateData.isUpdate = true;
final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: {'currentTemplate': templateData, 'isUpdate': true});
@ -240,7 +241,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
padding: EdgeInsets.only(left: 20.w, top: 20.h, bottom: 20.h),
child: RichText(
text: TextSpan(
children: itemData.contentType == 1
children: itemData.templateType == 1
? logic.buildElectronicKeySpan(templateData: itemData)
: logic.buildPasswordSpan(templateData: itemData),
),

View File

@ -6,7 +6,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/
class CustomSMSTemplateListState {
CustomSMSTemplateListState() {
if (Get.arguments != null) {
type.value = Get.arguments['type'];
channelType.value = Get.arguments['channelType'];
}
}
//
@ -19,5 +19,5 @@ class CustomSMSTemplateListState {
RxBool isVip = false.obs;
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
RxInt type = 0.obs;
RxInt channelType = 0.obs;
}

View File

@ -243,9 +243,7 @@ abstract class Api {
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //
final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息
final String appGetFwVersionURL = '/app/getFwVersion'; //
final String smsTemplateListURL = '/v2/service/listTemplate'; //
final String emailTemplateListURL =
'/v2/service/listEmailTemplate'; //
final String haveTemplateListURL = '/v2/service/listTemplate'; //
final String getDefaultTemplateURL =
'/v2/service/getDefaultTemplate'; //
final String addTemplateServiceURL = '/v2/service/addTemplate'; //

View File

@ -2191,9 +2191,9 @@ class ApiProvider extends BaseProvider {
);
//
Future<Response<dynamic>> getDefaultTemplate(int type) => post(
Future<Response<dynamic>> getDefaultTemplate() => post(
getDefaultTemplateURL.toUrl,
jsonEncode(<String, dynamic>{'type': type}),
jsonEncode(<String, dynamic>{}),
isUnShowLoading: true,
);
@ -2201,7 +2201,7 @@ class ApiProvider extends BaseProvider {
Future<Response<dynamic>> getSMSTemplateList(
int channelType, int pageNo, int pageSize) =>
post(
smsTemplateListURL.toUrl,
haveTemplateListURL.toUrl,
jsonEncode(<String, dynamic>{
'channelType': channelType,
'pageNo': pageNo,
@ -2211,17 +2211,17 @@ class ApiProvider extends BaseProvider {
);
//
Future<Response<dynamic>> addTemplateService(int type, String name,
int contentType, String regards, String tips, String fixedKey) =>
Future<Response<dynamic>> addTemplateService(int channelType, String name,
int langType, String regards, String tips, int templateType) =>
post(
addTemplateServiceURL.toUrl,
jsonEncode(<String, dynamic>{
'type': type,
'channelType': channelType,
'name': name,
'content_type': contentType,
'langType': langType,
'regards': regards,
'tips': tips,
'fixed_key': fixedKey
'templateType': templateType
}),
isUnShowLoading: true,
);

View File

@ -2217,8 +2217,8 @@ class ApiRepository {
}
//
Future<NewSMSTemplateEntity> getDefaultTemplate({required int type}) async {
final Response<dynamic> res = await apiProvider.getDefaultTemplate(type);
Future<NewSMSTemplateEntity> getDefaultTemplate() async {
final Response<dynamic> res = await apiProvider.getDefaultTemplate();
return NewSMSTemplateEntity.fromJson(res.body);
}
@ -2234,14 +2234,14 @@ class ApiRepository {
//
Future<LoginEntity> addTemplateService(
{required int type,
{required int channelType,
required String name,
required int contentType,
required int langType,
required String regards,
required String tips,
required String fixedKey}) async {
required int templateType}) async {
final Response<dynamic> res = await apiProvider.addTemplateService(
type, name, contentType, regards, tips, fixedKey);
channelType, name, langType, regards, tips, templateType);
return LoginEntity.fromJson(res.body);
}