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

'1-4'

@@ -16,7 +16,7 @@ use think\Request; @@ -16,7 +16,7 @@ use think\Request;
16 */ 16 */
17 class Article extends BaseApi 17 class Article extends BaseApi
18 { 18 {
19 - protected $noNeedLogin = ''; 19 + protected $noNeedLogin = ['setWechatNotify'];
20 protected $noNeedRight = '*'; 20 protected $noNeedRight = '*';
21 21
22 /** 22 /**
@@ -699,7 +699,7 @@ class Article extends BaseApi @@ -699,7 +699,7 @@ class Article extends BaseApi
699 /** 699 /**
700 * 支付礼物回调 700 * 支付礼物回调
701 * @ApiMethod (POST) 701 * @ApiMethod (POST)
702 - * @ApiRoute (/api/article/setWechatGiftNotify) 702 + * @ApiRoute (/api/article/setWechatNotify)
703 * @ApiReturn () 703 * @ApiReturn ()
704 */ 704 */
705 public function setWechatNotify(){ 705 public function setWechatNotify(){
@@ -208,8 +208,8 @@ class Treasured extends BaseApi @@ -208,8 +208,8 @@ class Treasured extends BaseApi
208 } 208 }
209 209
210 /** 210 /**
211 - * 墨宝档案列表  
212 - * @ApiTitle (墨宝档案列表) 211 + * 墨宝档案筛选
  212 + * @ApiTitle (墨宝档案筛选)
213 * @ApiMethod (POST) 213 * @ApiMethod (POST)
214 * @ApiRoute (/api/treasured/getTreasuredShai) 214 * @ApiRoute (/api/treasured/getTreasuredShai)
215 * @ApiParams (name="page", type="integer", required=true, description="分页次数") 215 * @ApiParams (name="page", type="integer", required=true, description="分页次数")
@@ -217,8 +217,10 @@ class Treasured extends BaseApi @@ -217,8 +217,10 @@ class Treasured extends BaseApi
217 * @ApiParams (name="author", type="string", required=false, description="作者名称") 217 * @ApiParams (name="author", type="string", required=false, description="作者名称")
218 * @ApiParams (name="start_time", type="integer", required=false, description="开始时间") 218 * @ApiParams (name="start_time", type="integer", required=false, description="开始时间")
219 * @ApiParams (name="end_time", type="integer", required=false, description="结束时间") 219 * @ApiParams (name="end_time", type="integer", required=false, description="结束时间")
220 - * @ApiParams (name="author", type="string", required=true, description="作者名称")  
221 - * @ApiParams (name="author", type="string", required=true, description="作者名称") 220 + * @ApiParams (name="production_format_id", type="integer", required=false, description="格式ID")
  221 + * @ApiParams (name="production_typeface_id", type="integer", required=false, description="字体ID")
  222 + * @ApiParams (name="treasured_size_id", type="integer", required=false, description="尺寸ID")
  223 + * @ApiParams (name="status", type="integer", required=false, description="状态:0=待出售,1=已出售,2=非卖品")
222 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 224 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
223 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 225 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
224 * @ApiReturnParams (name="data", type="object", description="扩展数据返回") 226 * @ApiReturnParams (name="data", type="object", description="扩展数据返回")
@@ -230,21 +232,90 @@ class Treasured extends BaseApi @@ -230,21 +232,90 @@ class Treasured extends BaseApi
230 ['page','分页次数不能为空'], 232 ['page','分页次数不能为空'],
231 ['num','分页数量不能为空'] 233 ['num','分页数量不能为空']
232 ]); 234 ]);
  235 + $res = input('param.');
233 //2.查询数据 236 //2.查询数据
234 - $treasured = model('treasured')  
235 - ->where('deletetime',null)  
236 - ->order('createtime','desc')  
237 - ->page($data['page'],$data['num'])  
238 - ->select();  
239 - //3.记录浏览记录  
240 - if ($treasured && $data['page'] == 1){  
241 - model('config')->where('name','mobao_num')->setInc('value'); 237 + $treasured = model('treasured');
  238 + if (isset($res['author']) && !empty($res['author'])){
  239 + $treasured = $treasured->where('author',$res['author']);
  240 + }
  241 + if (isset($res['start_time']) && !empty($res['start_time']) && isset($res['end_time']) && !empty($res['end_time'])){
  242 + $treasured = $treasured->where('createtime','>',$res['start_time'])->where('createtime','<',$res['end_time']);
242 } 243 }
  244 + if (isset($res['production_format_id']) && !empty($res['production_format_id'])){
  245 + $treasured = $treasured->where('production_format_id',$res['production_format_id']);
  246 + }
  247 + if (isset($res['production_typeface_id']) && !empty($res['production_typeface_id'])){
  248 + $treasured = $treasured->where('production_typeface_id',$res['production_typeface_id']);
  249 + }
  250 + if (isset($res['treasured_size_id']) && !empty($res['treasured_size_id'])){
  251 + $treasured = $treasured->where('treasured_size_id',$res['treasured_size_id']);
  252 + }
  253 + if (isset($res['status']) && $res['status'] != ''){
  254 + $treasured = $treasured->where('status',$res['status']);
  255 + }
  256 + $treasured = $treasured->page($data['page'],$data['num'])
  257 + ->select();
243 //4.返回数据 258 //4.返回数据
244 $this->success('查询数据成功',$treasured); 259 $this->success('查询数据成功',$treasured);
245 } 260 }
246 261
  262 + /**
  263 + * 墨宝档案详情
  264 + * @ApiTitle (墨宝档案详情)
  265 + * @ApiMethod (POST)
  266 + * @ApiRoute (/api/treasured/getTreasuredContent)
  267 + * @ApiParams (name="id", type="integer", required=true, description="墨宝ID")
  268 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  269 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  270 + * @ApiReturnParams (name="data", type="object", description="扩展数据返回")
  271 + * @ApiReturn ()
  272 + */
  273 + public function getTreasuredContent(){
  274 + //1.获取动态id
  275 + $id = $this->get_data('id','墨宝档案ID不能为空');
  276 + //2.查询数据
  277 + $treasured = model('treasured')->where('id',$id)->find();
  278 + //
  279 + //4.返回数据
  280 + $this->success('查询数据成功',$treasured);
  281 + }
247 282
248 283
  284 + /**
  285 + * 动态点赞或取消点赞{注意}
  286 + * @ApiTitle (动态点赞或取消点赞{注意})
  287 + * @ApiMethod (POST)
  288 + * @ApiRoute (/api/treasured/setTreasuredZan)
  289 + * @ApiParams (name="treasured_id", type="integer", required=true, description="动态内容")
  290 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  291 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  292 + * @ApiReturnParams (name="data", type="object", description="扩展数据返回")
  293 + * @ApiReturn ({
  294 + "code": 1,
  295 + "msg": "查询成功",
  296 + "time": "1608886856",
  297 + "data": {
  298 + "code": "0取消点赞 1=点赞成功",
  299 + "msg": "提示"
  300 + }
  301 + })
  302 + */
  303 + public function setTreasuredZan(){
  304 + //1.获取数据
  305 + $treasured_id = $this->get_data('treasured_id','动态id不能为空');
  306 + //2.查询点赞
  307 + $treasured_zan = model('treasured_zan')
  308 + ->where('user_id',$this->auth->id)
  309 + ->where('treasured_id',$treasured_id)
  310 + ->find();
  311 + if ($treasured_zan){
  312 + $treasured_zan->delete();
  313 + $this->success('查询成功',['code'=>0,'msg'=>'取消点赞成功']);
  314 + }
  315 + //3.增加点赞
  316 + model('treasured_zan')->create(['user_id'=>$this->auth->id,'treasured_id'=>$treasured_id]);
  317 + //4.返回结果
  318 + $this->success('查询成功',['code'=>1,'msg'=>'点赞成功']);
  319 + }
249 320
250 } 321 }
  1 +<?php
  2 +
  3 +
  4 +namespace app\common\model;
  5 +
  6 +
  7 +class TreasuredZan extends BaseModel
  8 +{
  9 +
  10 +}
此 diff 太大无法显示。