-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 14, 2026 at 11:40 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.3.32

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `mintgig_db`
--

-- --------------------------------------------------------

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admins`
--

INSERT INTO `admins` (`id`, `username`, `password`, `created_at`) VALUES
(1, 'admin', '$2y$10$3mOX9xF4rUW1wO6kS6QwPuRrUyryH8vghgwas/PpRPPPv2FwZN/Xa', '2026-07-28 12:04:42');

-- --------------------------------------------------------

--
-- Table structure for table `admin_notifications`
--

CREATE TABLE `admin_notifications` (
  `id` int(11) NOT NULL,
  `type` varchar(50) NOT NULL,
  `title` varchar(255) NOT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ads_orders`
--

CREATE TABLE `ads_orders` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `ad_id` int(11) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `ads_orders`
--
DELIMITER $$
CREATE TRIGGER `after_ads_order_approved` AFTER UPDATE ON `ads_orders` FOR EACH ROW BEGIN
    IF OLD.status != 'approved' AND NEW.status = 'approved' THEN
        UPDATE users 
        SET balance = balance + NEW.rate 
        WHERE id = NEW.user_id;
    END IF;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `facebook_orders`
--

CREATE TABLE `facebook_orders` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `uid_link` varchar(255) NOT NULL,
  `login_info` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `two_factor_key` varchar(255) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `facebook_orders`
--

