|
@@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic; |
|
@@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic; |
|
6
|
use App\Models\WebSetting\WebSettingReceiving;
|
6
|
use App\Models\WebSetting\WebSettingReceiving;
|
|
7
|
use App\Models\WebSetting\WebSettingText;
|
7
|
use App\Models\WebSetting\WebSettingText;
|
|
8
|
use App\Services\SyncService;
|
8
|
use App\Services\SyncService;
|
|
|
|
9
|
+use Illuminate\Support\Facades\DB;
|
|
9
|
|
10
|
|
|
10
|
class WebSettingReceivingLogic extends BaseLogic
|
11
|
class WebSettingReceivingLogic extends BaseLogic
|
|
11
|
{
|
12
|
{
|
|
@@ -34,9 +35,11 @@ class WebSettingReceivingLogic extends BaseLogic |
|
@@ -34,9 +35,11 @@ class WebSettingReceivingLogic extends BaseLogic |
|
34
|
* @time :2023/5/8 16:26
|
35
|
* @time :2023/5/8 16:26
|
|
35
|
*/
|
36
|
*/
|
|
36
|
public function setting_receiving_save(){
|
37
|
public function setting_receiving_save(){
|
|
|
|
38
|
+ $data = [];
|
|
|
|
39
|
+ DB::connection('custom_mysql')->beginTransaction();
|
|
37
|
try {
|
40
|
try {
|
|
38
|
$this->model->del(['project_id'=>$this->user['project_id']]);
|
41
|
$this->model->del(['project_id'=>$this->user['project_id']]);
|
|
39
|
- foreach ($this->param['data'] as $k => $v){
|
42
|
+ foreach ($this->param['data'] as $v){
|
|
40
|
if($v['type'] == 2){
|
43
|
if($v['type'] == 2){
|
|
41
|
// 使用正则表达式匹配中国大陆手机号
|
44
|
// 使用正则表达式匹配中国大陆手机号
|
|
42
|
$pattern = '/^1[3456789]\d{9}$/';
|
45
|
$pattern = '/^1[3456789]\d{9}$/';
|
|
@@ -47,11 +50,15 @@ class WebSettingReceivingLogic extends BaseLogic |
|
@@ -47,11 +50,15 @@ class WebSettingReceivingLogic extends BaseLogic |
|
47
|
$v['project_id'] = $this->user['project_id'];
|
50
|
$v['project_id'] = $this->user['project_id'];
|
|
48
|
$v['created_at'] = date('Y-m-d H:i:s');
|
51
|
$v['created_at'] = date('Y-m-d H:i:s');
|
|
49
|
$v['updated_at'] = date('Y-m-d H:i:s');
|
52
|
$v['updated_at'] = date('Y-m-d H:i:s');
|
|
50
|
- $this->param['data'][$k] = $v;
|
53
|
+ $data[] = $v;
|
|
51
|
}
|
54
|
}
|
|
52
|
- $this->model->insert($this->param['data']);
|
55
|
+ if(!empty($data)){
|
|
|
|
56
|
+ $this->model->insert($data);
|
|
|
|
57
|
+ }
|
|
|
|
58
|
+ DB::connection('custom_mysql')->commit();
|
|
53
|
}catch (\Exception $e){
|
59
|
}catch (\Exception $e){
|
|
54
|
- $this->fail('error');
|
60
|
+ DB::connection('custom_mysql')->rollBack();
|
|
|
|
61
|
+ $this->fail('编辑失败,请联系管理员');
|
|
55
|
}
|
62
|
}
|
|
56
|
(new SyncService())->projectAcceptAddress($this->user['project_id']);
|
63
|
(new SyncService())->projectAcceptAddress($this->user['project_id']);
|
|
57
|
return $this->success();
|
64
|
return $this->success();
|