This commit is contained in:
gongfuxiang 2018-10-15 00:27:48 +08:00
parent 41165e4326
commit c7b6916c3c
16 changed files with 286 additions and 104 deletions

View File

@ -70,7 +70,7 @@ class PayLogController extends CommonController
$this->assign('common_pay_type_list', $pay_list);
// 业务类型
$this->assign('common_busines_type_list', L('common_busines_type_list'));
$this->assign('common_business_type_list', L('common_business_type_list'));
// 参数
$this->assign('param', $param);
@ -97,11 +97,11 @@ class PayLogController extends CommonController
if(!empty($data))
{
$common_gender_list = L('common_gender_list');
$common_busines_type_list = L('common_busines_type_list');
$common_business_type_list = L('common_business_type_list');
foreach($data as &$v)
{
// 业务类型
$v['busines_type_text'] = $common_busines_type_list[$v['busines_type']]['name'];
$v['business_type_text'] = $common_business_type_list[$v['business_type']]['name'];
// 性别
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
@ -145,9 +145,9 @@ class PayLogController extends CommonController
{
$where['p.payment'] = I('pay_type');
}
if(I('busines_type', -1) > -1)
if(I('business_type', -1) > -1)
{
$where['p.busines_type'] = intval(I('busines_type', 0));
$where['p.business_type'] = intval(I('business_type', 0));
}
if(I('gender', -1) > -1)
{

View File

@ -14,7 +14,7 @@ return array(
'paylog_user_name' => '用户信息',
'paylog_pay_type_name' => '支付类型',
'paylog_busines_type_name' => '业务类型',
'paylog_business_type_name' => '业务类型',
'paylog_order_id_name' => '业务订单id',
'paylog_trade_no_name' => '支付平台交易号',
'paylog_platform_buyer_user_name' => '支付平台用户帐号',

View File

@ -29,10 +29,10 @@
</if>
</foreach>
</select>
<select name="busines_type" class="am-radius c-p m-t-10 m-l-5 param-where">
<option value="-1">{{:L('paylog_busines_type_name')}}</option>
<foreach name="common_busines_type_list" item="v">
<option value="{{$v.id}}" <if condition="isset($param['busines_type']) and $param['busines_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
<select name="business_type" class="am-radius c-p m-t-10 m-l-5 param-where">
<option value="-1">{{:L('paylog_business_type_name')}}</option>
<foreach name="common_business_type_list" item="v">
<option value="{{$v.id}}" <if condition="isset($param['business_type']) and $param['business_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
</foreach>
</select>
<div class="param-date param-where m-l-5">
@ -51,7 +51,7 @@
<tr>
<th>{{:L('paylog_user_name')}}</th>
<th>{{:L('paylog_pay_type_name')}}</th>
<th>{{:L('paylog_busines_type_name')}}</th>
<th>{{:L('paylog_business_type_name')}}</th>
<th class="am-hide-sm-only">{{:L('paylog_order_id_name')}}</th>
<th class="am-hide-sm-only">{{:L('paylog_trade_no_name')}}</th>
<th class="am-hide-sm-only">{{:L('paylog_platform_buyer_user_name')}}</th>
@ -82,7 +82,7 @@
<if condition="empty($v['payment_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.payment_name}}</if>
</td>
<td>
<if condition="empty($v['busines_type_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.busines_type_text}}</if>
<if condition="empty($v['business_type_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.business_type_text}}</if>
</td>
<td class="am-hide-sm-only">
<if condition="empty($v['order_id'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.order_id}}</if>

View File

@ -433,8 +433,8 @@ return array(
1 => array('id' => 1, 'name' => '微信'),
),
// 支付日志 - 业务类型
'common_busines_type_list' => array(
// 业务类型
'common_business_type_list' => array(
0 => array('id' => 0, 'name' => '订单', 'checked' => true),
),

View File

@ -2,6 +2,9 @@
namespace Home\Controller;
use Service\OrderService;
use Service\GoodsService;
/**
* 用户
* @author Devil
@ -54,6 +57,18 @@ class UserController extends CommonController
*/
public function Index()
{
// 订单总数
$where = ['user_id'=>$this->user['id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
$this->assign('user_order_count', OrderService::OrderTotal($where));
// 商品收藏总数
$where = ['user_id'=>$this->user['id']];
$this->assign('user_goods_favor_count', GoodsService::FavorGoodsTotal($where));
// 用户订单状态
$user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1]);
$this->assign('user_order_status', $user_order_status['data']);
$this->display('Index');
}

View File

@ -88,13 +88,15 @@
</if>
<if condition="!empty($user)">
<div class="member-center">
<foreach name="user_order_status" item="v">
<if condition="in_array($v['status'], [1,2,3])">
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'status'=>$v['status']])}}"><strong>{{$v.count}}</strong>{{$v.name}}</a>
<elseif condition="in_array($v['status'], [100])" />
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'is_comments'=>0, 'status'=>4])}}"><strong>{{$v.count}}</strong>{{$v.name}}</a>
</if>
</foreach>
<notempty name="user_order_status">
<foreach name="user_order_status" item="v">
<if condition="in_array($v['status'], [1,2,3])">
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'status'=>$v['status']])}}"><strong>{{$v.count}}</strong>{{$v.name}}</a>
<elseif condition="in_array($v['status'], [100])" />
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'is_comments'=>0, 'status'=>4])}}"><strong>{{$v.count}}</strong>{{$v.name}}</a>
</if>
</foreach>
</notempty>
</div>
</if>
</div>

