作者 lyh

变更数据

@@ -27,24 +27,23 @@ class GeoController extends BaseController @@ -27,24 +27,23 @@ class GeoController extends BaseController
27 * 获取GEO相关配置 27 * 获取GEO相关配置
28 * @param Request $request 28 * @param Request $request
29 */ 29 */
30 - public function getConfig(Request $request) 30 + public function getConfig()
31 { 31 {
32 $this->request->validate([ 32 $this->request->validate([
33 'project_id' => 'required', 33 'project_id' => 'required',
34 ], [ 34 ], [
35 'project_id.required' => '项目ID不能为空', 35 'project_id.required' => '项目ID不能为空',
36 ]); 36 ]);
37 -  
38 - $project_geo_conf = Project::select('title', 'version', 'geo_status', 'geo_qualify_num')->where(['project_id' => $this->param['project_id']])->first();  
39 - $geo_conf = GeoConf::where(['project_id' => $this->param['project_id']])->first();  
40 - $geo_manage_list = GeoConf::geoManage();  
41 - 37 + $projectModel = new Project();
  38 + $project_geo_conf = $projectModel->read(['project_id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']);
  39 + $geoConfModel = new GeoConf();
  40 + $geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]);
  41 + $geo_manage_list = $geoConfModel->geoManage();
42 // geo配置管理员,已经移除管理员列表,补充管理员信息 42 // geo配置管理员,已经移除管理员列表,补充管理员信息
43 - if ($geo_conf && $geo_conf->manager_id && empty($geo_manage_list[$geo_conf->manager_id])) {  
44 - $manage = ManageHr::where(['id' => $geo_conf->manager_id])->pluck('name', 'id')->toArray(); 43 + if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
  44 + $manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
45 $geo_manage_list = array_merge($geo_manage_list, $manage); 45 $geo_manage_list = array_merge($geo_manage_list, $manage);
46 } 46 }
47 -  
48 $result = [ 47 $result = [
49 'project_geo_conf' => $project_geo_conf, 48 'project_geo_conf' => $project_geo_conf,
50 'geo_conf' => $geo_conf, 49 'geo_conf' => $geo_conf,
@@ -63,7 +62,7 @@ class GeoController extends BaseController @@ -63,7 +62,7 @@ class GeoController extends BaseController
63 * @param Request $request 62 * @param Request $request
64 * @throws \App\Exceptions\AsideGlobalException 63 * @throws \App\Exceptions\AsideGlobalException
65 */ 64 */
66 - public function saveConfig(Request $request) 65 + public function saveConfig()
67 { 66 {
68 $this->request->validate([ 67 $this->request->validate([
69 'project_id' => 'required', 68 'project_id' => 'required',
@@ -78,7 +77,6 @@ class GeoController extends BaseController @@ -78,7 +77,6 @@ class GeoController extends BaseController
78 'brand.max' => '品牌名不能超过200个字符', 77 'brand.max' => '品牌名不能超过200个字符',
79 'description.max' => '描述不能超过500个字符', 78 'description.max' => '描述不能超过500个字符',
80 ]); 79 ]);
81 -  
82 try { 80 try {
83 $data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']); 81 $data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']);
84 # FIXME 保存GEO状态 达标数量 82 # FIXME 保存GEO状态 达标数量
@@ -94,7 +92,7 @@ class GeoController extends BaseController @@ -94,7 +92,7 @@ class GeoController extends BaseController
94 * @param Request $request 92 * @param Request $request
95 * @throws \App\Exceptions\AsideGlobalException 93 * @throws \App\Exceptions\AsideGlobalException
96 */ 94 */
97 - public function saveConfirmContent(Request $request) 95 + public function saveConfirmContent()
98 { 96 {
99 $this->request->validate([ 97 $this->request->validate([
100 'project_id' => 'required', 98 'project_id' => 'required',
@@ -108,16 +106,13 @@ class GeoController extends BaseController @@ -108,16 +106,13 @@ class GeoController extends BaseController
108 'content.required' => '确定数据不能为空', 106 'content.required' => '确定数据不能为空',
109 'max_num.required' => '最大确认数量不能为空', 107 'max_num.required' => '最大确认数量不能为空',
110 ]); 108 ]);
111 -  
112 try { 109 try {
113 $data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']); 110 $data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']);
114 -  
115 $friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first(); 111 $friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first();
116 - if (empty($friend)) 112 + if (empty($friend)){
117 $this->fail('项目未绑定微信群, 推送消息失败!'); 113 $this->fail('项目未绑定微信群, 推送消息失败!');
118 - 114 + }
119 $data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id); 115 $data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id);
120 -  
121 $this->response('success', Code::SUCCESS, $data); 116 $this->response('success', Code::SUCCESS, $data);
122 } catch (\Exception $e) { 117 } catch (\Exception $e) {
123 $this->fail('操作失败, error:' . $e->getMessage()); 118 $this->fail('操作失败, error:' . $e->getMessage());
@@ -131,4 +126,4 @@ class GeoController extends BaseController @@ -131,4 +126,4 @@ class GeoController extends BaseController
131 */ 126 */
132 public function saveConfirmData(Request $request) 127 public function saveConfirmData(Request $request)
133 {} 128 {}
134 -}  
  129 +}
@@ -56,7 +56,7 @@ class GeoConf extends Base @@ -56,7 +56,7 @@ class GeoConf extends Base
56 * TODO 负责人:优化师 + 陶婵 + 艾媛媛 56 * TODO 负责人:优化师 + 陶婵 + 艾媛媛
57 * @return array 57 * @return array
58 */ 58 */
59 - public static function geoManage() 59 + public function geoManage()
60 { 60 {
61 $key = 'geo_manage_list_' . date('Ymd'); 61 $key = 'geo_manage_list_' . date('Ymd');
62 $optimize = Cache::get($key); 62 $optimize = Cache::get($key);
@@ -69,4 +69,4 @@ class GeoConf extends Base @@ -69,4 +69,4 @@ class GeoConf extends Base
69 } 69 }
70 return $optimize; 70 return $optimize;
71 } 71 }
72 -}  
  72 +}
