Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
4 个修改的文件
包含
59 行增加
和
15 行删除
| @@ -120,6 +120,7 @@ class QuanqiusouApi | @@ -120,6 +120,7 @@ class QuanqiusouApi | ||
| 120 | 120 | ||
| 121 | /** | 121 | /** |
| 122 | * 获取每周谷歌排名数据 | 122 | * 获取每周谷歌排名数据 |
| 123 | + * fixme https://quanqiusou.cn/extend_api/api/data/2024-09-02.json | ||
| 123 | * @return array|false|mixed | 124 | * @return array|false|mixed |
| 124 | * @author zbj | 125 | * @author zbj |
| 125 | * @date 2023/5/11 | 126 | * @date 2023/5/11 |
| @@ -215,7 +215,7 @@ class PrivateController extends BaseController | @@ -215,7 +215,7 @@ class PrivateController extends BaseController | ||
| 215 | if (empty($project)) { | 215 | if (empty($project)) { |
| 216 | return $this->error('未找到当前域名对应的项目!'); | 216 | return $this->error('未找到当前域名对应的项目!'); |
| 217 | } | 217 | } |
| 218 | - $optimize = $project->optimize; | 218 | + $optimize = $project->deploy_optimize; |
| 219 | $keyword = $project->project_keyword; | 219 | $keyword = $project->project_keyword; |
| 220 | $keywords = explode("\r\n", $keyword ? $keyword->main_keyword : []); | 220 | $keywords = explode("\r\n", $keyword ? $keyword->main_keyword : []); |
| 221 | $result = [ | 221 | $result = [ |
| @@ -245,7 +245,7 @@ class PrivateController extends BaseController | @@ -245,7 +245,7 @@ class PrivateController extends BaseController | ||
| 245 | return $this->error('未找到当前域名对应的项目!'); | 245 | return $this->error('未找到当前域名对应的项目!'); |
| 246 | } | 246 | } |
| 247 | ProjectServer::useProject($project->id); | 247 | ProjectServer::useProject($project->id); |
| 248 | - $products = Product::with('category')->where(['status' => Product::STATUS_ON])->paginate($page_size); | 248 | + $products = Product::select(['id', 'title', 'thumb', 'gallery', 'intro', 'content', 'keyword_id', 'route'])->with('category')->where(['status' => Product::STATUS_ON])->paginate($page_size); |
| 249 | 249 | ||
| 250 | // $products_ids = $products->pluck('id')->toArray(); | 250 | // $products_ids = $products->pluck('id')->toArray(); |
| 251 | // $category_ids = CategoryRelated::whereIn('product_id', $products_ids)->pluck('cate_id')->toArray(); | 251 | // $category_ids = CategoryRelated::whereIn('product_id', $products_ids)->pluck('cate_id')->toArray(); |
| @@ -255,25 +255,18 @@ class PrivateController extends BaseController | @@ -255,25 +255,18 @@ class PrivateController extends BaseController | ||
| 255 | $keyword_ids = array_reduce($keyword_id, 'array_merge', array()); | 255 | $keyword_ids = array_reduce($keyword_id, 'array_merge', array()); |
| 256 | $keyword = Keyword::whereIn('id', $keyword_ids)->pluck('title', 'id')->toArray(); | 256 | $keyword = Keyword::whereIn('id', $keyword_ids)->pluck('title', 'id')->toArray(); |
| 257 | 257 | ||
| 258 | - $result = []; | ||
| 259 | foreach ($products as $product) { | 258 | foreach ($products as $product) { |
| 260 | $product_keyword = []; | 259 | $product_keyword = []; |
| 261 | foreach ($product->keyword_id as $k_id) { | 260 | foreach ($product->keyword_id as $k_id) { |
| 262 | array_push($product_keyword, $keyword[$k_id]); | 261 | array_push($product_keyword, $keyword[$k_id]); |
| 263 | } | 262 | } |
| 264 | $product_category = $product->category->pluck('title')->toArray(); | 263 | $product_category = $product->category->pluck('title')->toArray(); |
| 265 | - $result[] = [ | ||
| 266 | - 'title' => $product->title, | ||
| 267 | - 'thumb' => $product->thumb, | ||
| 268 | - 'gallery' => $product->gallery, | ||
| 269 | - 'intro' => $product->intro, | ||
| 270 | - 'content' => $product->content, | ||
| 271 | - 'category' => $product_category, | ||
| 272 | - 'keyword' => $product_keyword, | ||
| 273 | - 'route' => $product->route | ||
| 274 | - ]; | 264 | + unset($product->category); |
| 265 | + unset($product->keyword_id); | ||
| 266 | + $product->category = $product_category; | ||
| 267 | + $product->keyword = $product_keyword; | ||
| 275 | } | 268 | } |
| 276 | - return $this->success($result); | 269 | + return $this->success($products); |
| 277 | } | 270 | } |
| 278 | 271 | ||
| 279 | /** | 272 | /** |
| @@ -86,7 +86,12 @@ class ProjectAssociationController extends BaseController | @@ -86,7 +86,12 @@ class ProjectAssociationController extends BaseController | ||
| 86 | $this->response('success', Code::SERVER_ERROR); | 86 | $this->response('success', Code::SERVER_ERROR); |
| 87 | } | 87 | } |
| 88 | $cache = isset($cache); | 88 | $cache = isset($cache); |
| 89 | - $result = ProjectAssociationServices::getInstance()->getAiccWechatLists($isRes, $app, $cache); | 89 | + $search = request()->input('search'); |
| 90 | +// $result = ProjectAssociationServices::getInstance()->getAiccWechatLists($isRes, $app, $cache); | ||
| 91 | + $result = ProjectAssociationServices::getInstance()->getWorkChatRoomList($search, $isRes->friend_id); | ||
| 92 | + $result['info'] = [ | ||
| 93 | + 'friend_id' => $isRes->friend_id ?? 0 | ||
| 94 | + ]; | ||
| 90 | $this->response('success', Code::SUCCESS, $result); | 95 | $this->response('success', Code::SUCCESS, $result); |
| 91 | } | 96 | } |
| 92 | } | 97 | } |
| @@ -9,6 +9,7 @@ use App\Services\BaseService; | @@ -9,6 +9,7 @@ use App\Services\BaseService; | ||
| 9 | use Illuminate\Database\Eloquent\Builder; | 9 | use Illuminate\Database\Eloquent\Builder; |
| 10 | use Illuminate\Database\Eloquent\Model; | 10 | use Illuminate\Database\Eloquent\Model; |
| 11 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
| 12 | +use Illuminate\Support\Facades\Http; | ||
| 12 | 13 | ||
| 13 | class ProjectAssociationServices extends BaseService | 14 | class ProjectAssociationServices extends BaseService |
| 14 | { | 15 | { |
| @@ -151,4 +152,48 @@ class ProjectAssociationServices extends BaseService | @@ -151,4 +152,48 @@ class ProjectAssociationServices extends BaseService | ||
| 151 | ]; | 152 | ]; |
| 152 | return $result; | 153 | return $result; |
| 153 | } | 154 | } |
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 获取AI客服列表 | ||
| 158 | + * @author zbj | ||
| 159 | + * @date 2024/9/7 | ||
| 160 | + */ | ||
| 161 | + public function getWorkChatRoomList($search = '', $friend_id = 0){ | ||
| 162 | + $param = [ | ||
| 163 | + 'search' => $search, | ||
| 164 | + 'time' => time(), | ||
| 165 | + ]; | ||
| 166 | + if(!$search && $friend_id){ | ||
| 167 | + $param['friend_id'] = $friend_id; | ||
| 168 | + } | ||
| 169 | + $param['sign'] = $this->getSign($param); | ||
| 170 | + $url = 'https://hub.ai.cc/api/globalso_ai_customer_service/chatroom_list'; | ||
| 171 | + $result = Http::withoutVerifying()->post($url, $param)->json(); | ||
| 172 | + if(empty($result) || $result['status'] != 200){ | ||
| 173 | + return []; | ||
| 174 | + } | ||
| 175 | + return $result; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + /** | ||
| 179 | + * @param $data | ||
| 180 | + * @return string | ||
| 181 | + */ | ||
| 182 | + public function getSign($data) | ||
| 183 | + { | ||
| 184 | + if (empty($data) || FALSE == is_array($data)) | ||
| 185 | + return ''; | ||
| 186 | + unset($data['sign']); | ||
| 187 | + ksort($data); | ||
| 188 | + // 放弃http_build_query 会将空数据字段抛弃 | ||
| 189 | + // $string = http_build_query($data); | ||
| 190 | + $tem = []; | ||
| 191 | + foreach ($data as $key => $val) { | ||
| 192 | + $tem[] = $key . '=' . urlencode($val); | ||
| 193 | + } | ||
| 194 | + $string = implode('&', $tem); | ||
| 195 | + $key = md5('quanqiusou.com'); | ||
| 196 | + $sign = md5($string . $key); | ||
| 197 | + return $sign; | ||
| 198 | + } | ||
| 154 | } | 199 | } |
-
请 注册 或 登录 后发表评论