OfficialCustomMsg.php 713 B

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