分类图标,是否点赞,小程序登录
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\model\MessageNotice;
|
||||
use app\common\model\Post;
|
||||
use app\common\validate\PostCommentValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\PostComment;
|
||||
@@ -102,4 +104,23 @@ class PostCommentService
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加后置处理
|
||||
*/
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$data = [];
|
||||
$data['post_id'] = $res['post_id'];
|
||||
$data['receiver_user_id'] = Post::where(['id' => $data['post_id']])->value('user_id');
|
||||
$data['sender_user_id'] = $res['user_id'];
|
||||
$data['comment_id'] = $res['id'];
|
||||
$data['type'] = 3;
|
||||
MessageNotice::create($data);
|
||||
$post = Post::where(['id' => $data['post_id']])->first();
|
||||
$post['comment'] = $post['comment']+1;
|
||||
$post->save();
|
||||
}
|
||||
}
|
||||
@@ -103,5 +103,8 @@ class PostFavoriteService
|
||||
$data['sender_user_id'] = $res['user_id'];
|
||||
$data['type'] = 2;
|
||||
MessageNotice::create($data);
|
||||
$post = Post::where(['id' => $data['post_id']])->first();
|
||||
$post['favorite'] = $post['favorite']+1;
|
||||
$post->save();
|
||||
}
|
||||
}
|
||||
@@ -105,5 +105,8 @@ class PostLikeService
|
||||
$data['sender_user_id'] = $res['user_id'];
|
||||
$data['type'] = 1;
|
||||
MessageNotice::create($data);
|
||||
$post = Post::where(['id' => $data['post_id']])->first();
|
||||
$post['like'] = $post['like']+1;
|
||||
$post->save();
|
||||
}
|
||||
}
|
||||
@@ -237,11 +237,12 @@ class UserService
|
||||
$logic = new UserLogic();
|
||||
$wechatService = new WechatService();
|
||||
$wxinfo = $wechatService->xcxOpenid($data['code']);
|
||||
var_dump($wxinfo);
|
||||
|
||||
// 用户信息
|
||||
$user = User::firstOrCreate(
|
||||
['openid' => $wxinfo['openid']],
|
||||
['nickname' => '微信用户_'.$wxinfo['openid'], 'avatar' => getenv('MAIN_DOMAIN').'/avatar.png']
|
||||
['nickname' => '微信用户_'.$wxinfo['openid'], 'name' => '', 'avatar' => getenv('MAIN_DOMAIN').'/avatar.png']
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user