<?php

namespace App\Modules\OfficialAccount\Models;

use Illuminate\Database\Eloquent\Model;
use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
use DB;

class ForceSubscribeUserProperty extends Model
{
    protected $tables = 'force_subscribe_user_properties';

    protected $fillable = [ 'appid', 'openid', 'current_nickname'];

    protected $connection = 'wangdu_user';

    /**
     * 根据openid和appid获取用户属性
     */
    static function getForceUsersNickname($openids)
    {
        return self::whereIn( 'openid' , $openids)->get()->pluck('current_nickname','openid');
    }

    static function getForceUsersNicknameByOpenid($openid){
        return  self::whereIn( 'openid' , $openid)->select('current_nickname')->first();
    }
}
