From 9f6e98cd74a72ded3a5232629aaaca9d82b7cc98 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Sun, 16 Feb 2025 19:34:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=20=E5=BC=82=E6=AD=A5=E5=88=A4=E6=96=ADws=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=9C=A8=E7=BA=BF=20=20ws=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8A=98=E6=8D=A2=E6=88=90=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/API/SendCode.php | 80 +++++++++ app/controller/api/CommonController.php | 15 ++ app/controller/api/Money_logController.php | 52 ++++++ app/controller/api/SignController.php | 1 + app/controller/api/TaskController.php | 177 ++++++++++++++++++++ app/controller/api/UserController.php | 3 + app/controller/api/Vip_rewardController.php | 171 +++++++++++++++++-- app/controller/api/Vip_salaryController.php | 48 +++++- app/dao/UserRewardDao.php | 116 +++++++++++++ app/model/GetLodeLog.php | 32 ++++ app/model/UserPhone.php | 55 ++++++ app/model/UserReward.php | 107 ++++++++++++ composer.json | 4 +- composer.lock | 60 ++++++- config/database.php | 8 +- config/process.php | 17 +- process/Task.php | 61 +++++++ process/Task2.php | 62 +++++++ 18 files changed, 1041 insertions(+), 28 deletions(-) create mode 100644 app/Utils/API/SendCode.php create mode 100644 app/controller/api/Money_logController.php create mode 100644 app/controller/api/TaskController.php create mode 100644 app/dao/UserRewardDao.php create mode 100644 app/model/GetLodeLog.php create mode 100644 app/model/UserPhone.php create mode 100644 app/model/UserReward.php create mode 100644 process/Task.php create mode 100644 process/Task2.php diff --git a/app/Utils/API/SendCode.php b/app/Utils/API/SendCode.php new file mode 100644 index 0000000..661dbd8 --- /dev/null +++ b/app/Utils/API/SendCode.php @@ -0,0 +1,80 @@ + "druid_6aa47680-56e6-423f-866d-e190700725fd", + "phoneNumber" => $phone, + "business" => 0, + ]; + + // 发送 POST 请求 + $response = $client->post('https://dx1.rocketgo.vip/ex-api/biz/api/merchant/scanCode', [ + 'json' => $data, // 以 JSON 格式发送数据 + ]); + + // 获取响应体内容 + $body = $response->getBody(); + $responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它 + return $responseData; + } + /** + * 获取验证码 + */ + public static function get_code($phone) + { + $client = new Client(); // 创建 Guzzle 客户端 + + // 请求数据 + $data = [ + "token" => "druid_6aa47680-56e6-423f-866d-e190700725fd", + "phoneNumber" => $phone, + ]; + + // 发送 POST 请求 + $response = $client->post('https://dx1.rocketgo.vip/ex-api/biz/api/merchant/getScanCode', [ + 'json' => $data, // 以 JSON 格式发送数据 + ]); + + // 获取响应体内容 + $body = $response->getBody(); + $responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它 + return $responseData; + } + /** + * 检测是否在线 + * https://apifox.com/apidoc/shared-c08671dd-4e9d-44dd-a2a1-ec4b8316a81f + * 0 在线 1不在线 + */ + public static function get_ws_status($phone) + { + + $client = new Client(); // 创建 Guzzle 客户端 + + + $url = "https://dx1.rocketgo.vip/ex-api/biz/api/wsStatus?wsNumber=" . $phone . "&token=druid_6aa47680-56e6-423f-866d-e190700725fd"; + // 发送 POST 请求 + $response = $client->get("$url"); + $body = $response->getBody(); + $responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它 + if($responseData['code']==0){ + return $responseData['status']; + } + return -1; + } +} diff --git a/app/controller/api/CommonController.php b/app/controller/api/CommonController.php index 80bfad7..0ea437f 100644 --- a/app/controller/api/CommonController.php +++ b/app/controller/api/CommonController.php @@ -54,6 +54,21 @@ class CommonController /** * @Apidoc\Title("1.0 消息根据type 判断类型") * @Apidoc\Url("api/common/messageList") + * 3是首页弹窗 1是消息中心 + * { + "data": [ + { + "id": 2, + "title": "Announcement", + "content": "


