$user['uid'], 'name' =>$data['name'], 'type' =>$data['type'], 'contacts' =>$data['contacts'], 'post' =>$data['post'], 'phone' =>$data['phone'], 'password' =>md5($data['password']), 'user' =>$data['phone'], 'is_auth' =>1, 'headimg'=>$headimg, 'reason'=>"审核中", ]; // 先查询是否已存在改用户绑定的公司 $slct=self::where('uid',$user['uid'])->find(); if($slct&&$slct['is_auth']!=0) return $ruls=1; if($slct['is_auth']==0){ $res=self::where('uid',$user['uid'])->update($data); if($res){ return $ruls=2; } } if(!$slct){ $res=self::insert($data); if($res){ return $ruls=2; } } } } // 根据文章id查找到订阅号信息 public static function getInfo($id,$uid){ $list=self::where('id', $id)->field('id,name,sub,headimg')->find(); // 获取文章数 // 查询该用户是否已订阅该媒体 $is_sub=InterestUser::where('uid',$uid)->where('mer_id',$list['id'])->count(); $list=empty($list) ?[]:$list->toArray(); $essay=Article::where('mer_id',$id)->count(); $list['count'] = $essay; $list['is_sub'] = $is_sub; return $list; } }