1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Modules\OfficialAccount\Models;
- use Illuminate\Database\Eloquent\Model;
- class OfficialAccountMsg extends Model
- {
- protected $connection = 'api_mysql';
- protected $table = 'official_account_msgs';
- //获取事件回复
- static function getEventMsg($params)
- {
- $appid = $params['appid'];
- $apply_event_key = $params['apply_event_key'];
- $apply_event = $params['apply_event'];
- $search = self::where('appid',$appid)->where('apply_event',$apply_event)->active();
- if($apply_event_key) $search->where('apply_event_key',$apply_event_key);
- return $search->first();
- }
- //有效
- public function scopeActive($query)
- {
- return $query->where('status', 1);
- }
- }
|