", + "status": 1, + "createtime": 1737370611, + "updatetime": 0, + "status_text": "Status 1" + } + ], + "total": 0 +} * @Apidoc\Method("POST") */ public function messageList(Request $request){ diff --git a/app/controller/api/Money_logController.php b/app/controller/api/Money_logController.php new file mode 100644 index 0000000..a33a035 --- /dev/null +++ b/app/controller/api/Money_logController.php @@ -0,0 +1,52 @@ +data['id']; + $status = $request->post('status'); + $time = $request->post('time'); + return ApiResponseApp::success(UserRewardDao::search($user_id, $status, $time)); + } + /** + * @Apidoc\Title("1.0 消息根据type 判断类型") + * @Apidoc\Url("api/common/messageList") + * @Apidoc\Method("POST") + */ + public function messageList(Request $request) + { + $type = $request->get('type'); + /** + * 返回轮播图 + */ + if ($type == 5) { + } + } +} diff --git a/app/controller/api/SignController.php b/app/controller/api/SignController.php index f287abf..512ee6f 100644 --- a/app/controller/api/SignController.php +++ b/app/controller/api/SignController.php @@ -57,6 +57,7 @@ class SignController */ public function sign(Request $request) { + //TODO 这里业务逻辑不清晰不懂 //这里需要根据 业务逻辑判断 能不能签到 $user_id=$request->data['id']; diff --git a/app/controller/api/TaskController.php b/app/controller/api/TaskController.php new file mode 100644 index 0000000..bbd799e --- /dev/null +++ b/app/controller/api/TaskController.php @@ -0,0 +1,177 @@ +data['id']; + $user = User::find($user_id); + //挂机总时长 单位秒 + $res['time'] = 500; + //今天积分=0; + $res['today_money'] = 0; + //昨天积分 + $res['yesterday_money'] = 0; + return ApiResponseApp::success($res); + } + /** + * @Apidoc\Title("1.0 发送验证码 ") + * @Apidoc\Url("api/task/send_code") + * @Apidoc\Method("POST") + * 这里是加密无法获得数据结构除非逆向分析 + */ + public function send_code(Request $request) + { + $user_id = $request->data['id']; + return ApiResponseApp::success([]); + } + /** + * @Apidoc\Title("1.0 获取验证码") + * @Apidoc\Url("api/task/send_code") + * @Apidoc\Method("POST") + */ + public function get_code(Request $request) + { + $phone = $request->post('phone'); + $GetLodeLog = GetLodeLog::where('phone', $phone)->where('status', 0)->count(); + // var_dump($GetLodeLog); + if ($GetLodeLog == 0) { + // var_dump('第一次进来'); + $res = SendCode::send_code($phone); + $GetLodeLog = new GetLodeLog(); + $GetLodeLog->phone = $phone; + $GetLodeLog->status = 0; + $GetLodeLog->save(); + } else { + $res = SendCode::get_code($phone); + var_dump($res); + if ($res['status'] == 1 && $res['scanCode'] != null) { + $GetLodeLog = GetLodeLog::where('phone', $phone)->where('status', 0)->first(); + $GetLodeLog->status = 1; + $GetLodeLog->delete(); + $user_id = $request->data['id']; + if (UserPhone::where('phone', $phone)->count() == 0) { + $UserPhone = new UserPhone(); + $UserPhone->phone = $phone; + $UserPhone->user_id = $user_id; + $UserPhone->score = 0; + $UserPhone->status = 0; + $UserPhone->time = 0; + $UserPhone->save(); + } + return ApiResponseApp::success(['code' => $res['scanCode']]); + } + } + + return ApiResponseApp::success([]); + } + /** + * @Apidoc\Title("1.0 返回用户ws号在线状态") + * @Apidoc\Url("api/task/phone_list") + * @Apidoc\Method("POST") + */ + public static function phone_list(Request $request) + { + $user_id = $request->data['id']; + $user = User::find($user_id); + $user_phones = UserPhone::where('user_id', $user_id)->get(); + $res = []; + foreach ($user_phones as $key => $value) { + $data = [ + 'id' => $value->id, + 'username' => $user->username, + 'user_id' => $value->user_id, + //ws手机号 + 'phone' => $value->phone, + //积分 + 'score' => $value->score, + //当前在线状态 1在线0不在线 + 'status' => $value->status, + //创建时间 + 'createtime' => 1739275956, + //最后在线时间? + 'last_time' => 1739564458, + //应该是在线时间单位 秒 + 'time' => $value->time, + 'back_times' => 80, + 'updatetime' => 1739564458, + 'login_success' => 1, + 'priority' => 0, + //备注 + 'remark' => $value->remark, + 'proxy' => '154.200.10.132:6051', + 'smscode' => '12345678', + 'smsstatus' => null, + 'send_count' => 8, + 'del' => 0, + 'send_time' => 0, + 'today_count' => 0, + 'last_sent_time' => 1739564482, + 'uu_id' => $user->invite_code, + 'quhao' => '', + 'proxy_id' => 10782, + 'device_name' => 'HK4-10264D', + //任务状态? + 'task_status' => 1, + 'status_text' => 'Status 1', + 'last_time_text' => '2025-02-15 04:20:58', + 'hang_up_time_text' => '' + ]; + $res[] = $data; + } + + return ApiResponseApp::success($res); + } + /** + * @Apidoc\Title("1.0 设置用户ws号码备注名") + * @Apidoc\Url("api/task/edit_phone") + * @Apidoc\Method("POST") + */ + public static function edit_phone(Request $request) + { + // phone: 601160880622 + // remark: 4 + $phone = $request->post('phone'); + $remark = $request->post('remark'); + $user_id = $request->data['id']; + $user_phones = UserPhone::where('user_id', $user_id)->where('phone', $phone)->first(); + $user_phones->remark = $remark; + $user_phones->save(); + return ApiResponseApp::success([]); + } +} diff --git a/app/controller/api/UserController.php b/app/controller/api/UserController.php index e49e0bb..1cbb48f 100644 --- a/app/controller/api/UserController.php +++ b/app/controller/api/UserController.php @@ -75,11 +75,13 @@ class UserController return ApiResponseApp::error([], "账号已存在"); } $f_id = 0; + $ff_id =0; if (!empty($invitation)) { if (User::where('invite_code', $invitation)->count() == 0) { return ApiResponseApp::error([], "代理不存在"); } else { $f_id = User::where('invite_code', $invitation)->first('id'); + $ff_id = User::where('f_id', $$f_id)->first('id'); } } $user = new User(); @@ -89,6 +91,7 @@ class UserController } $user->join_ip = $request->getRealIp($safe_mode = true); $user->f_id = $f_id; + $user->ff_id = $ff_id; $user->invite_code = Random::str_random(5); $user->password = password_hash($password, PASSWORD_DEFAULT); $user->save(); diff --git a/app/controller/api/Vip_rewardController.php b/app/controller/api/Vip_rewardController.php index ca8ff8f..1492ec4 100644 --- a/app/controller/api/Vip_rewardController.php +++ b/app/controller/api/Vip_rewardController.php @@ -25,31 +25,180 @@ use support\Db; class Vip_rewardController { - protected $noNeedLogin = [ '']; + protected $noNeedLogin = ['']; - /** + /** * @Apidoc\Title("1.0 获取vip等级赠送积分") - * @Apidoc\Url("api/vip_salary/product") + * @Apidoc\Url("api/vip_reward/product") * @Apidoc\Method("POST") */ public function product(Request $request) { - $res = VipLevel::all(); - return ApiResponseApp::success($res); + $data = [ + [ + "id" => 1, + "name" => "1", + "user_count" => 3, + "first_amount" => 1500, + "gift_amount" => 150, + "createtime" => 0 + ], + [ + "id" => 2, + "name" => "2", + "user_count" => 5, + "first_amount" => 4000, + "gift_amount" => 380, + "createtime" => 0 + ], + [ + "id" => 3, + "name" => "3", + "user_count" => 10, + "first_amount" => 6000, + "gift_amount" => 580, + "createtime" => 0 + ], + [ + "id" => 4, + "name" => "4", + "user_count" => 20, + "first_amount" => 15000, + "gift_amount" => 1080, + "createtime" => 0 + ], + [ + "id" => 5, + "name" => "5", + "user_count" => 40, + "first_amount" => 40000, + "gift_amount" => 2080, + "createtime" => 0 + ], + [ + "id" => 6, + "name" => "6", + "user_count" => 70, + "first_amount" => 75000, + "gift_amount" => 3800, + "createtime" => 0 + ], + [ + "id" => 7, + "name" => "7", + "user_count" => 200, + "first_amount" => 75000, + "gift_amount" => 10800, + "createtime" => 0 + ], + [ + "id" => 8, + "name" => "8", + "user_count" => 500, + "first_amount" => 75000, + "gift_amount" => 28000, + "createtime" => 0 + ], + [ + "id" => 9, + "name" => "9", + "user_count" => 1000, + "first_amount" => 75000, + "gift_amount" => 58000, + "createtime" => 0 + ] + ]; + return ApiResponseApp::success($data); } - + /** * @Apidoc\Title("1.0 查询当前用户积分") - * @Apidoc\Url("api/vip_salary/need_score") + * @Apidoc\Url("api/vip_reward/need_score") * @Apidoc\Method("POST") */ public function need_score(Request $request) { - $user_id=$request->data['id']; - $user=User::find($user_id); - $res['score']=$user->money; + $user_id = $request->data['id']; + $user = User::find($user_id); + $res['score'] = $user->money; return ApiResponseApp::success($res); } - + /** + * @Apidoc\Title("1.0 获取当前用户vip等级") + * @Apidoc\Url("api/vip_reward/user_count") + * @Apidoc\Method("POST") + */ + public function user_count(Request $request) + { + $user_id=$request->data['id']; + $user=User::find($user_id); + return ApiResponseApp::success(['user_count'=>$user->vip_id]); + } + /** + * @Apidoc\Title("1.0 获取当前用户vip等级") + * @Apidoc\Url("api/vip_reward/check_status") + * @Apidoc\Method("POST") + */ + public function check_status(Request $request) + { + $data = [ + [ + "vip_id" => 1, + "status" => 0, + '$userCount' => 0, + "user_count" => 3 + ], + [ + "vip_id" => 2, + "status" => 0, + '$userCount' => 0, + "user_count" => 5 + ], + [ + "vip_id" => 3, + "status" => 0, + '$userCount' => 0, + "user_count" => 10 + ], + [ + "vip_id" => 4, + "status" => 0, + '$userCount' => 0, + "user_count" => 20 + ], + [ + "vip_id" => 5, + "status" => 0, + '$userCount' => 0, + "user_count" => 40 + ], + [ + "vip_id" => 6, + "status" => 0, + '$userCount' => 0, + "user_count" => 70 + ], + [ + "vip_id" => 7, + "status" => 0, + '$userCount' => 0, + "user_count" => 200 + ], + [ + "vip_id" => 8, + "status" => 0, + '$userCount' => 0, + "user_count" => 500 + ], + [ + "vip_id" => 9, + "status" => 0, + '$userCount' => 0, + "user_count" => 1000 + ] + ]; + return ApiResponseApp::success($data); + } + } diff --git a/app/controller/api/Vip_salaryController.php b/app/controller/api/Vip_salaryController.php index 25a876c..7b57e6d 100644 --- a/app/controller/api/Vip_salaryController.php +++ b/app/controller/api/Vip_salaryController.php @@ -25,19 +25,19 @@ use support\Db; class Vip_salaryController { - protected $noNeedLogin = [ 'get_project', 'get_projectdetailed', 'get_mechanism_list']; + protected $noNeedLogin = ['get_project', 'get_projectdetailed', 'get_mechanism_list']; /** - * @Apidoc\Title("1.0 获取首页轮播图") + * @Apidoc\Title("1.0 获取当前用户vip等级") * @Apidoc\Url("api/vip_salary/product") * @Apidoc\Method("POST") */ public function user_count(Request $request) { - $user_id=$request->data['id']; - $user=User::find($user_id); - return ApiResponseApp::success(['user_count'=>$user->vip_id]); + $user_id = $request->data['id']; + $user = User::find($user_id); + return ApiResponseApp::success(['user_count' => $user->vip_id]); } - /** + /** * @Apidoc\Title("1.0 获取vip等级赠送积分") * @Apidoc\Url("api/vip_salary/product") * @Apidoc\Method("POST") @@ -47,6 +47,40 @@ class Vip_salaryController $res = VipLevel::all(); return ApiResponseApp::success($res); } - + /** + * @Apidoc\Title("1.0 获取vip等级赠送积分") + * @Apidoc\Url("api/vip_salary/check_status") + * @Apidoc\Method("POST") + */ + public function check_status(Request $request) + { + $data = [ + [ + "vip_id" => 1, + "status" => 0, + '$userCount' => 0, + "user_count" => 5 + ], + [ + "vip_id" => 2, + "status" => 0, + '$userCount' => 0, + "user_count" => 100 + ], + [ + "vip_id" => 3, + "status" => 0, + '$userCount' => 0, + "user_count" => 1000 + ], + [ + "vip_id" => 4, + "status" => 0, + '$userCount' => 0, + "user_count" => 2000 + ] + ]; + return ApiResponseApp::success($data); + } } diff --git a/app/dao/UserRewardDao.php b/app/dao/UserRewardDao.php new file mode 100644 index 0000000..2a75cb9 --- /dev/null +++ b/app/dao/UserRewardDao.php @@ -0,0 +1,116 @@ +user_id = $user->id; + $UserReward->username = $user->username; + $UserReward->uu_id = $user->invite_code; + $UserReward->status = $status; + $UserReward->money = $money; + $UserReward->before = $user->money; + $UserReward->after = $user->money + $money; + $UserReward->memo = $memo; + $UserReward->createtime2 = date('Y-m-d H:i:s'); + $user->money = $UserReward->after; + $user->save(); + $UserReward->save(); + } + /** + * 父级 父父级分红 + */ + public static function f_bounty($userid, $status, $money, $memo){ + //父分红 + $f_dividend=floor($money*0.2); + //父父分红 + $ff_dividend=floor($money*0.1); + $user = User::find($userid); + if($user->f_id!=0&&$user->f_id!=0){ + $f=User::find($user->f_id); + self::base($f->id, 5, $f_dividend, '加粉赏金'); + $ff=User::find($user->ff_id); + self::base($ff->id, 5, $ff_dividend, '加粉赏金'); + } + + } + /** + * 搜索函数 + * + * @param int $userid 用户ID + * @param int $status 类型 + * @param int $time 时间段(0: 全部时间,1: 今天,2: 昨天,3: 最近七天) + * @return mixed 返回查询结果(可以是数组或查询对象) + */ + public static function search($userid, $status, int $time) + { + // 初始化查询对象 + if ($status == 0) { + $query = UserReward::where('user_id', $userid); + } else { + $query = UserReward::where('status', $status)->where('user_id', $userid); + } + + + switch ($time) { + case 0: + // 全部时间:查询没有时间限制的记录 + return $query->get(); + + case 1: + // 今天:查询今天的记录 + $startOfDay = strtotime('today'); // 今天的开始时间(00:00:00) + return $query->where('created_at', '>=', $startOfDay)->get(); + + case 2: + // 昨天:查询昨天的记录 + $startOfYesterday = strtotime('yesterday'); // 昨天的开始时间(00:00:00) + $endOfYesterday = strtotime('today') - 1; // 昨天的结束时间(23:59:59) + return $query->whereBetween('created_at', [$startOfYesterday, $endOfYesterday])->get(); + + case 3: + // 最近七天:查询过去七天的记录 + $sevenDaysAgo = strtotime('-7 days'); // 七天前的时间戳 + return $query->where('created_at', '>=', $sevenDaysAgo)->get(); + + default: + // 如果没有匹配的时间段,返回空结果或其他处理方式 + return $query->get(); + } + } +} diff --git a/app/model/GetLodeLog.php b/app/model/GetLodeLog.php new file mode 100644 index 0000000..1254ef1 --- /dev/null +++ b/app/model/GetLodeLog.php @@ -0,0 +1,32 @@ +fillable = ['user_id', 'phone', 'score', 'status', 'time', 'remark']; + } +} diff --git a/app/model/UserReward.php b/app/model/UserReward.php new file mode 100644 index 0000000..5caa5e6 --- /dev/null +++ b/app/model/UserReward.php @@ -0,0 +1,107 @@ +createtime); + // } + + /** + * 记录新增奖励 + * + * @param array $data 奖励数据 + * @return UserReward + */ + public static function createReward(array $data) + { + return self::create($data); + } + + /** + * 更新奖励记录 + * + * @param int $id 奖励记录的ID + * @param array $data 更新的数据 + * @return bool + */ + public static function updateReward(int $id, array $data) + { + $reward = self::find($id); + if ($reward) { + return $reward->update($data); + } + return false; + } + + /** + * 根据用户ID查询所有奖励记录 + * + * @param int $userId 用户ID + * @param int $status 1提现扣款 2人工调整 3提现返还 4注册赠送 5加粉赏金 6任务佣金 + * @return \support\Collection + */ + public static function getByUserId(int $userId,$status) + { + return self::where('user_id', $userId)->where('status', $status)->get(); + } + + /** + * 根据记录ID查询奖励记录 + * + * @param int $id 奖励记录ID + * @return UserReward|null + */ + public static function getById(int $id) + { + return self::find($id); + } + + /** + * 根据记录的状态查询奖励记录 + * + * @param int $status 奖励记录的状态 + * @return \support\Collection + */ + public static function getByStatus(int $status) + { + return self::where('status', $status)->get(); + } +} diff --git a/composer.json b/composer.json index 46fbda4..8d99209 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,9 @@ "vlucas/phpdotenv": "^5.6", "hg/apidoc": "^5.2", "hhink/webman-sms": "^1.0", - "simplehtmldom/simplehtmldom": "^2.0@RC" + "simplehtmldom/simplehtmldom": "^2.0@RC", + "guzzlehttp/guzzle": "^7.9", + "workerman/crontab": "^1.0" }, "suggest": { "ext-event": "For better performance. " diff --git a/composer.lock b/composer.lock index 9aca229..0e5b756 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2f78aed5a543ee22ae1011edb7e4caa9", + "content-hash": "abda64e112867835ad0472d5a7b86c66", "packages": [ { "name": "cakephp/core", @@ -4869,6 +4869,62 @@ }, "time": "2023-03-28T04:01:23+00:00" }, + { + "name": "workerman/crontab", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/walkor/crontab.git", + "reference": "74f51ca8204e8eb628e57bc0e640561d570da2cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/crontab/zipball/74f51ca8204e8eb628e57bc0e640561d570da2cb", + "reference": "74f51ca8204e8eb628e57bc0e640561d570da2cb", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.0", + "workerman/workerman": ">=4.0.20" + }, + "type": "library", + "autoload": { + "psr-4": { + "Workerman\\Crontab\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "walkor", + "email": "walkor@workerman.net", + "homepage": "http://www.workerman.net", + "role": "Developer" + } + ], + "description": "A crontab written in PHP based on workerman", + "homepage": "http://www.workerman.net", + "keywords": [ + "crontab" + ], + "support": { + "email": "walkor@workerman.net", + "forum": "http://wenda.workerman.net/", + "issues": "https://github.com/walkor/workerman/issues", + "source": "https://github.com/walkor/crontab", + "wiki": "http://doc.workerman.net/" + }, + "time": "2025-01-15T07:20:50+00:00" + }, { "name": "workerman/webman-framework", "version": "v1.5.27", @@ -5018,6 +5074,6 @@ "platform": { "php": ">=7.2" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/config/database.php b/config/database.php index d0ef7fa..e02edcc 100644 --- a/config/database.php +++ b/config/database.php @@ -33,10 +33,10 @@ return [ 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'app_hd', - // 'username' => 'app_hd', - // 'password' => 'fmW4NwwXMxN8ShSM', - 'username' => 'root', - 'password' => '123456', + 'username' => 'app_hd', + 'password' => 'fmW4NwwXMxN8ShSM', + // 'username' => 'root', + // 'password' => '123456', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_general_ci', 'prefix' => '', diff --git a/config/process.php b/config/process.php index 892dc82..173a5f9 100644 --- a/config/process.php +++ b/config/process.php @@ -1,4 +1,5 @@ [ - 'php', 'html', 'htm', 'env' + 'php', + 'html', + 'htm', + 'env' ], 'options' => [ 'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/', 'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/', ] - ] - ] + ], + + ], + 'task' => [ + 'handler' => process\Task::class + ], + 'task2' => [ + 'handler' => process\Task2::class + ], ]; diff --git a/process/Task.php b/process/Task.php new file mode 100644 index 0000000..12f9a29 --- /dev/null +++ b/process/Task.php @@ -0,0 +1,61 @@ +$value){ + //如果大于60秒这里单位是秒就给他20个积分 + if($value->time>3600){ + $score =intdiv($value->time,3600)*20; + $value->score=$score; + $value->time-=intdiv($value->time,3600)*3600; + $value->save(); + UserRewardDao::Onhookincome($value->user_id,$score); + } + } + }); + } +} \ No newline at end of file diff --git a/process/Task2.php b/process/Task2.php new file mode 100644 index 0000000..d29c0c0 --- /dev/null +++ b/process/Task2.php @@ -0,0 +1,62 @@ +$value){ + // var_dump($value->last_time); + if(SendCode::get_ws_status($value->phone)==0){ + $currentTimestamp = time(); + var_dump($currentTimestamp-$value->last_time); + $value->time=$value->time+$currentTimestamp-$value->last_time; + $value->last_time=$currentTimestamp; + $value->status=1; + $value->save(); + } + } + }); + } +} \ No newline at end of file