Merge branch 'develop'

This commit is contained in:
mzl
2025-09-18 15:05:57 +08:00
parent 5fef15b0fa
commit b7b6edb06c
46 changed files with 522 additions and 1512 deletions
+1
View File
@@ -7,3 +7,4 @@
/tests/tmp /tests/tmp
/tests/.phpunit.result.cache /tests/.phpunit.result.cache
/public/uploads /public/uploads
/webman
@@ -3,7 +3,7 @@ namespace app\admin\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\admin\service\ApprovalFlowsService; use app\common\service\ApprovalFlowsService;
class ApprovalFlowsController extends BaseController class ApprovalFlowsController extends BaseController
{ {
@@ -3,7 +3,7 @@ namespace app\admin\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\admin\service\ApprovalInstancesService; use app\common\service\ApprovalInstancesService;
class ApprovalInstancesController extends BaseController class ApprovalInstancesController extends BaseController
{ {
@@ -3,8 +3,7 @@ namespace app\admin\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\admin\service\ApprovalRecordsService; use app\common\service\ApprovalRecordsService;
use app\admin\service\SysDictService;
use app\common\model\SysDictItem; use app\common\model\SysDictItem;
use support\Request; use support\Request;
@@ -31,16 +30,16 @@ class ApprovalRecordsController extends BaseController
foreach ($data['records'] as $key => &$record) { foreach ($data['records'] as $key => &$record) {
$result = [ $result = [
'id' => $record['id'], 'id' => $record['id'],
'flows_name' => $record['approvalInstance']['flows']['name'], 'flows_name' => $record['instance']['flows']['name'],
'instance_id' => $record['instance_id'], 'instance_id' => $record['instance_id'],
'biz_id' => $record['approvalInstance']['biz_id'], 'biz_id' => $record['instance']['biz_id'],
'biz_desc' => '备货单【'.$record['approvalInstance']['bizInfo']['order_no'].'】', 'biz_desc' => '备货单【'.$record['instance']['bizInfo']['order_no'].'】',
'biz_type' => $record['approvalInstance']['flow_type'], 'biz_type' => $record['instance']['flow_type'],
'initiator_name' => $record['approvalInstance']['initiator']['name'], 'initiator_name' => $record['instance']['initiator']['name'],
'initiator_avatar' => $record['approvalInstance']['initiator']['avatar'], 'initiator_avatar' => $record['instance']['initiator']['avatar'],
'approver_name' => $record['approver']['name'], 'approver_name' => $record['approver']['name'],
'approver_avatar' => $record['approver']['avatar'], 'approver_avatar' => $record['approver']['avatar'],
@@ -53,8 +52,8 @@ class ApprovalRecordsController extends BaseController
'comment' => $record['comment'], 'comment' => $record['comment'],
'approved_at' => $record['approved_at'], 'approved_at' => $record['approved_at'],
'finished_at' => $record['approvalInstance']['finished_at'], 'finished_at' => $record['instance']['finished_at'],
'deadline_at' => $record['approvalInstance']['deadline_at'], 'deadline_at' => $record['instance']['deadline_at'],
'created_at' => $record['created_at'] 'created_at' => $record['created_at']
]; ];
@@ -87,4 +86,57 @@ class ApprovalRecordsController extends BaseController
return $this->error($e->getMessage()); return $this->error($e->getMessage());
} }
} }
public function todo(Request $request)
{
try {
$raw = $this->service->serviceList($request, 'todo');
$data = $this->transformData($raw, method_exists($this, 'todoFormat')
? [$this, 'todoFormat']
: null);
return $this->success($data);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}
}
protected function todoFormat($data)
{
if (isset($data['records']) && count($data['records']) > 0) {
foreach ($data['records'] as $key => &$record) {
$result = [
'id' => $record['id'],
'flows_name' => $record['instance']['flows']['name'],
'instance_id' => $record['instance_id'],
'biz_id' => $record['instance']['biz_id'],
'biz_desc' => '备货单号【'.$record['instance']['bizInfo']['order_no'].'】',
'biz_type' => $record['instance']['flow_type'],
'initiator_name' => $record['instance']['initiator']['name'],
'initiator_avatar' => $record['instance']['initiator']['avatar'],
'approver_name' => $record['approver']['name'],
'approver_avatar' => $record['approver']['avatar'],
'step_index' => $record['step_index'],
'action' => $record['action'],
'action_desc' => SysDictItem::where('item_value', $record['action'])->where('status', 1)->value('item_label'),
'status' => $record['status'],
'status_desc' => SysDictItem::where('item_value', $record['status'])->where('status', 1)->value('item_label'),
'comment' => $record['comment'],
'approved_at' => $record['approved_at'],
'finished_at' => $record['instance']['finished_at'],
'deadline_at' => $record['instance']['deadline_at'],
'created_at' => $record['created_at']
];
$record = $result;
}
}
return $data;
}
} }
@@ -1,17 +0,0 @@
<?php
namespace app\admin\logic;
use app\common\traits\crud\CrudLogicTrait;
use app\admin\model\ApprovalInstances;
class ApprovalInstancesLogic
{
use CrudLogicTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalInstances::class;
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace app\admin\logic;
use app\common\traits\crud\CrudLogicTrait;
use app\admin\model\ApprovalRecords;
class ApprovalRecordsLogic
{
use CrudLogicTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalRecords::class;
}
-54
View File
@@ -1,54 +0,0 @@
<?php
namespace app\admin\model;
use support\Model;
class ApprovalFlows extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_flows';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'name', 'type', 'steps', 'is_active', 'timeout_hours', 'timeout_action', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
protected $casts = [
'steps' => 'array',
];
}
-107
View File
@@ -1,107 +0,0 @@
<?php
namespace app\admin\model;
use app\common\model\StockOrders;
use app\common\model\User;
use support\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ApprovalInstances extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_instances';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
// protected $fillable = ['id', 'flow_type', 'biz_id', 'biz_type', 'form_data', 'initiator_id', 'status', 'current_step', 'finished_at', 'deadline_at', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
protected $fillable = [
'flow_type',
'biz_id',
'biz_type',
'form_data',
'initiator_id',
'status',
'current_step',
'finished_at',
'deadline_at',
];
protected $casts = [
'form_data' => 'array', // 自动转换 JSON 字段为数组
'finished_at' => 'datetime',
'deadline_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* 一个审批实例可以有多个审批记录
*/
public function approvalRecords(): HasMany
{
return $this->hasMany(ApprovalRecords::class, 'instance_id');
}
/**
* 获取当前步骤的所有审批记录(pending 状态)
*/
public function currentStepRecords()
{
return $this->approvalRecords()
->where('step_index', $this->current_step)
->where('status', 'pending');
}
public function flows()
{
return $this->belongsTo(ApprovalFlows::class, 'flow_type', 'type');
}
public function initiator()
{
return $this->belongsTo(User::class, 'initiator_id', 'id');
}
public function bizInfo()
{
return $this->hasOne(StockOrders::class, 'id', 'biz_id');
}
}
-84
View File
@@ -1,84 +0,0 @@
<?php
namespace app\admin\model;
use app\common\model\User;
use support\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ApprovalRecords extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_records';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
// protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'status', 'comment', 'approved_at', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
protected $fillable = [
'instance_id',
'approver_id',
'step_index',
'action',
'status',
'comment',
'approved_at',
];
protected $casts = [
'approved_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* 一条审批记录属于一个审批实例
*/
public function approvalInstance(): BelongsTo
{
return $this->belongsTo(ApprovalInstances::class, 'instance_id');
}
/**
* 关联审批人
*/
public function approver()
{
return $this->belongsTo(User::class, 'approver_id');
}
}
@@ -1,9 +1,9 @@
<?php <?php
namespace app\admin\logic; namespace app\common\logic;
use app\common\traits\crud\CrudLogicTrait; use app\common\traits\crud\CrudLogicTrait;
use app\admin\model\ApprovalFlows; use app\common\model\ApprovalFlows;
class ApprovalFlowsLogic class ApprovalFlowsLogic
{ {
@@ -1,9 +1,9 @@
<?php <?php
namespace app\crm\logic; namespace app\common\logic;
use app\common\traits\crud\CrudLogicTrait; use app\common\traits\crud\CrudLogicTrait;
use app\crm\model\ApprovalInstances; use app\common\model\ApprovalInstances;
class ApprovalInstancesLogic class ApprovalInstancesLogic
{ {
@@ -1,9 +1,9 @@
<?php <?php
namespace app\crm\logic; namespace app\common\logic;
use app\common\traits\crud\CrudLogicTrait; use app\common\traits\crud\CrudLogicTrait;
use app\crm\model\ApprovalRecords; use app\common\model\ApprovalRecords;
class ApprovalRecordsLogic class ApprovalRecordsLogic
{ {
@@ -1,6 +1,6 @@
<?php <?php
namespace app\common\utils\approval\model; namespace app\common\model;
use support\Model; use support\Model;
@@ -35,7 +35,7 @@ class ApprovalCcs extends Model
public $timestamps = true; public $timestamps = true;
protected $dateFormat = 'U'; // protected $dateFormat = 'U';
/** /**
* 允许自动填充模型字段 * 允许自动填充模型字段
@@ -1,6 +1,6 @@
<?php <?php
namespace app\crm\model; namespace app\common\model;
use support\Model; use support\Model;
@@ -35,7 +35,7 @@ class ApprovalFlows extends Model
public $timestamps = true; public $timestamps = true;
protected $dateFormat = 'U'; // protected $dateFormat = 'U';
/** /**
* 允许自动填充模型字段 * 允许自动填充模型字段
@@ -47,7 +47,6 @@ class ApprovalFlows extends Model
*/ */
protected $guarded = []; protected $guarded = [];
protected $casts = [ protected $casts = [
'steps' => 'array', 'steps' => 'array',
]; ];
@@ -1,11 +1,10 @@
<?php <?php
namespace app\crm\model; namespace app\common\model;
use app\common\model\StockOrders; use app\common\model\StockOrders;
use app\common\model\User; use app\common\model\User;
use support\Model; use support\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ApprovalInstances extends Model class ApprovalInstances extends Model
{ {
@@ -38,7 +37,7 @@ class ApprovalInstances extends Model
public $timestamps = true; public $timestamps = true;
protected $dateFormat = 'U'; // protected $dateFormat = 'U';
/** /**
* 允许自动填充模型字段 * 允许自动填充模型字段
@@ -50,7 +49,6 @@ class ApprovalInstances extends Model
*/ */
protected $guarded = []; protected $guarded = [];
protected $fillable = [ protected $fillable = [
'flow_type', 'flow_type',
'biz_id', 'biz_id',
@@ -71,22 +69,9 @@ class ApprovalInstances extends Model
'updated_at' => 'datetime', 'updated_at' => 'datetime',
]; ];
/** public function records()
* 一个审批实例可以有多个审批记录
*/
public function approvalRecords(): HasMany
{ {
return $this->hasMany(ApprovalRecords::class, 'instance_id'); return $this->hasMany(ApprovalRecords::class, 'instance_id', 'id');
}
/**
* 获取当前步骤的所有审批记录(pending 状态)
*/
public function currentStepRecords()
{
return $this->approvalRecords()
->where('step_index', $this->current_step)
->where('status', 'pending');
} }
public function flows() public function flows()
@@ -99,9 +84,18 @@ class ApprovalInstances extends Model
return $this->belongsTo(User::class, 'initiator_id', 'id'); return $this->belongsTo(User::class, 'initiator_id', 'id');
} }
public function bizInfo() public function bizInfo()
{ {
return $this->hasOne(StockOrders::class, 'id', 'biz_id'); return $this->belongsTo(StockOrders::class, 'biz_id', 'id');
}
/**
* 获取当前步骤的所有审批记录(pending 状态)
*/
public function currentStepRecords()
{
return $this->approvalRecords()
->where('step_index', $this->current_step)
->where('status', 'pending');
} }
} }
@@ -1,10 +1,9 @@
<?php <?php
namespace app\crm\model; namespace app\common\model;
use app\common\model\User; use app\common\model\User;
use support\Model; use support\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ApprovalRecords extends Model class ApprovalRecords extends Model
{ {
@@ -37,12 +36,12 @@ class ApprovalRecords extends Model
public $timestamps = true; public $timestamps = true;
protected $dateFormat = 'U'; // protected $dateFormat = 'U';
/** /**
* 允许自动填充模型字段 * 允许自动填充模型字段
*/ */
// protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'status', 'comment', 'approved_at', 'created_at', 'updated_at']; // protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'comment', 'approved_at', 'created_at', 'updated_at'];
/** /**
* 不允许自动填充模型字段 * 不允许自动填充模型字段
@@ -66,19 +65,14 @@ class ApprovalRecords extends Model
'updated_at' => 'datetime', 'updated_at' => 'datetime',
]; ];
/** public function instance()
* 一条审批记录属于一个审批实例
*/
public function approvalInstance(): BelongsTo
{ {
return $this->belongsTo(ApprovalInstances::class, 'instance_id'); return $this->belongsTo(ApprovalInstances::class, 'instance_id', 'id');
} }
/**
* 关联审批人
*/
public function approver() public function approver()
{ {
return $this->belongsTo(User::class, 'approver_id'); return $this->belongsTo(User::class, 'approver_id', 'id');
} }
} }
@@ -1,10 +1,10 @@
<?php <?php
namespace app\admin\service; namespace app\common\service;
use app\admin\validate\ApprovalFlowsValidate; use app\common\validate\ApprovalFlowsValidate;
use app\common\traits\crud\CrudServiceTrait; use app\common\traits\crud\CrudServiceTrait;
use app\admin\model\ApprovalFlows; use app\common\model\ApprovalFlows;
use support\Request; use support\Request;
class ApprovalFlowsService class ApprovalFlowsService
@@ -1,10 +1,10 @@
<?php <?php
namespace app\admin\service; namespace app\common\service;
use app\admin\validate\ApprovalInstancesValidate; use app\common\validate\ApprovalInstancesValidate;
use app\common\traits\crud\CrudServiceTrait; use app\common\traits\crud\CrudServiceTrait;
use app\admin\model\ApprovalInstances; use app\common\model\ApprovalInstances;
class ApprovalInstancesService class ApprovalInstancesService
{ {
@@ -1,10 +1,10 @@
<?php <?php
namespace app\admin\service; namespace app\common\service;
use app\admin\validate\ApprovalRecordsValidate; use app\common\validate\ApprovalRecordsValidate;
use app\common\traits\crud\CrudServiceTrait; use app\common\traits\crud\CrudServiceTrait;
use app\admin\model\ApprovalRecords; use app\common\model\ApprovalRecords;
use support\Request; use support\Request;
class ApprovalRecordsService class ApprovalRecordsService
@@ -42,17 +42,44 @@ class ApprovalRecordsService
$config['order']['id'] = 'desc'; $config['order']['id'] = 'desc';
$config['with'] = [ $config['with'] = [
'approvalInstance', 'instance',
'approver', 'approver',
'approvalInstance.flows', 'instance.flows',
'approvalInstance.initiator', 'instance.initiator',
'approvalInstance.bizInfo' 'instance.bizInfo'
]; ];
// $config['dataLimit']['type'] = 'relation'; // $config['dataLimit']['type'] = 'relation';
// $config['dataLimit']['userId'] = $request->user->uid; // $config['dataLimit']['userId'] = $request->user->uid;
// $config['dataLimit']['userField'] = 'approver_id'; // $config['dataLimit']['userField'] = 'approver_id';
break; break;
case 'todo':
if ($p['scene'] === 'todo') {
// if (!in_array(1, $request->user->role_ids)) {
$config['where']['approver_id'] = $request->user->uid;
// }
$config['where']['status'] = 'pending';
$config['where']['instance.status'] = 'processing';
}
if ($p['scene'] === 'history') {
if (!in_array(1, $request->user->role_ids)) {
$config['where']['approver_id'] = $request->user->uid;
}
$config['where']['status'] = ['!=', 'pending'];
}
$config['order']['id'] = 'desc';
$config['with'] = [
'instance',
'approver',
'instance.flows',
'instance.initiator',
'instance.bizInfo'
];
break;
case 'show': case 'show':
$config['where']['id'] = $p['id']; $config['where']['id'] = $p['id'];
break; break;
@@ -86,7 +86,7 @@ class MessageNotificationsService
return ['msg_id' => $msgId]; return ['msg_id' => $msgId];
} }
public function afterServiceList($data) public function afterServiceIndex($data)
{ {
$data->each(function (&$item) { $data->each(function (&$item) {
$temp = explode(',', $item->recipient); $temp = explode(',', $item->recipient);
@@ -97,7 +97,7 @@ class MessageUserStatusService
} }
protected function afterServiceList($res) protected function afterServiceIndex($res)
{ {
$res->each(function (&$item) { $res->each(function (&$item) {
if (isset($item->message)) { if (isset($item->message)) {
+1 -1
View File
@@ -95,7 +95,7 @@ class ResourceService
} }
protected function afterServiceListAll($data) protected function afterServiceDefault($data)
{ {
$data = Tree::buildMenuTreeWithReference($data->toArray()); $data = Tree::buildMenuTreeWithReference($data->toArray());
return $data; return $data;
+2 -2
View File
@@ -13,8 +13,8 @@ use support\Request;
use app\common\model\User; use app\common\model\User;
use support\Db; use support\Db;
use support\Model; use support\Model;
use app\admin\model\ApprovalInstances; use app\common\model\ApprovalInstances;
use app\admin\model\ApprovalRecords; use app\common\model\ApprovalRecords;
class StockOrdersService class StockOrdersService
{ {
+6 -4
View File
@@ -28,23 +28,25 @@ class SysDictService
public static function pluckValuesByCode(string $dictCode): \Illuminate\Support\Collection public static function pluckValuesByCode(string $dictCode): array
{ {
return SysDict::where('dict_code', $dictCode) return SysDict::where('dict_code', $dictCode)
->where('status', 1) ->where('status', 1)
->first()?->items() ->first()?->items()
->where('status', 1) ->where('status', 1)
->orderBy('sort') ->orderBy('sort')
->pluck('item_value') ?? collect(); ->pluck('item_value')
->toArray() ?? [];
} }
public static function pluckKeyValueByCode(string $dictCode): \Illuminate\Support\Collection public static function pluckKeyValueByCode(string $dictCode): array
{ {
return SysDict::where('dict_code', $dictCode) return SysDict::where('dict_code', $dictCode)
->where('status', 1) ->where('status', 1)
->first()?->items() ->first()?->items()
->where('status', 1) ->where('status', 1)
->orderBy('sort') ->orderBy('sort')
->pluck('item_value', 'item_label') ?? collect(); ->pluck('item_value', 'item_label')
->toArray() ?? [];
} }
} }
+35 -32
View File
@@ -27,63 +27,61 @@ trait CrudServiceTrait
} }
/** 分页列表 */ /** 分页列表 */
public function serviceList(Request $request) public function serviceList(Request $request, string $scene = 'index')
{ {
if (method_exists($this, 'complexQuery')) { $result = $this->cqyProcess(ucfirst($scene), $request);
$result = $this->complexQuery($request->get()); if ($result === false) {
} else { $config = $this->buildQueryConfig($request, $scene);
$config = $this->buildQueryConfig($request, 'index');
$limit = (int)$request->get('size', 15); $limit = (int)$request->get('size', 15);
$page = (int)$request->get('current', 1); $page = (int)$request->get('current', 1);
$result = $this->logicList($config, $limit, $page); $result = $this->logicList($config, $limit, $page);
} }
return $this->postProcess('List', $result); return $this->postProcess(ucfirst($scene), $result);
} }
/** 全量列表 */ /** 全量列表 */
public function serviceListAll(Request $request) public function serviceListAll(Request $request, string $scene = 'default')
{ {
if (method_exists($this, 'complexQuery')) { $result = $this->cqyProcess(ucfirst($scene), $request);
$result = $this->complexQuery($request->get()); if ($result === false) {
} else { $config = $this->buildQueryConfig($request, $scene);
$config = $this->buildQueryConfig($request, 'default');
$result = $this->logicListAll($config); $result = $this->logicListAll($config);
} }
return $this->postProcess('ListAll', $result); return $this->postProcess(ucfirst($scene), $result);
} }
/** 查看单条 */ /** 查看单条 */
public function serviceShow(Request $request) public function serviceShow(Request $request, string $scene = 'show')
{ {
$config = $this->buildQueryConfig($request, 'show'); $config = $this->buildQueryConfig($request, $scene);
$item = $this->logicShow($config); $item = $this->logicShow($config);
return $this->postProcess('Show', $item); return $this->postProcess(ucfirst($scene), $item);
} }
/** 创建 */ /** 创建 */
public function serviceStore(Request $request, array $data = []) public function serviceStore(Request $request, array $data = [], string $scene = 'store')
{ {
$data = $this->preProcess('Store', $data, $request); $data = $this->preProcess(ucfirst($scene), $data, $request);
$dl = $this->getDataLimitFromRequest($request); $dl = $this->getDataLimitFromRequest($request);
$created = $this->logicCreate($data, $dl); $created = $this->logicCreate($data, $dl);
return $this->postProcess('Store', $created); return $this->postProcess(ucfirst($scene), $created);
} }
/** 更新 */ /** 更新 */
public function serviceUpdate(Request $request, array $data = []) public function serviceUpdate(Request $request, array $data = [], string $scene = 'update')
{ {
$data = $this->preProcess('Update', $data, $request); $data = $this->preProcess(ucfirst($scene), $data, $request);
$config = $this->buildQueryConfig($request, 'update'); $config = $this->buildQueryConfig($request, $scene);
$updated = $this->logicUpdateBy($config, $data); $updated = $this->logicUpdateBy($config, $data);
return $this->postProcess('Update', $data); return $this->postProcess(ucfirst($scene), $data);
} }
/** 删除 */ /** 删除 */
public function serviceDestroy(Request $request) public function serviceDestroy(Request $request, string $scene = 'destroy')
{ {
$config = $this->buildQueryConfig($request, 'destroy'); $config = $this->buildQueryConfig($request, $scene);
$deleted = $this->logicDeleteBy($config); $deleted = $this->logicDeleteBy($config);
return $this->postProcess('Destroy', $deleted); return $this->postProcess(ucfirst($scene), $deleted);
} }
/** ----------------- 公共辅助方法 ----------------- */ /** ----------------- 公共辅助方法 ----------------- */
@@ -182,13 +180,18 @@ trait CrudServiceTrait
: $data; : $data;
} }
/** /**
* 处理复杂查询 * 复杂/自定义查询
* 覆盖此方法,实现复杂查询逻辑 *
* @param string $op 场景
* @param mixed $data 原始返回值
* @return mixed 处理后的返回值
*/ */
// protected function complexQuery(array $params): array protected function cqyProcess(string $op, Request $request): mixed
// { {
// throw new BusinessException('请在子类实现 complexQuery'); $hook = "complexQuery{$op}";
// } return method_exists($this, $hook)
? $this->{$hook}($request)
: false;
}
} }
@@ -0,0 +1,194 @@
<?php
namespace app\common\traits\crud;
use support\exception\BusinessException;
use support\Request;
/**
* Trait CrudServiceTrait
*
* 提供标准的增删改查 Service 接口,依赖 CrudLogicTrait。
* 使用此 Trait 的 Service 类,须:
* use CrudLogicTrait, CrudServiceTrait;
* protected string $modelClass = \App\common\model\YourModel::class;
*/
trait CrudServiceTrait_bak
{
use CrudLogicTrait;
/** 具体 Service 里定义:protected string $modelClass = YourModel::class; */
/**
* 获取验证器
*/
public function getValidator()
{
return $this->validator;
}
/** 分页列表 */
public function serviceList(Request $request)
{
if (method_exists($this, 'complexQuery')) {
$result = $this->complexQuery($request->get());
} else {
$config = $this->buildQueryConfig($request, 'index');
$limit = (int)$request->get('size', 15);
$page = (int)$request->get('current', 1);
$result = $this->logicList($config, $limit, $page);
}
return $this->postProcess('List', $result);
}
/** 全量列表 */
public function serviceListAll(Request $request)
{
if (method_exists($this, 'complexQuery')) {
$result = $this->complexQuery($request->get());
} else {
$config = $this->buildQueryConfig($request, 'default');
$result = $this->logicListAll($config);
}
return $this->postProcess('ListAll', $result);
}
/** 查看单条 */
public function serviceShow(Request $request)
{
$config = $this->buildQueryConfig($request, 'show');
$item = $this->logicShow($config);
return $this->postProcess('Show', $item);
}
/** 创建 */
public function serviceStore(Request $request, array $data = [])
{
$data = $this->preProcess('Store', $data, $request);
$dl = $this->getDataLimitFromRequest($request);
$created = $this->logicCreate($data, $dl);
return $this->postProcess('Store', $created);
}
/** 更新 */
public function serviceUpdate(Request $request, array $data = [])
{
$data = $this->preProcess('Update', $data, $request);
$config = $this->buildQueryConfig($request, 'update');
$updated = $this->logicUpdateBy($config, $data);
return $this->postProcess('Update', $data);
}
/** 删除 */
public function serviceDestroy(Request $request)
{
$config = $this->buildQueryConfig($request, 'destroy');
$deleted = $this->logicDeleteBy($config);
return $this->postProcess('Destroy', $deleted);
}
/** ----------------- 公共辅助方法 ----------------- */
/**
* 构造 CrudUtil 查询配置
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'default':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
break;
case 'index':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
break;
case 'show':
$config['where']['id'] = $p['id'];
$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
/** 解析 withFields 字符串 "rel:field,field;..." */
protected function parseWithFields(string $str): array
{
if (!$str) {
return [];
}
$out = [];
foreach (explode(';', $str) as $pair) {
[$rel, $flds] = explode(':', $pair);
$out[$rel] = explode(',', $flds);
}
return $out;
}
/** 从请求读取 dataLimitType, dataLimitField */
protected function getDataLimitFromRequest(Request $req): array
{
$type = $req->get('dataLimitType');
if (!$type) {
return [];
}
return [
'type' => $type,
'field' => $req->get('dataLimitField', 'admin_id'),
];
}
/**
* $data 前置处理
*
* @param array $data
* @param Request $request
* @return array
*/
protected function preProcess(string $op, mixed $data, Request $request): mixed
{
$hook = "beforeService{$op}";
return method_exists($this, $hook)
? $this->{$hook}($data, $request)
: $data;
}
/**
* 根据操作类型,调用对应的后置钩子
*
* @param string $op 操作:List, Show, Store, Update, Destroy
* @param mixed $data 原始返回值
* @return mixed 处理后的返回值
*/
protected function postProcess(string $op, mixed $data): mixed
{
$hook = "afterService{$op}";
return method_exists($this, $hook)
? $this->{$hook}($data)
: $data;
}
/**
* 处理复杂查询
* 覆盖此方法,实现复杂查询逻辑
*/
// protected function complexQuery(array $params): array
// {
// throw new BusinessException('请在子类实现 complexQuery');
// }
}
@@ -1,49 +0,0 @@
<?php
namespace app\common\utils\approval\model;
use support\Model;
class ApprovalFlows extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_flows';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'name', 'type', 'steps', 'is_active', 'timeout_hours', 'timeout_action', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -1,49 +0,0 @@
<?php
namespace app\common\utils\approval\model;
use support\Model;
class ApprovalInstances extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_instances';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'flow_type', 'biz_id', 'biz_type', 'form_data', 'initiator_id', 'status', 'current_step', 'finished_at', 'deadline_at', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -1,49 +0,0 @@
<?php
namespace app\common\utils\approval\model;
use support\Model;
class ApprovalRecords extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_records';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'comment', 'approved_at', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -1,7 +1,6 @@
<?php <?php
namespace app\common\utils\approval\service; namespace app\common\utils\approval\service;
use app\common\service\MessageNotificationsService;
use support\exception\BusinessException; use support\exception\BusinessException;
use support\Db; use support\Db;
@@ -234,31 +233,6 @@ class ApprovalFlowService
}); });
} }
/** 我的待办 */
public function getPendingApprovals(int $userId): array
{
return Db::table('approval_records as ar')
->join('approval_instances as ai', 'ar.instance_id', '=', 'ai.id')
->where('ar.approver_id', $userId)
->where('ar.status', 'pending')
->where('ai.status', 'processing')
->select('ai.*')
->distinct()
->get()
->toArray();
}
/** 审批历史 */
public function getApprovalHistory(int $instanceId): array
{
return Db::table('approval_records')
->where('instance_id', $instanceId)
->orderBy('step_index')
->orderByRaw('COALESCE(approved_at, created_at) asc')
->get()
->toArray();
}
/** 流程图数据(把 skipped/timeout 视作已完结的中性状态) */ /** 流程图数据(把 skipped/timeout 视作已完结的中性状态) */
public function getFlowDiagramData(int $instanceId): array public function getFlowDiagramData(int $instanceId): array
{ {
@@ -577,7 +551,7 @@ class ApprovalFlowService
$prefix = $isCC ? '【抄送】' : '【审批】'; $prefix = $isCC ? '【抄送】' : '【审批】';
$text = $map[$action] ?? $action; $text = $map[$action] ?? $action;
$approvalType = array_flip(\app\common\service\SysDictService::pluckKeyValueByCode('approval_type')->toArray()); $approvalType = array_flip(\app\common\service\SysDictService::pluckKeyValueByCode('approval_type'));
switch ($instance->flow_type) { switch ($instance->flow_type) {
case 'stock_orders': // 备货单 case 'stock_orders': // 备货单
@@ -1,6 +1,6 @@
<?php <?php
namespace app\admin\validate; namespace app\common\validate;
use think\Validate; use think\Validate;
@@ -1,6 +1,6 @@
<?php <?php
namespace app\admin\validate; namespace app\common\validate;
use think\Validate; use think\Validate;
@@ -1,6 +1,6 @@
<?php <?php
namespace app\admin\validate; namespace app\common\validate;
use think\Validate; use think\Validate;
+4 -49
View File
@@ -98,58 +98,13 @@ class IndexController
} }
public function test2(Request $request)
{
$where[] = ['id', '>', 141];
$list = (new \app\common\utils\MigrationResources())->getFullResourceTreeOptimized('resources', $where);
$keys = ['system_id','name','desc','type','code','parent_id','url','icon','open_type','link',
'is_hide','is_hide_tab','no_auth','is_home','instance','keep_alive','sort','status'];
foreach ($list as $key=>$item) {
$temp = [];
foreach ($item as $k=>$v) {
if (isset($item['children']) && count($item['children']) > 0) {
$temp = $item['children'];
}
if (!in_array($k, $keys)) {
unset($item[$k]);
}
$id = Db::table('resources')->insertGetId($item);
if ($temp) {
foreach ($temp as $kc=>$vc) {
foreach ($vc as $kk => $vv) {
if (!in_array($kk, $keys)) {
unset($vc[$kk]);
}
}
$vc['parent_id'] = $id;
Db::table('resources')->insert($vc);
}
}
}
}
}
public function test(Request $request) public function test(Request $request)
{ {
// 菜单迁移 // 菜单迁移
$where[] = ['id', '>', 141]; // $where[] = ['id', '>', 141];
$list = (new \app\common\utils\MigrationResources())->do('resources_20250916_bak', 'resources_yuanshi', $where); // $list = (new \app\common\utils\MigrationResources())->do('resources_20250916_bak', 'resources_yuanshi', $where);
$list = (new \app\common\utils\MigrationResources())->getFullResourceTreeOptimized('resources_20250916_bak', []);
var_dump($list);
} }
} }
@@ -3,7 +3,7 @@ namespace app\crm\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\crm\service\ApprovalFlowsService; use app\common\service\ApprovalFlowsService;
class ApprovalFlowsController extends BaseController class ApprovalFlowsController extends BaseController
{ {
@@ -3,7 +3,7 @@ namespace app\crm\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\crm\service\ApprovalInstancesService; use app\common\service\ApprovalInstancesService;
class ApprovalInstancesController extends BaseController class ApprovalInstancesController extends BaseController
{ {
@@ -3,7 +3,7 @@ namespace app\crm\controller;
use app\common\controller\BaseController; use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait; use app\common\traits\crud\CrudControllerTrait;
use app\crm\service\ApprovalRecordsService; use app\common\service\ApprovalRecordsService;
use app\common\model\SysDictItem; use app\common\model\SysDictItem;
use support\Request; use support\Request;
@@ -86,4 +86,58 @@ class ApprovalRecordsController extends BaseController
return $this->error($e->getMessage()); return $this->error($e->getMessage());
} }
} }
public function todo(Request $request)
{
try {
$raw = $this->service->serviceList($request, 'todo');
$data = $this->transformData($raw, method_exists($this, 'todoFormat')
? [$this, 'todoFormat']
: null);
return $this->success($data);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}
}
protected function todoFormat($data)
{
if (isset($data['records']) && count($data['records']) > 0) {
foreach ($data['records'] as $key => &$record) {
$result = [
'id' => $record['id'],
'flows_name' => $record['approvalInstance']['flows']['name'],
'instance_id' => $record['instance_id'],
'biz_id' => $record['approvalInstance']['biz_id'],
'biz_desc' => '备货单号【'.$record['approvalInstance']['bizInfo']['order_no'].'】',
'biz_type' => $record['approvalInstance']['flow_type'],
'initiator_name' => $record['approvalInstance']['initiator']['name'],
'initiator_avatar' => $record['approvalInstance']['initiator']['avatar'],
'approver_name' => $record['approver']['name'],
'approver_avatar' => $record['approver']['avatar'],
'step_index' => $record['step_index'],
'action' => $record['action'],
'action_desc' => SysDictItem::where('item_value', $record['action'])->where('status', 1)->value('item_label'),
'status' => $record['status'],
'status_desc' => SysDictItem::where('item_value', $record['status'])->where('status', 1)->value('item_label'),
'comment' => $record['comment'],
'approved_at' => $record['approved_at'],
'finished_at' => $record['approvalInstance']['finished_at'],
'deadline_at' => $record['approvalInstance']['deadline_at'],
'created_at' => $record['created_at']
];
$record = $result;
}
}
return $data;
}
} }
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace app\crm\logic;
use app\common\traits\crud\CrudLogicTrait;
use app\crm\model\ApprovalFlows;
class ApprovalFlowsLogic
{
use CrudLogicTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalFlows::class;
}
-31
View File
@@ -1,31 +0,0 @@
<?php
namespace app\crm\service;
use app\crm\validate\ApprovalFlowsValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\crm\model\ApprovalFlows;
class ApprovalFlowsService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalFlows::class;
/**
* 验证器
*/
protected $validator = ApprovalFlowsValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
}
@@ -1,31 +0,0 @@
<?php
namespace app\crm\service;
use app\crm\validate\ApprovalInstancesValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\crm\model\ApprovalInstances;
class ApprovalInstancesService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalInstances::class;
/**
* 验证器
*/
protected $validator = ApprovalInstancesValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
}
@@ -1,91 +0,0 @@
<?php
namespace app\crm\service;
use app\crm\validate\ApprovalRecordsValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\crm\model\ApprovalRecords;
use support\Request;
class ApprovalRecordsService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = ApprovalRecords::class;
/**
* 验证器
*/
protected $validator = ApprovalRecordsValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
$config['order']['id'] = 'desc';
$config['with'] = [
'approvalInstance',
'approver',
'approvalInstance.flows',
'approvalInstance.initiator',
'approvalInstance.bizInfo'
];
$config['dataLimit']['type'] = 'relation';
$config['dataLimit']['userId'] = $request->user->uid;
$config['dataLimit']['userField'] = 'approver_id';
break;
case 'show':
$config['where']['id'] = $p['id'];
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
case 'logs':
$config['where']['instance_id'] = $p['instance_id'];
$config['order']['id'] = 'desc';
break;
}
return $config;
}
public function serviceApprove(Request $request)
{
$param = $request->all();
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
return $appro->approve($param['instance_id'], $request->user->uid, $param['action'], $param['comment']);
}
public function serviceLogs(Request $request)
{
$config = $this->buildQueryConfig($request, 'logs');
$item = $this->logicListAll($config);
return $this->postProcess('Logs', $item);
}
}
+2 -2
View File
@@ -13,8 +13,8 @@ use support\Request;
use app\common\model\User; use app\common\model\User;
use support\Db; use support\Db;
use support\Model; use support\Model;
use app\admin\model\ApprovalInstances; use app\common\model\ApprovalInstances;
use app\admin\model\ApprovalRecords; use app\common\model\ApprovalRecords;
use support\exception\BusinessException; use support\exception\BusinessException;
class StockOrdersService class StockOrdersService
-1
View File
@@ -36,7 +36,6 @@
"webman/console": "^2.1", "webman/console": "^2.1",
"vlucas/phpdotenv": "^5.6", "vlucas/phpdotenv": "^5.6",
"firebase/php-jwt": "^6.11", "firebase/php-jwt": "^6.11",
"league/oauth2-server": "^9.2",
"topthink/think-validate": "^3.0", "topthink/think-validate": "^3.0",
"shopwwi/webman-filesystem": "1.1", "shopwwi/webman-filesystem": "1.1",
"shopwwi/filesystem-oss": "^1.0", "shopwwi/filesystem-oss": "^1.0",
Generated
+1 -647
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "68e74d2aef3a2f7f8163bfaf65431cb2", "content-hash": "4914e483b0c6fc599378c91d2eab17cf",
"packages": [ "packages": [
{ {
"name": "aliyuncs/oss-sdk-php", "name": "aliyuncs/oss-sdk-php",
@@ -265,73 +265,6 @@
], ],
"time": "2024-11-12T16:29:46+00:00" "time": "2024-11-12T16:29:46+00:00"
}, },
{
"name": "defuse/php-encryption",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "f53396c2d34225064647a05ca76c1da9d99e5828"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/f53396c2d34225064647a05ca76c1da9d99e5828",
"reference": "f53396c2d34225064647a05ca76c1da9d99e5828",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"paragonie/random_compat": ">= 2",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "^5|^6|^7|^8|^9|^10",
"yoast/phpunit-polyfills": "^2.0.0"
},
"bin": [
"bin/generate-defuse-key"
],
"type": "library",
"autoload": {
"psr-4": {
"Defuse\\Crypto\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Hornby",
"email": "taylor@defuse.ca",
"homepage": "https://defuse.ca/"
},
{
"name": "Scott Arciszewski",
"email": "info@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "Secure PHP Encryption Library",
"keywords": [
"aes",
"authenticated encryption",
"cipher",
"crypto",
"cryptography",
"encrypt",
"encryption",
"openssl",
"security",
"symmetric key cryptography"
],
"support": {
"issues": "https://github.com/defuse/php-encryption/issues",
"source": "https://github.com/defuse/php-encryption/tree/v2.4.0"
},
"time": "2023-06-19T06:10:36+00:00"
},
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
"version": "2.0.10", "version": "2.0.10",
@@ -1931,202 +1864,6 @@
}, },
"time": "2025-03-19T13:51:03+00:00" "time": "2025-03-19T13:51:03+00:00"
}, },
{
"name": "lcobucci/clock",
"version": "3.3.1",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "db3713a61addfffd615b79bf0bc22f0ccc61b86b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/db3713a61addfffd615b79bf0bc22f0ccc61b86b",
"reference": "db3713a61addfffd615b79bf0bc22f0ccc61b86b",
"shasum": ""
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.29",
"lcobucci/coding-standard": "^11.1.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.25",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.13",
"phpstan/phpstan-strict-rules": "^1.5.1",
"phpunit/phpunit": "^11.3.6"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\Clock\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com"
}
],
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.3.1"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2024-09-24T20:45:14+00:00"
},
{
"name": "lcobucci/jwt",
"version": "5.5.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "a835af59b030d3f2967725697cf88300f579088e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/a835af59b030d3f2967725697cf88300f579088e",
"reference": "a835af59b030d3f2967725697cf88300f579088e",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-sodium": "*",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"psr/clock": "^1.0"
},
"require-dev": {
"infection/infection": "^0.29",
"lcobucci/clock": "^3.2",
"lcobucci/coding-standard": "^11.0",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^11.1"
},
"suggest": {
"lcobucci/clock": ">= 3.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"support": {
"issues": "https://github.com/lcobucci/jwt/issues",
"source": "https://github.com/lcobucci/jwt/tree/5.5.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2025-01-26T21:29:45+00:00"
},
{
"name": "league/event",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/event.git",
"reference": "ec38ff7ea10cad7d99a79ac937fbcffb9334c210"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/event/zipball/ec38ff7ea10cad7d99a79ac937fbcffb9334c210",
"reference": "ec38ff7ea10cad7d99a79ac937fbcffb9334c210",
"shasum": ""
},
"require": {
"php": ">=7.2.0",
"psr/event-dispatcher": "^1.0"
},
"provide": {
"psr/event-dispatcher-implementation": "1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12.45",
"phpunit/phpunit": "^8.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"League\\Event\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frenky.net"
}
],
"description": "Event package",
"keywords": [
"emitter",
"event",
"listener"
],
"support": {
"issues": "https://github.com/thephpleague/event/issues",
"source": "https://github.com/thephpleague/event/tree/3.0.3"
},
"time": "2024-09-04T16:06:53+00:00"
},
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "3.29.0", "version": "3.29.0",
@@ -2333,276 +2070,6 @@
], ],
"time": "2024-01-28T23:22:08+00:00" "time": "2024-01-28T23:22:08+00:00"
}, },
{
"name": "league/oauth2-server",
"version": "9.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/oauth2-server.git",
"reference": "00323013403e1a1e0f424affafca56c28b60c22c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/oauth2-server/zipball/00323013403e1a1e0f424affafca56c28b60c22c",
"reference": "00323013403e1a1e0f424affafca56c28b60c22c",
"shasum": ""
},
"require": {
"defuse/php-encryption": "^2.4",
"ext-json": "*",
"ext-openssl": "*",
"lcobucci/clock": "^2.3 || ^3.0",
"lcobucci/jwt": "^5.0",
"league/event": "^3.0",
"league/uri": "^7.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"psr/http-message": "^2.0",
"psr/http-server-middleware": "^1.0"
},
"replace": {
"league/oauth2server": "*",
"lncd/oauth2": "*"
},
"require-dev": {
"laminas/laminas-diactoros": "^3.5",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"phpunit/phpunit": "^9.6.21",
"roave/security-advisories": "dev-master",
"slevomat/coding-standard": "^8.14.1",
"squizlabs/php_codesniffer": "^3.8"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\OAuth2\\Server\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alex Bilbie",
"email": "hello@alexbilbie.com",
"homepage": "http://www.alexbilbie.com",
"role": "Developer"
},
{
"name": "Andy Millington",
"email": "andrew@noexceptions.io",
"homepage": "https://www.noexceptions.io",
"role": "Developer"
}
],
"description": "A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.",
"homepage": "https://oauth2.thephpleague.com/",
"keywords": [
"Authentication",
"api",
"auth",
"authorisation",
"authorization",
"oauth",
"oauth 2",
"oauth 2.0",
"oauth2",
"protect",
"resource",
"secure",
"server"
],
"support": {
"issues": "https://github.com/thephpleague/oauth2-server/issues",
"source": "https://github.com/thephpleague/oauth2-server/tree/9.2.0"
},
"funding": [
{
"url": "https://github.com/sephster",
"type": "github"
}
],
"time": "2025-02-15T00:49:10+00:00"
},
{
"name": "league/uri",
"version": "7.5.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri.git",
"reference": "81fb5145d2644324614cc532b28efd0215bda430"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430",
"reference": "81fb5145d2644324614cc532b28efd0215bda430",
"shasum": ""
},
"require": {
"league/uri-interfaces": "^7.5",
"php": "^8.1"
},
"conflict": {
"league/uri-schemes": "^1.0"
},
"suggest": {
"ext-bcmath": "to improve IPV4 host parsing",
"ext-fileinfo": "to create Data URI from file contennts",
"ext-gmp": "to improve IPV4 host parsing",
"ext-intl": "to handle IDN host with the best performance",
"jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain",
"league/uri-components": "Needed to easily manipulate URI objects components",
"php-64bit": "to improve IPV4 host parsing",
"symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Uri\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ignace Nyamagana Butera",
"email": "nyamsprod@gmail.com",
"homepage": "https://nyamsprod.com"
}
],
"description": "URI manipulation library",
"homepage": "https://uri.thephpleague.com",
"keywords": [
"data-uri",
"file-uri",
"ftp",
"hostname",
"http",
"https",
"middleware",
"parse_str",
"parse_url",
"psr-7",
"query-string",
"querystring",
"rfc3986",
"rfc3987",
"rfc6570",
"uri",
"uri-template",
"url",
"ws"
],
"support": {
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri/tree/7.5.1"
},
"funding": [
{
"url": "https://github.com/sponsors/nyamsprod",
"type": "github"
}
],
"time": "2024-12-08T08:40:02+00:00"
},
{
"name": "league/uri-interfaces",
"version": "7.5.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri-interfaces.git",
"reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
"reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
"shasum": ""
},
"require": {
"ext-filter": "*",
"php": "^8.1",
"psr/http-factory": "^1",
"psr/http-message": "^1.1 || ^2.0"
},
"suggest": {
"ext-bcmath": "to improve IPV4 host parsing",
"ext-gmp": "to improve IPV4 host parsing",
"ext-intl": "to handle IDN host with the best performance",
"php-64bit": "to improve IPV4 host parsing",
"symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Uri\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ignace Nyamagana Butera",
"email": "nyamsprod@gmail.com",
"homepage": "https://nyamsprod.com"
}
],
"description": "Common interfaces and classes for URI representation and interaction",
"homepage": "https://uri.thephpleague.com",
"keywords": [
"data-uri",
"file-uri",
"ftp",
"hostname",
"http",
"https",
"parse_str",
"parse_url",
"psr-7",
"query-string",
"querystring",
"rfc3986",
"rfc3987",
"rfc6570",
"uri",
"url",
"ws"
],
"support": {
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0"
},
"funding": [
{
"url": "https://github.com/sponsors/nyamsprod",
"type": "github"
}
],
"time": "2024-12-08T08:18:47+00:00"
},
{ {
"name": "maennchen/zipstream-php", "name": "maennchen/zipstream-php",
"version": "3.1.2", "version": "3.1.2",
@@ -3950,119 +3417,6 @@
}, },
"time": "2023-04-04T09:54:51+00:00" "time": "2023-04-04T09:54:51+00:00"
}, },
{
"name": "psr/http-server-handler",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-server-handler.git",
"reference": "84c4fb66179be4caaf8e97bd239203245302e7d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4",
"reference": "84c4fb66179be4caaf8e97bd239203245302e7d4",
"shasum": ""
},
"require": {
"php": ">=7.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Server\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP server-side request handler",
"keywords": [
"handler",
"http",
"http-interop",
"psr",
"psr-15",
"psr-7",
"request",
"response",
"server"
],
"support": {
"source": "https://github.com/php-fig/http-server-handler/tree/1.0.2"
},
"time": "2023-04-10T20:06:20+00:00"
},
{
"name": "psr/http-server-middleware",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-server-middleware.git",
"reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829",
"reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829",
"shasum": ""
},
"require": {
"php": ">=7.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/http-server-handler": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Server\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP server-side middleware",
"keywords": [
"http",
"http-interop",
"middleware",
"psr",
"psr-15",
"psr-7",
"request",
"response"
],
"support": {
"issues": "https://github.com/php-fig/http-server-middleware/issues",
"source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2"
},
"time": "2023-04-11T06:14:47+00:00"
},
{ {
"name": "psr/log", "name": "psr/log",
"version": "3.0.2", "version": "3.0.2",
+4
View File
@@ -315,6 +315,8 @@ Route::group('/admin', function () {
Route::any('/list', [app\admin\controller\ApprovalRecordsController::class, 'index']); Route::any('/list', [app\admin\controller\ApprovalRecordsController::class, 'index']);
Route::any('/logs', [app\admin\controller\ApprovalRecordsController::class, 'logs']); Route::any('/logs', [app\admin\controller\ApprovalRecordsController::class, 'logs']);
Route::any('/action', [app\admin\controller\ApprovalRecordsController::class, 'approve']); Route::any('/action', [app\admin\controller\ApprovalRecordsController::class, 'approve']);
Route::any('/todo', [app\admin\controller\ApprovalRecordsController::class, 'todo']);
}); });
Route::group('/stock/order', function () { Route::group('/stock/order', function () {
@@ -430,6 +432,8 @@ Route::group('/crm', function () {
Route::any('/list', [app\crm\controller\ApprovalRecordsController::class, 'index']); Route::any('/list', [app\crm\controller\ApprovalRecordsController::class, 'index']);
Route::any('/logs', [app\crm\controller\ApprovalRecordsController::class, 'logs']); Route::any('/logs', [app\crm\controller\ApprovalRecordsController::class, 'logs']);
Route::any('/action', [app\crm\controller\ApprovalRecordsController::class, 'approve']); Route::any('/action', [app\crm\controller\ApprovalRecordsController::class, 'approve']);
Route::any('/todo', [app\admin\controller\ApprovalRecordsController::class, 'todo']);
}); });
// 汽车颜色 // 汽车颜色
Executable → Regular
View File