作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

@@ -59,7 +59,10 @@ class SuppliersController extends BaseController @@ -59,7 +59,10 @@ class SuppliersController extends BaseController
59 $token = $action_name. '+' .date('Y-m-d'). '+' .http_build_query($param); 59 $token = $action_name. '+' .date('Y-m-d'). '+' .http_build_query($param);
60 $param['token'] = md5($token); 60 $param['token'] = md5($token);
61 $res = http_post($url,json_encode($param)); 61 $res = http_post($url,json_encode($param));
62 - return $this->success($res); 62 + if($res['code'] != 200){
  63 + $this->response($res['message'],Code::SYSTEM_ERROR);
  64 + }
  65 + return $this->success($res['data']);
63 } 66 }
64 /** 67 /**
65 * @remark :按名字搜索公司 68 * @remark :按名字搜索公司
@@ -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,18 @@ class WebSettingReceivingLogic extends BaseLogic @@ -34,9 +35,18 @@ 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){
  43 + if($v['type'] == 1){
  44 + // 使用正则表达式匹配中国大陆手机号
  45 + $pattern = '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/';
  46 + if (!preg_match($pattern, $v['values'])) {
  47 + continue;
  48 + }
  49 + }
40 if($v['type'] == 2){ 50 if($v['type'] == 2){
41 // 使用正则表达式匹配中国大陆手机号 51 // 使用正则表达式匹配中国大陆手机号
42 $pattern = '/^1[3456789]\d{9}$/'; 52 $pattern = '/^1[3456789]\d{9}$/';
@@ -47,11 +57,15 @@ class WebSettingReceivingLogic extends BaseLogic @@ -47,11 +57,15 @@ class WebSettingReceivingLogic extends BaseLogic
47 $v['project_id'] = $this->user['project_id']; 57 $v['project_id'] = $this->user['project_id'];
48 $v['created_at'] = date('Y-m-d H:i:s'); 58 $v['created_at'] = date('Y-m-d H:i:s');
49 $v['updated_at'] = date('Y-m-d H:i:s'); 59 $v['updated_at'] = date('Y-m-d H:i:s');
50 - $this->param['data'][$k] = $v; 60 + $data[] = $v;
  61 + }
  62 + if(!empty($data)){
  63 + $this->model->insert($data);
51 } 64 }
52 - $this->model->insert($this->param['data']); 65 + DB::connection('custom_mysql')->commit();
53 }catch (\Exception $e){ 66 }catch (\Exception $e){
54 - $this->fail('error'); 67 + DB::connection('custom_mysql')->rollBack();
  68 + $this->fail('编辑失败,请联系管理员');
55 } 69 }
56 (new SyncService())->projectAcceptAddress($this->user['project_id']); 70 (new SyncService())->projectAcceptAddress($this->user['project_id']);
57 return $this->success(); 71 return $this->success();
@@ -37,7 +37,7 @@ class WebSettingServiceLogic extends BaseLogic @@ -37,7 +37,7 @@ class WebSettingServiceLogic extends BaseLogic
37 * @time :2023/5/4 11:10 37 * @time :2023/5/4 11:10
38 */ 38 */
39 public function setting_service_save(){ 39 public function setting_service_save(){
40 - DB::beginTransaction(); 40 + DB::connection('custom_mysql')->beginTransaction();
41 try { 41 try {
42 $this->param['data'] = Common::uniqueMultiArray($this->param['data']); 42 $this->param['data'] = Common::uniqueMultiArray($this->param['data']);
43 //删除以前的数据 43 //删除以前的数据
@@ -54,10 +54,9 @@ class WebSettingServiceLogic extends BaseLogic @@ -54,10 +54,9 @@ class WebSettingServiceLogic extends BaseLogic
54 if(!empty($data)){ 54 if(!empty($data)){
55 $this->model->insert($data); 55 $this->model->insert($data);
56 } 56 }
57 -  
58 - DB::commit(); 57 + DB::connection('custom_mysql')->commit();
59 }catch (\Exception $e){ 58 }catch (\Exception $e){
60 - DB::rollBack(); 59 + DB::connection('custom_mysql')->rollBack();
61 $this->fail('系统错误,请联系管理员'); 60 $this->fail('系统错误,请联系管理员');
62 } 61 }
63 return $this->success(); 62 return $this->success();