作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改通过详情页搜索

... ... @@ -6,6 +6,7 @@
<component name="ChangeListManager">
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/User.php" afterPath="$PROJECT_DIR$/application/api/controller/User.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/api.html" afterPath="$PROJECT_DIR$/public/api.html" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -19,8 +20,8 @@
<file leaf-file-name="User.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<caret line="623" column="13" lean-forward="false" selection-start-line="623" selection-start-column="13" selection-end-line="623" selection-end-column="13" />
<state relative-caret-position="455">
<caret line="918" column="44" lean-forward="true" selection-start-line="918" selection-start-column="44" selection-end-line="918" selection-end-column="44" />
<folding>
<element signature="e#535#1273#0#PHP" expanded="false" />
<element signature="e#1278#2941#0#PHP" expanded="false" />
... ... @@ -47,59 +48,60 @@
<element signature="e#14837#16157#0#PHP" expanded="false" />
<element signature="e#16163#16739#0#PHP" expanded="false" />
<element signature="e#16744#17356#0#PHP" expanded="false" />
<element signature="e#17362#18078#0#PHP" expanded="false" />
<element signature="e#18083#21577#0#PHP" expanded="false" />
<element signature="e#21583#22513#0#PHP" expanded="false" />
<element signature="e#22518#26568#0#PHP" expanded="false" />
<element signature="e#26574#26951#0#PHP" expanded="false" />
<element signature="e#26956#27395#0#PHP" expanded="false" />
<element signature="e#27401#28136#0#PHP" expanded="false" />
<element signature="e#28141#29813#0#PHP" expanded="false" />
<element signature="e#29819#30324#0#PHP" expanded="false" />
<element signature="e#30329#30580#0#PHP" expanded="false" />
<element signature="e#30586#31065#0#PHP" expanded="false" />
<element signature="e#31070#31827#0#PHP" expanded="false" />
<element signature="e#31833#32314#0#PHP" expanded="false" />
<element signature="e#32319#33089#0#PHP" expanded="false" />
<element signature="e#33095#33458#0#PHP" expanded="false" />
<element signature="e#33463#33654#0#PHP" expanded="false" />
<element signature="e#33660#34018#0#PHP" expanded="false" />
<element signature="e#34023#34214#0#PHP" expanded="false" />
<element signature="e#34220#35363#0#PHP" expanded="false" />
<element signature="e#35368#38033#0#PHP" expanded="false" />
<element signature="e#38039#38537#0#PHP" expanded="false" />
<element signature="e#38542#40288#0#PHP" expanded="false" />
<element signature="e#40294#40707#0#PHP" expanded="false" />
<element signature="e#40712#41191#0#PHP" expanded="false" />
<element signature="e#41197#41731#0#PHP" expanded="false" />
<element signature="e#41736#43121#0#PHP" expanded="false" />
<element signature="e#43127#43781#0#PHP" expanded="false" />
<element signature="e#43786#45801#0#PHP" expanded="false" />
<element signature="e#45807#46567#0#PHP" expanded="false" />
<element signature="e#46572#49281#0#PHP" expanded="false" />
<element signature="e#49307#50138#0#PHP" expanded="false" />
<element signature="e#50144#50564#0#PHP" expanded="false" />
<element signature="e#50569#51052#0#PHP" expanded="false" />
<element signature="e#51058#51864#0#PHP" expanded="false" />
<element signature="e#51869#55027#0#PHP" expanded="false" />
<element signature="e#53662#55021#0#PHP" expanded="false" />
<element signature="e#55042#56377#0#PHP" expanded="false" />
<element signature="e#55158#55560#0#PHP" expanded="false" />
<element signature="e#56393#57427#0#PHP" expanded="false" />
<element signature="e#57433#58191#0#PHP" expanded="false" />
<element signature="e#58196#61939#0#PHP" expanded="false" />
<element signature="e#61945#62337#0#PHP" expanded="false" />
<element signature="e#62342#63294#0#PHP" expanded="false" />
<element signature="e#63318#63891#0#PHP" expanded="false" />
<element signature="e#63897#64496#0#PHP" expanded="false" />
<element signature="e#64501#65428#0#PHP" expanded="false" />
<element signature="e#65434#66148#0#PHP" expanded="false" />
<element signature="e#66154#66581#0#PHP" expanded="false" />
<element signature="e#66586#67055#0#PHP" expanded="false" />
<element signature="e#67062#68267#0#PHP" expanded="false" />
<element signature="e#68272#69975#0#PHP" expanded="false" />
<element signature="e#69981#70758#0#PHP" expanded="false" />
<element signature="e#70763#74701#0#PHP" expanded="false" />
<element signature="e#74707#75216#0#PHP" expanded="false" />
<element signature="e#75221#75893#0#PHP" expanded="false" />
<element signature="e#28673#31625#0#PHP" expanded="false" />
<element signature="e#31637#32142#0#PHP" expanded="false" />
<element signature="e#32147#32398#0#PHP" expanded="false" />
<element signature="e#32404#32883#0#PHP" expanded="false" />
<element signature="e#32888#33645#0#PHP" expanded="false" />
<element signature="e#33651#34132#0#PHP" expanded="false" />
<element signature="e#34137#34907#0#PHP" expanded="false" />
<element signature="e#34913#35276#0#PHP" expanded="false" />
<element signature="e#35281#35472#0#PHP" expanded="false" />
<element signature="e#35478#35836#0#PHP" expanded="false" />
<element signature="e#35841#36032#0#PHP" expanded="false" />
<element signature="e#36038#37181#0#PHP" expanded="false" />
<element signature="e#37186#39851#0#PHP" expanded="false" />
<element signature="e#39857#40355#0#PHP" expanded="false" />
<element signature="e#40360#42106#0#PHP" expanded="false" />
<element signature="e#42112#42525#0#PHP" expanded="false" />
<element signature="e#42530#43009#0#PHP" expanded="false" />
<element signature="e#43015#43549#0#PHP" expanded="false" />
<element signature="e#43554#44939#0#PHP" expanded="false" />
<element signature="e#44945#45599#0#PHP" expanded="false" />
<element signature="e#45604#47619#0#PHP" expanded="false" />
<element signature="e#47625#48385#0#PHP" expanded="false" />
<element signature="e#48390#51099#0#PHP" expanded="false" />
<element signature="e#51125#51956#0#PHP" expanded="false" />
<element signature="e#51962#52382#0#PHP" expanded="false" />
<element signature="e#52387#52870#0#PHP" expanded="false" />
<element signature="e#52876#53682#0#PHP" expanded="false" />
<element signature="e#53687#56845#0#PHP" expanded="false" />
<element signature="e#55480#56839#0#PHP" expanded="false" />
<element signature="e#56860#58195#0#PHP" expanded="false" />
<element signature="e#56976#57378#0#PHP" expanded="false" />
<element signature="e#58211#59245#0#PHP" expanded="false" />
<element signature="e#59251#60009#0#PHP" expanded="false" />
<element signature="e#60014#63757#0#PHP" expanded="false" />
<element signature="e#63763#64155#0#PHP" expanded="false" />
<element signature="e#64160#65112#0#PHP" expanded="false" />
<element signature="e#65136#65709#0#PHP" expanded="false" />
<element signature="e#65715#66314#0#PHP" expanded="false" />
<element signature="e#66319#67246#0#PHP" expanded="false" />
<element signature="e#67252#67966#0#PHP" expanded="false" />
<element signature="e#67972#68399#0#PHP" expanded="false" />
<element signature="e#68404#68873#0#PHP" expanded="false" />
<element signature="e#68880#70085#0#PHP" expanded="false" />
<element signature="e#70090#71793#0#PHP" expanded="false" />
<element signature="e#71799#72576#0#PHP" expanded="false" />
<element signature="e#72581#76519#0#PHP" expanded="false" />
<element signature="e#76525#77034#0#PHP" expanded="false" />
<element signature="e#77039#77711#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -206,9 +208,9 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="372" />
<option name="y" value="119" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="150" />
<option name="y" value="87" />
<option name="width" value="1652" />
<option name="height" value="917" />
</component>
... ... @@ -397,7 +399,7 @@
<workItem from="1583799928944" duration="18981000" />
<workItem from="1583826020973" duration="10927000" />
<workItem from="1583848752159" duration="3638000" />
<workItem from="1583886688361" duration="15391000" />
<workItem from="1583886688361" duration="16488000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -424,7 +426,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="612530000" />
<option name="totallyTimeSpent" value="613627000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
... ... @@ -436,7 +438,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="372" y="119" width="1652" height="917" extended-state="0" />
<frame x="150" y="87" width="1652" height="917" extended-state="1" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16520101" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32912987" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
... ... @@ -891,8 +893,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<caret line="623" column="13" lean-forward="false" selection-start-line="623" selection-start-column="13" selection-end-line="623" selection-end-column="13" />
<state relative-caret-position="455">
<caret line="918" column="44" lean-forward="true" selection-start-line="918" selection-start-column="44" selection-end-line="918" selection-end-column="44" />
<folding>
<element signature="e#535#1273#0#PHP" expanded="false" />
<element signature="e#1278#2941#0#PHP" expanded="false" />
... ... @@ -919,59 +921,60 @@
<element signature="e#14837#16157#0#PHP" expanded="false" />
<element signature="e#16163#16739#0#PHP" expanded="false" />
<element signature="e#16744#17356#0#PHP" expanded="false" />
<element signature="e#17362#18078#0#PHP" expanded="false" />
<element signature="e#18083#21577#0#PHP" expanded="false" />
<element signature="e#21583#22513#0#PHP" expanded="false" />
<element signature="e#22518#26568#0#PHP" expanded="false" />
<element signature="e#26574#26951#0#PHP" expanded="false" />
<element signature="e#26956#27395#0#PHP" expanded="false" />
<element signature="e#27401#28136#0#PHP" expanded="false" />
<element signature="e#28141#29813#0#PHP" expanded="false" />
<element signature="e#29819#30324#0#PHP" expanded="false" />
<element signature="e#30329#30580#0#PHP" expanded="false" />
<element signature="e#30586#31065#0#PHP" expanded="false" />
<element signature="e#31070#31827#0#PHP" expanded="false" />
<element signature="e#31833#32314#0#PHP" expanded="false" />
<element signature="e#32319#33089#0#PHP" expanded="false" />
<element signature="e#33095#33458#0#PHP" expanded="false" />
<element signature="e#33463#33654#0#PHP" expanded="false" />
<element signature="e#33660#34018#0#PHP" expanded="false" />
<element signature="e#34023#34214#0#PHP" expanded="false" />
<element signature="e#34220#35363#0#PHP" expanded="false" />
<element signature="e#35368#38033#0#PHP" expanded="false" />
<element signature="e#38039#38537#0#PHP" expanded="false" />
<element signature="e#38542#40288#0#PHP" expanded="false" />
<element signature="e#40294#40707#0#PHP" expanded="false" />
<element signature="e#40712#41191#0#PHP" expanded="false" />
<element signature="e#41197#41731#0#PHP" expanded="false" />
<element signature="e#41736#43121#0#PHP" expanded="false" />
<element signature="e#43127#43781#0#PHP" expanded="false" />
<element signature="e#43786#45801#0#PHP" expanded="false" />
<element signature="e#45807#46567#0#PHP" expanded="false" />
<element signature="e#46572#49281#0#PHP" expanded="false" />
<element signature="e#49307#50138#0#PHP" expanded="false" />
<element signature="e#50144#50564#0#PHP" expanded="false" />
<element signature="e#50569#51052#0#PHP" expanded="false" />
<element signature="e#51058#51864#0#PHP" expanded="false" />
<element signature="e#51869#55027#0#PHP" expanded="false" />
<element signature="e#53662#55021#0#PHP" expanded="false" />
<element signature="e#55042#56377#0#PHP" expanded="false" />
<element signature="e#55158#55560#0#PHP" expanded="false" />
<element signature="e#56393#57427#0#PHP" expanded="false" />
<element signature="e#57433#58191#0#PHP" expanded="false" />
<element signature="e#58196#61939#0#PHP" expanded="false" />
<element signature="e#61945#62337#0#PHP" expanded="false" />
<element signature="e#62342#63294#0#PHP" expanded="false" />
<element signature="e#63318#63891#0#PHP" expanded="false" />
<element signature="e#63897#64496#0#PHP" expanded="false" />
<element signature="e#64501#65428#0#PHP" expanded="false" />
<element signature="e#65434#66148#0#PHP" expanded="false" />
<element signature="e#66154#66581#0#PHP" expanded="false" />
<element signature="e#66586#67055#0#PHP" expanded="false" />
<element signature="e#67062#68267#0#PHP" expanded="false" />
<element signature="e#68272#69975#0#PHP" expanded="false" />
<element signature="e#69981#70758#0#PHP" expanded="false" />
<element signature="e#70763#74701#0#PHP" expanded="false" />
<element signature="e#74707#75216#0#PHP" expanded="false" />
<element signature="e#75221#75893#0#PHP" expanded="false" />
<element signature="e#28673#31625#0#PHP" expanded="false" />
<element signature="e#31637#32142#0#PHP" expanded="false" />
<element signature="e#32147#32398#0#PHP" expanded="false" />
<element signature="e#32404#32883#0#PHP" expanded="false" />
<element signature="e#32888#33645#0#PHP" expanded="false" />
<element signature="e#33651#34132#0#PHP" expanded="false" />
<element signature="e#34137#34907#0#PHP" expanded="false" />
<element signature="e#34913#35276#0#PHP" expanded="false" />
<element signature="e#35281#35472#0#PHP" expanded="false" />
<element signature="e#35478#35836#0#PHP" expanded="false" />
<element signature="e#35841#36032#0#PHP" expanded="false" />
<element signature="e#36038#37181#0#PHP" expanded="false" />
<element signature="e#37186#39851#0#PHP" expanded="false" />
<element signature="e#39857#40355#0#PHP" expanded="false" />
<element signature="e#40360#42106#0#PHP" expanded="false" />
<element signature="e#42112#42525#0#PHP" expanded="false" />
<element signature="e#42530#43009#0#PHP" expanded="false" />
<element signature="e#43015#43549#0#PHP" expanded="false" />
<element signature="e#43554#44939#0#PHP" expanded="false" />
<element signature="e#44945#45599#0#PHP" expanded="false" />
<element signature="e#45604#47619#0#PHP" expanded="false" />
<element signature="e#47625#48385#0#PHP" expanded="false" />
<element signature="e#48390#51099#0#PHP" expanded="false" />
<element signature="e#51125#51956#0#PHP" expanded="false" />
<element signature="e#51962#52382#0#PHP" expanded="false" />
<element signature="e#52387#52870#0#PHP" expanded="false" />
<element signature="e#52876#53682#0#PHP" expanded="false" />
<element signature="e#53687#56845#0#PHP" expanded="false" />
<element signature="e#55480#56839#0#PHP" expanded="false" />
<element signature="e#56860#58195#0#PHP" expanded="false" />
<element signature="e#56976#57378#0#PHP" expanded="false" />
<element signature="e#58211#59245#0#PHP" expanded="false" />
<element signature="e#59251#60009#0#PHP" expanded="false" />
<element signature="e#60014#63757#0#PHP" expanded="false" />
<element signature="e#63763#64155#0#PHP" expanded="false" />
<element signature="e#64160#65112#0#PHP" expanded="false" />
<element signature="e#65136#65709#0#PHP" expanded="false" />
<element signature="e#65715#66314#0#PHP" expanded="false" />
<element signature="e#66319#67246#0#PHP" expanded="false" />
<element signature="e#67252#67966#0#PHP" expanded="false" />
<element signature="e#67972#68399#0#PHP" expanded="false" />
<element signature="e#68404#68873#0#PHP" expanded="false" />
<element signature="e#68880#70085#0#PHP" expanded="false" />
<element signature="e#70090#71793#0#PHP" expanded="false" />
<element signature="e#71799#72576#0#PHP" expanded="false" />
<element signature="e#72581#76519#0#PHP" expanded="false" />
<element signature="e#76525#77034#0#PHP" expanded="false" />
<element signature="e#77039#77711#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -817,6 +817,7 @@ class User extends Api
* @ApiRoute (/api/user/search_key)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiHeaders (name=type, type=string, required=true, description="类型(视频1图片2)")
* @ApiParams (name="keyword", type=string, required=true, description="关键字")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
... ... @@ -840,45 +841,85 @@ class User extends Api
$page = $this->request->param('page',1,'intval');
$pageNum = $this->request->param('pageNum',10,'intval');
$keyword = $this->request->param('keyword');
if(empty($keyword)){
$type = $this->request->param('type');
if(empty($type) || empty($keyword)){
$this->error(['code'=>2,'msg'=>'缺少必要参数']);
}
//查出所有手动写入该关键词的素材ID
$hand_ids = Db::name('video')
->where('keyword','like',"%$keyword%")
->column('id');
//根据用户点选的关键词搜索对应的关键词表找出该关键词是否存在,如果存在找出ID,继续查素材含有该ID的素材ID
$words_id = Db::name('words')
->where('name',$keyword)
->find();
if(empty($words_id)){
$words_ids = [];
}else{
if($words_id['type'] == 1){
$address_id = ','.$words_id['id'].',';
$words_ids = Db::name('video')
->where('address_ids','like',"%$address_id%")
->column('id');
if($type == 1){
//查出所有手动写入该关键词的素材ID
$hand_ids = Db::name('video')
->where('keyword','like',"%$keyword%")
->column('id');
//根据用户点选的关键词搜索对应的关键词表找出该关键词是否存在,如果存在找出ID,继续查素材含有该ID的素材ID
$words_id = Db::name('words')
->where('name',$keyword)
->find();
if(empty($words_id)){
$words_ids = [];
}else{
if($words_id['type'] == 1){
$address_id = ','.$words_id['id'].',';
$words_ids = Db::name('video')
->where('address_ids','like',"%$address_id%")
->column('id');
}
if($words_id['type'] == 2){
$text_id = ','.$words_id['id'].',';
$words_ids = Db::name('video')
->where('text_ids','like',"%$text_id%")
->column('id');
}
}
if($words_id['type'] == 2){
$text_id = ','.$words_id['id'].',';
$words_ids = Db::name('video')
->where('text_ids','like',"%$text_id%")
->column('id');
//合并所有查出的数组ID
$public_ids = array_merge($hand_ids,$words_ids);
$data = Db::name('video')
->whereIn('id',$public_ids)
->field('id,title,thumbnail')
->page($page,$pageNum)
->select();
foreach ($data as &$v){
$v['thumbnail'] = $rule.$v['thumbnail'];
}
$this->success('SUCCESS',$data);
}elseif ($type == 2){
//查出所有手动写入该关键词的素材ID
$hand_ids = Db::name('pic')
->where('keyword','like',"%$keyword%")
->column('id');
//根据用户点选的关键词搜索对应的关键词表找出该关键词是否存在,如果存在找出ID,继续查素材含有该ID的素材ID
$words_id = Db::name('words')
->where('name',$keyword)
->find();
if(empty($words_id)){
$words_ids = [];
}else{
if($words_id['type'] == 1){
$address_id = ','.$words_id['id'].',';
$words_ids = Db::name('pic')
->where('address_ids','like',"%$address_id%")
->column('id');
}
if($words_id['type'] == 2){
$text_id = ','.$words_id['id'].',';
$words_ids = Db::name('pic')
->where('text_ids','like',"%$text_id%")
->column('id');
}
}
//合并所有查出的数组ID
$public_ids = array_merge($hand_ids,$words_ids);
$data = Db::name('pic')
->whereIn('id',$public_ids)
->field('id,title,thumbnail')
->page($page,$pageNum)
->select();
foreach ($data as &$v){
$v['thumbnail'] = $rule.$v['thumbnail'];
}
$this->success('SUCCESS',$data);
}else{
$this->error('参数错误');
}
//合并所有查出的数组ID
$public_ids = array_merge($hand_ids,$words_ids);
$data = Db::name('video')
->whereIn('id',$public_ids)
->field('id,title,thumbnail')
->page($page,$pageNum)
->select();
foreach ($data as &$v){
$v['thumbnail'] = $rule.$v['thumbnail'];
}
$this->success('SUCCESS',$data);
}
/**
... ...
... ... @@ -6828,6 +6828,12 @@
<td></td>
<td>请求的Token</td>
</tr>
<tr>
<td>type</td>
<td>string</td>
<td></td>
<td>类型(视频1图片2</td>
</tr>
</tbody>
</table>
</div>
... ... @@ -6885,6 +6891,10 @@
<label class="control-label" for="token">token</label>
<input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
</div>
<div class="form-group">
<label class="control-label" for="type">type</label>
<input type="string" class="form-control input-sm" id="type" required placeholder="类型(视频1图片2 - Ex: " name="type">
</div>
</div>
</div>
</div>
... ... @@ -7530,7 +7540,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-03-11 14:34:55 </div>
Generated on 2020-03-11 15:08:02 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...