12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Models\Media;
- use App\Models\Model;
- abstract class MediaSecure extends Model
- {
- //
- // 机器审核通过
- public const MACHINE_SUGGESTION_PASS = 1;
- // 机器审核待定
- public const MACHINE_SUGGESTION_REVIEW = 0;
- // 机器审核不通过
- public const MACHINE_SUGGESTION_BLOCK = -1;
- // 人工审核通过
- public const MANUAL_SUGGESTION_PASS = 1;
- // 人工审核待定
- public const MANUAL_SUGGESTION_REVIEW = 0;
- // 人工审核不通过
- public const MANUAL_SUGGESTION_BLOCK = -1;
- // 机器审核
- public const CHANNEL_MACHINE = 1;
- // 人工审核
- public const CHANNEL_MANUAL = 2;
- protected $dateFormat = 'U';
- protected $casts = array(
- 'machine_result' => 'array',
- 'labels' => 'array',
- );
- /**
- * 字段筛选
- * @param \Illuminate\Database\Eloquent\Builder $builder
- * @param $field
- * @return \Illuminate\Database\Eloquent\Builder
- */
- public function scopeOfField($builder, $field)
- {
- switch ($field) {
- // 图片
- case "avatar":
- $builder->where('field', 'headimgurl');
- break;
- case "photo":
- $builder->whereIn('field', ['photo_src', 'photo_1', 'photo_2', 'photo_3', 'photo_4']);
- break;
- // 文字
- case "nickname":
- $builder->where('field', 'nickname');
- break;
- case "question":
- $builder->where('field', 'question');
- break;
- case "invite_answer":
- $builder->where('field', 'invite_answer');
- break;
- case "introduce":
- $builder->where('field', 'introduce');
- break;
- // 语音
- case "voice":
- $builder->where('field', 'voice');
- break;
- case "invite_voice":
- $builder->where('field', 'invite_voice');
- break;
- case "invite_sing":
- $builder->where('field', 'invite_sing');
- break;
- }
- return $builder;
- }
- }
|