作者 lyh

变更数据

... ... @@ -27,24 +27,23 @@ class GeoController extends BaseController
* 获取GEO相关配置
* @param Request $request
*/
public function getConfig(Request $request)
public function getConfig()
{
$this->request->validate([
'project_id' => 'required',
], [
'project_id.required' => '项目ID不能为空',
]);
$project_geo_conf = Project::select('title', 'version', 'geo_status', 'geo_qualify_num')->where(['project_id' => $this->param['project_id']])->first();
$geo_conf = GeoConf::where(['project_id' => $this->param['project_id']])->first();
$geo_manage_list = GeoConf::geoManage();
$projectModel = new Project();
$project_geo_conf = $projectModel->read(['project_id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']);
$geoConfModel = new GeoConf();
$geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]);
$geo_manage_list = $geoConfModel->geoManage();
// geo配置管理员,已经移除管理员列表,补充管理员信息
if ($geo_conf && $geo_conf->manager_id && empty($geo_manage_list[$geo_conf->manager_id])) {
$manage = ManageHr::where(['id' => $geo_conf->manager_id])->pluck('name', 'id')->toArray();
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
$geo_manage_list = array_merge($geo_manage_list, $manage);
}
$result = [
'project_geo_conf' => $project_geo_conf,
'geo_conf' => $geo_conf,
... ... @@ -63,7 +62,7 @@ class GeoController extends BaseController
* @param Request $request
* @throws \App\Exceptions\AsideGlobalException
*/
public function saveConfig(Request $request)
public function saveConfig()
{
$this->request->validate([
'project_id' => 'required',
... ... @@ -78,7 +77,6 @@ class GeoController extends BaseController
'brand.max' => '品牌名不能超过200个字符',
'description.max' => '描述不能超过500个字符',
]);
try {
$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']);
# FIXME 保存GEO状态 达标数量
... ... @@ -94,7 +92,7 @@ class GeoController extends BaseController
* @param Request $request
* @throws \App\Exceptions\AsideGlobalException
*/
public function saveConfirmContent(Request $request)
public function saveConfirmContent()
{
$this->request->validate([
'project_id' => 'required',
... ... @@ -108,16 +106,13 @@ class GeoController extends BaseController
'content.required' => '确定数据不能为空',
'max_num.required' => '最大确认数量不能为空',
]);
try {
$data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']);
$friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first();
if (empty($friend))
if (empty($friend)){
$this->fail('项目未绑定微信群, 推送消息失败!');
}
$data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id);
$this->response('success', Code::SUCCESS, $data);
} catch (\Exception $e) {
$this->fail('操作失败, error:' . $e->getMessage());
... ... @@ -131,4 +126,4 @@ class GeoController extends BaseController
*/
public function saveConfirmData(Request $request)
{}
}
\ No newline at end of file
}
... ...
... ... @@ -56,7 +56,7 @@ class GeoConf extends Base
* TODO 负责人:优化师 + 陶婵 + 艾媛媛
* @return array
*/
public static function geoManage()
public function geoManage()
{
$key = 'geo_manage_list_' . date('Ymd');
$optimize = Cache::get($key);
... ... @@ -69,4 +69,4 @@ class GeoConf extends Base
}
return $optimize;
}
}
\ No newline at end of file
}
... ...
... ... @@ -112,14 +112,12 @@ class GeoConfirm extends Base
public static function sendConfirmMessage($id, $friend_id)
{
$data = self::where(compact('id'))->first();
$project_id = $data->project_id;
$content_type = 'Link';
$send_time = now();
$type = MessagePush::TYPE_GEO_CONFIRM;
$token = uniqid();
$created_at = $updated_at = now();
$content_array = [
'title' => self::typeMapping()[$data->type],
'desc' => self::typeMapping()[$data->type],
... ... @@ -130,14 +128,12 @@ class GeoConfirm extends Base
];
$content = json_encode($content_array, JSON_UNESCAPED_UNICODE);
MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at'));
// 消息推送, 更新数据
$data->confirm = '';
$data->send_at = now();
$data->uniqid = $token;
$data->status = self::STATUS_RUNNING;
$data->save();
return $data;
}
}
\ No newline at end of file
}
... ...
... ... @@ -586,6 +586,10 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink');
Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData');
});
//geo设置
Route::prefix('conf')->group(function () {
Route::any('/getConfig', [Aside\Geo\GeoController::class, 'getConfig'])->name('admin.geo_conf_getConfig');
});
});
// 任务相关
Route::prefix('task')->group(function () {
... ... @@ -652,6 +656,8 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save');
Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail');
});
});
//无需登录验证的路由组
... ...