Merge branch 'feature/payment_merchant' of wmtx/platform into release

完善支付商户操作日志
master
廖金灵 5 years ago committed by Gogs
commit d73ab9c4cd

@ -2399,6 +2399,7 @@ function addOperationLog($options)
'op_name'=>$options['op_name'],
'url'=>$options['url'],
'key'=>$options['key'],
'content'=>$options['content'] ?? '',
'create_time'=>time()
];
//获取菜单名称

@ -127,6 +127,16 @@ class PaymentMerchantController extends ThinkController
}
$statusText = $status == 0 ? '禁用' : '启用';
M('payment_merchant', 'tab_')->where(['id' => $id])->save(['status' => $status]);
addOperationLog([
'op_type' => 1,
'key' => $id,
'op_name' => '修改商户状态',
'url' => U('PaymentMerchant/changeStatus'),
'menu' => '系统-扩展工具-支付收款商户-修改商户状态',
'content' => json_encode(['status' => $status]),
]);
$this->ajaxReturn([
'status' => 1,
'message' => $statusText . '成功',
@ -212,9 +222,28 @@ class PaymentMerchantController extends ThinkController
$data['channel'] = $channel;
$data['identifier'] = $paymentMerchantService->getIdentifierByConfig($config, $channel);
M('payment_merchant', 'tab_')->add($data);
addOperationLog([
'op_type' => 0,
'key' => $id,
'op_name' => '添加商户',
'url' => U('PaymentMerchant/save'),
'menu' => '系统-扩展工具-支付收款商户-添加商户',
'content' => json_encode($data),
]);
} else {
$data['identifier'] = $paymentMerchantService->getIdentifierByConfig($config, $merchant['channel']);
M('payment_merchant', 'tab_')->where(['id' => $id])->save($data);
addOperationLog([
'op_type' => 1,
'key' => $id,
'op_name' => '修改商户',
'url' => U('PaymentMerchant/save'),
'menu' => '系统-扩展工具-支付收款商户-修改商户',
'content' => json_encode($data),
]);
}
$this->ajaxReturn([
@ -228,14 +257,23 @@ class PaymentMerchantController extends ThinkController
public function delete()
{
$id = I('id', 0);
M('payment_merchant', 'tab_')->where(['id' => $id])->delete();
$merchant = M('payment_merchant', 'tab_')->where(['id' => $id])->find();
if ($merchant === null) {
$this->ajaxReturn([
'status' => 0,
'message' => '记录不存在'
]);
}
M('payment_merchant', 'tab_')->where(['id' => $id])->delete();
addOperationLog([
'op_type' => 2,
'key' => $id,
'op_name' => '删除商户渠道',
'url' => U('Market/delete', ['id' => $id]),
'menu' => '推广员-推广员管理-市场换绑-删除商户渠道'
'op_name' => '删除商户',
'url' => U('PaymentMerchant/delete'),
'menu' => '系统-扩展工具-支付收款商户-删除商户',
'content' => json_encode($merchant),
]);
$this->ajaxReturn([
@ -284,6 +322,15 @@ class PaymentMerchantController extends ThinkController
}
$model->commit();
addOperationLog([
'op_type' => 1,
'key' => implode(',', array_values($setting)),
'op_name' => '设置默认商户',
'url' => U('PaymentMerchant/saveDefault'),
'menu' => '系统-扩展工具-支付收款商户-设置默认商户',
'content' => json_encode($setting),
]);
$this->ajaxReturn([
'status' => 1,
'message' => '设置成功'
@ -462,6 +509,7 @@ class PaymentMerchantController extends ThinkController
]);
}
$ids = [];
$paymentRuleService = new PaymentRuleService();
foreach ($records as $record) {
$startTime = $record['start_time'] == '' ? 0 : strtotime($record['start_time'] . ' 00:00:00');
@ -486,8 +534,18 @@ class PaymentMerchantController extends ThinkController
'update_time' => time()
];
$id = M('payment_rule', 'tab_')->add($item);
$ids[] = $id;
}
addOperationLog([
'op_type' => 0,
'key' => implode(',', $ids),
'op_name' => '新增支付商户配置',
'url' => U('PaymentMerchant/saveRule'),
'menu' => '推广员-推广员管理-支付商户配置-新增支付商户配置',
'content' => json_encode($records)
]);
$this->ajaxReturn([
'status' => 1,
'message' => '添加成功'
@ -587,6 +645,15 @@ class PaymentMerchantController extends ThinkController
M('payment_rule', 'tab_')->where(['id' => $id])->save($item);
addOperationLog([
'op_type' => 1,
'key' => $id,
'op_name' => '修改支付商户配置',
'url' => U('PaymentMerchant/modifyRule', ['id' => $id]),
'menu' => '推广员-推广员管理-支付商户配置-修改支付商户配置',
'content' => json_encode(['rule' => $rule, 'modify' => $item]),
]);
$this->ajaxReturn([
'status' => 1,
'message' => '修改成功'
@ -596,16 +663,24 @@ class PaymentMerchantController extends ThinkController
public function deleteRule()
{
$id = I('id', 0);
M('payment_rule', 'tab_')->where(['id' => $id])->delete();
$rule = M('payment_rule', 'tab_')->where(['id' => $id])->find();
if (!$rule) {
$this->ajaxReturn([
'status' => 0,
'message' => '记录不存在'
]);
}
M('payment_rule', 'tab_')->where(['id' => $id])->delete();
addOperationLog([
'op_type' => 2,
'key' => $id,
'op_name' => '删除支付商户配置',
'url' => U('PaymentMerchant/deleteRule', ['id' => $id]),
'menu' => '推广员-推广员管理-市场换绑-删除支付商户配置'
'menu' => '推广员-推广员管理-支付商户配置-删除支付商户配置',
'content' => json_encode($rule),
]);
$this->ajaxReturn([
'status' => 1,
'message' => '删除成功'

Loading…
Cancel
Save