View File

@ -45,13 +45,13 @@
<ul class="user-base-icon">
<li>
<a href="{{:U('Home/Order/Index')}}">
<p>0</p>
<p>{{$user_order_count}}</p>
<p>订单总数</p>
</a>
</li>
<li>
<a href="{{:U('Home/UserFavor/Goods')}}">
<p>0</p>
<p>{{$user_goods_favor_count}}</p>
<p>商品收藏</p>
</a>
</li>
@ -77,33 +77,33 @@
</span>
</a>
</div>
<ul class="order-base">
<li>
<a href="{{:U('Home/Order/Index')}}">
<i class="icon-1"></i>
<p>待付款</p>
<span class="am-badge am-badge-danger am-round">6</span>
</a>
</li>
<li>
<a href="{{:U('Home/Order/Index')}}">
<i class="icon-2"></i>
<p>待发货</p>
</a>
</li>
<li>
<a href="{{:U('Home/Order/Index')}}">
<i class="icon-3"></i>
<p>待收货</p>
</a>
</li>
<li>
<a href="{{:U('Home/Order/Index')}}">
<i class="icon-100"></i>
<p>待付款</p>
</a>
</li>
</ul>
<notempty name="user_order_status">
<ul class="order-base">
<foreach name="user_order_status" item="v">
<if condition="in_array($v['status'], [1,2,3])">
<li>
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'status'=>$v['status']])}}">
<i class="icon-1"></i>
<p>{{$v.name}}</p>
<notempty name="v.count">
<span class="am-badge am-badge-danger am-round">{{$v.count}}</span>
</notempty>
</a>
</li>
<elseif condition="in_array($v['status'], [100])" />
<li>
<a href="{{:U('Home/Order/Index', ['is_more'=>1, 'is_comments'=>0, 'status'=>4])}}">
<i class="icon-1"></i>
<p>{{$v.name}}</p>
<notempty name="v.count">
<span class="am-badge am-badge-danger am-round">{{$v.count}}</span>
</notempty>
</a>
</li>
</if>
</foreach>
</ul>
</notempty>
</div>
</div>
<!-- content end -->

View File

@ -490,7 +490,7 @@ class GoodsService
$limit_start = max(0, intval($params['limit_start']));
$limit_number = max(1, intval($params['limit_number']));
$order_by = empty($params['$order_by']) ? 'f.id desc' : I('order_by', '', '', $params);
$order_by = empty($params['order_by']) ? 'f.id desc' : I('order_by', '', '', $params);
$field = 'f.*, g.title, g.original_price, g.price, g.images';
// 获取订单

