123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace app\models\user;
- use app\models\article\Article;
- use crmeb\services\SystemConfigService;
- use app\models\user\InterestUser as InterestUser;
- use think\facade\Session;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- use crmeb\traits\JwtAuthModelTrait;
- use think\Model;
- class EnterpriseUser extends BaseModel
- {
- protected $name = 'enterprise_user';
- protected $pk = 'uid';
- // 认证
- public function auth($val){
-
- }
-
- public function inserts($data,$user){
- if($user){
- $headimg=$user['avatar'];
- $data=[
- 'uid' =>$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;
-
- }
-
- }
|