| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | <?phpnamespace App\Modules\WechatMaterial\Models;use Illuminate\Database\Eloquent\Model;class WechatMaterialSendMsg extends Model{    protected $table = 'wechat_material_send_msgs';    protected $connection = 'api_mysql';    protected $fillable = ['batch_id', 'distribution_channel_id', 'appid', 'name', 'wechat_material_id', 'wechat_media_id',        'status', 'send_user_num', 'receive_user_num', 'first_day_material_uv', 'first_day_url_uv', 'del_flag', 'upload_result',        'created_at', 'updated_at'];    public static function get_zs_wechat_batch_distribution_infos($batch_id)    {        return self::where('batch_id', $batch_id)->select('batch_id', 'distribution_channel_id', 'appid')->get();    }    public static function get_infos_by_batch_id($batch_id,$columns=[])    {        if(!isset($columns))        {            $columns ='*';        }        return self::where('batch_id', $batch_id)->select($columns)->get();    }    /**     * 根据状态获取客服消息     */    public static function wechatCustomMsgsByStatus($status)    {        return self::where(['status' => $status, 'del_flag' => 0])->get();    }    public static function getMsgByAppBatchChannelId($appId, $batchId, $channelId)    {        $where  = ['appid' => $appId, 'batch_id' => $batchId, 'distribution_channel_id' => $channelId];        $result = self::where($where)->first();        return $result ? $result->toArray() : [];    }    /**     *     * @return mixed     */    public static function getUnCollectedList()    {        $result = self::whereNull('first_day_material_uv')->get();        return $result;    }}
 |