This commit is contained in:
2026-01-05 15:28:19 +08:00
parent ee348b4925
commit a40df925a7
8 changed files with 176 additions and 10 deletions
@@ -0,0 +1,33 @@
<?php
namespace app\common\controller;
use app\common\controller\BaseController;
use app\common\traits\crud\CrudControllerTrait;
use app\common\service\UsedCarService;
class UsedCarController extends BaseController
{
use CrudControllerTrait;
protected $service;
public function __construct()
{
$this->service = new UsedCarService();
}
/**
* 列表页数据格式化
*
* @param array $data
* @return array
*/
// protected function indexFormat($data)
// {
// if (isset($data['created_at']))
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
// if (isset($data['updated_at']))
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
// return $data;
// }
}
+3 -4
View File
@@ -36,7 +36,6 @@ class AuthLogic
public function feishuLogin(array $data): array
{
$feishuUserInfo = $this->getFeishuUserInfo($data);
var_dump($feishuUserInfo);
return $feishuUserInfo;
$user = $this->getOrCreateUser($feishuUserInfo);
@@ -202,10 +201,11 @@ class AuthLogic
if(empty($app[$data['app_id']])){
throw new BusinessException('app_id非法');
}
$feishu = new Feishu($data['app_id'], $app[$data['app_id']]);
$fsAppInfo = CorpFeishuApp::where('app_id', $data['app_id'])->first();
$feishu = new Feishu($data['app_id'], $fsAppInfo['feishu']);
//回调地址
$redirect_uri = $data['r_url'];
$redirect_uri = $fsAppInfo['r_url'];
$userAccessToken = $feishu->userAccessToken($data['feishu_code'], $redirect_uri);
$userInfo = $feishu->userInfo($userAccessToken['access_token']);
@@ -303,7 +303,6 @@ class AuthLogic
public function feishuAppInfo(string $app_id, string $systemCode)
{
$fsAppInfo = CorpFeishuApp::where('app_id', $app_id)->first();
var_dump($fsAppInfo);
return [
'app_id' => $fsAppInfo->app_id,
'app_secret' => $fsAppInfo->app_secret,
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace app\common\logic;
use app\common\traits\crud\CrudLogicTrait;
use app\common\model\UsedCar;
class UsedCarLogic
{
use CrudLogicTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = UsedCar::class;
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace app\common\model;
use support\Model;
class UsedCar extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'used_car';
/**
* 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', 'product_name', 'vin', 'price', 'source_place', 'plate_place', 'plate_time', 'displacement', 'body_color', 'images', 'condition_desc', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace app\common\service;
use app\common\validate\UsedCarValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\UsedCar;
class UsedCarService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = UsedCar::class;
/**
* 验证器
*/
protected $validator = UsedCarValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\common\validate;
use think\Validate;
class UsedCarValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+6 -6
View File
@@ -74,25 +74,25 @@ class IndexController
$options = [
'controller' => [
'module' => 'common',
'name' => 'inv_requisition_item_return_attachment'
'name' => 'used_car'
],
'model' => [
'module' => 'common',
'name' => 'inv_requisition_item_return_attachment'
'name' => 'used_car'
],
'service' => [
'module' => 'common',
'name' => 'inv_requisition_item_return_attachment'
'name' => 'used_car'
],
'logic' => [
'module' => 'common',
'name' => 'inv_requisition_item_return_attachment'
'name' => 'used_car'
],
'validate' => [
'module' => 'common',
'name' => 'inv_requisition_item_return_attachment'
'name' => 'used_car'
],
'table' => 'inv_requisition_item_return_attachment'
'table' => 'used_car'
];
$result = (new Generate($options))->doGenerate();
+8
View File
@@ -58,4 +58,12 @@ Route::group('/common', function () {
Route::any('/team', [app\common\controller\UserController::class, 'team']);
Route::any('/resign', [app\common\controller\UserController::class, 'resignMember']);
});
Route::group('/usedcar', function () {
Route::any('/list', [app\common\controller\UsedCarController::class, 'index']);
Route::any('/show', [app\common\controller\UsedCarController::class, 'show']);
Route::any('/store', [app\common\controller\UsedCarController::class, 'store']);
Route::any('/update', [app\common\controller\UsedCarController::class, 'update']);
Route::any('/destroy', [app\common\controller\UsedCarController::class, 'destroy']);
});
});