This commit is contained in:
mzl
2025-09-01 14:00:44 +08:00
parent 8fdfd02c81
commit 29f573a467
3 changed files with 33 additions and 57 deletions
@@ -24,14 +24,14 @@ class VehVehicleSkuController extends BaseController
* @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;
// }
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;
}
protected function showFormat($data)
{
@@ -90,7 +90,7 @@ class VehVehicleSkuController extends BaseController
}
public function index(Request $request)
public function index22(Request $request)
{
$data = [
'sku_code' , // 'SKU编码,系统生成',
@@ -90,12 +90,10 @@ class VehVehicleSkuService
switch ($scene) {
case 'default':
$config['where']['is_active'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
break;
case 'index':
$config['where']['is_active'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
break;
case 'show':
@@ -118,14 +116,12 @@ class VehVehicleSkuService
public function beforeServiceStore($data, Request $request)
{
$data = $this->backfill($data);
// 未提供时自动生成;若你想“强制覆盖人工输入”,可去掉 isset 判断
if (empty($data['model_code'])) {
$data['model_code'] = ModelNaming::buildModelCode($data);
}
if (empty($data['model_name'])) {
$data['model_name'] = ModelNaming::buildModelName($data);
}
// 填充系统字段
$data['sku_code'] = SkuCodeBuilder::build($data);
$data['corp_id'] = 0;
$data['created_by'] = $request->user->uid;
@@ -145,7 +141,6 @@ class VehVehicleSkuService
public function beforeServiceUpdate($data, Request $request)
{
$data = $this->backfill($data);
// 未提供时自动生成;若你想“强制覆盖人工输入”,可去掉 isset 判断
if (empty($data['model_code'])) {
$data['model_code'] = ModelNaming::buildModelCode($data);
}
+24 -43
View File
@@ -78,25 +78,25 @@ class IndexController
$options = [
'controller' => [
'module' => 'common',
'name' => 'veh_dict_i18n'
'name' => 'stock_orders'
],
'model' => [
'module' => 'common',
'name' => 'veh_dict_i18n'
'name' => 'stock_orders'
],
'service' => [
'module' => 'common',
'name' => 'veh_dict_i18n'
'name' => 'stock_orders'
],
'logic' => [
'module' => 'common',
'name' => 'veh_dict_i18n'
'name' => 'stock_orders'
],
'validate' => [
'module' => 'common',
'name' => 'veh_dict_i18n'
'name' => 'stock_orders'
],
'table' => 'veh_dict_i18n'
'table' => 'stock_orders'
];
$result = (new Generate($options))->doGenerate();
@@ -106,43 +106,24 @@ class IndexController
public function test()
{
$params = [
'email' => '',
'phone' => '11',
'whatsApp' => ''
];
$corpId = 1;
$customer = \app\crm\model\Customer::where('corp_id', $corpId)
->where((function (\Illuminate\Database\Eloquent\Builder $query) use ($params) {
if(!empty($params['email']))
$query->Orwhere('email', '=', $params['email']);
if(!empty($params['phone']))
$query->Orwhere('phone', '=', $params['phone']);
if(!empty($params['whatsApp']))
$query->Orwhere('whatsApp', '=', $params['whatsApp']);
return $query;
}))
->first();
// $data = [
// 'sender_id' => 0,
// 'sender_type' => 'system',
// 'title' => '测试消息 - 标题',
// 'content' => '测试消息 - 内容',
// 'scene' => 1,
// 'recipient' => [1],
// ];
// $data['recipient'] = [1, 74];
// // // 同步推送
// // (new MessageNotificationsService())->pushNotice($data);
// // 异步推送
// \Webman\RedisQueue\Redis::send('notice', $data);
$info = InquiryLog::with(['channelInfo', 'countryInfo', 'enter'])->where('id', 1)->where('sync_crm', 0)->first();
var_dump(empty($info->recipient));
if ($info) {
var_dump(11);
} else {
var_dump(22);
}
if ($info !== NULL) {
var_dump(33);
} else {
var_dump(44);
}
return json(['code' => 0, 'msg' => 'success']);
return json($customer);
}
}