小程序一键获取手机和地址导入增加可单独选择

feat/task1-c-wallet
gongfuxiang 2022-04-11 17:04:07 +08:00
parent 70840cda9c
commit 72074df3e7
7 changed files with 70 additions and 39 deletions

View File

@ -52,8 +52,9 @@ class AppConfig extends Common
// 配置信息
MyViewAssign('data', ConfigService::ConfigList());
// 是否
// 静态数据
MyViewAssign('common_is_text_list', MyConst('common_is_text_list'));
MyViewAssign('common_platform_type', MyConst('common_platform_type'));
// 导航/视图
$nav_type = input('nav_type', 'base');
@ -70,7 +71,12 @@ class AppConfig extends Common
*/
public function Save()
{
return ConfigService::ConfigSave($_POST);
// 空字段处理
$field_list = [
'common_user_onekey_bind_mobile_list',
'common_user_address_platform_import_list',
];
return ConfigService::ConfigSave(ConfigService::FieldsEmptyDataHandle($_POST, $field_list));
}
}
?>

View File

@ -92,28 +92,19 @@ class Config extends Common
$params = $_POST;
// 字段不存在赋值
$empty_value_field_list = [];
$field_list = [];
// 页面类型
$view_type = empty($this->data_request['view_type']) ? 'index' : $this->data_request['view_type'];
switch($view_type)
{
case 'store' :
$empty_value_field_list['common_customer_store_qrcode'] = '';
$field_list[] = 'common_customer_store_qrcode';
break;
}
// 空字段处理
if(!empty($empty_value_field_list))
{
foreach($empty_value_field_list as $fk=>$fv)
{
if(!isset($params[$fk]))
{
$params[$fk] = $fv;
}
}
}
$params = ConfigService::FieldsEmptyDataHandle($params, $field_list);
// 默认值字段处理
$default_value_field_list = [

View File

@ -48,7 +48,7 @@ class Pluginsadmin extends Common
}
/**
* [Index 配置列表]
* 列表
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1

View File

@ -372,20 +372,8 @@ class Site extends Common
break;
}
// 开始处理空值
if(!empty($field_list))
{
foreach($field_list as $field)
{
if(!isset($params[$field]))
{
$params[$field] = '';
}
}
}
// 基础配置
$ret = ConfigService::ConfigSave($params);
$ret = ConfigService::ConfigSave(ConfigService::FieldsEmptyDataHandle($params, $field_list));
// 清除缓存
if($ret['code'] == 0)

View File

@ -26,20 +26,37 @@
</select>
</div>
<div class="am-form-group">
<label>{{$data.common_user_is_onekey_bind_mobile.name}}<span class="am-form-group-label-tips">{{$data.common_user_is_onekey_bind_mobile.describe}}</span></label>
<select name="{{$data.common_user_is_onekey_bind_mobile.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.common_user_is_onekey_bind_mobile.error_tips}}" required>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($data['common_user_is_onekey_bind_mobile']['value']) and $data['common_user_is_onekey_bind_mobile']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
<label>{{$data.common_user_onekey_bind_mobile_list.name}}<span class="am-form-group-label-tips">{{$data.common_user_onekey_bind_mobile_list.describe}}</span></label>
<select name="{{$data.common_user_onekey_bind_mobile_list.only_tag}}" class="am-radius chosen-select" data-placeholder="{{$data.common_user_onekey_bind_mobile_list.name}}" multiple data-validation-message="{{$data.common_user_onekey_bind_mobile_list.error_tips}}">
{{foreach $common_platform_type as $v}}
{{if in_array($v['value'], ['weixin', 'baidu'])}}
<option value="{{$v.value}}" {{if isset($data['common_user_onekey_bind_mobile_list']['value']) and in_array($v['value'], $data['common_user_onekey_bind_mobile_list']['value'])}}selected{{/if}}>{{$v.name}}</option>
{{/if}}
{{/foreach}}
</select>
<div class="am-alert am-alert-warning" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p>1. 获取当前小程序平台账户或者本本机的手机号码一键登录绑定</p>
<p>2. 无需用户输入手机号码进行验证绑定</p>
<p>3. 依赖需要开启《强制绑定手机》有效</p>
<p>1. 获取当前小程序平台账户或者本本机的手机号码一键登录绑定,目前仅支持【微信小程序、百度小程序】</p>
<p>2. 依赖需要开启《强制绑定手机》有效</p>
<p>3. 部分小程序平台可能需要申请权限、请根据小程序平台要求申请后再对应开启</p>
</div>
</div>
<div class="am-form-group">
<label>{{$data.common_user_address_platform_import_list.name}}<span class="am-form-group-label-tips">{{$data.common_user_address_platform_import_list.describe}}</span></label>
<select name="{{$data.common_user_address_platform_import_list.only_tag}}" class="am-radius chosen-select" data-placeholder="{{$data.common_user_address_platform_import_list.name}}" multiple data-validation-message="{{$data.common_user_address_platform_import_list.error_tips}}">
{{foreach $common_platform_type as $v}}
{{if in_array($v['value'], ['weixin', 'baidu', 'alipay', 'qq', 'toutiao'])}}
<option value="{{$v.value}}" {{if isset($data['common_user_address_platform_import_list']['value']) and in_array($v['value'], $data['common_user_address_platform_import_list']['value'])}}selected{{/if}}>{{$v.name}}</option>
{{/if}}
{{/foreach}}
</select>
<div class="am-alert am-alert-warning" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p>1. 获取当前小程序平台app账户的收货地址目前仅支持【小程序】</p>
<p>2. 确认导入后直接添加为系统用户收货地址</p>
<p>3. 部分小程序平台可能需要申请权限、请根据小程序平台要求申请后再对应开启</p>
</div>
</div>
<div class="am-form-group">
<label>{{$data.common_app_is_enable_search.name}}<span class="am-form-group-label-tips">{{$data.common_app_is_enable_search.describe}}</span></label>
<select name="{{$data.common_app_is_enable_search.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.common_app_is_enable_search.error_tips}}" required>

View File

@ -70,6 +70,8 @@ class ConfigService
'home_user_reg_type',
'admin_login_type',
'home_search_params_type',
'common_user_onekey_bind_mobile_list',
'common_user_address_platform_import_list',
];
// 需要文件缓存的key
@ -494,5 +496,31 @@ class ConfigService
];
return DataReturn('操作成功', 0, $result);
}
/**
* 字段空值数据处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-04-10
* @desc description
* @param [array] $params [输入参数]
* @param [array] $fields [字段列表]
* @return [array] [处理的数据]
*/
public static function FieldsEmptyDataHandle($params, $fields)
{
if(!empty($fields))
{
foreach($fields as $fv)
{
if(!isset($params[$fv]))
{
$params[$fv] = '';
}
}
}
return $params;
}
}
?>

View File

@ -89,9 +89,10 @@ class SystemBaseService
'home_is_enable_userregister_agreement' => (int) MyC('home_is_enable_userregister_agreement', 0, true),
'home_site_user_register_bg_images' => ResourcesService::AttachmentPathViewHandle(MyC('home_site_user_register_bg_images')),
// 用户帐号绑定
'common_user_is_onekey_bind_mobile' => (int) MyC('common_user_is_onekey_bind_mobile', 0),
'common_user_is_mandatory_bind_mobile' => (int) MyC('common_user_is_mandatory_bind_mobile', 0),
// 用户相关
'common_user_is_mandatory_bind_mobile' => (int) MyC('common_user_is_mandatory_bind_mobile', 0),
'common_user_onekey_bind_mobile_list' => MyC('common_user_onekey_bind_mobile_list', [], true),
'common_user_address_platform_import_list' => MyC('common_user_address_platform_import_list', [], true),
// 站点信息
'home_site_name' => MyC('home_site_name', null, true),