master
cody 2 days ago
parent 2d2b176ee7
commit 61cec0c99c

@ -143,6 +143,7 @@ class OtherController extends CommonController
if ($cache && !empty($cache->payload)) { if ($cache && !empty($cache->payload)) {
$cache->last_matched_at = now(); $cache->last_matched_at = now();
$cache->save(); $cache->save();
$this->syncCurrentUserCompanyType($cache->payload);
return $this->success($cache->payload); return $this->success($cache->payload);
} }
@ -163,9 +164,28 @@ class OtherController extends CommonController
'fetched_at' => now(), 'fetched_at' => now(),
] ]
); );
$this->syncCurrentUserCompanyType($result);
return $this->success($result); return $this->success($result);
} }
protected function syncCurrentUserCompanyType(array $result): void
{
$user = $this->getUser();
if (!$user) {
return;
}
$companyType = implode(',', $result['tagList'] ?? []);
if ($user->company_type === $companyType) {
return;
}
$user->company_type = $companyType;
$user->save();
}
/** /**
* @OA\Get( * @OA\Get(
* path="/api/mobile/other/company-list", * path="/api/mobile/other/company-list",

@ -344,8 +344,7 @@ Route::group(["namespace" => "Mobile", "prefix" => "mobile"], function () {
Route::get('other/banner', [\App\Http\Controllers\Mobile\OtherController::class, "banner"]); Route::get('other/banner', [\App\Http\Controllers\Mobile\OtherController::class, "banner"]);
// 公司查询 // 公司查询
Route::get('other/company', [\App\Http\Controllers\Mobile\OtherController::class, "company"]); Route::get('other/company', [\App\Http\Controllers\Mobile\OtherController::class, "company"]);
// 公司详情
Route::get('other/company-detail', [\App\Http\Controllers\Mobile\OtherController::class, "companyDetail"]);
// 公司查询 // 公司查询
Route::get('other/company-list', [\App\Http\Controllers\Mobile\OtherController::class, "companyList"]); Route::get('other/company-list', [\App\Http\Controllers\Mobile\OtherController::class, "companyList"]);
// 通知 // 通知
@ -368,6 +367,8 @@ Route::group(["namespace" => "Mobile", "prefix" => "mobile"], function () {
// 支付回调 // 支付回调
Route::any('course/pay_callback', [\App\Http\Controllers\Mobile\CourseController::class, "payCallback"]); Route::any('course/pay_callback', [\App\Http\Controllers\Mobile\CourseController::class, "payCallback"]);
Route::group(['middleware' => ['sanctum.jwt:mobile']], function () { Route::group(['middleware' => ['sanctum.jwt:mobile']], function () {
// 公司详情
Route::get('other/company-detail', [\App\Http\Controllers\Mobile\OtherController::class, "companyDetail"]);
// 其他 // 其他
Route::post('upload-file', [\App\Http\Controllers\Mobile\UploadController::class, "uploadFile"]); Route::post('upload-file', [\App\Http\Controllers\Mobile\UploadController::class, "uploadFile"]);
// 用户信息 // 用户信息

Loading…
Cancel
Save