询单转发
This commit is contained in:
@@ -3,6 +3,7 @@ namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\model\InquiryTransmit;
|
||||
use app\common\model\InquiryTransmitConfig;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\common\service\InquiryTransmitService;
|
||||
use support\Log;
|
||||
@@ -45,11 +46,16 @@ class InquiryTransmitController extends BaseController
|
||||
{
|
||||
try {
|
||||
$params = $request->all();
|
||||
|
||||
var_dump($params);
|
||||
|
||||
$mailto = '1696136552@qq.com';
|
||||
$fromDomain = 'magicbridgeauto.com';
|
||||
$url = $request->header('referer');
|
||||
$domain = parse_url($url, PHP_URL_HOST);
|
||||
$transmitConfig = InquiryTransmitConfig::where('domain', $domain)->first();
|
||||
if ($transmitConfig) {
|
||||
$mailto = $transmitConfig->mailto;
|
||||
$fromDomain = $domain;
|
||||
} else {
|
||||
$mailto = '1696136552@qq.com';
|
||||
$fromDomain = 'referer Failed to obtain';
|
||||
}
|
||||
|
||||
if ($request->method() == 'GET') {
|
||||
$config = [
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace app\common\service;
|
||||
use app\common\validate\InquiryTransmitConfigValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\InquiryTransmitConfig;
|
||||
use support\Request;
|
||||
|
||||
class InquiryTransmitConfigService
|
||||
{
|
||||
@@ -28,4 +29,39 @@ class InquiryTransmitConfigService
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 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']['id'] = 'desc';
|
||||
break;
|
||||
case 'index':
|
||||
$config['where']['status'] = 1;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ class InquiryTransmitService
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
|
||||
/** 创建 */
|
||||
public function serviceStore(Request $request, array $data = [])
|
||||
{
|
||||
@@ -46,4 +45,47 @@ class InquiryTransmitService
|
||||
|
||||
return InquiryTransmit::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 CrudUtil 查询配置
|
||||
*/
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'default':
|
||||
$config['order']['id'] = 'desc';
|
||||
break;
|
||||
case 'index':
|
||||
// 域名
|
||||
if (isset($p['domain']) && !empty($p['domain'])) {
|
||||
$config['where']['domain'] = $p['domain'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['email', 'name', 'tel', 'country', 'message', 'form_url'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
$config['order']['id'] = 'desc';
|
||||
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;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -220,6 +220,24 @@ Route::group('/admin', function () {
|
||||
});
|
||||
});
|
||||
|
||||
// 询单转发
|
||||
Route::group('/inquiry', function () {
|
||||
Route::group('/transmit', function () {
|
||||
Route::any('/list', [app\admin\controller\InquiryTransmitController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\InquiryTransmitController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\InquiryTransmitController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\InquiryTransmitController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\InquiryTransmitController::class, 'destroy']);
|
||||
});
|
||||
Route::group('/config', function () {
|
||||
Route::any('/list', [app\admin\controller\InquiryTransmitConfigController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\InquiryTransmitConfigController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\InquiryTransmitConfigController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\InquiryTransmitConfigController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\InquiryTransmitConfigController::class, 'destroy']);
|
||||
});
|
||||
});
|
||||
|
||||
// crm
|
||||
Route::group('/crm', function () {
|
||||
Route::group('/customer', function () {
|
||||
|
||||
Reference in New Issue
Block a user