@@ -112,14 +112,12 @@ class GeoConfirm extends Base @@ -112,14 +112,12 @@ class GeoConfirm extends Base
112 public static function sendConfirmMessage($id, $friend_id) 112 public static function sendConfirmMessage($id, $friend_id)
113 { 113 {
114 $data = self::where(compact('id'))->first(); 114 $data = self::where(compact('id'))->first();
115 -  
116 $project_id = $data->project_id; 115 $project_id = $data->project_id;
117 $content_type = 'Link'; 116 $content_type = 'Link';
118 $send_time = now(); 117 $send_time = now();
119 $type = MessagePush::TYPE_GEO_CONFIRM; 118 $type = MessagePush::TYPE_GEO_CONFIRM;
120 $token = uniqid(); 119 $token = uniqid();
121 $created_at = $updated_at = now(); 120 $created_at = $updated_at = now();
122 -  
123 $content_array = [ 121 $content_array = [
124 'title' => self::typeMapping()[$data->type], 122 'title' => self::typeMapping()[$data->type],
125 'desc' => self::typeMapping()[$data->type], 123 'desc' => self::typeMapping()[$data->type],
@@ -130,14 +128,12 @@ class GeoConfirm extends Base @@ -130,14 +128,12 @@ class GeoConfirm extends Base
130 ]; 128 ];
131 $content = json_encode($content_array, JSON_UNESCAPED_UNICODE); 129 $content = json_encode($content_array, JSON_UNESCAPED_UNICODE);
132 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at')); 130 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at'));
133 -  
134 // 消息推送, 更新数据 131 // 消息推送, 更新数据
135 $data->confirm = ''; 132 $data->confirm = '';
136 $data->send_at = now(); 133 $data->send_at = now();
137 $data->uniqid = $token; 134 $data->uniqid = $token;
138 $data->status = self::STATUS_RUNNING; 135 $data->status = self::STATUS_RUNNING;
139 $data->save(); 136 $data->save();
140 -  
141 return $data; 137 return $data;
142 } 138 }
143 -}  
  139 +}
@@ -586,6 +586,10 @@ Route::middleware(['aloginauth'])->group(function () { @@ -586,6 +586,10 @@ Route::middleware(['aloginauth'])->group(function () {
586 Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink'); 586 Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink');
587 Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData'); 587 Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData');
588 }); 588 });
  589 + //geo设置
  590 + Route::prefix('conf')->group(function () {
  591 + Route::any('/getConfig', [Aside\Geo\GeoController::class, 'getConfig'])->name('admin.geo_conf_getConfig');
  592 + });
589 }); 593 });
590 // 任务相关 594 // 任务相关
591 Route::prefix('task')->group(function () { 595 Route::prefix('task')->group(function () {
@@ -652,6 +656,8 @@ Route::middleware(['aloginauth'])->group(function () { @@ -652,6 +656,8 @@ Route::middleware(['aloginauth'])->group(function () {
652 Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save'); 656 Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save');
653 Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail'); 657 Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail');
654 }); 658 });
  659 +
  660 +
655 }); 661 });
656 662
657 //无需登录验证的路由组 663 //无需登录验证的路由组