|
@@ -97,43 +97,46 @@ class NewUserPushMsg implements ShouldQueue
|
|
|
{
|
|
|
$result = true;
|
|
|
$conditions = json_decode($filter, true);
|
|
|
- foreach ($conditions as $key => $value) {
|
|
|
- $condition = $this->getCondition($key, $value);
|
|
|
- if ($result && $condition) {
|
|
|
- switch ($key) {
|
|
|
- case 'balance':
|
|
|
- $balance = $this->findUserBalance($uid);
|
|
|
- $result = $condition[0] ? $balance >= $condition[0] && ($condition[1] ? $balance <= $condition[1] : true) : true;
|
|
|
- break;
|
|
|
- case 'paid':
|
|
|
- switch ($value) {
|
|
|
- case 'unpaid':
|
|
|
- $result = !Order::where('uid', $uid)->where('status', 'PAID')->exists();
|
|
|
- break;
|
|
|
- case 'paid':
|
|
|
- $result = Order::where('uid', $uid)->where('status', 'PAID')->exists();
|
|
|
- break;
|
|
|
- case 'vip':
|
|
|
- $result = Order::where('uid', $uid)->where('status', 'PAID')->where('order_type', 'YEAR')->exists();
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'add_desktop':
|
|
|
- $result = ($value == QappUserAddDestop::where('uid', $uid)->where('status', 1)->exists());
|
|
|
- break;
|
|
|
+ if ($conditions) {
|
|
|
+ foreach ($conditions as $key => $value) {
|
|
|
+ $condition = $this->getCondition($key, $value);
|
|
|
+ if ($result && $condition) {
|
|
|
+ switch ($key) {
|
|
|
+ case 'balance':
|
|
|
+ $balance = $this->findUserBalance($uid);
|
|
|
+ $result = $condition[0] ? $balance >= $condition[0] && ($condition[1] ? $balance <= $condition[1] : true) : true;
|
|
|
+ break;
|
|
|
+ case 'paid':
|
|
|
+ switch ($value) {
|
|
|
+ case 'unpaid':
|
|
|
+ $result = !Order::where('uid', $uid)->where('status', 'PAID')->exists();
|
|
|
+ break;
|
|
|
+ case 'paid':
|
|
|
+ $result = Order::where('uid', $uid)->where('status', 'PAID')->exists();
|
|
|
+ break;
|
|
|
+ case 'vip':
|
|
|
+ $result = Order::where('uid', $uid)->where('status', 'PAID')->where('order_type', 'YEAR')->exists();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'add_desktop':
|
|
|
+ $result = ($value == QappUserAddDestop::where('uid', $uid)->where('status', 1)->exists());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ return $result;
|
|
|
}
|
|
|
- return $result;
|
|
|
}
|
|
|
|
|
|
private function getCondition($key, $value)
|
|
|
{
|
|
|
- foreach (self::condition[$key] as $item) {
|
|
|
- if ($item['value'] == $value) {
|
|
|
- return $item['condition'];
|
|
|
+ if (array_key_exists($key, self::condition))
|
|
|
+ foreach (self::condition[$key] as $item) {
|
|
|
+ if ($item['value'] == $value) {
|
|
|
+ return $item['condition'];
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
return '';
|
|
|
}
|
|
|
}
|