正在显示
2 个修改的文件
包含
72 行增加
和
25 行删除
@@ -117,7 +117,7 @@ class Create extends Api | @@ -117,7 +117,7 @@ class Create extends Api | ||
117 | public function publish_pic() | 117 | public function publish_pic() |
118 | { | 118 | { |
119 | $user_id = $this->auth->id; | 119 | $user_id = $this->auth->id; |
120 | - $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find(); | 120 | + $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find(); |
121 | //判断用户身份是否审核通过 | 121 | //判断用户身份是否审核通过 |
122 | if($user['audit'] != 1){ | 122 | if($user['audit'] != 1){ |
123 | $this->error('身份身份通过才可发布!'); | 123 | $this->error('身份身份通过才可发布!'); |
@@ -162,16 +162,16 @@ class Create extends Api | @@ -162,16 +162,16 @@ class Create extends Api | ||
162 | //查询谁订阅了我 | 162 | //查询谁订阅了我 |
163 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); | 163 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); |
164 | 164 | ||
165 | - //添加到订阅了我的粉丝 转存记录里 | ||
166 | - $info['savemes_id'] = $data; | ||
167 | - $info['folder_id'] = 0; | ||
168 | - $info['is_up'] = 1; | ||
169 | - $info['is_open'] = 1; | 165 | + //添加到订阅了我的粉丝 消息通知里 |
166 | + $info['title'] = '消息通知'; | ||
167 | + $info['content'] = '您订阅的'.$user['username'].'用户新发布了内容'; | ||
168 | + $info['is_read'] = 0; | ||
169 | + $info['type'] = 1; | ||
170 | $info['createtime'] = time(); | 170 | $info['createtime'] = time(); |
171 | $info['updatetime'] = time(); | 171 | $info['updatetime'] = time(); |
172 | foreach ($subscribe as $v){ | 172 | foreach ($subscribe as $v){ |
173 | $info['user_id'] = $v; | 173 | $info['user_id'] = $v; |
174 | - Db::name('rotor')->insertGetId($info); | 174 | + Db::name('message')->insertGetId($info); |
175 | } | 175 | } |
176 | 176 | ||
177 | $this->success('发布图片成功'); | 177 | $this->success('发布图片成功'); |
@@ -200,7 +200,7 @@ class Create extends Api | @@ -200,7 +200,7 @@ class Create extends Api | ||
200 | public function publish_video() | 200 | public function publish_video() |
201 | { | 201 | { |
202 | $user_id = $this->auth->id; | 202 | $user_id = $this->auth->id; |
203 | - $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find(); | 203 | + $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find(); |
204 | //判断用户身份是否审核通过 | 204 | //判断用户身份是否审核通过 |
205 | if($user['audit'] != 1){ | 205 | if($user['audit'] != 1){ |
206 | $this->error('身份身份通过才可发布!'); | 206 | $this->error('身份身份通过才可发布!'); |
@@ -239,16 +239,16 @@ class Create extends Api | @@ -239,16 +239,16 @@ class Create extends Api | ||
239 | //查询谁订阅了我 | 239 | //查询谁订阅了我 |
240 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); | 240 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); |
241 | 241 | ||
242 | - //添加到订阅了我的粉丝 转存记录里 | ||
243 | - $info['savemes_id'] = $data; | ||
244 | - $info['folder_id'] = 0; | ||
245 | - $info['is_up'] = 1; | ||
246 | - $info['is_open'] = 1; | 242 | + //添加到订阅了我的粉丝 消息通知里 |
243 | + $info['title'] = '消息通知'; | ||
244 | + $info['content'] = '您订阅的'.$user['username'].'用户新发布了内容'; | ||
245 | + $info['is_read'] = 0; | ||
246 | + $info['type'] = 1; | ||
247 | $info['createtime'] = time(); | 247 | $info['createtime'] = time(); |
248 | $info['updatetime'] = time(); | 248 | $info['updatetime'] = time(); |
249 | foreach ($subscribe as $v){ | 249 | foreach ($subscribe as $v){ |
250 | $info['user_id'] = $v; | 250 | $info['user_id'] = $v; |
251 | - Db::name('rotor')->insertGetId($info); | 251 | + Db::name('message')->insertGetId($info); |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
@@ -278,7 +278,7 @@ class Create extends Api | @@ -278,7 +278,7 @@ class Create extends Api | ||
278 | public function publish_note() | 278 | public function publish_note() |
279 | { | 279 | { |
280 | $user_id = $this->auth->id; | 280 | $user_id = $this->auth->id; |
281 | - $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find(); | 281 | + $user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find(); |
282 | //判断用户身份是否审核通过 | 282 | //判断用户身份是否审核通过 |
283 | if($user['audit'] != 1){ | 283 | if($user['audit'] != 1){ |
284 | $this->error('身份身份通过才可发布!'); | 284 | $this->error('身份身份通过才可发布!'); |
@@ -317,16 +317,16 @@ class Create extends Api | @@ -317,16 +317,16 @@ class Create extends Api | ||
317 | //查询谁订阅了我 | 317 | //查询谁订阅了我 |
318 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); | 318 | $subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id'); |
319 | 319 | ||
320 | - //添加到订阅了我的粉丝 转存记录里 | ||
321 | - $info['savemes_id'] = $data; | ||
322 | - $info['folder_id'] = 0; | ||
323 | - $info['is_up'] = 1; | ||
324 | - $info['is_open'] = 1; | 320 | + //添加到订阅了我的粉丝 消息通知里 |
321 | + $info['title'] = '消息通知'; | ||
322 | + $info['content'] = '您订阅的'.$user['username'].'用户新发布了内容'; | ||
323 | + $info['is_read'] = 0; | ||
324 | + $info['type'] = 1; | ||
325 | $info['createtime'] = time(); | 325 | $info['createtime'] = time(); |
326 | $info['updatetime'] = time(); | 326 | $info['updatetime'] = time(); |
327 | foreach ($subscribe as $v){ | 327 | foreach ($subscribe as $v){ |
328 | $info['user_id'] = $v; | 328 | $info['user_id'] = $v; |
329 | - Db::name('rotor')->insertGetId($info); | 329 | + Db::name('message')->insertGetId($info); |
330 | } | 330 | } |
331 | 331 | ||
332 | $this->success('发布笔记成功'); | 332 | $this->success('发布笔记成功'); |
@@ -395,11 +395,12 @@ class Create extends Api | @@ -395,11 +395,12 @@ class Create extends Api | ||
395 | Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$user_id]); | 395 | Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$user_id]); |
396 | }else{ | 396 | }else{ |
397 | $whiteip_ids = explode(',',$user['whiteip_ids']); | 397 | $whiteip_ids = explode(',',$user['whiteip_ids']); |
398 | - array_push( $whiteip_ids,$user_id); | ||
399 | - $whiteip = implode(',',$whiteip_ids); | ||
400 | - Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$whiteip]); | 398 | + if(!in_array($user_id,$whiteip_ids)){ |
399 | + array_push( $whiteip_ids,$user_id); | ||
400 | + $whiteip = implode(',',$whiteip_ids); | ||
401 | + Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$whiteip]); | ||
402 | + } | ||
401 | } | 403 | } |
402 | - | ||
403 | $this->success('密码正确'); | 404 | $this->success('密码正确'); |
404 | } | 405 | } |
405 | } | 406 | } |
@@ -1464,6 +1465,52 @@ class Create extends Api | @@ -1464,6 +1465,52 @@ class Create extends Api | ||
1464 | $this->success('success',$data); | 1465 | $this->success('success',$data); |
1465 | } | 1466 | } |
1466 | 1467 | ||
1468 | + /** | ||
1469 | + * @ApiTitle (微信扫码分享二维码) | ||
1470 | + * @ApiSummary (微信扫码分享二维码) | ||
1471 | + * @ApiMethod (POST) | ||
1472 | + * @ApiRoute (/api/create/wx_share) | ||
1473 | + * | ||
1474 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
1475 | + * @ApiParams (name="id", type="inter", required=true, description="文件id") | ||
1476 | + * @ApiParams (name="folder_id", type="inter", required=true, description="文件夹id") | ||
1477 | + * | ||
1478 | + * @ApiReturn({ | ||
1479 | + "code": 1, | ||
1480 | + "msg": "成功", | ||
1481 | + "time": "1571492001", | ||
1482 | + "data": { | ||
1483 | + "id"://id | ||
1484 | + "thumbnail"://二维码 | ||
1485 | + } | ||
1486 | + }) | ||
1487 | + */ | ||
1488 | + public function wx_share() | ||
1489 | + { | ||
1490 | + $user_id = $this->auth->id; | ||
1491 | + $id = $this->request->param('id'); //文件id | ||
1492 | + $folder_id = $this->request->param('folder_id'); //文件夹id | ||
1493 | + | ||
1494 | + if(empty($id) && empty($folder_id)){ | ||
1495 | + $this->error('缺少必要参数'); | ||
1496 | + } | ||
1497 | + | ||
1498 | + if(!empty($id)){ | ||
1499 | + $info = Db::name('savemes')->where('id',$id)->field('id,type,share_url')->find(); | ||
1500 | + //生成二维码 | ||
1501 | + $page = $info['share_url']; | ||
1502 | + $data['thumbnail'] = $this->qrcode($page,$user_id); | ||
1503 | + } | ||
1504 | + if(!empty($folder_id)){ | ||
1505 | + $info = Db::name('folder')->where('id',$id)->field('id,type,share_url')->find(); | ||
1506 | + //生成二维码 | ||
1507 | + $page = $info['share_url']; | ||
1508 | + $data['thumbnail'] = $this->qrcode($page,$user_id); | ||
1509 | + } | ||
1510 | + $this->success('success',$data); | ||
1511 | + } | ||
1512 | + | ||
1513 | + | ||
1467 | 1514 | ||
1468 | /** | 1515 | /** |
1469 | * @ApiTitle (批量转存/转存) | 1516 | * @ApiTitle (批量转存/转存) |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论