BatchWechatMaterial.php 1.0 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Modules\WechatMaterial\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class BatchWechatMaterial extends Model
  5. {
  6. protected $table = 'batch_wechat_materials';
  7. protected $connection = 'api_mysql';
  8. protected $fillable = ['id','name', 'send_time', 'content', 'subscribe_time', 'balance','sex','pay_type','interaction_time',
  9. 'status','is_all_user','del_flag','created_at','','updated_at','channel_user_id','distribution_channel_id'];
  10. public static function get_zs_wechat_material_list($channel_user_id){
  11. return self::where('del_flag',0)->where('channel_user_id',$channel_user_id)->paginate();
  12. }
  13. public static function del_zs_wechat_material($batch_id,$channel_user_id){
  14. return self::where(['id'=>$batch_id,'channel_user_id'=>$channel_user_id])->update(['del_flag'=>1,'updated_at'=>date('Y-m-d H:i:s')]);
  15. }
  16. public static function get_zs_wechat_material($batch_id,$channel_user_id){
  17. return self::where(['id'=>$batch_id,'channel_user_id'=>$channel_user_id])->first();
  18. }
  19. }