|
@@ -4,26 +4,26 @@
|
|
|
namespace App\Modules\Push\Models;
|
|
|
|
|
|
|
|
|
+use App\Consts\PushConst;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
class QappPushTask extends Model
|
|
|
{
|
|
|
protected $table = 'qapp_push_task';
|
|
|
protected $fillable = ['uid', 'package_id', 'type', 'title', 'content', 'url', 'num',
|
|
|
- 'status', 'providers', 'push_time', 'push_filter', 'push_result'];
|
|
|
+ 'status', 'providers', 'push_time', 'push_filter', 'push_result', 'select_user_status'];
|
|
|
|
|
|
/**
|
|
|
* @param $id
|
|
|
* @return array
|
|
|
*/
|
|
|
- public static function getPushTaskById($id): array
|
|
|
+ public static function getPushTaskById($id)
|
|
|
{
|
|
|
if (empty($id)) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
- $result = self::where('id', $id)->first();
|
|
|
- return $result ? $result->toArray() : [];
|
|
|
+ return self::where('id', $id)->first();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -39,4 +39,15 @@ class QappPushTask extends Model
|
|
|
|
|
|
return self::where('id', $id)->update($data);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public static function getValidTask()
|
|
|
+ {
|
|
|
+ return self::where('status', PushConst::PUSH_STATUS_TODO)
|
|
|
+ ->where('select_user_status', PushConst::SELECT_USER_OK)
|
|
|
+ ->orderBy('push_time', 'ASC')
|
|
|
+ ->first();
|
|
|
+ }
|
|
|
}
|