OfficialCustomMsg.php 672 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Modules\OfficialAccount\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class OfficialCustomMsg extends Model
  5. {
  6. protected $table = 'official_custom_msg';
  7. protected $fillable = ['title','description','url','image','text','channelname'];
  8. /**
  9. * 根据text获取客服消息
  10. */
  11. static function officialCustomMsgByText($text)
  12. {
  13. return self::where('text',$text)->first();
  14. }
  15. /**
  16. * 根据channelname和text获取神书
  17. */
  18. static function customerMsgByChannelAndText($channelname,$text)
  19. {
  20. return self::where(['channelname'=>$channelname,'text'=>$text])->get();
  21. }
  22. }