作者 张关杰

Merge branch 'akun' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -220,19 +220,26 @@ class VideoTask extends Command
if (count($productIds)<7){
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
$number = 40;
$product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
$array_count = count($product_all_id);
if ($array_count > 0) {
$product_id = array_rand($product_all_id, min($array_count, $number - count($productIds)));
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
$products = $productsQuery->merge($randomData);
}
}else{
$products = $productsQuery;
}
}else{
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
$number = 40;
$product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
$array_count = count($product_all_id);
if ($array_count > 0)
{
$product_id = array_rand($product_all_id, min($array_count, $number-count($productIds)));
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
}
}
}
$data = [];
if (!empty($products)){
foreach ($products as $item){
... ... @@ -242,10 +249,11 @@ class VideoTask extends Command
if(count($data) > 13){
break;
}
if (strpos($item->keyword_id, ','.$productKeyword->id.',') === false) {
$keyword_id = implode(',',$item->keyword_id);
if (strpos(','.$keyword_id.',', ','.$productKeyword->id.',') === false) {
//不包含
$productModel = new Product();
$keyword_id = $item->keyword_id . $productKeyword->id.',';
$keyword_id = $keyword_id . $productKeyword->id.',';
$productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]);
}
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\RouteMap\RouteMap;
use App\Models\User\User;
use App\Services\ProjectServer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
/**
* Class PrivateController
... ... @@ -127,4 +128,18 @@ class PrivateController extends BaseController
return $this->success($result);
}
/**
* v6 有效用户
* @param Request $request
* @return false|string
*/
public function validUser(Request $request)
{
// 排除演示项目数据
$valid_user = User::select(['gl_project_user.mobile'])->leftJoin('gl_project', 'gl_project.id', '=', 'gl_project_user.project_id')->where(['delete_status' => 0, 'is_upgrade' => Project::IS_UPGRADE_FALSE])->where('gl_project.id', '>', 1)->pluck('mobile')->toArray();
$upgrade_user = User::select(['gl_project_user.mobile'])->leftJoin('gl_project', 'gl_project.id', '=', 'gl_project_user.project_id')->where(['delete_status' => 0, 'is_upgrade' => Project::IS_UPGRADE_TRUE])->where('gl_project.type', '>', Project::TYPE_ONE)->pluck('mobile')->toArray();
$user = array_unique(array_merge($valid_user, $upgrade_user));
return $this->success($user);
}
}
\ No newline at end of file
... ...
... ... @@ -18,6 +18,7 @@ use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
/**
... ... @@ -169,7 +170,9 @@ class CNoticeController extends BaseController
$ids = explode(',',$info['country_lists']);
}
$languageModel = new WebLanguage();
$lists = $languageModel->list(['id'=>['in',$ids]]);
//根据排序查询选中的小语种
$lists = $languageModel->whereIn('id', $ids)->orderByRaw(DB::raw("FIND_IN_SET(id,'" . implode(',', $ids) . "'" . ')'))->get()->toArray();
// $lists = $languageModel->list(['id'=>['in',$ids]]);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -235,9 +235,15 @@ class LoginController extends BaseController
* @time :2023/8/24 17:37
*/
public function globalSo_v6_login(UserLoginLogic $logic){
$this->param = $this->request->validate([
'token' => 'required',
],[
'token.required' => 'token不能为空',
]);
try {
$common = new Common();
$arr = $common->decrypt(urldecode($this->param['token']));
if(empty($arr)){
}catch (\Exception $e){
$this->response('非法请求!',Code::USER_ERROR);
}
if (empty($arr['timestamp']) || time() - $arr['timestamp'] > 60) {
... ...
... ... @@ -42,7 +42,7 @@ class HttpUtils
public static function get($url, $data, $headers = [])
{
LogUtils::info("HttpUtils-GET请求URL:" . $url);
$response = Http::withHeaders($headers)->get($url, $data);
$response = Http::timeout(20)->withHeaders($headers)->get($url, $data);
self::checkSuccess($response);
return $response->getBody()->getContents();
}
... ... @@ -50,7 +50,7 @@ class HttpUtils
public static function post($url, $data, $headers = [])
{
LogUtils::info("HttpUtils-POST请求URL:" . $url);
$response = Http::withHeaders($headers)->post($url, $data);
$response = Http::timeout(20)->withHeaders($headers)->post($url, $data);
self::checkSuccess($response);
return $response->getBody()->getContents();
}
... ...
... ... @@ -28,3 +28,5 @@ Route::any('getOptimizationReport', [\App\Http\Controllers\Api\OptimizationRepor
Route::post('video_task_callback', [\App\Http\Controllers\Api\NoticeController::class, 'videoTaskCallback'])->name('api.video_task_callback');
// 验证是否为6.0用户
Route::any('has_user', [\App\Http\Controllers\Api\PrivateController::class, 'hasUser'])->name('api.has_user');
// 6.0有效用户用户
Route::any('valid_user', [\App\Http\Controllers\Api\PrivateController::class, 'validUser'])->name('api.valid_user');
... ...