作者 lyh

变更数据

@@ -8,9 +8,12 @@ @@ -8,9 +8,12 @@
8 namespace App\Http\Controllers\Api; 8 namespace App\Http\Controllers\Api;
9 9
10 use App\Enums\Common\Code; 10 use App\Enums\Common\Code;
  11 +use App\Models\Geo\GeoConf;
11 use App\Models\Geo\GeoConfirm; 12 use App\Models\Geo\GeoConfirm;
12 use App\Models\Geo\GeoWritings; 13 use App\Models\Geo\GeoWritings;
  14 +use App\Models\Manage\ManageHr;
13 use App\Models\Project\Project; 15 use App\Models\Project\Project;
  16 +use App\Services\DingService;
14 use Illuminate\Http\Request; 17 use Illuminate\Http\Request;
15 use Illuminate\Support\Facades\Crypt; 18 use Illuminate\Support\Facades\Crypt;
16 19
@@ -89,11 +92,28 @@ class GeoController extends BaseController @@ -89,11 +92,28 @@ class GeoController extends BaseController
89 if ($info['status'] == GeoWritings::STATUS_FINISH){ 92 if ($info['status'] == GeoWritings::STATUS_FINISH){
90 return $this->response('当前文章已确认,不可再次确认',Code::SYSTEM_ERROR); 93 return $this->response('当前文章已确认,不可再次确认',Code::SYSTEM_ERROR);
91 } 94 }
92 - $this->param['confirm_ip'] = $this->request->ip();  
93 - $this->param['confirm_at'] = date('Y-m-d H:i:s');  
94 - $this->param['content_length'] = strlen($this->param['content']);  
95 - $this->param['status'] = GeoWritings::STATUS_FINISH;  
96 - $geoWritingsModel->edit($this->param,['uniqid' => $token]); 95 + try {
  96 + $this->param['confirm_ip'] = $this->request->ip();
  97 + $this->param['confirm_at'] = date('Y-m-d H:i:s');
  98 + $this->param['content_length'] = strlen($this->param['content']);
  99 + $this->param['status'] = GeoWritings::STATUS_FINISH;
  100 + $geoWritingsModel->edit($this->param,['uniqid' => $token]);
  101 + $geoConfModel = new GeoConf();
  102 + $confInfo = $geoConfModel->read(['project_id'=>$info['project_id']]);
  103 + $hrModel = new ManageHr();
  104 + $manage_name = $hrModel->getName($confInfo['manager_id'] ??'');
  105 + $dingService = new DingService();
  106 + $dingService->handle([
  107 + 'keyword' => '项目数据确认',
  108 + 'msg' =>
  109 + 'cm:文章确认完成' . PHP_EOL .
  110 + '项目名称:'.$confInfo['company'] ?? '' . PHP_EOL .
  111 + '负责人:'.$manage_name . PHP_EOL,
  112 + 'isAtAll' => false, // 是否@所有人
  113 + ], 'https://oapi.dingtalk.com/robot/send?access_token=4effe85882009a8a1617dbeadc38c350f832deef7431ce10f5fda751b4c82fb9');
  114 + }catch (\Exception $e){
  115 + $this->response('非法请求',Code::SYSTEM_ERROR);
  116 + }
97 $this->response('success',Code::SUCCESS); 117 $this->response('success',Code::SUCCESS);
98 } 118 }
99 119
@@ -138,10 +158,31 @@ class GeoController extends BaseController @@ -138,10 +158,31 @@ class GeoController extends BaseController
138 'confirm_num.max' => '客户确认数量不能为空', 158 'confirm_num.max' => '客户确认数量不能为空',
139 ]); 159 ]);
140 $geoConfirmModel = new GeoConfirm(); 160 $geoConfirmModel = new GeoConfirm();
141 - $this->param['status'] = $geoConfirmModel::STATUS_FINISH;  
142 - $this->param['confirm_ip'] = $this->request->ip();  
143 - $this->param['confirm_at'] = date('Y-m-d H:i:s');  
144 - $result = $geoConfirmModel->edit($this->param,['uniqid'=>$this->param['uniqid']]); 161 + $info = $geoConfirmModel->read(['uniqid'=>$this->param['uniqid']]);
  162 + if ($info === false){
  163 + $this->response('当前数据不存在已被删除',Code::SYSTEM_ERROR);
  164 + }
  165 + try {
  166 + $this->param['status'] = $geoConfirmModel::STATUS_FINISH;
  167 + $this->param['confirm_ip'] = $this->request->ip();
  168 + $this->param['confirm_at'] = date('Y-m-d H:i:s');
  169 + $result = $geoConfirmModel->edit($this->param,['id'=>$info['$info']]);
  170 + $geoConfModel = new GeoConf();
  171 + $confInfo = $geoConfModel->read(['project_id'=>$info['project_id']]);
  172 + $hrModel = new ManageHr();
  173 + $manage_name = $hrModel->getName($confInfo['manager_id'] ??'');
  174 + $dingService = new DingService();
  175 + $dingService->handle([
  176 + 'keyword' => '项目数据确认',
  177 + 'msg' =>
  178 + 'cm:'.(($info['type'] == 1) ? '标题确认' : '关键词确认'). PHP_EOL .
  179 + '项目名称:'.$confInfo['company'] ?? '' . PHP_EOL .
  180 + '负责人:'.$manage_name . PHP_EOL,
  181 + 'isAtAll' => false, // 是否@所有人
  182 + ], 'https://oapi.dingtalk.com/robot/send?access_token=4effe85882009a8a1617dbeadc38c350f832deef7431ce10f5fda751b4c82fb9');
  183 + }catch (\Exception $e){
  184 + $this->response('非法请求',Code::SYSTEM_ERROR);
  185 + }
145 $this->response('success',Code::SUCCESS,$result); 186 $this->response('success',Code::SUCCESS,$result);
146 } 187 }
147 } 188 }
@@ -12,7 +12,6 @@ namespace App\Http\Controllers\Bside\ExtensionModule; @@ -12,7 +12,6 @@ namespace App\Http\Controllers\Bside\ExtensionModule;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\ExtentModule\ExtensionModuleValue; 14 use App\Models\ExtentModule\ExtensionModuleValue;
15 -use Illuminate\Pagination\LengthAwarePaginator;  
16 use Illuminate\Support\Facades\Cache; 15 use Illuminate\Support\Facades\Cache;
17 16
18 class Extension3915ModuleController extends BaseController 17 class Extension3915ModuleController extends BaseController
@@ -99,6 +98,7 @@ class Extension3915ModuleController extends BaseController @@ -99,6 +98,7 @@ class Extension3915ModuleController extends BaseController
99 */ 98 */
100 public function importData() 99 public function importData()
101 { 100 {
102 - 101 + $data = $this->param;
  102 + return $data;
103 } 103 }
104 } 104 }