View File

@ -0,0 +1,192 @@
<?php
namespace Service;
/**
* 消息服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class MessageService
{
/**
* 消息添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-21
* @desc description
* @param [int] $user_id [用户id]
* @param [string] $title [标题]
* @param [string] $detail [内容]
* @param [int] $business_type [业务类型0默认, 1订单, ...]
* @param [int] $business_id [业务id]
* @param [int] $type [类型默认0 普通消息)]
* @return [boolean] [成功true, 失败false]
*/
public static function MessageAdd($user_id, $title, $detail, $business_type = 0, $business_id = 0, $type = 0)
{
$data = array(
'title' => $title,
'detail' => $detail,
'user_id' => intval($user_id),
'business_type' => intval($business_type),
'business_id' => intval($business_id),
'type' => intval($type),
'add_time' => time(),
);
return M('Message')->add($data) > 0;
}
/**
* 前端消息列表条件
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function HomeMessgeListWhere($params = [])
{
$where = [
'is_delete_time' => 0,
'user_is_delete_time' => 0,
];
// id
if(!empty($params['id']))
{
$where['id'] = intval($params['id']);
}
// 用户id
if(!empty($params['user']))
{
$where['user_id'] = $params['user']['id'];
}
if(!empty($params['keywords']))
{
$like_keywords = array('like', '%'.I('keywords').'%');
$where[] = [
'title' => $like_keywords,
'detail' => $like_keywords,
'_logic' => 'or',
];
}
// 是否更多条件
if(I('is_more', 0) == 1)
{
// 等值
if(I('business_type', -1) > -1)
{
$where['business_type'] = intval(I('business_type', 0));
}
if(I('type', -1) > -1)
{
$where['type'] = intval(I('type', 0));
}
if(I('is_read', -1) > -1)
{
$where['is_read'] = intval(I('is_read', 0));
}
// 时间
if(!empty($_REQUEST['time_start']))
{
$where['add_time'][] = array('gt', strtotime(I('time_start')));
}
if(!empty($_REQUEST['time_end']))
{
$where['add_time'][] = array('lt', strtotime(I('time_end')));
}
}
return $where;
}
/**
* 消息总数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $where [条件]
*/
public static function MessageTotal($where = [])
{
return (int) M('Message')->where($where)->count();
}
/**
* 订单列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function MessageList($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'where',
'error_msg' => '条件不能为空',
],
[
'checked_type' => 'is_array',
'key_name' => 'where',
'error_msg' => '条件格式有误',
],
[
'checked_type' => 'isset',
'key_name' => 'limit_start',
'error_msg' => '分页起始值有误',
],
[
'checked_type' => 'isset',
'key_name' => 'limit_number',
'error_msg' => '分页数量不能为空',
],
];
$ret = params_checked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
$limit_start = max(0, intval($params['limit_start']));
$limit_number = max(1, intval($params['limit_number']));
$order_by = empty($params['order_by']) ? 'id desc' : I('order_by', '', '', $params);
// 获取订单
$data = M('Message')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select();
if(!empty($data))
{
$common_business_type_list = L('common_business_type_list');
$common_is_read_list = L('common_is_read_list');
$common_message_type_list = L('common_message_type_list');
foreach($data as &$v)
{
// 消息类型
$v['type_name'] = $common_message_type_list[$v['type']]['name'];
// 是否已读
$v['is_read_name'] = $common_is_read_list[$v['is_read']]['name'];
// 业务类型
$v['business_type_name'] = $common_business_type_list[$v['business_type']]['name'];
}
}
return DataReturn('处理成功', 0, $data);
}
}
?>

View File

@ -336,7 +336,7 @@ class OrderService
// 消息通知
$detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元';
ResourcesService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']);
MessageService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']);
// 开启事务
$m = M('Order');
@ -387,7 +387,7 @@ class OrderService
'user_is_delete_time' => 0,
];
// 订单id
// id
if(!empty($params['id']))
{
$where['id'] = intval($params['id']);
@ -513,7 +513,7 @@ class OrderService
$limit_start = max(0, intval($params['limit_start']));
$limit_number = max(1, intval($params['limit_number']));
$order_by = empty($params['$order_by']) ? 'id desc' : I('order_by', '', '', $params);
$order_by = empty($params['order_by']) ? 'id desc' : I('order_by', '', '', $params);
// 获取订单
$data = M('Order')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select();
@ -653,7 +653,7 @@ class OrderService
if($m->where($where)->save($data))
{
// 用户消息
ResourcesService::MessageAdd($order['user_id'], '订单取消', '订单取消成功', 1, $order['id']);
MessageService::MessageAdd($order['user_id'], '订单取消', '订单取消成功', 1, $order['id']);
// 订单状态日志
$creator = isset($params['creator']) ? intval($params['creator']) : 0;
@ -728,7 +728,7 @@ class OrderService
if($m->where($where)->save($data))
{
// 用户消息
ResourcesService::MessageAdd($order['user_id'], '订单发货', '订单已发货', 1, $order['id']);
MessageService::MessageAdd($order['user_id'], '订单发货', '订单已发货', 1, $order['id']);
// 订单状态日志
$creator = isset($params['creator']) ? intval($params['creator']) : 0;
@ -791,7 +791,7 @@ class OrderService
if($m->where($where)->save($data))
{
// 用户消息
ResourcesService::MessageAdd($order['user_id'], '订单收货', '订单收货成功', 1, $order['id']);
MessageService::MessageAdd($order['user_id'], '订单收货', '订单收货成功', 1, $order['id']);
// 订单状态日志
$creator = isset($params['creator']) ? intval($params['creator']) : 0;
@ -874,7 +874,7 @@ class OrderService
if($m->where($where)->save($data))
{
// 用户消息
ResourcesService::MessageAdd($order['user_id'], '订单删除', '订单删除成功', 1, $order['id']);
MessageService::MessageAdd($order['user_id'], '订单删除', '订单删除成功', 1, $order['id']);
return DataReturn(L('common_operation_delete_success'), 0);
}

View File

@ -172,34 +172,5 @@ class ResourcesService
return M('Region')->where($where)->field($field)->order('id asc, sort asc')->select();
}
/**
* 消息添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-21
* @desc description
* @param [int] $user_id [用户id]
* @param [string] $title [标题]
* @param [string] $detail [内容]
* @param [int] $business_type [业务类型0默认, 1订单, ...]
* @param [int] $business_id [业务id]
* @param [int] $type [类型默认0 普通消息)]
* @return [boolean] [成功true, 失败false]
*/
public static function MessageAdd($user_id, $title, $detail, $business_type = 0, $business_id = 0, $type = 0)
{
$data = array(
'title' => $title,
'detail' => $detail,
'user_id' => intval($user_id),
'business_type' => intval($business_type),
'business_id' => intval($business_id),
'type' => intval($type),
'add_time' => time(),
);
return M('Message')->add($data) > 0;
}
}
?>

View File

@ -649,6 +649,8 @@ background:url(../Images/ibar_sprites.png) no-repeat;background-position:0px -23
.am-pagination > .am-active > a, .am-pagination > .am-active > a:hover { background-color: #d13b49; border-color: #d13b49; }
.am-popup-bd { padding: 5px; background: none; }
.am-badge { padding: 0.25em 0.5em;}
/**
* 用户中心布局样式

View File

@ -28,6 +28,7 @@
.so-list .chosen-container { width:100%; }
.so-list tr td:last-child { padding-top:0px !important; }
.chosen-container-single .chosen-search input[type="text"] { width: 100% !important; }
.so-list select { width: calc(100% - 40px); display: -webkit-inline-box; }
}
/**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

After

Width:  |  Height:  |  Size: 669 B

File diff suppressed because one or more lines are too long