新增用户审核开关

This commit is contained in:
devil_gong 2019-02-26 17:52:17 +08:00
parent 8c48bc445c
commit 3f7a7d0acb
13 changed files with 135 additions and 15 deletions

View File

@ -81,6 +81,9 @@ class User extends Common
// 性别
$this->assign('common_gender_list', lang('common_gender_list'));
// 用户状态
$this->assign('common_user_status_list', lang('common_user_status_list'));
// Excel地址
$this->assign('excel_url', MyUrl('admin/user/excelexport', $params));

View File

@ -123,6 +123,10 @@ return array(
'name' => '生日',
'type' => 'string',
],
'status_text'=> [
'name' => '状态',
'type' => 'string',
],
'mobile' => [
'name' => '手机号码',
'type' => 'int',

View File

@ -17,6 +17,14 @@
<label>{{$data.admin_page_number.name}}<span class="fs-12 fw-100 cr-999">{{$data.admin_page_number.describe}}</span></label>
<input type="number" name="{{$data.admin_page_number.only_tag}}" placeholder="{{$data.admin_page_number.name}}" pattern="{{:lang('common_regex_page_number')}}" data-validation-message="{{$data.admin_page_number.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.admin_page_number.value}}"{{/if}} required />
</div>
<div class="am-form-group">
<label>{{$data.common_register_is_enable_audit.name}}<span class="fs-12 fw-100 cr-999">{{$data.common_register_is_enable_audit.describe}}</span></label>
<select name="{{$data.common_register_is_enable_audit.only_tag}}" class="am-radius chosen-select c-p" data-validation-message="{{$data.common_register_is_enable_audit.error_tips}}" required>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($data['common_register_is_enable_audit']['value']) and $data['common_register_is_enable_audit']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>{{$data.common_is_deduction_inventory.name}}<span class="fs-12 fw-100 cr-999">{{$data.common_is_deduction_inventory.describe}}</span></label>
<select name="{{$data.common_is_deduction_inventory.only_tag}}" class="am-radius chosen-select c-p" data-validation-message="{{$data.common_is_deduction_inventory.error_tips}}" required>

View File

@ -1,7 +1,7 @@
<!-- 用户状态 开始 -->
<div class="am-form-group">
<label>{{:lang('common_view_user_status_name')}}</label>
<select name="status" class="am-radius c-p" data-validation-message="{{:lang('common_user_status_format')}}" required>
<label>用户状态</label>
<select name="status" class="am-radius chosen-select c-p" data-validation-message="请选择用户状态" required>
{{foreach :lang('common_user_status_list') as $v}}
<option value="{{$v.id}}" {{if isset($data['status']) and $data['status'] eq $v['id']}}selected{{else /}}{{if !isset($data['status']) and isset($v['checked']) and $v['checked'] eq true}}selected{{/if}}{{/if}}>{{$v.name}}</option>
{{/foreach}}

View File

@ -21,6 +21,12 @@
<option value="{{$v.id}}" {{if isset($params['gender']) and $params['gender'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
<select name="status" class="am-radius c-p m-t-10 m-l-5 param-where">
<option value="-1">状态</option>
{{foreach $common_user_status_list as $v}}
<option value="{{$v.id}}" {{if isset($params['status']) and $params['status'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
<div class="param-date param-where m-l-5">
<input type="text" autocomplete="off" name="time_start" class="Wdate am-radius m-t-10" placeholder="起始时间" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" {{if isset($params['time_start'])}}value="{{$params.time_start}}"{{/if}}/>
<span>~</span>
@ -49,6 +55,7 @@
<th class="am-hide-sm-only">手机号码</th>
<th class="am-hide-sm-only">积分</th>
<th class="am-hide-sm-only">性别</th>
<th class="am-hide-sm-only">状态</th>
<th class="am-hide-sm-only">生日</th>
<th>更多</th>
<th>操作</th>
@ -77,6 +84,9 @@
<td class="am-hide-sm-only">
{{if empty($v['gender_text'])}}<span class="cr-ddd">未设置</span>{{else /}}{{$v.gender_text}}{{/if}}
</td>
<td class="am-hide-sm-only">
{{if empty($v['status_text'])}}<span class="cr-ddd">未知</span>{{else /}}{{$v.status_text}}{{/if}}
</td>
<td class="am-hide-sm-only">
{{if empty($v['birthday_text'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.birthday_text}}{{/if}}
</td>
@ -102,6 +112,18 @@
<dt>电子邮箱</dt>
<dd>{{if empty($v['email'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.email}}{{/if}}</dd>
<dt>状态</dt>
<dd>{{if empty($v['status_text'])}}<span class="cr-ddd">未知</span>{{else /}}{{$v.status_text}}{{/if}}</dd>
<dt>支付宝openid</dt>
<dd>{{if empty($v['alipay_openid'])}}<span class="cr-ddd">未知</span>{{else /}}{{$v.alipay_openid}}{{/if}}</dd>
<dt>微信openid</dt>
<dd>{{if empty($v['weixin_openid'])}}<span class="cr-ddd">未知</span>{{else /}}{{$v.weixin_openid}}{{/if}}</dd>
<dt>百度openid</dt>
<dd>{{if empty($v['baidu_openid'])}}<span class="cr-ddd">未知</span>{{else /}}{{$v.baidu_openid}}{{/if}}</dd>
<dt>性别</dt>
<dd>{{if empty($v['gender_text'])}}<span class="cr-ddd">未设置</span>{{else /}}{{$v.gender_text}}{{/if}}</dd>

View File

@ -32,6 +32,20 @@
<label>电子邮箱</label>
<input type="email" name="email" class="am-radius" placeholder="电子邮箱" data-validation-message="电子邮箱格式错误" {{if !empty($data)}} value="{{$data.email}}"{{/if}} />
</div>
<div class="am-form-group">
<label>支付宝openid</label>
<input type="text" name="alipay_openid" class="am-radius" placeholder="支付宝openid" data-validation-message="请填写支付宝openid" {{if !empty($data)}} value="{{$data.alipay_openid}}"{{/if}} />
</div>
<div class="am-form-group">
<label>微信openid</label>
<input type="text" name="weixin_openid" class="am-radius" placeholder="微信openid" data-validation-message="请填写微信openid" {{if !empty($data)}} value="{{$data.weixin_openid}}"{{/if}} />
</div>
<div class="am-form-group">
<label>百度openid</label>
<input type="text" name="baidu_openid" class="am-radius" placeholder="百度openid" data-validation-message="请填写百度openid" {{if !empty($data)}} value="{{$data.baidu_openid}}"{{/if}} />
</div>
<div class="am-form-group">
<label>生日</label>
<input type="text" name="birthday" class="am-radius Wdate" placeholder="生日" pattern="{{:lang('common_regex_date')}}" data-validation-message="生日格式有误" {{if !empty($data)}} value="{{$data.birthday_text}}" {{/if}} onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" />
@ -46,6 +60,8 @@
<input type="number" placeholder="积分" name="integral" data-validation-message="详细地址2~60 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.integral}}"{{/if}} />
</div>
{{include file="lib/user_status" /}}
<div class="am-form-group">
<label>登录密码</label>
<input type="text" placeholder="登录密码" name="pwd" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="登录密码格式 6~18 个字符之间" class="am-radius" value="" />

View File

@ -1,6 +1,6 @@
{
"name":"默认模板",
"ver":"1.3.0",
"ver":"1.4.0",
"author":"Devil",
"home":"http://shopxo.net/"
}

View File

@ -22,6 +22,7 @@ return array(
'1.1.0' => array('value' => '1.1.0', 'name' => 'v1.1.0'),
'1.2.0' => array('value' => '1.2.0', 'name' => 'v1.2.0'),
'1.3.0' => array('value' => '1.3.0', 'name' => 'v1.3.0'),
'1.4.0' => array('value' => '1.4.0', 'name' => 'v1.4.0'),
),
// 性别
@ -210,6 +211,7 @@ return array(
0 => array('id' => 0, 'name' => '正常', 'checked' => true),
1 => array('id' => 1, 'name' => '禁止发言', 'tips' => '用户被禁止发言'),
2 => array('id' => 2, 'name' => '禁止登录', 'tips' => '用户被禁止登录'),
3 => array('id' => 3, 'name' => '待审核', 'tips' => '用户等待审核中'),
),
// 是否已评价

View File

@ -45,6 +45,7 @@ class UserService
if(!empty($data))
{
$common_gender_list = lang('common_gender_list');
$common_user_status_list = lang('common_user_status_list');
foreach($data as &$v)
{
// 生日
@ -66,6 +67,9 @@ class UserService
// 性别
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
// 状态
$v['status_text'] = $common_user_status_list[$v['status']]['name'];
}
}
return DataReturn('处理成功', 0, $data);
@ -96,6 +100,12 @@ class UserService
$where[] = ['gender', '=', intval($params['gender'])];
}
// 状态
if(isset($params['status']) && $params['status'] > -1)
{
$where[] = ['status', '=', intval($params['status'])];
}
// 时间
if(!empty($params['time_start']))
{
@ -170,9 +180,15 @@ class UserService
[
'checked_type' => 'in',
'key_name' => 'gender',
'checked_data' => [0,1,2],
'checked_data' => array_column(lang('common_gender_list'), 'id'),
'error_msg' => '性别值范围不正确',
],
[
'checked_type' => 'in',
'key_name' => 'status',
'checked_data' => array_column(lang('common_user_status_list'), 'id'),
'error_msg' => '状态值范围不正确',
],
[
'checked_type' => 'length',
'key_name' => 'address',
@ -203,6 +219,10 @@ class UserService
'address' => isset($params['address']) ? $params['address'] : '',
'gender' => intval($params['gender']),
'integral' => intval($params['integral']),
'status' => intval($params['status']),
'alipay_openid' => isset($params['alipay_openid']) ? $params['alipay_openid'] : '',
'weixin_openid' => isset($params['weixin_openid']) ? $params['weixin_openid'] : '',
'baidu_openid' => isset($params['baidu_openid']) ? $params['baidu_openid'] : '',
'birthday' => empty($params['birthday']) ? 0 : strtotime($params['birthday']),
'upd_time' => time(),
];
@ -799,8 +819,9 @@ class UserService
{
return DataReturn('帐号不存在', -3);
}
// 用户状态
if($user['status'] == 2)
if(in_array($user['status'], [2,3]))
{
return DataReturn(lang('common_user_status_list')[$user['status']]['tips'], -10);
}
@ -918,12 +939,17 @@ class UserService
return DataReturn('验证码错误', -11);
}
// 是否需要审核
$common_register_is_enable_audit = MyC('common_register_is_enable_audit', 0);
// 用户数据
$salt = GetNumberCode(6);
$data = [
'add_time' => time(),
'upd_time' => time(),
'salt' => $salt,
'pwd' => LoginPwdEncryption($params['pwd'], $salt),
'status' => ($common_register_is_enable_audit == 1) ? 3 : 0,
];
if($params['type'] == 'sms')
{
@ -939,6 +965,13 @@ class UserService
// 清除验证码
$obj->Remove();
// 是否需要审核
if($common_register_is_enable_audit == 1)
{
return DataReturn('注册成功,请等待审核');
}
// 用户登录session纪录
if(self::UserLoginRecord($user_id))
{
return DataReturn('注册成功', 0);
@ -1401,6 +1434,12 @@ class UserService
$user = self::UserInfo($field, $params['openid']);
if(!empty($user))
{
// 用户状态
if(in_array($user['status'], [2,3]))
{
return DataReturn(lang('common_user_status_list')[$user['status']]['tips'], -10);
}
$data = $user;
}
@ -1488,9 +1527,15 @@ class UserService
{
return DataReturn('用户openid不能为空', -20);
}
// 是否需要审核
$common_register_is_enable_audit = MyC('common_register_is_enable_audit', 0);
// 用户数据
$data = array(
$accounts_field => $params[$accounts_field],
'mobile' => $params['mobile'],
'status' => ($common_register_is_enable_audit == 1) ? 3 : 0,
);
// 获取用户信息
@ -1538,6 +1583,12 @@ class UserService
// 清除验证码
$obj->Remove();
// 是否需要审核
if($common_register_is_enable_audit == 1)
{
return DataReturn('绑定成功、等待审核', -101);
}
return DataReturn('绑定成功', 0, self::UserLoginRecord($user_id, true));
} else {
return DataReturn('绑定失败', -100);

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<template name="copyright">
<view class="copyright">
<view class="text">Powered by ShopXO v1.3.0</view>
<view class="text">Powered by ShopXO v1.4.0</view>
</view>
</template>

View File

@ -1,5 +1,5 @@
<template name="copyright">
<view class="copyright">
<view class="text">Powered by ShopXO v1.3.0</view>
<view class="text">Powered by ShopXO v1.4.0</view>
</view>
</template>

View File

@ -13,7 +13,7 @@
if(version_compare(PHP_VERSION,'5.6.0','<')) die('PHP版本最低 5.6.0');
// 系统版本
define('APPLICATION_VERSION', 'v1.3.0');
define('APPLICATION_VERSION', 'v1.4.0');
// 定义系统目录分隔符
define('DS', '/');