作者 李宇航

合并分支 'lyh-server' 到 'master'

变更数据



查看合并请求 !3026
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 */ 7 */
8 namespace App\Http\Controllers\Api; 8 namespace App\Http\Controllers\Api;
9 9
  10 +use App\Enums\Common\Code;
10 use App\Models\Geo\GeoConfirm; 11 use App\Models\Geo\GeoConfirm;
11 use App\Models\Geo\GeoWritings; 12 use App\Models\Geo\GeoWritings;
12 use App\Models\Project\Project; 13 use App\Models\Project\Project;
@@ -35,13 +36,15 @@ class GeoController extends BaseController @@ -35,13 +36,15 @@ class GeoController extends BaseController
35 } catch (\Exception $e) { 36 } catch (\Exception $e) {
36 return $this->error('非法请求'); 37 return $this->error('非法请求');
37 } 38 }
38 - $project = Project::select('title', 'version')->where(['project_id' => $this->param['project_id']])->first();  
39 - $list = GeoWritings::select(['title', 'status', 'uniqid', 'confirm_at'])->where(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE])->get(); 39 + $projectModel = new Project();
  40 + $projectInfo = $projectModel->read(['project_id' => $project_id],['title','version']);
  41 + $geoWritingsModel = new GeoWritings();
  42 + $lists = $geoWritingsModel->list(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']);
40 $result = [ 43 $result = [
41 - 'project' => $project,  
42 - 'list' => $list 44 + 'project' => $projectInfo,
  45 + 'list' => $lists
43 ]; 46 ];
44 - return $this->success($result); 47 + $this->response('success',Code::SUCCESS,$result);
45 } 48 }
46 49
47 /** 50 /**
@@ -49,11 +52,12 @@ class GeoController extends BaseController @@ -49,11 +52,12 @@ class GeoController extends BaseController
49 * @param Request $request 52 * @param Request $request
50 * @return false|string 53 * @return false|string
51 */ 54 */
52 - public function getWritingsDetail(Request $request) 55 + public function getWritingsDetail()
53 { 56 {
54 - $token = trim($request->input('token'));  
55 - $detail = GeoWritings::select(['title', 'content', 'status'])->where(['uniqid' => $token])->first();  
56 - return $this->success($detail); 57 + $geoWritingsModel = new GeoWritings();
  58 + $token = trim($this->param['token']);
  59 + $detail = $geoWritingsModel->read(['uniqid' => $token],['title', 'content', 'status']);
  60 + $this->response('success',Code::SUCCESS,$detail);
57 } 61 }
58 62
59 63
@@ -95,9 +99,9 @@ class GeoController extends BaseController @@ -95,9 +99,9 @@ class GeoController extends BaseController
95 * @param Request $request 99 * @param Request $request
96 * @return false|string 100 * @return false|string
97 */ 101 */
98 - public function getConfirm(Request $request) 102 + public function getConfirm()
99 { 103 {
100 - $token = trim($request->input('token')); 104 + $token = trim($this->param['token']);
101 $data = GeoConfirm::where(['uniqid' => $token])->first(); 105 $data = GeoConfirm::where(['uniqid' => $token])->first();
102 if (empty($data)){ 106 if (empty($data)){
103 return $this->error('当前授权已失效'); 107 return $this->error('当前授权已失效');
@@ -107,7 +111,7 @@ class GeoController extends BaseController @@ -107,7 +111,7 @@ class GeoController extends BaseController
107 $type = $data->type; 111 $type = $data->type;
108 $status = $data->status; 112 $status = $data->status;
109 $result = compact('content', 'confirm', 'type', 'status'); 113 $result = compact('content', 'confirm', 'type', 'status');
110 - return $this->success($result); 114 + $this->response('success',Code::SUCCESS,$result);
111 } 115 }
112 116
113 /** 117 /**
@@ -115,6 +119,20 @@ class GeoController extends BaseController @@ -115,6 +119,20 @@ class GeoController extends BaseController
115 * 验证当前确认数据状态, 不可重复确认 119 * 验证当前确认数据状态, 不可重复确认
116 * @param Request $request 120 * @param Request $request
117 */ 121 */
118 - public function saveConfirm(Request $request)  
119 - {} 122 + public function saveConfirm()
  123 + {
  124 + $this->request->validate([
  125 + 'uniqid' => 'required',
  126 + 'confirm' => 'required',
  127 + 'confirm_num' => 'required',
  128 + ], [
  129 + 'uniqid.required' => '非法请求',
  130 + 'confirm.required' => '客户确认内容不能为空',
  131 + 'confirm_num.max' => '客户确认数量不能为空',
  132 + ]);
  133 + $geoConfirmModel = new GeoConfirm();
  134 + $this->param['status'] = $geoConfirmModel::STATUS_FINISH;
  135 + $result = $geoConfirmModel->edit($this->param,['uniqid'=>$this->param['uniqid']]);
  136 + $this->response('success',Code::SUCCESS,$result);
  137 + }
120 } 138 }
@@ -110,5 +110,8 @@ Route::prefix('ticket_upload')->group(function () { @@ -110,5 +110,8 @@ Route::prefix('ticket_upload')->group(function () {
110 //geo设置 110 //geo设置
111 Route::prefix('geo')->group(function () { 111 Route::prefix('geo')->group(function () {
112 Route::any('/getConfirm', [\App\Http\Controllers\Api\GeoController::class, 'getConfirm'])->name('geo.getConfirm'); 112 Route::any('/getConfirm', [\App\Http\Controllers\Api\GeoController::class, 'getConfirm'])->name('geo.getConfirm');
  113 + Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//确认文章数据
  114 + Route::any('/getWritingsDetail', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsDetail'])->name('geo.getWritingsDetail');//文章数据详情
  115 + Route::any('/saveConfirm', [\App\Http\Controllers\Api\GeoController::class, 'saveConfirm'])->name('geo.saveConfirm');//保存用户确认信息
113 }); 116 });
114 117