正在显示
4 个修改的文件
包含
52 行增加
和
5 行删除
@@ -114,7 +114,6 @@ class Production extends BaseApi | @@ -114,7 +114,6 @@ class Production extends BaseApi | ||
114 | $data['user_id'] = $this->auth->id; | 114 | $data['user_id'] = $this->auth->id; |
115 | $data['avatar'] = $this->auth->avatar; | 115 | $data['avatar'] = $this->auth->avatar; |
116 | $data['nickname'] = $this->auth->nickname; | 116 | $data['nickname'] = $this->auth->nickname; |
117 | - $data['images'] = $data['images']; | ||
118 | //5.增加作品 | 117 | //5.增加作品 |
119 | $production = model('production')->create($data); | 118 | $production = model('production')->create($data); |
120 | //6.查询数据 | 119 | //6.查询数据 |
@@ -26,6 +26,7 @@ class User extends BaseApi | @@ -26,6 +26,7 @@ class User extends BaseApi | ||
26 | * @ApiTitle (会员中心) | 26 | * @ApiTitle (会员中心) |
27 | * @ApiMethod (POST) | 27 | * @ApiMethod (POST) |
28 | * @ApiRoute (/api/user/index) | 28 | * @ApiRoute (/api/user/index) |
29 | + * @ApiParams (name="user_id", type="integer", required=true, description="用户id") | ||
29 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 30 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
30 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 31 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
31 | * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | 32 | * @ApiReturnParams (name="data", type="object", description="扩展数据返回") |
@@ -61,8 +62,18 @@ class User extends BaseApi | @@ -61,8 +62,18 @@ class User extends BaseApi | ||
61 | */ | 62 | */ |
62 | public function index() | 63 | public function index() |
63 | { | 64 | { |
65 | + //获取用户id | ||
66 | + $user_id = $this->get_data('user_id','用户id不能为空'); | ||
67 | + //更新用户的查看浏览量 | ||
64 | //获取用户信息 | 68 | //获取用户信息 |
65 | - $user = model('user')->where('id',$this->auth->id)->find(); | 69 | + $user = model('user')->where('id',$user_id)->find(); |
70 | + //查看数量 | ||
71 | + if (!$user){ | ||
72 | + $this->error('该用户不存在'); | ||
73 | + } | ||
74 | + //判断用户 | ||
75 | + $user->show_num += 1; | ||
76 | + $user->save(); | ||
66 | $this->success('查询用户信息成功', $user); | 77 | $this->success('查询用户信息成功', $user); |
67 | } | 78 | } |
68 | 79 |
@@ -7,6 +7,11 @@ namespace app\common\model; | @@ -7,6 +7,11 @@ namespace app\common\model; | ||
7 | class Production extends BaseModel | 7 | class Production extends BaseModel |
8 | { | 8 | { |
9 | 9 | ||
10 | + | ||
11 | + // 追加属性 | ||
12 | + protected $append = [ | ||
13 | + 'one_image' | ||
14 | + ]; | ||
10 | /** | 15 | /** |
11 | * 关联用户表 | 16 | * 关联用户表 |
12 | */ | 17 | */ |
@@ -14,4 +19,17 @@ class Production extends BaseModel | @@ -14,4 +19,17 @@ class Production extends BaseModel | ||
14 | return $this->belongsTo('user','user_id','id'); | 19 | return $this->belongsTo('user','user_id','id'); |
15 | } | 20 | } |
16 | 21 | ||
22 | + public function getOneImageAttr($value,$data) | ||
23 | + { | ||
24 | + $arr = explode(',',$data['images']); | ||
25 | + foreach ($arr as $key => $val){ | ||
26 | + $arr[$key] = cdnurl($val); | ||
27 | + } | ||
28 | + if (empty($arr)){ | ||
29 | + return ''; | ||
30 | + } | ||
31 | + return $arr[0]; | ||
32 | + } | ||
33 | + | ||
34 | + | ||
17 | } | 35 | } |
@@ -10278,7 +10278,24 @@ | @@ -10278,7 +10278,24 @@ | ||
10278 | <div class="panel panel-default"> | 10278 | <div class="panel panel-default"> |
10279 | <div class="panel-heading"><strong>参数</strong></div> | 10279 | <div class="panel-heading"><strong>参数</strong></div> |
10280 | <div class="panel-body"> | 10280 | <div class="panel-body"> |
10281 | - 无 | 10281 | + <table class="table table-hover"> |
10282 | + <thead> | ||
10283 | + <tr> | ||
10284 | + <th>名称</th> | ||
10285 | + <th>类型</th> | ||
10286 | + <th>必选</th> | ||
10287 | + <th>描述</th> | ||
10288 | + </tr> | ||
10289 | + </thead> | ||
10290 | + <tbody> | ||
10291 | + <tr> | ||
10292 | + <td>user_id</td> | ||
10293 | + <td>integer</td> | ||
10294 | + <td>是</td> | ||
10295 | + <td>用户id</td> | ||
10296 | + </tr> | ||
10297 | + </tbody> | ||
10298 | + </table> | ||
10282 | </div> | 10299 | </div> |
10283 | </div> | 10300 | </div> |
10284 | <div class="panel panel-default"> | 10301 | <div class="panel panel-default"> |
@@ -10296,7 +10313,8 @@ | @@ -10296,7 +10313,8 @@ | ||
10296 | <div class="panel-body"> | 10313 | <div class="panel-body"> |
10297 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/index" method="POST" name="form66" id="form66"> | 10314 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/index" method="POST" name="form66" id="form66"> |
10298 | <div class="form-group"> | 10315 | <div class="form-group"> |
10299 | - 无 | 10316 | + <label class="control-label" for="user_id">user_id</label> |
10317 | + <input type="integer" class="form-control input-sm" id="user_id" required placeholder="用户id" name="user_id"> | ||
10300 | </div> | 10318 | </div> |
10301 | <div class="form-group"> | 10319 | <div class="form-group"> |
10302 | <button type="submit" class="btn btn-success send" rel="66">提交</button> | 10320 | <button type="submit" class="btn btn-success send" rel="66">提交</button> |
@@ -10377,6 +10395,7 @@ | @@ -10377,6 +10395,7 @@ | ||
10377 | "brief": "个人简介", | 10395 | "brief": "个人简介", |
10378 | "show_array":"显示字段", | 10396 | "show_array":"显示字段", |
10379 | "is_ok_arr":"获取可以显示隐藏的字段", | 10397 | "is_ok_arr":"获取可以显示隐藏的字段", |
10398 | + "is_expert":"是否是专家:0=不是,1=是", | ||
10380 | "createtime": 0, | 10399 | "createtime": 0, |
10381 | "updatetime": 1608086439, | 10400 | "updatetime": 1608086439, |
10382 | "url": "/u/1" | 10401 | "url": "/u/1" |
@@ -13316,7 +13335,7 @@ | @@ -13316,7 +13335,7 @@ | ||
13316 | 13335 | ||
13317 | <div class="row mt0 footer"> | 13336 | <div class="row mt0 footer"> |
13318 | <div class="col-md-6" align="left"> | 13337 | <div class="col-md-6" align="left"> |
13319 | - Generated on 2021-01-06 15:30:48 </div> | 13338 | + Generated on 2021-01-06 17:19:50 </div> |
13320 | <div class="col-md-6" align="right"> | 13339 | <div class="col-md-6" align="right"> |
13321 | <a href="./" target="_blank">书法公众号</a> | 13340 | <a href="./" target="_blank">书法公众号</a> |
13322 | </div> | 13341 | </div> |
-
请 注册 或 登录 后发表评论