INSERT INTO `facebook_orders` (`id`, `user_id`, `uid_link`, `login_info`, `password`, `two_factor_key`, `rate`, `status`, `created_at`) VALUES
(3, 3, '837482384782', 'amrname36@gmail.com', 'Mamama12', 'JKHDI IEFI  EIOFI EI EIF IEO84 HUT48T 8 EFKWJI3J', 5.00, 'approved', '2026-06-27 11:52:02'),
(4, 3, 'rafi017256@gmail.com', 'frgrgrereg', 'Mamama12', 'JKHDI IEFI  EIOFI EI EIF IEO84 HUT48T 8 EFKWJI3J', 5.00, 'approved', '2026-07-02 08:02:47'),
(5, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 5.00, 'approved', '2026-07-04 19:23:41'),
(6, 3, 'rafi017256@gmail.com', 'fefjehuwifwiu@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 5.00, 'approved', '2026-07-04 20:45:13'),
(7, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'approved', '2026-07-04 21:59:31'),
(8, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'rejected', '2026-07-04 22:59:11'),
(9, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'rejected', '2026-07-05 11:14:11'),
(10, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'rejected', '2026-07-05 11:14:29'),
(11, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'approved', '2026-07-05 11:14:59'),
(12, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'rejected', '2026-07-05 11:41:18'),
(13, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'approved', '2026-07-05 11:41:29'),
(14, 3, 'rafi017256@gmail.com', 'amrname36@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 5.00, 'rejected', '2026-07-05 11:45:21');

--
-- Triggers `facebook_orders`
--
DELIMITER $$
CREATE TRIGGER `after_fb_order_approved` AFTER UPDATE ON `facebook_orders` FOR EACH ROW BEGIN
    -- যদি আগের স্ট্যাটাস 'approved' না থাকে এবং নতুন স্ট্যাটাস 'approved' করা হয়
    -- (এটি ডাবল পেমেন্ট ক্রেডিট হওয়া সম্পূর্ণ রোধ করবে)
    IF OLD.status != 'approved' AND NEW.status = 'approved' THEN
        UPDATE `users` 
        SET `balance` = `balance` + NEW.rate 
        WHERE `id` = NEW.user_id;
    END IF;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `fcm_devices`
--

CREATE TABLE `fcm_devices` (
  `id` int(11) NOT NULL,
  `token` varchar(500) NOT NULL,
  `device_type` varchar(50) DEFAULT 'android',
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fcm_devices`
--

INSERT INTO `fcm_devices` (`id`, `token`, `device_type`, `updated_at`) VALUES
(2, 'd_Vtn_38T4KMxTktLx_xlM:APA91bE3V8UR1QjApzOBEb7b31zdo_ieQe6E-8upDJJfO46XMserfzz9d7oY7lWE6LsyQ9ug2Xn0iyspmCtz_L594gbizOMJZQykv1Ztxdvo-w5x1OwXn-o', 'android', '2026-07-05 07:13:02'),
(4, 'c6Fy8h4LQuaNsXMd3XJcKJ:APA91bGkYf0R-xKhW5MkDxT6SUgqbmvTwO-elR3qhfvH32RFX3UCpdyAispFncTd0SJsmTeKWJrx7o_OEW9immApd6KZMUHvFBtOd0nyqQGOI-O-SE0JwZQ', 'android', '2026-07-05 07:15:48'),
(5, 'cQ9E-zNvTKuu6Wlm_oS2g-:APA91bHOknbrBquj7RYcgu_t65Q0K4LYzjLwx_XubDwjR7C_LfJhIyAdoyic1eEkTx8i4homO-tAHxo5xZPSQIAw91FvYwHl5lPyq7Ov97TkVzxP97qBWcI', 'android', '2026-07-05 07:27:00'),
(6, 'eqGAH_9dSjK02I0CoKFLwI:APA91bFaOH6aU1YZNvjDAcLSrW3-c0-yMhrjP_RX5MBLTzJx3BJcI3m64ul9QbS31JvLePMlL3QvPZSyWzIR0WWCj8I6UDtETjrczukSKQAtzOVamOEyGaM', 'android', '2026-07-05 07:42:23');

-- --------------------------------------------------------

--
-- Table structure for table `gift_claims`
--

CREATE TABLE `gift_claims` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `code_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `gift_claims`
--

INSERT INTO `gift_claims` (`id`, `user_id`, `code_id`, `amount`, `created_at`) VALUES
(1, 3, 2, 30.00, '2026-06-29 19:49:03'),
(2, 3, 1, 50.00, '2026-06-29 19:52:42');

-- --------------------------------------------------------

--
-- Table structure for table `gift_codes`
--

CREATE TABLE `gift_codes` (
  `id` int(11) NOT NULL,
  `code` varchar(100) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `max_claims` int(11) NOT NULL DEFAULT 100,
  `claimed_count` int(11) NOT NULL DEFAULT 0,
  `status` varchar(20) NOT NULL DEFAULT 'active',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `gift_codes`
--

INSERT INTO `gift_codes` (`id`, `code`, `amount`, `max_claims`, `claimed_count`, `status`, `created_at`) VALUES
(1, 'MINTGIG50', 50.00, 100, 1, 'active', '2026-06-29 19:46:47'),
(2, 'FREE30', 30.00, 500, 1, 'active', '2026-06-29 19:46:47'),
(4, 'MINT-0B373E9B', 5.00, 10, 0, 'active', '2026-07-03 15:12:34');

-- --------------------------------------------------------

--
-- Table structure for table `gmail_orders`
--

CREATE TABLE `gmail_orders` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `gmail_address` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `gmail_orders`
--

INSERT INTO `gmail_orders` (`id`, `user_id`, `gmail_address`, `password`, `rate`, `status`, `created_at`) VALUES
(2, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-06-27 12:24:12'),
(3, 3, 'rafi017e256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-06-29 21:26:36'),
(4, 3, 'rafi017efe256@gmail.com', 'Mamama12xxcd', 19.00, 'approved', '2026-06-29 21:27:24'),
(5, 3, 'rafi01dsfs7256@gmail.com', 'Mamama1df2', 19.00, 'rejected', '2026-06-29 21:37:19'),
(6, 3, 'efefwegw@gmail.com', 'duhfiuheiufhie', 19.00, 'approved', '2026-06-29 21:37:27'),
(7, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-06-30 10:45:31'),
(8, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'rejected', '2026-07-02 07:59:25'),
(9, 3, 'rafi01725ef6@gmail.com', 'Mamama12scd', 19.00, 'rejected', '2026-07-02 08:03:27'),
(10, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'rejected', '2026-07-02 08:03:50'),
(11, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'rejected', '2026-07-02 08:03:53'),
(12, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-07-04 16:55:31'),
(13, 3, 'rafi017256efjheu@gmail.com', 'Mamama12ejhf', 19.00, 'approved', '2026-07-04 16:58:20'),
(14, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-07-04 19:22:46'),
(15, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-07-05 11:45:36'),
(16, 3, 'rafi017256@gmail.com', 'Mamama12', 19.00, 'approved', '2026-07-29 23:18:28');

--
-- Triggers `gmail_orders`
--
DELIMITER $$
CREATE TRIGGER `after_gmail_order_approved` AFTER UPDATE ON `gmail_orders` FOR EACH ROW BEGIN
    IF OLD.status != 'approved' AND NEW.status = 'approved' THEN
        UPDATE `users` 
        SET `balance` = `balance` + NEW.rate 
        WHERE `id` = NEW.user_id;
    END IF;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `instagram_orders`
--

CREATE TABLE `instagram_orders` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `two_factor_key` varchar(255) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `instagram_orders`
--

INSERT INTO `instagram_orders` (`id`, `user_id`, `username`, `password`, `two_factor_key`, `rate`, `status`, `created_at`) VALUES
(1, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, '', '2026-06-28 06:51:37'),
(2, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 2.50, 'approved', '2026-07-05 11:49:39'),
(3, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:13:22'),
(4, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:13:39'),
(5, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 2.50, 'pending', '2026-07-05 13:30:45'),
(6, 3, 'mraiprime', 'Lalala@12', 'HD6 HD7 HDJ HD H DYD', 2.50, 'pending', '2026-07-05 13:30:59'),
(7, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:32:16'),
(8, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:32:27'),
(9, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 2.50, 'pending', '2026-07-05 13:37:38'),
(10, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:37:51'),
(11, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD IJF9 IJEFIJE', 2.50, 'pending', '2026-07-05 13:38:23'),
(12, 3, 'rafi017256@gmail.com', 'Mamama12', 'HD6 HD7 HDJ HD H DYD', 2.50, 'pending', '2026-07-05 13:42:38');

--
-- Triggers `instagram_orders`
--
DELIMITER $$
CREATE TRIGGER `after_instagram_order_approved` AFTER UPDATE ON `instagram_orders` FOR EACH ROW BEGIN
    -- যদি আগের স্ট্যাটাস 'approved' না থাকে এবং নতুন স্ট্যাটাস 'approved' করা হয়
    IF OLD.status != 'approved' AND NEW.status = 'approved' THEN
        UPDATE `users` 
        SET `balance` = `balance` + NEW.rate 
        WHERE `id` = NEW.user_id;
    END IF;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `math_submissions`
--

CREATE TABLE `math_submissions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `reward` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `math_submissions`
--

INSERT INTO `math_submissions` (`id`, `user_id`, `reward`, `created_at`) VALUES
(2, 3, 1.00, '2026-06-29 21:36:38'),
(3, 3, 1.00, '2026-06-29 21:38:19');

-- --------------------------------------------------------

--
-- Table structure for table `microjobs`
--

CREATE TABLE `microjobs` (
  `id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `task_desc` text DEFAULT NULL,
  `task_link` varchar(255) NOT NULL,
  `task_image` varchar(255) DEFAULT NULL,
  `reward` decimal(10,2) NOT NULL DEFAULT 1.00,
  `total_slots` int(11) NOT NULL DEFAULT 1000,
  `filled_slots` int(11) NOT NULL DEFAULT 0,
  `status` varchar(20) NOT NULL DEFAULT 'active',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `microjobs`
--

INSERT INTO `microjobs` (`id`, `title`, `task_desc`, `task_link`, `task_image`, `reward`, `total_slots`, `filled_slots`, `status`, `created_at`) VALUES
(1, 'টেলিগ্রাম গ্রুপে জয়েন করুন', 'নিচের দেওয়া নীল রঙের লিঙ্কে ক্লিক করে আমাদের অফিসিয়াল টেলিগ্রাম গ্রুপে জয়েন করুন। জয়েন করে সফলভাবে জয়েন করার একটি স্ক্রিনশট নিচে কাজের প্রুফ হিসেবে সাবমিট করুন। সঠিকভাবে কাজ সম্পন্ন করলে ১২ ঘণ্টার ভেতর আপনার পেমেন্ট ওয়ালেটে যোগ হয়ে যাবে। অনুগ্রহ করে কাজ শেষ না করে গ্রুপ থেকে লিভ নেবেন না, অন্যথায় পেমেন্ট বাতিল করা হবে।', 'https://t.me/yourchannel', NULL, 1.00, 10000, 1528, 'active', '2026-06-29 08:04:28'),
(2, 'টেলিগ্রাম চ্যানেলে জয়েন করুন', 'নিচের দেওয়া নীল রঙের লিঙ্কে ক্লিক করে আমাদের অফিসিয়াল টেলিগ্রাম চ্যানেলে জয়েন করুন। জয়েন করে সফলভাবে জয়েন করার একটি স্পষ্ট স্ক্রিনশট নিচে কাজের প্রুফ হিসেবে সাবমিট করুন।', 'https://t.me/yourchannel', NULL, 1.00, 12000, 2291, 'active', '2026-06-29 08:04:28'),
(3, 'ফেসবুকে ফলো করুন', 'নিচের দেওয়া নীল রঙের লিঙ্কে ক্লিক করে আমাদের অফিসিয়াল ফেসবুক পেজে লাইক ও ফলো করুন। ফলো করে পেজের একটি স্ক্রিনশট নিচে কাজের প্রুফ হিসেবে সাবমিট করুন।', 'https://facebook.com/yourpage', NULL, 50.00, 15000, 6777, 'active', '2026-06-29 08:04:28'),
(4, 'Follow My Tiktok Profile', 'tiktok e giye follow diba ..then 3 ta video te like korba .', 'https://tiktok.com/sjsdvkh', 'uploads/microjobs/microjob_1783180585.jpg', 2.00, 1000, 0, 'active', '2026-07-04 21:56:25');

-- --------------------------------------------------------

--
-- Table structure for table `microjob_submissions`
--

CREATE TABLE `microjob_submissions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `task_id` int(11) NOT NULL,
  `work_report` text NOT NULL,
  `proof_images` text NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `microjob_submissions`
--

INSERT INTO `microjob_submissions` (`id`, `user_id`, `task_id`, `work_report`, `proof_images`, `status`, `created_at`) VALUES
(6, 3, 3, 'hjhj', '[\"proof_3_3_1782703471_0.jpg\"]', 'approved', '2026-06-29 09:24:31'),
(7, 3, 2, 'rrrrr', '[\"proof_3_2_1783071073_0.jpeg\"]', 'rejected', '2026-07-03 15:31:13'),
(8, 3, 1, 'jhygyuguy', '[\"proof_3_1_1783159465_0.jpg\"]', 'approved', '2026-07-04 16:04:25'),
(9, 3, 4, 'djkshfikjs', '[\"proof_3_4_1783180656_0.jpg\"]', 'pending', '2026-07-04 21:57:36'),
(10, 7, 1, 'baefjjkfdssdf', '[\"proof_7_1_1783184136_0.jpg\"]', 'approved', '2026-07-04 22:55:36'),
(11, 7, 4, 'reerhry', '[\"proof_7_4_1783221880_0.jpg\"]', 'pending', '2026-07-05 09:24:40');

--
-- Triggers `microjob_submissions`
--
DELIMITER $$
CREATE TRIGGER `after_microjob_approved` AFTER UPDATE ON `microjob_submissions` FOR EACH ROW BEGIN
    -- যদি আগের স্ট্যাটাস 'approved' না থাকে এবং নতুন স্ট্যাটাস 'approved' করা হয়
    IF OLD.status != 'approved' AND NEW.status = 'approved' THEN
        -- ক. ইউজারের ওয়ালেটে এই নির্দিষ্ট কাজের রেট (Reward) যোগ করা
        UPDATE `users` 
        SET `balance` = `balance` + (SELECT reward FROM microjobs WHERE id = NEW.task_id)
        WHERE `id` = NEW.user_id;

        -- খ. মাইক্রোজবস টেবিলে filled_slots সংখ্যা ১ বাড়িয়ে দেওয়া (স্বয়ংক্রিয়ভাবে)
        UPDATE `microjobs`
        SET `filled_slots` = `filled_slots` + 1
        WHERE `id` = NEW.task_id;
    END IF;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `site_settings`
--

CREATE TABLE `site_settings` (
  `id` int(11) NOT NULL,
  `site_name` varchar(100) DEFAULT 'MINTGIG',
  `activation_bonus` decimal(10,2) DEFAULT 20.00,
  `referral_bonus` decimal(10,2) DEFAULT 10.00,
  `target_referral_goal` int(11) DEFAULT 20,
  `target_bonus_amount` decimal(10,2) DEFAULT 200.00,
  `target_cycle_days` int(11) DEFAULT 15,
  `activation_fee` decimal(10,2) DEFAULT 30.00,
  `admin_bkash_number` varchar(50) DEFAULT '01700000000',
  `admin_nagad_number` varchar(50) DEFAULT '01800000000',
  `admin_rocket_number` varchar(50) DEFAULT '01900000000',
  `firebase_api_key` varchar(255) DEFAULT NULL,
  `firebase_auth_domain` varchar(255) DEFAULT NULL,
  `firebase_database_url` varchar(255) DEFAULT NULL,
  `firebase_project_id` varchar(255) DEFAULT NULL,
  `firebase_storage_bucket` varchar(255) DEFAULT NULL,
  `firebase_messaging_sender_id` varchar(255) DEFAULT NULL,
  `firebase_app_id` varchar(255) DEFAULT NULL,
  `popup_active` tinyint(1) DEFAULT 1,
  `popup_title` varchar(100) DEFAULT 'Welcome!',
  `popup_text` text DEFAULT NULL,
  `telegram_link` varchar(255) DEFAULT 'https://t.me/yourchannel',
  `facebook_link` varchar(255) DEFAULT 'https://facebook.com/yourpage',
  `admin_1_link` varchar(255) DEFAULT 'https://t.me/admin1',
  `admin_2_link` varchar(255) DEFAULT 'https://t.me/admin2',
  `youtube_link` varchar(255) DEFAULT 'https://youtube.com/yourchannel',
  `facebook_rate` decimal(10,2) DEFAULT 0.00,
  `facebook_notice` text DEFAULT NULL,
  `gmail_rate` decimal(10,2) DEFAULT 15.00,
  `gmail_notice` varchar(255) DEFAULT '@shanto@#&',
  `gmail_video` varchar(255) DEFAULT NULL,
  `instagram_rate` decimal(10,2) DEFAULT 2.50,
  `instagram_notice` varchar(255) DEFAULT '@topearn28',
  `math_active` tinyint(1) DEFAULT 1,
  `math_gmail_required` int(11) DEFAULT 5,
  `math_reward` decimal(10,2) DEFAULT 1.00,
  `typing_active` tinyint(1) DEFAULT 1,
  `typing_fb_required` int(11) DEFAULT 1,
  `typing_reward` decimal(10,2) DEFAULT 0.20,
  `training_video` varchar(255) DEFAULT NULL,
  `ticker_notice` text DEFAULT NULL,
  `site_launch_date` datetime DEFAULT '2024-01-01 00:00:00',
  `notice_active` tinyint(1) DEFAULT 1,
  `ads_active` tinyint(1) DEFAULT 0,
  `job_post_active` tinyint(1) NOT NULL DEFAULT 0,
  `ads_rate` decimal(10,2) DEFAULT 0.10,
  `maintenance_mode` tinyint(1) DEFAULT 0,
  `maintenance_text` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `site_settings`
--

INSERT INTO `site_settings` (`id`, `site_name`, `activation_bonus`, `referral_bonus`, `target_referral_goal`, `target_bonus_amount`, `target_cycle_days`, `activation_fee`, `admin_bkash_number`, `admin_nagad_number`, `admin_rocket_number`, `firebase_api_key`, `firebase_auth_domain`, `firebase_database_url`, `firebase_project_id`, `firebase_storage_bucket`, `firebase_messaging_sender_id`, `firebase_app_id`, `popup_active`, `popup_title`, `popup_text`, `telegram_link`, `facebook_link`, `admin_1_link`, `admin_2_link`, `youtube_link`, `facebook_rate`, `facebook_notice`, `gmail_rate`, `gmail_notice`, `gmail_video`, `instagram_rate`, `instagram_notice`, `math_active`, `math_gmail_required`, `math_reward`, `typing_active`, `typing_fb_required`, `typing_reward`, `training_video`, `ticker_notice`, `site_launch_date`, `notice_active`, `ads_active`, `job_post_active`, `ads_rate`, `maintenance_mode`, `maintenance_text`) VALUES
(1, 'Mintgig', 20.00, 10.00, 20, 200.00, 15, 10.00, '01937439085', '01937439085', '01937439085', 'AIzaSyCh4S8xb-_wKwR9pS-foSLW5T-TRGSkF9E', 'payment-getway--app-website.firebaseapp.com', 'https://payment-getway--app-website-default-rtdb.firebaseio.com', 'payment-getway--app-website', 'payment-getway--app-website.firebasestorage.app', '468687760077', '1:468687760077:web:e6a498cb0afa37d15a1784', 1, 'Welcome!', 'প্রতিদিন গিফট কোড দেওয়া হয় আমাদের টেলিগ্রাম চ্যানেলে। গিফট কোড বোনাস নিতে জয়েন করুন।', 'https://t.me/yourchannel', 'https://facebook.com/yourpage', 'https://t.me/admin1', 'https://t.me/admin2', 'https://youtube.com/yourchannel', 5.00, 'ফেসবুকের আপডেটের কারণে কাজ বন্ধ করা হলো আপডেট শেষ হলে আবার চালু করা হবে❌', 19.00, 'Rejone@34', '', 2.50, 'REJONE123', 1, 2, 1.00, 0, 1, 0.20, '', '৩০ টাকা দিয়ে আইডি এক্টিভ করে ২০ হাজার টাকা পর্যন্ত সেলারি নিয়ে কাজ শুরু করে দিন সমস্ত কাজের আপডেট এবং গিভ কোড বোনাস পেতে আমাদের টেলিগ্রাম চ্যানেলে জয়েন করুন প্রতিদিন রাত ৯ টায় টেলিগ্রাম চ্যানেলে লাইভ ক্লাসে গিভ কোড বোনাস দেওয়া হয় গিভ কোড বোনাস নিতে চ্যানেলে জয়েন করুন এবং লাইভ ক্লাসে থাকুন ধন্যবাদ\r\n', '2026-06-25 10:00:00', 1, 0, 0, 0.10, 0, '');

-- --------------------------------------------------------

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `type` varchar(50) NOT NULL,
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `transactions`
--

INSERT INTO `transactions` (`id`, `user_id`, `amount`, `type`, `description`, `created_at`) VALUES
(1, 3, 0.20, 'typing_task', 'টাইপিং টাস্ক সফলভাবে সম্পন্ন করার পুরস্কার।', '2026-06-30 04:54:47');

-- --------------------------------------------------------

--
-- Table structure for table `typing_submissions`
--

CREATE TABLE `typing_submissions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `reward` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `typing_submissions`
--

INSERT INTO `typing_submissions` (`id`, `user_id`, `reward`, `created_at`) VALUES
(1, 3, 0.20, '2026-06-30 10:54:47');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `full_name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `mobile` varchar(20) DEFAULT '01720000089',
  `address` varchar(100) DEFAULT 'Dhaka',
  `password` varchar(255) NOT NULL,
  `profile_pic` varchar(255) DEFAULT NULL,
  `balance` decimal(10,2) DEFAULT 0.00,
  `is_active` tinyint(1) DEFAULT 0,
  `referral_bonus_paid` tinyint(1) DEFAULT 0,
  `target_bonus_claimed` tinyint(1) DEFAULT 0,
  `referred_by` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `salary` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `full_name`, `email`, `mobile`, `address`, `password`, `profile_pic`, `balance`, `is_active`, `referral_bonus_paid`, `target_bonus_claimed`, `referred_by`, `created_at`, `salary`) VALUES
(1, 'atik', 'Dev Atik', 'atik@gmail.com', '01728394889', 'Dhaka', '$2y$10$fVbK1bMvK3wU10L8oA9yWeV3HlP7r8PZfSjT1S2Y7M3S2zL3c9f2S', NULL, 0.00, 1, 0, 0, 3, '2026-06-25 12:39:17', 0.00),
(2, 'rahim', 'Rahim Uddin', 'rahim@gmail.com', '01827364527', 'Chittagong', '$2y$10$fVbK1bMvK3wU10L8oA9yWeV3HlP7r8PZfSjT1S2Y7M3S2zL3c9f2S', NULL, 0.00, 1, 0, 0, 3, '2026-06-25 12:39:17', 0.00),
(3, 'rafi017256', 'Rejone Ahmmed', 'rafi017256@gmail.com', '01720000089', 'Dhaka', '$2y$10$Y6M7s7iMei2s1N5N6nwZf.Jqyfe9GW/LH28x1Bmv8p1JRSQw9juK2', 'profile_3_1782486121.png', 28.00, 1, 0, 1, NULL, '2024-01-01 12:00:00', 0.00),
(6, 'ewhfuwfe', 'wgrehethrehege', 'gwrgrgeg@gmail.com', '01720000089', 'Dhaka', '$2y$10$yuN9Z.iU5WctTf0DRAcqku.B.fif5uQGF8ARDZGRNHOto66GoF1X6', NULL, 0.00, 1, 0, 0, 3, '2026-06-28 07:06:47', 0.00),
(7, 'amrname36', 'Aktar', 'htcharjoka@gmail.com', '01720000089', 'Dhaka', '$2y$10$ZIdbtt7Rgh0XdZcs4jgDZed6bIyoYecVQ33vtzRlpZXTH00T5yD0q', NULL, 1.00, 1, 0, 0, 3, '2026-07-04 21:35:54', 0.00),
(8, 'demo2233', 'Laolao', 'afsdyufikdnwbvgsdc@gmail.com', '01937439085', 'Dhaka', '$2y$10$w6z1E0/p.0rt3uFqUgcZ4uHXCK7wnrerybKU6SPooGD4.mLJMn2v2', NULL, 0.00, 0, 0, 0, 3, '2026-07-31 19:25:27', 0.00);

-- --------------------------------------------------------

--
-- Table structure for table `withdrawals`
--

CREATE TABLE `withdrawals` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `method` varchar(50) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'pending',
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `withdrawals`
--

INSERT INTO `withdrawals` (`id`, `user_id`, `method`, `amount`, `status`, `created_at`) VALUES
(7, 3, 'bkash', 110.00, 'approved', '2026-06-30 21:16:42'),
(8, 3, 'bkash', 110.00, 'pending', '2026-07-04 21:07:09'),
(9, 3, 'bkash', 110.00, 'pending', '2026-07-04 21:07:45'),
(10, 3, 'bkash', 110.00, 'approved', '2026-07-04 21:20:50'),
(11, 3, 'bkash', 110.00, 'pending', '2026-07-05 09:07:38');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `admin_notifications`
--
ALTER TABLE `admin_notifications`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ads_orders`
--
ALTER TABLE `ads_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `facebook_orders`
--
ALTER TABLE `facebook_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `fcm_devices`
--
ALTER TABLE `fcm_devices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `token` (`token`);

--
-- Indexes for table `gift_claims`
--
ALTER TABLE `gift_claims`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `code_id` (`code_id`);

--
-- Indexes for table `gift_codes`
--
ALTER TABLE `gift_codes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `code` (`code`);

--
-- Indexes for table `gmail_orders`
--
ALTER TABLE `gmail_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `instagram_orders`
--
ALTER TABLE `instagram_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `math_submissions`
--
ALTER TABLE `math_submissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `microjobs`
--
ALTER TABLE `microjobs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `microjob_submissions`
--
ALTER TABLE `microjob_submissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `task_id` (`task_id`);

--
-- Indexes for table `site_settings`
--
ALTER TABLE `site_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `typing_submissions`
--
ALTER TABLE `typing_submissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `referred_by` (`referred_by`);

--
-- Indexes for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `admin_notifications`
--
ALTER TABLE `admin_notifications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ads_orders`
--
ALTER TABLE `ads_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `facebook_orders`
--
ALTER TABLE `facebook_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `fcm_devices`
--
ALTER TABLE `fcm_devices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `gift_claims`
--
ALTER TABLE `gift_claims`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `gift_codes`
--
ALTER TABLE `gift_codes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `gmail_orders`
--
ALTER TABLE `gmail_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `instagram_orders`
--
ALTER TABLE `instagram_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `math_submissions`
--
ALTER TABLE `math_submissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `microjobs`
--
ALTER TABLE `microjobs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `microjob_submissions`
--
ALTER TABLE `microjob_submissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `site_settings`
--
ALTER TABLE `site_settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `typing_submissions`
--
ALTER TABLE `typing_submissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `withdrawals`
--
ALTER TABLE `withdrawals`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `ads_orders`
--
ALTER TABLE `ads_orders`
  ADD CONSTRAINT `ads_orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `facebook_orders`
--
ALTER TABLE `facebook_orders`
  ADD CONSTRAINT `facebook_orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `gift_claims`
--
ALTER TABLE `gift_claims`
  ADD CONSTRAINT `gift_claims_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `gift_claims_ibfk_2` FOREIGN KEY (`code_id`) REFERENCES `gift_codes` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `gmail_orders`
--
ALTER TABLE `gmail_orders`
  ADD CONSTRAINT `gmail_orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `instagram_orders`
--
ALTER TABLE `instagram_orders`
  ADD CONSTRAINT `instagram_orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `math_submissions`
--
ALTER TABLE `math_submissions`
  ADD CONSTRAINT `math_submissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `microjob_submissions`
--
ALTER TABLE `microjob_submissions`
  ADD CONSTRAINT `microjob_submissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `microjob_submissions_ibfk_2` FOREIGN KEY (`task_id`) REFERENCES `microjobs` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `typing_submissions`
--
ALTER TABLE `typing_submissions`
  ADD CONSTRAINT `typing_submissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`referred_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD CONSTRAINT `withdrawals_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
