belongsTo('User','uid','id',[],'LEFT'); } /** * 申请我的 */ public function applyme(){ return $this->belongsTo('User','nid','id',[],"LEFT")/*->field('id,id_authentication,avatar,username,avatar')*/; } /** * 被申请信息 */ public function Nuser(){ return $this->belongsTo('User','nid','id',[],"LEFT")->field('id,id_authentication,avatar,username,avatar,wx'); } public static function n_read($arr){ foreach ($arr as $v){ Apply::update(['n_is_read'=>1],['id'=>$v['id']]); } } public static function u_read($arr){ foreach ($arr as $v){ Apply::update(['u_is_read'=>1],['id'=>$v['id']]); } } /** * 微信服务号通知 */ public static function wxMessage($id,$time){ $user_name = User::get(['id'=>$id]); $data = [ 'keyword1'=>[ 'value'=>$user_name['username'] ], 'keyword2'=>[ 'value'=>$time ], ]; (new \app\api\controller\Common())->sendWechatMessage($user_name['open_id'],'SDrPJvTOgm03PnQHibVlguD3lra3nK9pknojcMjSXq8',$data,'https://'.$_SERVER['HTTP_HOST'].'/h5/#/pages/xiaoxi/shenqing-me'); } /** * 微信模板消息通知(访客到访) */ public static function wxVisitorMessage($user_name,$time,$nid){ $user_info = User::get(['id'=>$nid]); $data = [ 'thing1'=>[ 'value'=>$user_name ], 'time3'=>[ 'value'=>$time ], ]; (new \app\api\controller\Common())->sendWechatMessage($user_info['open_id'],'KOWDFd4MsuxROCPCLNZF5k5LHzM_-o-WoEI2NpfQYx0',$data,'https://'.$_SERVER['HTTP_HOST'].'/h5/#/pages/xiaoxi/look-me'); } }