作者 sgj
1 个管道 的构建 失败 耗费 3 秒

志愿者修改

... ... @@ -21,7 +21,7 @@ class OrderController extends AdminBaseController
$param=$this->request->param();
$map=[];
$data= db('orders')->alias('o')
->field('v.name as user_name,v.photo,o.*,g.*')
->field('v.name as user_name,v.photo,g.*,o.*')
->join('goods g','o.good_id=g.id')
->join('user u','u.id=o.user_id')
->join('volunteer v','v.user_id=o.user_id')
... ... @@ -48,13 +48,12 @@ class OrderController extends AdminBaseController
$param = $this->request->param();
$map['o.id'] = $id;
$data = db('orders')->alias('o')
->field('v.name as user_name,v.photo,o.*,g.*')
->field('v.name as user_name,v.photo,g.*,o.*')
->join('goods g', 'o.good_id=g.id')
->join('user u', 'u.id=o.user_id')
->join('volunteer v', 'v.user_id=o.user_id')
->where($map)
->find();
$this->assign('data', $data);
return $this->fetch();
}
... ...
... ... @@ -21,6 +21,7 @@ class VolunteerController extends AdminBaseController
public function index()
{
$where = [];
$where1 = [];
$param = $this->request->param();
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
... ... @@ -42,6 +43,18 @@ class VolunteerController extends AdminBaseController
if (!empty($type)) {
$where['type'] = ['eq', "$type"];
}
$sex = empty($param['sex']) ? '' : $param['sex'];
if (!empty($sex)) {
$where['sex'] = ['eq', "$sex"];
}
$level = empty($param['level']) ? '' : $param['level'];
if (!empty($level)) {
$level_map['level'] = ['eq', "$level"];
$level=\db('level')->where('level',$level)->find();
$where['work_time']=['>=',$level['min']];
$where1['work_time']=['<',$level['max']];
}
$keyword = empty($param['keyword']) ? '' : $param['keyword'];
if (!empty($keyword)) {
$where['name|province|city|county|email|move_phone|fixed_phone|card_number|school|postcode|nation|politics|sex|urgency_phone|qq'] = ['like', "%$keyword%"];
... ... @@ -50,9 +63,13 @@ class VolunteerController extends AdminBaseController
if (!empty($addr)) {
$where['addr'] = ['like', "%$addr%"];
}
// dump($where);
// dump($where1);
$list = Db::name('volunteer')
->where('delete_time', 0)
->where($where)
->where($where1)
->order('create_time desc')
->paginate(10);
$list->appends($param);
... ... @@ -73,6 +90,8 @@ class VolunteerController extends AdminBaseController
$this->assign('addr', isset($param['addr']) ? $param['addr'] : '');
$this->assign('category', isset($param['category']) ? $param['category'] : '');
$this->assign('type', isset($param['type']) ? $param['type'] : '');
$this->assign('sex', isset($param['sex']) ? $param['sex'] : '');
$this->assign('level', isset($param['level']) ? $param['level'] : '');
return $this->fetch();
}
... ... @@ -261,6 +280,7 @@ class VolunteerController extends AdminBaseController
$data[$k]['sex'] = '保密';
}
$data[$k]['card_number'] = '`' . $v['card_number'];
$data[$k]['level'] = get_level_text($v['work_time']);
}
$title = [
['ID', 15, 'id', 1],
... ... @@ -285,6 +305,7 @@ class VolunteerController extends AdminBaseController
['市', 15, 'city', 1],
['区县', 15, 'county', 1],
['详细地址', 15, 'address', 1],
['星级', 15, 'level', 1],
];
$Excel = new Excel();
... ...
... ... @@ -4,10 +4,7 @@
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('index')}">订单列表</a></li>
<li>
<a href="{:url('add')}">商品添加</a>
</li>
<li class="active"><a href="#">编辑商品</a></li>
<li class="active"><a href="#">查看订单</a></li>
</ul>
<form action="{:url('editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
... ... @@ -54,6 +51,20 @@
</td>
</tr>
<tr>
<th width="100">收货人<span class="form-required">*</span></th>
<td>
<input class="form-control" readonly
id="good_name" value="{$data.name}" />
</td>
</tr>
<tr>
<th width="100"> 联系方式<span class="form-required">*</span></th>
<td>
<input class="form-control" readonly
id="good_name" value="{$data.mobile}" />
</td>
</tr>
<tr>
<th width="100">地址<span class="form-required">*</span></th>
<td>
<input class="form-control" readonly type="text"
... ... @@ -71,7 +82,7 @@
<tr>
<th width="100">发放内容<span class="form-required">*</span></th>
<td>
<script type="text/plain" id="content" name="content">{:cmf_replace_content_file_url(htmlspecialchars_decode($data.content))}</script>
<script type="text/plain" id="content" name="content_info">{:cmf_replace_content_file_url(htmlspecialchars_decode($data.content))}</script>
</td>
</tr>
</if>
... ... @@ -88,13 +99,13 @@
<table class="table table-bordered">
<tr>
<th>是否为线上商品</th>
<th>订单状态</th>
</tr>
<tr>
<td>
<div class="checkbox">
<label><input type="radio" value="0" <eq name="$data.real_good" value="0">checked</eq> >虚拟商品</label>
<label><input type="radio" value="1" <eq name="$data.real_good" value="1">checked</eq> >实物商品</label>
<label><input type="radio" name="status" value="0" <eq name="$data.status" value="0">checked</eq> >未发放</label>
<label><input type="radio" name="status" value="1" <eq name="$data.status" value="1">checked</eq> >已发放</label>
</div>
</td>
</tr>
... ...
... ... @@ -23,6 +23,23 @@
</select> &nbsp;&nbsp;
地区:
<input type="text" class="form-control" name="addr" style="width: 150px;" value="{$addr|default=''}" placeholder="请输入地区">&nbsp;&nbsp;
性别:
<select class="form-control" name="sex" style="width: 140px;">
<option value=''>全部</option>
<option value='1' <if condition="$sex eq 1">selected</if>>男</option>
<option value='2' <if condition="$sex eq 2">selected</if>>女</option>
</select>
星级:
<select class="form-control" name="level" style="width: 140px;">
<option value=''>全部</option>
<option value='0' <if condition="$level eq 1">selected</if>>0</option>
<option value='1' <if condition="$level eq 1">selected</if>>1星</option>
<option value='2' <if condition="$level eq 2">selected</if>>2星</option>
<option value='3' <if condition="$level eq 3">selected</if>>3星</option>
<option value='4' <if condition="$level eq 4">selected</if>>4星</option>
<option value='5' <if condition="$level eq 5">selected</if>>5星</option>
<option value='6' <if condition="$level eq 5">selected</if>>金牌志愿者</option>
</select>
关键字:
<input type="text" class="form-control" name="keyword" style="width: 150px;" value="{$keyword|default=''}" placeholder="请输入关键字">&nbsp;&nbsp;
时间:
... ...
... ... @@ -1928,13 +1928,26 @@ function wxappNotice($message){
*/
function get_level($time){
$map['min']=['<=',$time];
$map['max']=['>=',$time];
$map['max']=['>',$time];
$level=\db('level')->where($map)->value('level');
if (empty($level)){
return 0;
}
return $level;
}
function get_level_text($time){
$map['min']=['<=',$time];
$map['max']=['>',$time];
$level=\db('level')->where($map)->value('level');
if (empty($level)){
return 0;
}
if ($level==6){
return '金牌志愿者';
}
return $level.'星';
}
/**
* 获取距离
... ...