提交 249aa227 编写于 作者: D devil

数据日志列表优化

上级 4181d3a3
...@@ -78,5 +78,36 @@ class IntegralLog extends Common ...@@ -78,5 +78,36 @@ class IntegralLog extends Common
$this->assign('data_list', $ret['data']); $this->assign('data_list', $ret['data']);
return $this->fetch(); return $this->fetch();
} }
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public function Detail()
{
if(!empty($this->data_request['id']))
{
// 条件
$where = [
['id', '=', intval($this->data_request['id'])],
];
// 获取列表
$data_params = [
'm' => 0,
'n' => 1,
'where' => $where,
'is_public' => 0,
'user_type' => 'admin',
];
$ret = IntegralService::IntegralLogList($data_params);
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
$this->assign('data', $data);
}
return $this->fetch();
}
} }
?> ?>
\ No newline at end of file
...@@ -80,6 +80,9 @@ class Order extends Common ...@@ -80,6 +80,9 @@ class Order extends Common
]; ];
$this->assign('buy_payment_list', PaymentService::BuyPaymentList($pay_where)); $this->assign('buy_payment_list', PaymentService::BuyPaymentList($pay_where));
// 快递公司
$this->assign('express_list', ExpressService::ExpressList());
// 基础参数赋值 // 基础参数赋值
$this->assign('params', $this->data_request); $this->assign('params', $this->data_request);
$this->assign('page_html', $page->GetPageHtml()); $this->assign('page_html', $page->GetPageHtml());
......
...@@ -78,5 +78,36 @@ class PayLog extends Common ...@@ -78,5 +78,36 @@ class PayLog extends Common
$this->assign('data_list', $ret['data']); $this->assign('data_list', $ret['data']);
return $this->fetch(); return $this->fetch();
} }
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public function Detail()
{
if(!empty($this->data_request['id']))
{
// 条件
$where = [
['id', '=', intval($this->data_request['id'])],
];
// 获取列表
$data_params = [
'm' => 0,
'n' => 1,
'where' => $where,
'is_public' => 0,
'user_type' => 'admin',
];
$ret = PayLogService::PayLogList($data_params);
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
$this->assign('data', $data);
}
return $this->fetch();
}
} }
?> ?>
\ No newline at end of file
...@@ -78,5 +78,36 @@ class RefundLog extends Common ...@@ -78,5 +78,36 @@ class RefundLog extends Common
$this->assign('data_list', $ret['data']); $this->assign('data_list', $ret['data']);
return $this->fetch(); return $this->fetch();
} }
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public function Detail()
{
if(!empty($this->data_request['id']))
{
// 条件
$where = [
['id', '=', intval($this->data_request['id'])],
];
// 获取列表
$data_params = [
'm' => 0,
'n' => 1,
'where' => $where,
'is_public' => 0,
'user_type' => 'admin',
];
$ret = RefundLogService::RefundLogList($data_params);
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
$this->assign('data', $data);
}
return $this->fetch();
}
} }
?> ?>
\ No newline at end of file
...@@ -211,6 +211,15 @@ class Goods ...@@ -211,6 +211,15 @@ class Goods
'is_multiple' => 1, 'is_multiple' => 1,
], ],
], ],
[
'label' => '购买赠送积分比例',
'view_type' => 'field',
'view_key' => 'give_integral',
'view_join_last'=> '%',
'search_config' => [
'form_type' => 'section',
],
],
[ [
'label' => '单次最低起购数量', 'label' => '单次最低起购数量',
'view_type' => 'field', 'view_type' => 'field',
......
...@@ -73,6 +73,14 @@ class Integrallog ...@@ -73,6 +73,14 @@ class Integrallog
'is_multiple' => 1, 'is_multiple' => 1,
], ],
], ],
[
'label' => '操作积分',
'view_type' => 'field',
'view_key' => 'operation_integral',
'search_config' => [
'form_type' => 'section',
],
],
[ [
'label' => '原始积分', 'label' => '原始积分',
'view_type' => 'field', 'view_type' => 'field',
...@@ -117,6 +125,13 @@ class Integrallog ...@@ -117,6 +125,13 @@ class Integrallog
'form_name' => 'add_time', 'form_name' => 'add_time',
], ],
], ],
[
'label' => '操作',
'view_type' => 'operate',
'view_key' => 'integrallog/module/operate',
'align' => 'center',
'fixed' => 'right',
],
], ],
]; ];
} }
......
...@@ -151,6 +151,13 @@ class Paylog ...@@ -151,6 +151,13 @@ class Paylog
'form_name' => 'add_time', 'form_name' => 'add_time',
], ],
], ],
[
'label' => '操作',
'view_type' => 'operate',
'view_key' => 'paylog/module/operate',
'align' => 'center',
'fixed' => 'right',
],
], ],
]; ];
} }
......
...@@ -166,6 +166,13 @@ class Refundlog ...@@ -166,6 +166,13 @@ class Refundlog
'form_name' => 'add_time', 'form_name' => 'add_time',
], ],
], ],
[
'label' => '操作',
'view_type' => 'operate',
'view_key' => 'refundlog/module/operate',
'align' => 'center',
'fixed' => 'right',
],
], ],
]; ];
} }
......
...@@ -130,8 +130,17 @@ ...@@ -130,8 +130,17 @@
<input type="text" name="inventory_unit" placeholder="库存单位" minlength="1" maxlength="6" data-validation-message="库存单位格式 1~6 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.inventory_unit}}"{{/if}} required /> <input type="text" name="inventory_unit" placeholder="库存单位" minlength="1" maxlength="6" data-validation-message="库存单位格式 1~6 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.inventory_unit}}"{{/if}} required />
</div> </div>
<div class="am-form-group"> <div class="am-form-group">
<label>购买赠送积分比例<span class="am-form-group-label-tips">按照商品金额比例乘以数量的比例进行发放</span></label>
<div class="am-input-group am-input-group-sm">
<input type="number" name="give_integral" placeholder="购买赠送积分" min="0" max="100" data-validation-message="购买赠送积分比例 0~100 的数字" class="am-form-field am-radius" {{if !empty($data['give_integral'])}} value="{{$data.give_integral}}"{{/if}} />
<span class="am-input-group-btn">
<button type="button" class="am-btn am-btn-default am-radius">%</button>
</span>
</div>
</div>
<div class="am-form-group">
<label>最低起购数量<span class="am-form-group-label-tips">默认数值 1</span></label> <label>最低起购数量<span class="am-form-group-label-tips">默认数值 1</span></label>
<input type="number" name="buy_min_number" placeholder="最低起购数量" min="1" max="100000000" data-validation-message="最低起购数量 1~100000000" class="am-radius" value="{{if empty($data)}}1{{else /}}{{$data.buy_min_number}}{{/if}}" required /> <input type="number" name="buy_min_number" placeholder="最低起购数量" min="1" max="100000000" data-validation-message="最低起购数量 1~100000000" class="am-radius" value="{{if empty($data) or empty($data['buy_min_number'])}}1{{else /}}{{$data.buy_min_number}}{{/if}}" required />
</div> </div>
<div class="am-form-group"> <div class="am-form-group">
<label>单次最大购买数量<span class="am-form-group-label-tips">单次最大数值 100000000, 小于等于0或空则不限</span></label> <label>单次最大购买数量<span class="am-form-group-label-tips">单次最大数值 100000000, 小于等于0或空则不限</span></label>
......
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
<!-- 操作栏 -->
<button type="button" class="am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup" data-url="{{:MyUrl('admin/integrallog/detail', ['id'=>$module_data['id']])}}">
<i class="am-icon-eye"></i>
<span>详情</span>
</button>
\ No newline at end of file
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
<!-- 操作栏 -->
<button type="button" class="am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup" data-url="{{:MyUrl('admin/paylog/detail', ['id'=>$module_data['id']])}}">
<i class="am-icon-eye"></i>
<span>详情</span>
</button>
\ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
<tbody> <tbody>
{{if !empty($data_list) and !empty($form_table['base']['key_field'])}} {{if !empty($data_list) and !empty($form_table['base']['key_field'])}}
<!-- 处理数据数量小于默认数量 --> <!-- 处理数据数量小于默认数量 -->
{{for start="0" end="(count($data_list) < $page_size ? count($data_list) : $page_size)"}} {{for start="0" end="count($data_list)"}}
<!-- 1. tr 主键id名称 --> <!-- 1. tr 主键id名称 -->
<!-- 2. 是否黄色选中class --> <!-- 2. 是否黄色选中class -->
<tr <tr
...@@ -257,6 +257,11 @@ ...@@ -257,6 +257,11 @@
<!-- 数据匹配 --> <!-- 数据匹配 -->
{{switch $t.view_type}} {{switch $t.view_type}}
{{case field}} {{case field}}
<!-- 前后固定拼接的值 前面 -->
{{if isset($t['view_join_first'])}}
<span>{{$t.view_join_first}}</span>
{{/if}}
<!-- 如果字段为数组则处理多个字段拼接数据 --> <!-- 如果字段为数组则处理多个字段拼接数据 -->
{{if is_array($t['view_key'])}} {{if is_array($t['view_key'])}}
{{foreach $t['view_key'] as $fk=>$fv}} {{foreach $t['view_key'] as $fk=>$fv}}
...@@ -281,6 +286,10 @@ ...@@ -281,6 +286,10 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
<!-- 前后固定拼接的值 后面 -->
{{if isset($t['view_join_last'])}}
<span>{{$t.view_join_last}}</span>
{{/if}}
{{/case}} {{/case}}
{{case module}} {{case module}}
<!-- 从模块加载自定义模块数据 --> <!-- 从模块加载自定义模块数据 -->
......
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
<!-- 操作栏 -->
<button type="button" class="am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup" data-url="{{:MyUrl('admin/refundlog/detail', ['id'=>$module_data['id']])}}">
<i class="am-icon-eye"></i>
<span>详情</span>
</button>
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace app\module; namespace app\module;
use think\Controller; use think\Controller;
use think\facade\Hook;
/** /**
* 动态表格处理 * 动态表格处理
...@@ -80,6 +81,20 @@ class FormHandleModule ...@@ -80,6 +81,20 @@ class FormHandleModule
return DataReturn('表格唯一字段配置有误['.$module.']base->[key_field]', -1); return DataReturn('表格唯一字段配置有误['.$module.']base->[key_field]', -1);
} }
// 钩子
$hv = explode('\\', $module);
if(isset($hv[2]) && isset($hv[4]) && in_array($hv[2], config('shopxo.module_form_hook_group')))
{
// 动态钩子名称 plugins_module_form_group_controller_action
$hook_name = 'plugins_module_form_'.strtolower($hv[2]).'_'.strtolower($hv[4]).'_'.strtolower($action);
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => $this->out_params,
'data' => &$this->form_data,
]);
}
// 基础条件 // 基础条件
$this->BaseWhereHandle(); $this->BaseWhereHandle();
......
...@@ -14,6 +14,7 @@ use think\Db; ...@@ -14,6 +14,7 @@ use think\Db;
use app\service\OrderService; use app\service\OrderService;
use app\service\BuyService; use app\service\BuyService;
use app\service\MessageService; use app\service\MessageService;
use app\service\IntegralService;
/** /**
* 定时任务服务层 * 定时任务服务层
...@@ -120,20 +121,25 @@ class CrontabService ...@@ -120,20 +121,25 @@ class CrontabService
Db::startTrans(); Db::startTrans();
if(Db::name('Order')->where(['id'=>$v['id'], 'status'=>3])->update($upd_data)) if(Db::name('Order')->where(['id'=>$v['id'], 'status'=>3])->update($upd_data))
{ {
// 订单商品销量增加 // 订单商品积分赠送
$ret = OrderService::GoodsSalesCountInc(['order_id'=>$v['id']]); $ret = IntegralService::OrderGoodsIntegralGiving(['order_id'=>$v['id']]);
if($ret['code'] == 0) if($ret['code'] == 0)
{ {
// 用户消息 // 订单商品销量增加
MessageService::MessageAdd($v['user_id'], '订单收货', '订单自动收货成功', 1, $v['id']); $ret = OrderService::GoodsSalesCountInc(['order_id'=>$v['id']]);
if($ret['code'] == 0)
{
// 用户消息
MessageService::MessageAdd($v['user_id'], '订单收货', '订单自动收货成功', 1, $v['id']);
// 订单状态日志 // 订单状态日志
OrderService::OrderHistoryAdd($v['id'], $upd_data['status'], $v['status'], '自动收货', 0, '系统'); OrderService::OrderHistoryAdd($v['id'], $upd_data['status'], $v['status'], '自动收货', 0, '系统');
// 提交事务 // 提交事务
Db::commit(); Db::commit();
$sucs++; $sucs++;
continue; continue;
}
} }
} }
// 事务回滚 // 事务回滚
......
...@@ -1084,6 +1084,9 @@ class GoodsService ...@@ -1084,6 +1084,9 @@ class GoodsService
$content_web = empty($params['content_web']) ? '' : ResourcesService::ContentStaticReplace(htmlspecialchars_decode($params['content_web']), 'add'); $content_web = empty($params['content_web']) ? '' : ResourcesService::ContentStaticReplace(htmlspecialchars_decode($params['content_web']), 'add');
$fictitious_goods_value = empty($params['fictitious_goods_value']) ? '' : ResourcesService::ContentStaticReplace(htmlspecialchars_decode($params['fictitious_goods_value']), 'add'); $fictitious_goods_value = empty($params['fictitious_goods_value']) ? '' : ResourcesService::ContentStaticReplace(htmlspecialchars_decode($params['fictitious_goods_value']), 'add');
// 赠送积分
$give_integral = max(0, (isset($params['give_integral']) && $params['give_integral'] <= 100) ? intval($params['give_integral']) : 0);
// 基础数据 // 基础数据
$data = [ $data = [
'title' => $params['title'], 'title' => $params['title'],
...@@ -1092,6 +1095,7 @@ class GoodsService ...@@ -1092,6 +1095,7 @@ class GoodsService
'model' => $params['model'], 'model' => $params['model'],
'place_origin' => isset($params['place_origin']) ? intval($params['place_origin']) : 0, 'place_origin' => isset($params['place_origin']) ? intval($params['place_origin']) : 0,
'inventory_unit' => $params['inventory_unit'], 'inventory_unit' => $params['inventory_unit'],
'give_integral' => $give_integral,
'buy_min_number' => max(1, isset($params['buy_min_number']) ? intval($params['buy_min_number']) : 1), 'buy_min_number' => max(1, isset($params['buy_min_number']) ? intval($params['buy_min_number']) : 1),
'buy_max_number' => isset($params['buy_max_number']) ? intval($params['buy_max_number']) : 0, 'buy_max_number' => isset($params['buy_max_number']) ? intval($params['buy_max_number']) : 0,
'is_deduction_inventory' => isset($params['is_deduction_inventory']) ? intval($params['is_deduction_inventory']) : 0, 'is_deduction_inventory' => isset($params['is_deduction_inventory']) ? intval($params['is_deduction_inventory']) : 0,
......
...@@ -31,40 +31,29 @@ class IntegralService ...@@ -31,40 +31,29 @@ class IntegralService
* @datetime 2018-05-18T16:51:12+0800 * @datetime 2018-05-18T16:51:12+0800
* @param [int] $user_id [用户id] * @param [int] $user_id [用户id]
* @param [int] $original_integral [原始积分] * @param [int] $original_integral [原始积分]
* @param [int] $new_integral [最新积分] * @param [int] $operation_integral[操作积分]
* @param [string] $msg [操作原因] * @param [string] $msg [操作原因]
* @param [int] $type [操作类型(0减少, 1增加)] * @param [int] $type [操作类型(0减少, 1增加)]
* @param [int] $operation_id [操作人员id] * @param [int] $operation_id [操作人员id]
* @return [boolean] [成功true, 失败false] * @return [boolean] [成功true, 失败false]
*/ */
public static function UserIntegralLogAdd($user_id, $original_integral, $new_integral, $msg = '', $type = 0, $operation_id = 0) public static function UserIntegralLogAdd($user_id, $original_integral, $operation_integral, $msg = '', $type = 0, $operation_id = 0)
{ {
$data = array( $data = array(
'user_id' => intval($user_id), 'user_id' => intval($user_id),
'original_integral' => intval($original_integral), 'original_integral' => intval($original_integral),
'new_integral' => intval($new_integral), 'operation_integral' => intval($operation_integral),
'msg' => $msg, 'msg' => $msg,
'type' => intval($type), 'type' => intval($type),
'operation_id' => intval($operation_id), 'operation_id' => intval($operation_id),
'add_time' => time(), 'add_time' => time(),
); );
$data['new_integral'] = ($data['type'] == 1) ? $data['original_integral']+$data['operation_integral'] : $data['original_integral']-$data['operation_integral'];
if(Db::name('UserIntegralLog')->insertGetId($data) > 0) if(Db::name('UserIntegralLog')->insertGetId($data) > 0)
{ {
$type_msg = lang('common_integral_log_type_list')[$type]['name']; $type_msg = lang('common_integral_log_type_list')[$type]['name'];
$integral = ($data['type'] == 0) ? $data['original_integral']-$data['new_integral'] : $data['new_integral']-$data['original_integral']; $detail = $msg.'积分'.$type_msg.$operation_integral;
$detail = $msg.'积分'.$type_msg.$integral;
MessageService::MessageAdd($user_id, '积分变动', $detail); MessageService::MessageAdd($user_id, '积分变动', $detail);
// 用户登录数据更新防止数据存储session不同步展示
if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
{
$user = UserService::LoginUserInfo();
if(isset($user['id']) && $user['id'] == $user_id)
{
UserService::UserLoginRecord($user_id);
}
}
return true; return true;
} }
return false; return false;
...@@ -176,7 +165,7 @@ class IntegralService ...@@ -176,7 +165,7 @@ class IntegralService
} }
/** /**
* 订单商品积分赠送(已丢弃) * 订单商品积分赠送
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
...@@ -208,39 +197,109 @@ class IntegralService ...@@ -208,39 +197,109 @@ class IntegralService
} }
if(!in_array($order['status'], [4])) if(!in_array($order['status'], [4]))
{ {
return DataReturn('当前订单状态不允许操作['.$params['order_id'].'-'.$order['status'].']', 0); return DataReturn('当前订单状态不允许操作,未完成', 0);
} }
// 获取用户信息 // 获取用户信息
$user = Db::name('User')->field('id')->find(intval($order['user_id'])); $user = Db::name('User')->field('id')->find($order['user_id']);
if(empty($user)) if(empty($user))
{ {
return DataReturn('用户不存在或已删除,中止操作', 0); return DataReturn('用户不存在或已删除,中止操作', 0);
} }
// 获取订单商品 // 获取订单商品
$goods_all = Db::name('OrderDetail')->where(['order_id'=>$params['order_id']])->column('goods_id'); $order_detail = Db::name('OrderDetail')->where(['order_id'=>$params['order_id']])->field('goods_id,total_price')->select();
if(!empty($goods_all)) if(!empty($order_detail))
{ {
foreach($goods_all as $goods_id) // 获取赠送积分的商品
$goods_give = Db::name('Goods')->where(['id'=>array_column($order_detail, 'goods_id')])->column('give_integral', 'id');
// 循环发放
foreach($order_detail as $dv)
{ {
$give_integral = Db::name('Goods')->where(['id'=>$goods_id])->value('give_integral'); if(array_key_exists($dv['goods_id'], $goods_give))
if(!empty($give_integral))
{ {
// 用户积分添加 $give_rate = $goods_give[$dv['goods_id']];
$user_integral = Db::name('User')->where(['id'=>$user['id']])->value('integral'); if($give_rate > 0 && $give_rate <= 100)
if(!Db::name('User')->where(['id'=>$user['id']])->setInc('integral', $give_integral))
{ {
return DataReturn('用户积分赠送失败['.$params['order_id'].'-'.$goods_id.']', -10); // 实际赠送积分
} $give_integral = intval(($give_rate/100)*$dv['total_price']);
if($give_integral >= 1)
{
// 用户积分添加
$user_integral = Db::name('User')->where(['id'=>$user['id']])->value('integral');
if(!Db::name('User')->where(['id'=>$user['id']])->setInc('integral', $give_integral))
{
return DataReturn('用户积分赠送失败['.$params['order_id'].'-'.$goods_id.']', -10);
}
// 积分日志 // 积分日志
self::UserIntegralLogAdd($user['id'], $user_integral, $user_integral+$give_integral, '订单商品完成赠送', 1); self::UserIntegralLogAdd($user['id'], $user_integral, $give_integral, '订单商品完成赠送', 1);
}
}
} }
} }
return DataReturn('操作成功', 0); return DataReturn('操作成功', 0);
} }
return DataReturn('没有需要操作的数据', 0); return DataReturn('没有需要操作的数据', 0);
} }
/**
* 订单商品积分释放
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-28
* @desc description
* @param [array] $params [输入参数]
*/
public static function OrderGoodsIntegralRollback($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'order_detail_id',
'error_msg' => '订单详情id有误',
]
];
$ret = ParamsChecked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
// 订单详情
$order_detail = Db::name('OrderDetail')->field('id,user_id,order_id,goods_id,total_price,refund_price')->find(intval($params['order_detail_id']));
if(empty($order_detail))
{
return DataReturn('订单详情不存在或已删除,中止操作', 0);
}
// 获取用户信息
$user = Db::name('User')->field('id,integral')->find($order_detail['user_id']);
if(empty($user))
{
return DataReturn('用户不存在或已删除,中止操作', 0);
}
// 获取商品相关信息
$give_rate = Db::name('Goods')->where(['id'=>$order_detail['goods_id']])->value('give_integral');
if($give_rate > 0 && $give_rate <= 100)
{
$give_integral = intval(($give_rate/100)*$order_detail['refund_price']);
if($give_integral >= 1)
{
// 用户积分添加
if(!Db::name('User')->where(['id'=>$user['id']])->setDec('integral', $give_integral))
{
return DataReturn('用户积分释放失败['.$order_detail['order_id'].'-'.$order_detail['goods_id'].']', -10);
}
// 积分日志
self::UserIntegralLogAdd($user['id'], $user['integral'], $give_integral, '订单商品发生售后收回', 0);
}
}
}
} }
?> ?>
\ No newline at end of file
...@@ -210,32 +210,34 @@ class NavigationService ...@@ -210,32 +210,34 @@ class NavigationService
$field = '*'; $field = '*';
$data = self::NavigationHandle(self::NavDataDealWith(Db::name('Navigation')->field($field)->where($where1)->order('sort')->select())); $data = self::NavigationHandle(self::NavDataDealWith(Db::name('Navigation')->field($field)->where($where1)->order('sort')->select()));
$result = [];
if(!empty($data)) if(!empty($data))
{ {
// 子级数据 // 子级数据组合
$items = [];
$where2 = $where; $where2 = $where;
$where2[] = ['pid', 'in', array_column($data, 'id')]; $where2[] = ['pid', 'in', array_column($data, 'id')];
$items_data = self::NavigationHandle(self::NavDataDealWith(Db::name('Navigation')->field($field)->where($where2)->order('sort')->select())); $items_data = self::NavigationHandle(self::NavDataDealWith(Db::name('Navigation')->field($field)->where($where2)->order('sort')->select()));
$items_group = [];
if(!empty($items_data)) if(!empty($items_data))
{ {
foreach($items_data as $it) foreach($items_data as $tv)
{ {
$items[$it['pid']][] = $it; $items_group[$tv['pid']][] = $tv;
} }
} }
// 数据处理 // 数据集合
foreach($data as $k=>$v) foreach($data as $dv)
{ {
// 数据类型 $result[] = $dv;
if(isset($items[$v['id']])) if(!empty($items_group) && array_key_exists($dv['id'], $items_group))
{ {
array_splice($data, $k+1, 0, $items[$v['id']]); $result = array_merge($result, $items_group[$dv['id']]);
} }
} }
} }
return DataReturn('处理成功', 0, $data);
return DataReturn('处理成功', 0, $result);
} }
/** /**
......
...@@ -17,6 +17,7 @@ use app\service\ResourcesService; ...@@ -17,6 +17,7 @@ use app\service\ResourcesService;
use app\service\RefundLogService; use app\service\RefundLogService;
use app\service\OrderService; use app\service\OrderService;
use app\service\MessageService; use app\service\MessageService;
use app\service\IntegralService;
use app\plugins\wallet\service\WalletService; use app\plugins\wallet\service\WalletService;
/** /**
...@@ -966,10 +967,18 @@ class OrderAftersaleService ...@@ -966,10 +967,18 @@ class OrderAftersaleService
if($ret['code'] != 0) if($ret['code'] != 0)
{ {
Db::rollback(); Db::rollback();
return DataReturn($ret['msg'], -10); return $ret;
} }
} }
// 积分释放
$ret = IntegralService::OrderGoodsIntegralRollback(['order_detail_id'=>$aftersale['order_detail_id']]);
if($ret['code'] != 0)
{
Db::rollback();
return $ret;
}
// 消息通知 // 消息通知
$detail = '订单退款成功,金额'.PriceBeautify($aftersale['price']).'元'; $detail = '订单退款成功,金额'.PriceBeautify($aftersale['price']).'元';
MessageService::MessageAdd($order['data']['user_id'], '订单退款', $detail, 1, $order['data']['id']); MessageService::MessageAdd($order['data']['user_id'], '订单退款', $detail, 1, $order['data']['id']);
......
...@@ -1447,6 +1447,15 @@ class OrderService ...@@ -1447,6 +1447,15 @@ class OrderService
]; ];
if(Db::name('Order')->where($where)->update($upd_data)) if(Db::name('Order')->where($where)->update($upd_data))
{ {
// 订单商品积分赠送
$ret = IntegralService::OrderGoodsIntegralGiving(['order_id'=>$order['id']]);
if($ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return DataReturn($ret['msg'], -10);
}
// 订单商品销量增加 // 订单商品销量增加
$ret = self::GoodsSalesCountInc(['order_id'=>$order['id']]); $ret = self::GoodsSalesCountInc(['order_id'=>$order['id']]);
if($ret['code'] != 0) if($ret['code'] != 0)
......
...@@ -329,13 +329,15 @@ class UserService ...@@ -329,13 +329,15 @@ class UserService
if(($data['integral'] > 0 && empty($user)) || (isset($user['integral']) && $user['integral'] != $data['integral'])) if(($data['integral'] > 0 && empty($user)) || (isset($user['integral']) && $user['integral'] != $data['integral']))
{ {
$integral_type = 1; $integral_type = 1;
$integral = 0; $old_integral = 0;
if(isset($user['integral'])) $opt_integral = 0;
if(!empty($params['id']))
{ {
$old_integral = $user['integral'];
$integral_type = ($user['integral'] > $data['integral']) ? 0 : 1; $integral_type = ($user['integral'] > $data['integral']) ? 0 : 1;
$integral = $user['integral']; $opt_integral = ($integral_type == 1) ? $data['integral']-$user['integral'] : $user['integral']-$data['integral'];
} }
IntegralService::UserIntegralLogAdd($user_id, $integral, $data['integral'], '管理员操作', $integral_type, $params['admin']['id']); IntegralService::UserIntegralLogAdd($user_id, $old_integral, $opt_integral, '管理员操作', $integral_type, $params['admin']['id']);
} }
return DataReturn('操作成功', 0); return DataReturn('操作成功', 0);
} }
......
+=========================================================+
ShopXO 1.9.0 Release --- http://shopxo.net
+=========================================================+
全局
1. 所有条件、列表、新增、编辑、删除 新增钩子(公共 form 表单封装)
2. 积分支持按照订单商品总额比例发放,发生售后收回积分
3. 微信小程序好物推荐和直播组件支持配置组件版本号
web端
小程序端
插件
+=========================================================+ +=========================================================+
ShopXO 1.8.1 Release 20200420 http://shopxo.net ShopXO 1.8.1 Release 20200420 http://shopxo.net
+=========================================================+ +=========================================================+
......
...@@ -93,5 +93,8 @@ return [ ...@@ -93,5 +93,8 @@ return [
// 验证码最大验证次数,防止暴力破解 // 验证码最大验证次数,防止暴力破解
'security_prevent_violence_max' => 6, 'security_prevent_violence_max' => 6,
// 动态表格可加入钩子组
'module_form_hook_group' => ['admin', 'index', 'api'],
]; ];
?> ?>
\ No newline at end of file
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title> <title></title>
<script type="text/javascript" src="../internal.js"></script> <script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak={{common_baidu_map_ak}}"></script> <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=XSdiGjfg3wOHiKjpYEMG6CYA"></script>
<style type="text/css"> <style type="text/css">
.content{width:530px; height: 350px;margin: 10px auto;} .content{width:530px; height: 350px;margin: 10px auto;}
.content table{width: 100%} .content table{width: 100%}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册