生活号 用户

feat/task1-c-wallet
devil_gong 2018-10-23 10:39:41 +08:00
parent a3d1bee01f
commit afded26434
7 changed files with 377 additions and 51 deletions

View File

@ -0,0 +1,167 @@
<?php
namespace Admin\Controller;
/**
* 生活号用户管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class AlipayLifeUserController extends CommonController
{
/**
* [_initialize 前置操作-继承公共前置方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function _initialize()
{
// 调用父类前置方法
parent::_initialize();
// 登录校验
$this->Is_Login();
// 权限校验
$this->Is_Power();
}
/**
* [Index 用户列表]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Index()
{
// 参数
$param = array_merge($_POST, $_GET);
// 条件
$where = $this->GetIndexWhere();
// 模型
$m = M('AlipayLifeUser');
// 分页
$number = MyC('admin_page_number');
$page_param = array(
'number' => $number,
'total' => $m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->count(),
'where' => $param,
'url' => U('Admin/AlipayLifeUser/Index'),
);
$page = new \Library\Page($page_param);
// 获取列表
$field = 'u.*, au.alipay_life_id';
$list = $this->SetDataHandle($m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->field($field)->limit($page->GetPageStarNumber(), $number)->order('au.id desc')->select());
// 性别
$this->assign('common_gender_list', L('common_gender_list'));
// 参数
$this->assign('param', $param);
// 分页
$this->assign('page_html', $page->GetPageHtml());
// 数据列表
$this->assign('list', $list);
$this->display('Index');
}
/**
* [SetDataHandle 数据处理]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-29T21:27:15+0800
* @param [array] $data [用户数据]
* @return [array] [处理好的数据]
*/
private function SetDataHandle($data)
{
if(!empty($data))
{
$common_gender_list = L('common_gender_list');
$life_m = M('AlipayLife');
foreach($data as &$v)
{
// 生日
if(!empty($v['birthday']))
{
$v['birthday_text'] = date('Y-m-d', $v['birthday']);
} else {
$v['birthday_text'] = '';
}
// 注册时间
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
// 更新时间
$v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']);
// 性别
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
// 所属生活号
$v['alipay_life_name'] = $life_m->where(['id'=>$v['alipay_life_id']])->getField('name');
}
}
return $data;
}
/**
* [GetIndexWhere 用户列表条件]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-10T22:16:29+0800
*/
private function GetIndexWhere()
{
$where = array('is_delete_time'=>0);
// 模糊
if(!empty($_REQUEST['keyword']))
{
$like_keyword = array('like', '%'.I('keyword').'%');
$where[] = array(
'u.username' => $like_keyword,
'u.nickname' => $like_keyword,
'u.mobile' => $like_keyword,
'_logic' => 'or',
);
}
// 是否更多条件
if(I('is_more', 0) == 1)
{
// 等值
if(I('gender', -1) > -1)
{
$where['u.gender'] = intval(I('gender', 0));
}
// 表达式
if(!empty($_REQUEST['time_start']))
{
$where['au.add_time'][] = array('gt', strtotime(I('time_start')));
}
if(!empty($_REQUEST['time_end']))
{
$where['au.add_time'][] = array('lt', strtotime(I('time_end')));
}
}
return $where;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* 模块语言包-成员
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
return array(
'alipay_life_user_add_name' => '成员添加',
'alipay_life_user_edit_name' => '成员编辑',
'alipay_life_user_so_keyword_tips' => '姓名/手机/邮箱/昵称',
'alipay_life_user_time_start_text' => '起始时间',
'alipay_life_user_time_end_text' => '结束时间',
'alipay_life_user_nickname_name' => '昵称',
'alipay_life_user_birthday_name' => '生日',
'alipay_life_user_nickname_format' => '昵称最多 16 个字符',
'alipay_life_user_birthday_format' => '生日格式有误',
'alipay_life_user_accounts_param_error' => '至少填写一项手机或邮箱',
'alipay_life_user_login_pwd_name' => '登录密码',
'alipay_life_user_login_pwd_format' => '登录密码格式 6~18 个字符之间',
'alipay_life_user_username_name' => '用户名',
'alipay_life_user_username_format' => '用户名 2~30 个字符',
'alipay_life_user_integral_name' => '积分',
'alipay_life_user_avatar_name' => '用户头像',
'alipay_life_user_province_name' => '所在省',
'alipay_life_user_city_name' => '所在市',
'alipay_life_user_alipay_life_name_text' => '所属生活号',
);
?>

View File

@ -0,0 +1,153 @@
<include file="Public/Header" />
<!-- right content start -->
<div class="content-right">
<div class="content">
<!-- form start -->
<form class="am-form view-list" action="{{:U('Admin/AlipayLifeUser/Index')}}" method="POST">
<div class="am-g">
<input type="hidden" name="organization_id" <present name="param['organization_id']"> value="{{$param.organization_id}}"</present> />
<input type="text" class="am-radius form-keyword" placeholder="{{:L('alipay_life_user_so_keyword_tips')}}" name="keyword" <present name="param['keyword']"> value="{{$param.keyword}}"</present> />
<button type="submit" class="am-btn am-btn-secondary am-btn-sm am-radius form-submit">{{:L('common_operation_query')}}</button>
<label class="fs-12 m-l-5 c-p fw-100 more-submit">
{{:L('common_more_screening')}}
<input type="checkbox" name="is_more" value="1" id="is_more" <if condition="isset($param['is_more']) and $param['is_more'] eq 1">checked</if> />
<i class="am-icon-angle-down"></i>
</label>
<div class="more-where <if condition="!isset($param['is_more']) or $param['is_more'] neq 1">none</if>">
<select name="gender" class="am-radius c-p m-t-10 m-l-5 param-where">
<option value="-1">{{:L('common_view_gender_name')}}</option>
<foreach name="common_gender_list" item="v">
<option value="{{$v.id}}" <if condition="isset($param['gender']) and $param['gender'] eq $v['id']">selected</if>>{{$v.name}}</option>
</foreach>
</select>
<div class="param-date param-where m-l-5">
<input type="text" name="time_start" class="Wdate am-radius m-t-10" placeholder="{{:L('common_time_start_name')}}" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" <if condition="isset($param['time_start'])">value="{{$param.time_start}}"</if>/>
<span>~</span>
<input type="text" class="Wdate am-radius m-t-10" placeholder="{{:L('common_time_end_name')}}" name="time_end" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" <if condition="isset($param['time_end'])">value="{{$param.time_end}}"</if>/>
</div>
</div>
</div>
</form>
<!-- form end -->
<!-- list start -->
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10 m-l-5">
<thead>
<tr>
<th>{{:L('alipay_life_user_avatar_name')}}</th>
<th>{{:L('alipay_life_user_username_name')}}</th>
<th class="am-hide-sm-only">{{:L('common_mobile_name')}}</th>
<th class="am-hide-sm-only">{{:L('alipay_life_user_alipay_life_name_text')}}</th>
<th class="am-hide-sm-only">{{:L('common_view_gender_name')}}</th>
<th class="am-hide-sm-only">{{:L('alipay_life_user_birthday_name')}}</th>
<th>{{:L('common_more_name')}}</th>
</tr>
</thead>
<tbody>
<if condition="!empty($list)">
<foreach name="list" item="v">
<tr id="data-list-{{$v.id}}">
<td>
<if condition="!empty($v['avatar'])">
<img src="{{$v['avatar']}}" class="am-img-thumbnail am-radius" width="60" height="60" />
<else />
<span class="cr-ddd">{{:L('common_on_fill_in_images')}}</span>
</if>
</td>
<td>
<if condition="empty($v['username'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.username}}</if>
</td>
<td class="am-hide-sm-only">
<if condition="empty($v['mobile'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.mobile}}</if>
</td>
<td class="am-hide-sm-only">
<if condition="empty($v['alipay_life_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.alipay_life_name}}</if>
</td>
<td class="am-hide-sm-only">
<if condition="empty($v['gender_text'])"><span class="cr-ddd">{{:L('common_not_set_text')}}</span><else />{{$v.gender_text}}</if>
</td>
<td class="am-hide-sm-only">
<if condition="empty($v['birthday_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.birthday_text}}</if>
</td>
<td>
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> {{:L('common_see_more_name')}}</span>
<div class="am-popup am-radius" id="my-popup{{$v.id}}">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">{{:L('common_detail_content')}}</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<dl class="dl-content">
<dt>{{:L('alipay_life_user_username_name')}}</dt>
<dd><if condition="empty($v['username'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.username}}</if></dd>
<dt>{{:L('alipay_life_user_nickname_name')}}</dt>
<dd><if condition="empty($v['nickname'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.nickname}}</if></dd>
<dt>{{:L('common_mobile_name')}}</dt>
<dd><if condition="empty($v['mobile'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.mobile}}</if></dd>
<dt>{{:L('common_email_name')}}</dt>
<dd><if condition="empty($v['email'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.email}}</if></dd>
<dt>{{:L('common_view_gender_name')}}</dt>
<dd><if condition="empty($v['gender_text'])"><span class="cr-ddd">{{:L('common_not_set_text')}}</span><else />{{$v.gender_text}}</if></dd>
<dt>{{:L('alipay_life_user_birthday_name')}}</dt>
<dd><if condition="empty($v['birthday_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.birthday_text}}</if></dd>
<dt>{{:L('alipay_life_user_province_name')}}</dt>
<dd><if condition="empty($v['province'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.province}}</if></dd>
<dt>{{:L('alipay_life_user_city_name')}}</dt>
<dd><if condition="empty($v['city'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.city}}</if></dd>
<dt>{{:L('common_address_text')}}</dt>
<dd><if condition="empty($v['address'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.address}}</if></dd>
<dt>{{:L('alipay_life_user_integral_name')}}</dt>
<dd><if condition="empty($v['integral'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.integral}}</if></dd>
<dt>{{:L('alipay_life_user_avatar_name')}}</dt>
<dd>
<if condition="!empty($v['avatar'])">
<img src="{{$v['avatar']}}" class="am-img-thumbnail am-radius" width="100" height="100" />
<else />
<span class="cr-ddd">{{:L('common_on_fill_in_images')}}</span>
</if>
</dd>
<dt>{{:L('common_reg_time_name')}}</dt>
<dd>{{$v.add_time}}</dd>
<dt>{{:L('common_upd_time_name')}}</dt>
<dd>{{$v.upd_time}}</dd>
</dl>
</div>
</div>
</div>
</td>
</tr>
</foreach>
<else />
<tr><td colspan="20" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
</if>
</tbody>
</table>
<!-- list end -->
<!-- page start -->
<if condition="!empty($list)">
{{$page_html}}
</if>
<!-- page end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
<include file="Public/Footer" />
<!-- footer end -->

View File

@ -121,9 +121,6 @@
<dt>{{:L('user_integral_name')}}</dt>
<dd><if condition="empty($v['integral'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.integral}}</if></dd>
<dt>{{:L('user_service_expire_time_name')}}</dt>
<dd><if condition="empty($v['service_expire_time_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.service_expire_time_text}}</if></dd>
<dt>{{:L('user_avatar_name')}}</dt>
<dd>
<if condition="!empty($v['avatar'])">
@ -156,53 +153,6 @@
</if>
</tbody>
</table>
<div class="am-popup am-radius" id="my-popup-audit">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">{{:L('common_operation_audit')}}</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<dl class="dl-content">
<dt>{{:L('user_username_name')}}</dt>
<dd class="audit-username"></dd>
<dt>{{:L('common_mobile_name')}}</dt>
<dd class="audit-mobile"></dd>
<dt>{{:L('common_view_gender_name')}}</dt>
<dd class="audit-gender"></dd>
<dt>{{:L('user_organization_name')}}</dt>
<dd class="audit-organization_name"></dd>
<dt>{{:L('user_birthday_name')}}</dt>
<dd class="audit-birthday"></dd>
<dt>{{:L('user_user_type_name')}}</dt>
<dd class="audit-user_type"></dd>
<dt>{{:L('user_salary_type_name')}}</dt>
<dd class="audit-salary_type"></dd>
</dl>
<form class="am-form form-validation" action="{{:U('Admin/User/Audit')}}" method="POST" request-type="ajax-reload" enctype="multipart/form-data">
<div class="am-form-group">
<label>{{:L('user_refused_why_name')}}</label>
<textarea name="refused_why" rows="5" class="am-radius" placeholder="{{:L('user_refused_why_format')}}" data-validation-message="{{:L('user_refused_why_format')}}" maxlength="80"></textarea>
</div>
<div class="am-form-group audit-submit t-c">
<input type="hidden" name="status" value="" />
<input type="hidden" name="id" value="" />
<button type="submit" class="am-btn am-btn-danger am-radius am-btn-sm" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}" data-status="3">拒绝</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button type="submit" class="am-btn am-btn-success am-radius am-btn-sm" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}" data-status="2">同意</button>
</div>
</form>
</div>
</div>
</div>
<!-- list end -->
<!-- page start -->

View File

@ -225,6 +225,7 @@ class AlipayLife
break;
// 关注/进入生活号
case 'follow' :
case 'enter' :
$status = AlipayLifeService::UserEnter($data);
break;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
/**
*
*/
.form-keyword { width: 55% !important; display: initial !important; }
.more-submit input { display: none; }
.param-where, .param-date input { display: initial !important; }
@media only screen and (max-width: 641px) {
.param-where { width: 100% !important; margin-left: 0px !important; }
.param-date input { width: 47% !important; }
}
@media only screen and (min-width: 641px) {
.param-where { width: 32% !important; float: left; }
.param-date input { width: 45% !important; }
.param-where:nth-child(1), .param-where:nth-child(4) { margin-left: 0px !important; }
}
@media only screen and (max-width: 321px) {
.view-operation button { margin: 2px 0px; }
}