阶段性更新
This commit is contained in:
@@ -10,6 +10,7 @@ use RuLong\Identity\Models\Identity;
|
||||
|
||||
class IdentityController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '用户身份配置';
|
||||
|
||||
protected function grid()
|
||||
@@ -47,6 +48,7 @@ class IdentityController extends AdminController
|
||||
|
||||
$grid->column('remark', '说明');
|
||||
$grid->column('updated_at', '修改时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ class IndexController extends AdminController
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
$filter->equal('msg_txn_code', '交易类型')->select(config('unionpay.type'));
|
||||
});
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
$filter->equal('req_serial_no', '流水号');
|
||||
$filter->equal('orig_req_serial_no', '原流水号');
|
||||
});
|
||||
});
|
||||
|
||||
$grid->column('id', '#ID#');
|
||||
@@ -53,6 +57,9 @@ class IndexController extends AdminController
|
||||
$grid->column('mkt_code', '券码');
|
||||
$grid->column('msg_sys_sn', '平台流水号');
|
||||
$grid->column('req_serial_no', '查询流水号');
|
||||
$grid->column('status', '状态')
|
||||
->using(UnionpayLog::STATUS)
|
||||
->label();
|
||||
|
||||
// $grid->column('请求参数')->display(function ($title, $column) {
|
||||
// return '点击展开';
|
||||
|
||||
@@ -143,12 +143,15 @@ class IndexController extends AdminController
|
||||
$grid->column('分润规则')->display(function ($title, $column) {
|
||||
return '点击展开';
|
||||
})->modal(function ($model) {
|
||||
|
||||
if ($model->code) {
|
||||
$codes = $model->code->map(function ($code) {
|
||||
return $code->only(['name', 'code', 'profit']);
|
||||
});
|
||||
|
||||
return new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||
$table = new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||
|
||||
return trim($table->render(), '"');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
23
app/Admin/Renderable/User/Rule.php
Normal file
23
app/Admin/Renderable/User/Rule.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Renderable\User;
|
||||
|
||||
use App\Models\User;
|
||||
use Encore\Admin\Widgets\Table;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
|
||||
class Rule implements Renderable
|
||||
{
|
||||
|
||||
public function render($key = null)
|
||||
{
|
||||
$user = User::find($key);
|
||||
$codes = $user->code->map(function ($code) {
|
||||
return $code->only(['name', 'code', 'profit']);
|
||||
});
|
||||
$table = new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||
|
||||
return $table->render();
|
||||
}
|
||||
|
||||
}
|
||||
31
app/Admin/Renderable/User/ServerKey.php
Normal file
31
app/Admin/Renderable/User/ServerKey.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Renderable\User;
|
||||
|
||||
use App\Models\User;
|
||||
use Encore\Admin\Widgets\Table;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
|
||||
class ServerKey implements Renderable
|
||||
{
|
||||
|
||||
public function render($key = null)
|
||||
{
|
||||
$user = User::find($key);
|
||||
|
||||
$data = [
|
||||
[
|
||||
'服务秘钥', $user->server_key ?? '---',
|
||||
],
|
||||
[
|
||||
'DES3秘钥', $user->des3key ?? '---',
|
||||
],
|
||||
];
|
||||
|
||||
$table = new Table(['名称', '参数'], $data);
|
||||
|
||||
return $table->render();
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: sai
|
||||
* Date: 2020/1/15
|
||||
* Time: 14:31
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
class ApiUnionpayException extends \Exception
|
||||
{
|
||||
|
||||
const ERROR_CODE = 1001;
|
||||
const ERROR_MSG = 'ApiUnionpayException';
|
||||
|
||||
private $data = [];
|
||||
|
||||
/**
|
||||
* BusinessException constructor.
|
||||
* @param string $message
|
||||
* @param string $code
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct($data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常输出
|
||||
*/
|
||||
public function render($request)
|
||||
{
|
||||
return response()->json($this->getData(), 200);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ class Handler extends ExceptionHandler
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
ApiException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,6 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
info($exception->getMessage());
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Events\ConponCallback;
|
||||
use App\Models\ActivityCouponLog;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use RuntimeException;
|
||||
|
||||
class ConponCallbackListener implements ShouldQueue
|
||||
{
|
||||
@@ -55,6 +56,7 @@ class ConponCallbackListener implements ShouldQueue
|
||||
$data['remark'] = '接口错误';
|
||||
$error = true;
|
||||
}
|
||||
|
||||
ActivityCouponLog::create($data);
|
||||
|
||||
if ($error) {
|
||||
|
||||
@@ -64,4 +64,26 @@ class ActivityCoupon extends Model
|
||||
return $this->canRedemption();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 是否可以撤销
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/10/12 11:57
|
||||
* @return bool
|
||||
*/
|
||||
public function canReversal()
|
||||
{
|
||||
return $this->status == self::STATUS_USED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 撤销
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/10/12 13:56
|
||||
*/
|
||||
public function reversal()
|
||||
{
|
||||
$this->status = self::STATUS_INIT;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class Coupon extends Model
|
||||
case 4:
|
||||
return '已分润';
|
||||
break;
|
||||
case 5:
|
||||
return '已撤销';
|
||||
break;
|
||||
default:
|
||||
return '未知状态';
|
||||
break;
|
||||
@@ -88,6 +91,27 @@ class Coupon extends Model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 撤销
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/10/12 13:56
|
||||
*/
|
||||
public function reversal()
|
||||
{
|
||||
$this->status = 5;
|
||||
$this->remark = '撤销成功';
|
||||
$this->save();
|
||||
|
||||
if ($this->profit > 0) {
|
||||
return $this->user->account->rule('refreeze', -$this->profit, false, [
|
||||
'coupon_id' => $this->id,
|
||||
'redemptionCode' => $this->redemptionCode,
|
||||
]);
|
||||
} else {
|
||||
return '不需要操作';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 撤销分润
|
||||
* @Author: 玄尘
|
||||
|
||||
@@ -10,6 +10,13 @@ class UnionpayLog extends Model
|
||||
'out_source' => 'array',
|
||||
];
|
||||
|
||||
const STATUS_SUCCESS = 1;
|
||||
const STATUS_ERROR = 0;
|
||||
const STATUS = [
|
||||
self::STATUS_SUCCESS => '成功',
|
||||
self::STATUS_ERROR => '失败',
|
||||
];
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
return $this->hasOne(Coupon::class, 'redemptionCode', 'mkt_code');
|
||||
|
||||
Reference in New Issue
Block a user