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

修改订阅,微信扫码

... ... @@ -117,7 +117,7 @@ class Create extends Api
public function publish_pic()
{
$user_id = $this->auth->id;
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find();
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find();
//判断用户身份是否审核通过
if($user['audit'] != 1){
$this->error('身份身份通过才可发布!');
... ... @@ -162,16 +162,16 @@ class Create extends Api
//查询谁订阅了我
$subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id');
//添加到订阅了我的粉丝 转存记录里
$info['savemes_id'] = $data;
$info['folder_id'] = 0;
$info['is_up'] = 1;
$info['is_open'] = 1;
//添加到订阅了我的粉丝 消息通知里
$info['title'] = '消息通知';
$info['content'] = '您订阅的'.$user['username'].'用户新发布了内容';
$info['is_read'] = 0;
$info['type'] = 1;
$info['createtime'] = time();
$info['updatetime'] = time();
foreach ($subscribe as $v){
$info['user_id'] = $v;
Db::name('rotor')->insertGetId($info);
Db::name('message')->insertGetId($info);
}
$this->success('发布图片成功');
... ... @@ -200,7 +200,7 @@ class Create extends Api
public function publish_video()
{
$user_id = $this->auth->id;
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find();
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find();
//判断用户身份是否审核通过
if($user['audit'] != 1){
$this->error('身份身份通过才可发布!');
... ... @@ -239,16 +239,16 @@ class Create extends Api
//查询谁订阅了我
$subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id');
//添加到订阅了我的粉丝 转存记录里
$info['savemes_id'] = $data;
$info['folder_id'] = 0;
$info['is_up'] = 1;
$info['is_open'] = 1;
//添加到订阅了我的粉丝 消息通知里
$info['title'] = '消息通知';
$info['content'] = '您订阅的'.$user['username'].'用户新发布了内容';
$info['is_read'] = 0;
$info['type'] = 1;
$info['createtime'] = time();
$info['updatetime'] = time();
foreach ($subscribe as $v){
$info['user_id'] = $v;
Db::name('rotor')->insertGetId($info);
Db::name('message')->insertGetId($info);
}
... ... @@ -278,7 +278,7 @@ class Create extends Api
public function publish_note()
{
$user_id = $this->auth->id;
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit')->find();
$user = Db::name('user')->where('id',$user_id)->field('id,identity,audit,username')->find();
//判断用户身份是否审核通过
if($user['audit'] != 1){
$this->error('身份身份通过才可发布!');
... ... @@ -317,16 +317,16 @@ class Create extends Api
//查询谁订阅了我
$subscribe = Db::name('subscribe')->where('to_user_id',$user_id)->column('user_id');
//添加到订阅了我的粉丝 转存记录里
$info['savemes_id'] = $data;
$info['folder_id'] = 0;
$info['is_up'] = 1;
$info['is_open'] = 1;
//添加到订阅了我的粉丝 消息通知里
$info['title'] = '消息通知';
$info['content'] = '您订阅的'.$user['username'].'用户新发布了内容';
$info['is_read'] = 0;
$info['type'] = 1;
$info['createtime'] = time();
$info['updatetime'] = time();
foreach ($subscribe as $v){
$info['user_id'] = $v;
Db::name('rotor')->insertGetId($info);
Db::name('message')->insertGetId($info);
}
$this->success('发布笔记成功');
... ... @@ -395,11 +395,12 @@ class Create extends Api
Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$user_id]);
}else{
$whiteip_ids = explode(',',$user['whiteip_ids']);
array_push( $whiteip_ids,$user_id);
$whiteip = implode(',',$whiteip_ids);
Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$whiteip]);
if(!in_array($user_id,$whiteip_ids)){
array_push( $whiteip_ids,$user_id);
$whiteip = implode(',',$whiteip_ids);
Db::name('user')->where('id',$data['user_id'])->update(['whiteip_ids'=>$whiteip]);
}
}
$this->success('密码正确');
}
}
... ... @@ -1464,6 +1465,52 @@ class Create extends Api
$this->success('success',$data);
}
/**
* @ApiTitle (微信扫码分享二维码)
* @ApiSummary (微信扫码分享二维码)
* @ApiMethod (POST)
* @ApiRoute (/api/create/wx_share)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="id", type="inter", required=true, description="文件id")
* @ApiParams (name="folder_id", type="inter", required=true, description="文件夹id")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id"://id
"thumbnail"://二维码
}
})
*/
public function wx_share()
{
$user_id = $this->auth->id;
$id = $this->request->param('id'); //文件id
$folder_id = $this->request->param('folder_id'); //文件夹id
if(empty($id) && empty($folder_id)){
$this->error('缺少必要参数');
}
if(!empty($id)){
$info = Db::name('savemes')->where('id',$id)->field('id,type,share_url')->find();
//生成二维码
$page = $info['share_url'];
$data['thumbnail'] = $this->qrcode($page,$user_id);
}
if(!empty($folder_id)){
$info = Db::name('folder')->where('id',$id)->field('id,type,share_url')->find();
//生成二维码
$page = $info['share_url'];
$data['thumbnail'] = $this->qrcode($page,$user_id);
}
$this->success('success',$data);
}
/**
* @ApiTitle (批量转存/转存)
... ...
此 diff 太大无法显示。