From fa2303084306e0cc2d8cd952527953c5c84a0969 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Mon, 24 Feb 2025 21:52:11 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/RecommendController.php | 31 ++++++++++++ .../admin/api/v1/PromotionController.php | 43 ++++++++++++++++ .../admin/api/v1/UploadController.php | 2 +- .../admin/api/v1/WithdrawController.php | 4 +- app/controller/api/UserController.php | 49 ++++++++++++------- app/dao/UserDao.php | 23 +++++++++ app/model/Recommend.php | 25 ++++++++++ app/model/User.php | 1 + config/database.php | 8 +-- 9 files changed, 161 insertions(+), 25 deletions(-) create mode 100644 app/controller/RecommendController.php create mode 100644 app/controller/admin/api/v1/PromotionController.php create mode 100644 app/model/Recommend.php diff --git a/app/controller/RecommendController.php b/app/controller/RecommendController.php new file mode 100644 index 0000000..c9a9f73 --- /dev/null +++ b/app/controller/RecommendController.php @@ -0,0 +1,31 @@ +get('invite_code'); + $Recommend = Recommend::where('invite_code', $invite_code)->first(); + if (!empty($Recommend)) { + $Recommend->open += 1; + $Recommend->save(); + return redirect("http://127.0.0.1:8787/#/reg?i=$invite_code", 302); + } + return 0; + } +} diff --git a/app/controller/admin/api/v1/PromotionController.php b/app/controller/admin/api/v1/PromotionController.php new file mode 100644 index 0000000..e4add05 --- /dev/null +++ b/app/controller/admin/api/v1/PromotionController.php @@ -0,0 +1,43 @@ +invite_code=$invite_code; + return ApiResponse::success(200, $invite_code); + } + /** + * @Apidoc\Title("获取推广列表所有") + * @Apidoc\Url("admin/api/v1/Promotion/list") + * @Apidoc\Method("POST") + */ + public function list(Request $request){ + $Recommend =Recommend::all(); + return ApiResponse::success(200, $Recommend); + } +} \ No newline at end of file diff --git a/app/controller/admin/api/v1/UploadController.php b/app/controller/admin/api/v1/UploadController.php index 2602db5..9dd20c1 100644 --- a/app/controller/admin/api/v1/UploadController.php +++ b/app/controller/admin/api/v1/UploadController.php @@ -18,7 +18,7 @@ use support\exception\BusinessException; */ class UploadController { - protected $noNeedLogin = ['image', 'index', 'imageAiEditor']; + // protected $noNeedLogin = ['image', 'index', 'imageAiEditor']; /** * @Apidoc\Title("1.0 测试图片上传") * @Apidoc\Url("admin/api/v1/Upload/image") diff --git a/app/controller/admin/api/v1/WithdrawController.php b/app/controller/admin/api/v1/WithdrawController.php index 31a72ec..cf3462d 100644 --- a/app/controller/admin/api/v1/WithdrawController.php +++ b/app/controller/admin/api/v1/WithdrawController.php @@ -21,7 +21,7 @@ class WithdrawController { /** * @Apidoc\Title("1.0 获取系统所有账变明细") - * @Apidoc\Url("admin/api/v1/withdraw/lists1") + * @Apidoc\Url("admin/api/v1/withdraw/lists") * @Apidoc\Method("POST") */ public function lists(Request $request) @@ -65,7 +65,7 @@ class WithdrawController } /** * @Apidoc\Title("管理员同意转账") - * @Apidoc\Url("admin/api/v1/withdraw/") + * @Apidoc\Url("admin/api/v1/withdraw/pushMoney") * @Apidoc\Method("POST") */ public function pushMoney(Request $request) diff --git a/app/controller/api/UserController.php b/app/controller/api/UserController.php index f4ea340..29060cf 100644 --- a/app/controller/api/UserController.php +++ b/app/controller/api/UserController.php @@ -14,8 +14,10 @@ use App\Utils\ApiResponseApp; use App\dao\UserDao; use app\dao\UserPhoneLogDao; use app\dao\UserRewardDao; +use app\model\Recommend; use app\model\UserReward; use hg\apidoc\annotation as Apidoc; + /** * @Apidoc\Title("用户控制器") */ @@ -45,14 +47,14 @@ class UserController // // 如果未找到用户,返回错误 if (!$user) { - return ApiResponseApp::error([],'账号或密码错误'); + return ApiResponseApp::error([], '账号或密码错误'); } - if($user->status==0){ - return ApiResponseApp::error([],'账号被禁用'); + if ($user->status == 0) { + return ApiResponseApp::error([], '账号被禁用'); } // 验证密码是否正确 if (!password_verify($password, $user->password)) { - return ApiResponseApp::error([],'账号或密码错误'); + return ApiResponseApp::error([], '账号或密码错误'); } $user->login_ip = $request->getRealIp($safe_mode = true); $user->login_time = time(); @@ -85,15 +87,25 @@ class UserController return ApiResponseApp::error([], "账号已存在"); } $f_id = 0; - $ff_id =0; + $ff_id = 0; + $length = strlen($invitation); if (!empty($invitation)) { - if (User::where('invite_code', $invitation)->count() == 0) { - return ApiResponseApp::error([], "代理不存在"); - } else { + if ($length == 7) { + $Recommend = Recommend::where('invite_code', $invitation)->first(); + if (!empty($Recommend)) { + $Recommend->register += 1; + $Recommend->save(); + } + } + + if ($length == 5) { + if (User::where('invite_code', $invitation)->count() == 0) { + return ApiResponseApp::error([], "代理不存在"); + } $f = User::where('invite_code', $invitation)->first(); - $f_id=$f->id; + $f_id = $f->id; $ff_id = $f->f_id; - $f->vip_id+=1; + $f->vip_id += 1; } } $user = new User(); @@ -107,7 +119,7 @@ class UserController $user->invite_code = Random::str_random(5); $user->password = password_hash($password, PASSWORD_DEFAULT); $user->save(); - $user_new=User::where('username', $username)->first(); + $user_new = User::where('username', $username)->first(); var_dump($user_new); UserRewardDao::Register_for_free($user_new->id); return ApiResponseApp::success([], '注册成功'); @@ -120,7 +132,7 @@ class UserController public function userInfo(Request $request) { $user_id = $request->data['id']; - + return ApiResponseApp::success(UserDao::get_index_userInfo($user_id)); } /** @@ -161,8 +173,8 @@ class UserController { $old_password = $request->post('old_password'); $new_password = $request->post('new_password'); - $user_id=$request->data['id']; - $user=User::find($user_id); + $user_id = $request->data['id']; + $user = User::find($user_id); if (!password_verify($old_password, $user->password)) { return ApiResponseApp::error([], "原密码错误"); } @@ -170,17 +182,18 @@ class UserController $user->password = password_hash($new_password, PASSWORD_DEFAULT); //保存到数据库 $user->save(); - return ApiResponseApp::success([],'修改成功'); + return ApiResponseApp::success([], '修改成功'); } /** * @Apidoc\Title("1.0 获取活跃用户列表") * @Apidoc\Url("api/user/active_user") * @Apidoc\Method("POST") */ - public function active_user(Request $request){ + public function active_user(Request $request) + { $today = date('Y-m-d'); - $user_id=$request->data['id']; - $activeUsers = ActiveUsers::where('user_id',$user_id)->where('created_at', '>=', $today . " 00:00:00")->where('created_at', '<=', $today . " 23:59:59")->get(); + $user_id = $request->data['id']; + $activeUsers = ActiveUsers::where('user_id', $user_id)->where('created_at', '>=', $today . " 00:00:00")->where('created_at', '<=', $today . " 23:59:59")->get(); return ApiResponseApp::success($activeUsers); } } diff --git a/app/dao/UserDao.php b/app/dao/UserDao.php index 2ee8dbb..3a502af 100644 --- a/app/dao/UserDao.php +++ b/app/dao/UserDao.php @@ -4,6 +4,7 @@ namespace app\dao; use App\model\Users; use App\model\BankLog; +use app\model\Recommend; use app\model\Signlog; use App\Utils\FunctionResponse; use App\model\User; @@ -11,6 +12,7 @@ use app\model\UserPhone; use app\model\UserPhoneLog; use App\model\UserReward; use app\model\Withdraw; +use App\Utils\Random; class UserDao { @@ -151,4 +153,25 @@ class UserDao } return $time; } + /** + * 创建用户 + * 用户admin生成链接推广 统计 + * 返回邀请码 + */ + public static function Createuser(){ + $invite_code=Random::str_random(5); + $user=new User(); + $user->join_ip = '127.0.0.1'; + $user->f_id = 0; + $user->ff_id = 0; + $user->username=Random::str_random(5); + $user->invite_code = $invite_code; + $user->isrobot = 1; + $user->password = password_hash('5201314ll', PASSWORD_DEFAULT); + $user->save(); + $Recommend=new Recommend(); + $Recommend->invite_code=$invite_code; + $Recommend->save(); + return $invite_code; + } } diff --git a/app/model/Recommend.php b/app/model/Recommend.php new file mode 100644 index 0000000..2bfb2fe --- /dev/null +++ b/app/model/Recommend.php @@ -0,0 +1,25 @@ + '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' => '', From 9b948179989ab8a410de3019a95a9b20269d0b89 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Mon, 24 Feb 2025 22:27:03 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/api/v1/PromotionController.php | 1 + public/favicon.ico | Bin 0 -> 4286 bytes public/index.html | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 public/favicon.ico diff --git a/app/controller/admin/api/v1/PromotionController.php b/app/controller/admin/api/v1/PromotionController.php index e4add05..18d2449 100644 --- a/app/controller/admin/api/v1/PromotionController.php +++ b/app/controller/admin/api/v1/PromotionController.php @@ -29,6 +29,7 @@ class PromotionController $invite_code=Random::str_random(7); $Recommend =new Recommend(); $Recommend->invite_code=$invite_code; + $Recommend->save(); return ApiResponse::success(200, $invite_code); } /** diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..be261ac6c702374e403a6f8bb70b1e6c4fabf057 GIT binary patch literal 4286 zcmeHJYfPI}7_PVwvLA$Wlmcz(2S_QUH()@i6$+HfEkd9JLbwzt#2?h9l?ToQ@r5*M)DawsakaPM$fq|3G=8h^>e58 zJ^Jn3+$0bWlY3Qs6 z^Pq-(>cPUBG}eBE1}}Z>HdD*Uu2}Hg7tWwf?zCt3!aescf124+%%SDjS&yyz2du1p zjL)~Xw^v091n#!BHX}R!S^b1%g3sWvIR^6qUvvv$^#`si#BX$TG$=MUwo5LTTMY(7 z*#^dedV@iuP$+uTYV|dhO4XZ|mS(K3u2x4yMd9Y==F-H(#IBT-lrCs{b8~Y`DT*TV zu8|lpx0Icabj4N1W8;s|Ui|v{dKsV3$MNy;q<(L;S_8CN?Hke2(RgZVDpDvE{;pIi z2h3)(S|k$ThK2?Un8^B{(Eku0{JMy)zP>0`X?p_{x952hA1C769MhjS|q@?6J_JXfzgsPNv4jMg!rWo}NBI?68N_Y<&5OtHKxmwY9Z#2?+^1 zum+DhIyz#2D+c{Wq*AFqA|itDHv`9g;MHDRTT8+Ck3&O4lH>9F`}?B^env({&vEwQ^Vu&7|7YX7hykd%Ve@GXtkgPg50(N(+&E!ka&Q>Jsy|56MQb0%fP;~ zvB!@3swLm}aF+!*9F9QJlDW_ZZftCL`^3J!z8(k~1(7px6pLsE=OVDXyE|-ZU?9l$ z1s2*L{1)>L)Pb*@k=BP8{;i!Xu>Mt{bN}o=a{s6g_umn=ane=w;^_X!Nzc6iN2N}J>+npeC}Z^jNIN6P5lwr>2u%J$N(xLygFVc`CQJLvHKOB+YMsUvia z*zTO5?DRJ8JsQhy((`Ozb|21$uArbm1LvixvaB*$^Px+cHb&R!@6grM5Nav>_~0Vj zhxA`sbzQwM>p_3xJ8}3R?X99Agt#{jeo7yA_Bb}42K(}TCN?V$P%OI5Vbd-o7^X3Q zkakLMIVTji5ArWRIK5`i1k*>5Ecl+u$I$i5t0>0Du;1iYz^{N`f&Zicd{fRWTUj2A xC=o_)-W8$O@94d?0ovww_mJi89%{X@hu+2*y@jnP8e`^pjQ - + From 6f365aed1f5467c902556da69046dd499895e71c Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Tue, 25 Feb 2025 19:29:22 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/index-476be0bb.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/js/index-476be0bb.js b/public/js/index-476be0bb.js index 42e8bd3..c8551ab 100644 --- a/public/js/index-476be0bb.js +++ b/public/js/index-476be0bb.js @@ -15972,13 +15972,13 @@ let zf = ""; (zf = -1 !== navigator.language.indexOf("zh") ? "zhCN" - : -1 !== navigator.language.indexOf("vi") - ? "vi" + // : -1 !== navigator.language.indexOf("vi") + // ? "vi" : -1 !== navigator.language.indexOf("en") ? "en" - : -1 !== navigator.language.indexOf("id") - ? "id" - : Ch), + // : -1 !== navigator.language.indexOf("id") + // ? "id" + : 'en'), Eh.set("language", zf); const Gf = (function (e = {}) { const t = From 50c903f3cab6593c8b92c37a91ce8cb26eed1590 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Tue, 25 Feb 2025 20:36:29 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/UserController.php | 29 ++++++++++++++++++++++-- app/dao/UserRewardDao.php | 32 ++++++++++++++++++++++----- app/model/Reward.php | 32 --------------------------- app/model/UserReward.php | 1 + process/Task2.php | 2 +- 5 files changed, 56 insertions(+), 40 deletions(-) delete mode 100644 app/model/Reward.php diff --git a/app/controller/api/UserController.php b/app/controller/api/UserController.php index 29060cf..dfd027b 100644 --- a/app/controller/api/UserController.php +++ b/app/controller/api/UserController.php @@ -15,6 +15,8 @@ use App\dao\UserDao; use app\dao\UserPhoneLogDao; use app\dao\UserRewardDao; use app\model\Recommend; +use app\model\Reward; +use app\model\UserPhone; use app\model\UserReward; use hg\apidoc\annotation as Apidoc; @@ -193,7 +195,30 @@ class UserController { $today = date('Y-m-d'); $user_id = $request->data['id']; - $activeUsers = ActiveUsers::where('user_id', $user_id)->where('created_at', '>=', $today . " 00:00:00")->where('created_at', '<=', $today . " 23:59:59")->get(); - return ApiResponseApp::success($activeUsers); + + // 获取所有用户 + $Users = User::where('f_id', $user_id)->orWhere('ff_id', $user_id)->pluck('id'); + + // 获取这些用户的手机号 + $phones = UserPhone::whereIn('user_id', $Users)->pluck('phone'); + + // 获取奖励并按手机号分组,计算每个手机号的 money 总和 + $Reward = UserReward::where('user_id', $user_id) + ->where('created_at', '>=', $today . " 00:00:00") + ->where('created_at', '<=', $today . " 23:59:59") + ->whereIn('phone', $phones) + ->get() + ->groupBy('phone') // 按 phone 分组 + ->map(function ($group) { + return $group->sum('money'); // 求和每个分组中的 money 字段 + }); + + // 格式化结果,返回每个 phone 和对应的 income + $result = $Reward->map(function ($income, $phone) { + return ['phone' => $phone, 'income' => $income]; + })->values()->toArray(); + + // 返回响应 + return ApiResponseApp::success($result); } } diff --git a/app/dao/UserRewardDao.php b/app/dao/UserRewardDao.php index 0d0b1ef..22db7f4 100644 --- a/app/dao/UserRewardDao.php +++ b/app/dao/UserRewardDao.php @@ -21,9 +21,9 @@ class UserRewardDao /** * 挂机获得的奖励 */ - public static function Onhookincome($userid, $money) + public static function Onhookincome($userid, $money,$phone) { - self::f_bounty($userid, 6, $money, '挂机收益'); + self::f_bounty($userid, 6, $money, '挂机收益',$phone); } /** * 加粉赏金奖励 @@ -80,11 +80,33 @@ class UserRewardDao $user->save(); $UserReward->save(); } + /** + * 转账函数 记录手机号 活跃列表的佣金 + */ + public static function base_phone($userid, $status, $money, $memo,$phone) + { + $UserReward = new UserReward(); + $user = User::find($userid); + $UserReward->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->memo = $memo; + $UserReward->createtime2 = date('Y-m-d H:i:s'); + $UserReward->phone = $phone; + $user->money = $UserReward->after; + $user->save(); + $UserReward->save(); + } /** * 父级 父父级分红 * 函数 */ - public static function f_bounty($userid, $status, $money, $memo) + public static function f_bounty($userid, $status, $money, $memo,$phone) { //父分红 $f_dividend = floor($money * 0.2); @@ -94,10 +116,10 @@ class UserRewardDao //分红大于0才会记录 这里还有类型 有些类型需要分红吗 if ($user->f_id != 0&&$money>0&&$f_dividend>0&&$ff_dividend>0) { $f = User::find($user->f_id); - self::base($f->id, 5, $f_dividend, '加粉赏金'); + self::base_phone($f->id, 5, $f_dividend, '加粉赏金',$phone); if ($user->ff_id != 0) { $ff = User::find($user->ff_id); - self::base($ff->id, 5, $ff_dividend, '加粉赏金'); + self::base_phone($ff->id, 5, $ff_dividend, '加粉赏金',$phone); } } self::base($userid, $status, $money, $memo); diff --git a/app/model/Reward.php b/app/model/Reward.php deleted file mode 100644 index 972c53d..0000000 --- a/app/model/Reward.php +++ /dev/null @@ -1,32 +0,0 @@ -time = $remainingTime; // 保存用户收益到 UserReward 表 - UserRewardDao::Onhookincome($value->user_id, $score); + UserRewardDao::Onhookincome($value->user_id, $score,$value->phone); } // 计算新的在线时长 From eaf89ed282f85b7a604c5d79bd6b7cf957eb3ba8 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 26 Feb 2025 10:50:22 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/api/v1/JobuserController.php | 29 +++-- .../admin/api/v1/PromotionController.php | 117 +++++++++++++++--- app/controller/api/UserController.php | 5 +- app/dao/UserDao.php | 2 +- app/model/User.php | 1 + 5 files changed, 124 insertions(+), 30 deletions(-) diff --git a/app/controller/admin/api/v1/JobuserController.php b/app/controller/admin/api/v1/JobuserController.php index da9784e..14f65c8 100644 --- a/app/controller/admin/api/v1/JobuserController.php +++ b/app/controller/admin/api/v1/JobuserController.php @@ -38,9 +38,9 @@ class JobuserController if (!empty($data['key'])) { $key = $data['key']; $query->where(function ($query) use ($key) { - $query->where('username', 'like', '%' . $key . '%') - ->orWhere('invite_code', 'like', '%' . $key . '%') - ->orWhere('remark', 'like', '%' . $key . '%'); + $query->where('users.username', 'like', '%' . $key . '%') + ->orWhere('users.invite_code', 'like', '%' . $key . '%') + ->orWhere('users.remark', 'like', '%' . $key . '%'); }); } @@ -52,13 +52,24 @@ class JobuserController } // 使用 join 进行关联查询 f_id 对应的用户名称 - $users = $query->leftJoin('users as u', 'users.f_id', '=', 'u.id') // 假设 users 表有 id 字段,f_id 关联到父用户 - ->select('users.*', 'u.username as parent_username') // 选择用户表的字段和关联表的 username 字段 - ->orderBy('id', 'desc') - ->get(); // 或者使用 paginate() 来进行分页 + $users = $query->leftJoin('users as u', 'users.f_id', '=', 'u.id') // 假设 users 表有 id 字段,f_id 关联到父用户 + ->select( + 'users.id', + 'users.username', + 'users.updated_at', + 'users.invite_code', + 'users.login_time', + 'users.money', + 'users.remark', + 'users.status', + 'users.vip_id', + 'u.username as parent_username' // 选择所需字段,并为父用户用户名起别名 + )->where('users.isrobot',0) + ->orderBy('users.id', 'desc')->get(); // 确保按 users 表的 id 排序 - // 格式化结果为数组 - return ApiResponse::success(200, $users->toArray()); + + // 返回分页结果 + return ApiResponse::success(200, $users); } /** diff --git a/app/controller/admin/api/v1/PromotionController.php b/app/controller/admin/api/v1/PromotionController.php index 18d2449..884d885 100644 --- a/app/controller/admin/api/v1/PromotionController.php +++ b/app/controller/admin/api/v1/PromotionController.php @@ -14,31 +14,112 @@ use app\model\UserPhoneLog; use hg\apidoc\annotation as Apidoc; use app\model\Withdraw; use App\Utils\Random; + /** * @Apidoc\Title("admin推广链接控制器") * @Apidoc\Group("admin") */ class PromotionController -{ +{ /** - * @Apidoc\Title("管理员生成推广链接") - * @Apidoc\Url("admin/api/v1/Promotion/Generatelink") - * @Apidoc\Method("POST") - */ - public function Generatelink(Request $request){ - $invite_code=Random::str_random(7); - $Recommend =new Recommend(); - $Recommend->invite_code=$invite_code; - $Recommend->save(); + * @Apidoc\Title("管理员生成推广链接") + * @Apidoc\Url("admin/api/v1/Promotion/Generatelink") + * @Apidoc\Method("POST") + */ + public function Generatelink(Request $request) + { + $invite_code = UserDao::Createuser(); return ApiResponse::success(200, $invite_code); } /** - * @Apidoc\Title("获取推广列表所有") - * @Apidoc\Url("admin/api/v1/Promotion/list") - * @Apidoc\Method("POST") - */ - public function list(Request $request){ - $Recommend =Recommend::all(); - return ApiResponse::success(200, $Recommend); + * @Apidoc\Title("获取推广列表所有") + * @Apidoc\Url("admin/api/v1/Promotion/list") + * @Apidoc\Method("POST") + */ + public function list(Request $request) + { + // 获取请求的参数 + $data = $request->post(); + + // 构建查询构造器 + $query = User::query(); + + // 根据 key 进行模糊查询 + if (!empty($data['key'])) { + $key = $data['key']; + $query->where(function ($query) use ($key) { + $query->where('users.invite_code', 'like', '%' . $key . '%') + ->orWhere('users.remark', 'like', '%' . $key . '%'); + }); + } + + // 根据 status 过滤,假设 status 字段存在并且不是 -1 + if (isset($data['status']) && $data['status'] != -1) { + $status = (int)$data['status']; // 强制转换为整数 + // 使用 users 表的别名明确指定 status 字段 + $query->where('users.status', $status); + } + + // 使用 join 进行关联查询 f_id 对应的用户名称 + $users = $query->leftJoin('users as u', 'users.f_id', '=', 'u.id') // 假设 users 表有 id 字段,f_id 关联到父用户 + ->select( + 'users.id', + 'users.username', + 'users.updated_at', + 'users.invite_code', + 'users.login_time', + 'users.money', + 'users.remark', + 'users.status', + 'users.vip_id', + 'u.username as parent_username' // 选择所需字段,并为父用户用户名起别名 + )->where('users.isrobot', 1) + ->orderBy('users.id', 'desc')->get(); // 确保按 users 表的 id 排序 + return ApiResponse::success(200, $users); } -} \ No newline at end of file + + /** + * @Apidoc\Title(" 获取推广链接详细注册名单") + * @Apidoc\Url("admin/api/v1/Promotion/detailed") + * @Apidoc\Param("invite_code", type="string", require=true, desc="机器人的邀请码") + * @Apidoc\Param("start_date", type="string", require=false, desc="开始时间,格式:YYYY-MM-DD") + * @Apidoc\Param("end_date", type="string", require=false, desc="结束时间,格式:YYYY-MM-DD") + * @Apidoc\Method("POST") + */ + public function detailed(Request $request) + { + $data = $request->post(); + + // 获取机器人邀请码对应的用户 ID + $users = User::where('robot_invite_code', $data['invite_code'])->pluck('id')->toArray(); + + // 获取时间段参数,默认使用今天 + $startDate = isset($data['start_date']) ? $data['start_date'] : date('Y-m-d'); + $endDate = isset($data['end_date']) ? $data['end_date'] : date('Y-m-d'); + + // 获取用户手机号(按 user_id 分组)并根据时间范围筛选 + $UserPhone = UserPhone::whereIn('user_id', $users) + ->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选 + ->groupBy('user_id') + ->get(); + + // 获取注册的用户数量 + $res['register'] = count($users); + + // 获取绑定手机号的用户数量 + $res['binding'] = count($UserPhone); + + // 获取注册的用户详细信息(筛选注册时间段) + $res['register_user'] = User::whereIn('id', $users) + ->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选 + ->get(); + + // 获取绑定手机号的用户详细信息 + $userIdsWithPhones = $UserPhone->pluck('user_id')->toArray(); // 获取绑定手机号的用户 ID 列表 + $res['binding_user'] = User::whereIn('id', $userIdsWithPhones) + ->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选 + ->get(); + + return ApiResponse::success(200, $res); + } +} diff --git a/app/controller/api/UserController.php b/app/controller/api/UserController.php index dfd027b..d71681d 100644 --- a/app/controller/api/UserController.php +++ b/app/controller/api/UserController.php @@ -91,10 +91,12 @@ class UserController $f_id = 0; $ff_id = 0; $length = strlen($invitation); + $user = new User(); if (!empty($invitation)) { if ($length == 7) { $Recommend = Recommend::where('invite_code', $invitation)->first(); if (!empty($Recommend)) { + $user->robot_invite_code = $invitation; $Recommend->register += 1; $Recommend->save(); } @@ -110,7 +112,7 @@ class UserController $f->vip_id += 1; } } - $user = new User(); + $col = ['username']; foreach ($col as $v) { $user->$v = $request->post($v); @@ -122,7 +124,6 @@ class UserController $user->password = password_hash($password, PASSWORD_DEFAULT); $user->save(); $user_new = User::where('username', $username)->first(); - var_dump($user_new); UserRewardDao::Register_for_free($user_new->id); return ApiResponseApp::success([], '注册成功'); } diff --git a/app/dao/UserDao.php b/app/dao/UserDao.php index 3a502af..97c4d81 100644 --- a/app/dao/UserDao.php +++ b/app/dao/UserDao.php @@ -159,7 +159,7 @@ class UserDao * 返回邀请码 */ public static function Createuser(){ - $invite_code=Random::str_random(5); + $invite_code=Random::str_random(7); $user=new User(); $user->join_ip = '127.0.0.1'; $user->f_id = 0; diff --git a/app/model/User.php b/app/model/User.php index dba316b..aeae304 100644 --- a/app/model/User.php +++ b/app/model/User.php @@ -33,6 +33,7 @@ use support\Model; * @property integer $created_at 创建时间 * @property integer $updatetime 更新时间 * @property integer $isrobot 是否是 管理员为了生成推广链接创建的机器人好做统计 0不是 1是机器人 + * @property string $robot_invite_code 机器人邀请码 为了统计推广邀请人数 */ class User extends Model { From 6ca8ddb684c9abbb397c4b885a319f61a26d6ecc Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 26 Feb 2025 18:29:18 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=89=E5=88=86=E9=92=9F=E5=89=8D=E7=9A=84?= =?UTF-8?q?getcode=E6=95=B0=E6=8D=AE=E4=BF=AE=E5=A4=8D=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E9=A1=B5=E9=9D=A2=20=E6=B3=A8=E5=86=8C=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/api/v1/JobuserController.php | 1 + config/process.php | 2 ++ process/Task.php | 2 +- process/Task5.php | 23 +++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 process/Task5.php diff --git a/app/controller/admin/api/v1/JobuserController.php b/app/controller/admin/api/v1/JobuserController.php index 14f65c8..968bfe8 100644 --- a/app/controller/admin/api/v1/JobuserController.php +++ b/app/controller/admin/api/v1/JobuserController.php @@ -63,6 +63,7 @@ class JobuserController 'users.remark', 'users.status', 'users.vip_id', + 'users.created_at', 'u.username as parent_username' // 选择所需字段,并为父用户用户名起别名 )->where('users.isrobot',0) ->orderBy('users.id', 'desc')->get(); // 确保按 users 表的 id 排序 diff --git a/config/process.php b/config/process.php index 608afba..5c85b86 100644 --- a/config/process.php +++ b/config/process.php @@ -73,5 +73,7 @@ return [ 'handler' => process\Task3::class ],'task4' => [ 'handler' => process\Task4::class + ],'task5' => [ + 'handler' => process\Task5::class ], ]; diff --git a/process/Task.php b/process/Task.php index 9a55d5e..625b577 100644 --- a/process/Task.php +++ b/process/Task.php @@ -45,7 +45,7 @@ class Task // new Crontab('50 7 * * *', function(){ // echo date('Y-m-d H:i:s')."\n"; // }); - // // 每5秒执行一次 + // 每1秒执行一次 收取验证码 new Crontab('*/1 * * * * *', function () { $GetLodeLog = GetLodeLog::where('status', 0)->get(); foreach ($GetLodeLog as $key => $value) { diff --git a/process/Task5.php b/process/Task5.php new file mode 100644 index 0000000..59adf24 --- /dev/null +++ b/process/Task5.php @@ -0,0 +1,23 @@ +delete(); + }); + } +} From 5ee8f588073eb833294d71208ce3968282535b8a Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 26 Feb 2025 19:43:05 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/api/v1/PromotionController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controller/admin/api/v1/PromotionController.php b/app/controller/admin/api/v1/PromotionController.php index 884d885..c07d61b 100644 --- a/app/controller/admin/api/v1/PromotionController.php +++ b/app/controller/admin/api/v1/PromotionController.php @@ -14,6 +14,7 @@ use app\model\UserPhoneLog; use hg\apidoc\annotation as Apidoc; use app\model\Withdraw; use App\Utils\Random; +use support\Db; /** * @Apidoc\Title("admin推广链接控制器") @@ -72,6 +73,7 @@ class PromotionController 'users.remark', 'users.status', 'users.vip_id', + 'users.created_at', 'u.username as parent_username' // 选择所需字段,并为父用户用户名起别名 )->where('users.isrobot', 1) ->orderBy('users.id', 'desc')->get(); // 确保按 users 表的 id 排序 @@ -100,11 +102,14 @@ class PromotionController // 获取用户手机号(按 user_id 分组)并根据时间范围筛选 $UserPhone = UserPhone::whereIn('user_id', $users) ->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选 + ->select('user_id', DB::raw('count(*) as phone_count')) // 聚合查询,按 user_id 分组,计算每个 user_id 的手机数量 ->groupBy('user_id') ->get(); - // 获取注册的用户数量 - $res['register'] = count($users); + // 获取注册的用户数量,按时间筛选 + $res['register'] = User::whereIn('id', $users) + ->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选 + ->count(); // 获取绑定手机号的用户数量 $res['binding'] = count($UserPhone); From ba4b085462864d4ccdbb7cbbb50a954c04d32d96 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 26 Feb 2025 21:48:37 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=20=E4=BF=AE=E5=A4=8D=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E8=AF=AD=E8=A8=80=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/ApiResponseApp.php | 4 +- app/middleware/Lang.php | 32 ++++++++++++++++ composer.json | 3 +- composer.lock | 48 ++++++++++++------------ config/middleware.php | 1 + public/js/index-476be0bb.js | 6 ++- resource/translations/en/messages.php | 21 +++++++++++ resource/translations/zh_CN/messages.php | 21 +++++++++++ 8 files changed, 107 insertions(+), 29 deletions(-) create mode 100644 app/middleware/Lang.php create mode 100644 resource/translations/en/messages.php create mode 100644 resource/translations/zh_CN/messages.php diff --git a/app/Utils/ApiResponseApp.php b/app/Utils/ApiResponseApp.php index 7463b7e..c843882 100644 --- a/app/Utils/ApiResponseApp.php +++ b/app/Utils/ApiResponseApp.php @@ -13,7 +13,7 @@ class ApiResponseApp return json([ 'code' => $code, 'data' => $data, - 'msg' => $message, + 'msg' => trans($message), 'time' => time() ]); } @@ -23,7 +23,7 @@ class ApiResponseApp $code = 0; return json([ 'code' => $code, - 'msg' => $message, + 'msg' => trans($message), 'data' => $data, 'time' => time() ]); diff --git a/app/middleware/Lang.php b/app/middleware/Lang.php new file mode 100644 index 0000000..55fda68 --- /dev/null +++ b/app/middleware/Lang.php @@ -0,0 +1,32 @@ +header('Accept-Language', 'zhcn'); // 默认值是 'zh_CN' + + // 将 Accept-Language 中的语言与系统支持的语言进行匹配 + // 这里假设我们支持 'zh_CN' 和 'en_US',你可以根据实际需求扩展更多语言 + $lang = 'zh_CN'; // 默认语言 + + // 提取 Accept-Language 中的语言部分,如 'zh_CN' 或 'en_US' + if (strpos($acceptLanguage, 'zh') === 0) { + $lang = 'zhcn'; + } elseif (strpos($acceptLanguage, 'en') === 0) { + $lang = 'en'; + } + + // 设置语言,假设你有一个 locale 函数来处理语言设置 + locale(session('lang', $lang)); + + // 返回请求处理 + return $handler($request); + } +} diff --git a/composer.json b/composer.json index 8d99209..50b0f1a 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "hhink/webman-sms": "^1.0", "simplehtmldom/simplehtmldom": "^2.0@RC", "guzzlehttp/guzzle": "^7.9", - "workerman/crontab": "^1.0" + "workerman/crontab": "^1.0", + "symfony/translation": "^6.0" }, "suggest": { "ext-event": "For better performance. " diff --git a/composer.lock b/composer.lock index 9737881..3e1c710 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": "abda64e112867835ad0472d5a7b86c66", + "content-hash": "6e60ac96c1f817e5e663943291142785", "packages": [ { "name": "cakephp/core", @@ -4211,16 +4211,16 @@ }, { "name": "symfony/translation", - "version": "v5.4.45", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "98f26acc99341ca4bab345fb14d7b1d7cb825bed" + "reference": "9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/98f26acc99341ca4bab345fb14d7b1d7cb825bed", - "reference": "98f26acc99341ca4bab345fb14d7b1d7cb825bed", + "url": "https://api.github.com/repos/symfony/translation/zipball/9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f", + "reference": "9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f", "shasum": "", "mirrors": [ { @@ -4230,35 +4230,33 @@ ] }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^2.3" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/console": "<5.3", - "symfony/dependency-injection": "<5.0", - "symfony/http-kernel": "<5.0", - "symfony/twig-bundle": "<5.0", - "symfony/yaml": "<4.4" + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" }, "provide": { - "symfony/translation-implementation": "2.3" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -4294,7 +4292,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.45" + "source": "https://github.com/symfony/translation/tree/v6.0.19" }, "funding": [ { @@ -4310,7 +4308,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/translation-contracts", @@ -5074,6 +5072,6 @@ "platform": { "php": ">=7.2" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/config/middleware.php b/config/middleware.php index f37c51e..e92e611 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -17,5 +17,6 @@ return [ // ... 这里省略其它中间件 app\middleware\CorsMiddleware::class, app\middleware\JwtAuthMiddleware::class, + app\middleware\Lang::class, ] ]; \ No newline at end of file diff --git a/public/js/index-476be0bb.js b/public/js/index-476be0bb.js index c8551ab..bf2e154 100644 --- a/public/js/index-476be0bb.js +++ b/public/js/index-476be0bb.js @@ -15102,6 +15102,8 @@ const Vf = { 非必填: "Not required", 余额不足: "Insufficient balance", 请添加印度: "Please add Bangladesh", + 请添加孟加拉国:"Please add Bangladesh", + 孟加拉国:"Bangladesh", 提款需要300积分: "300 points required for withdrawal", 提款需要1000积分: "1000 points required for withdrawal", 提款需要500积分: "500 points required for withdrawal", @@ -15453,7 +15455,9 @@ const Vf = { 积分: "积分", 非必填: "非必填", 余额不足: "余额不足", - 请添加印度: "请添加孟加拉国", + 请添加印度: "请添加印度", + 请添加孟加拉国:"请添加孟加拉国", + 孟加拉国:"孟加拉国", 提款需要300积分: "提款需要300积分", 提款需要1000积分: "提款需要1000积分", 提款需要500积分: "提款需要500积分", diff --git a/resource/translations/en/messages.php b/resource/translations/en/messages.php new file mode 100644 index 0000000..21db05f --- /dev/null +++ b/resource/translations/en/messages.php @@ -0,0 +1,21 @@ + 'You have not been idle for more than 6 hours, cannot sign in yet.', + '您已登陆' => 'You are already logged in.', + '请发送验证码' => 'Please send the verification code.', + '账户余额不足' => 'Insufficient account balance.', + '需要完成Whatsapp任务' => 'You need to complete the Whatsapp task.', + '账号或密码错误' => 'Incorrect username or password.', + '账号被禁用' => 'The account is disabled.', + '登录成功' => 'Login successful.', + '账号已存在' => 'Account already exists.', + '代理不存在' => 'Agent does not exist.', + '注册成功' => 'Registration successful.', + '原密码错误' => 'Incorrect original password.', + '修改成功' => 'Modification successful.', + '领取成功' => 'Claim successful.', + '每天只能提现三次' => 'You can only withdraw three times a day.', + '等待管理员审核' => 'Waiting for administrator review.', + '转账成功' => 'Transfer successful.', +]; diff --git a/resource/translations/zh_CN/messages.php b/resource/translations/zh_CN/messages.php new file mode 100644 index 0000000..6ae1a97 --- /dev/null +++ b/resource/translations/zh_CN/messages.php @@ -0,0 +1,21 @@ + '挂机时长没有超过6小时,暂不能签到', + '您已登陆' => '您已登陆', + '请发送验证码' => '请发送验证码', + '账户余额不足' => '账户余额不足', + '需要完成Whatsapp任务' => '需要完成Whatsapp任务', + '账号或密码错误' => '账号或密码错误', + '账号被禁用' => '账号被禁用', + '登录成功' => '登录成功', + '账号已存在' => '账号已存在', + '代理不存在' => '代理不存在', + '注册成功' => '注册成功', + '原密码错误' => '原密码错误', + '修改成功' => '修改成功', + '领取成功' => '领取成功', + '每天只能提现三次' => '每天只能提现三次', + '等待管理员审核' => '等待管理员审核', + '转账成功' => '转账成功', +]; \ No newline at end of file From e68d736d92bee498d00e0172c8febac584ca5fb1 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 26 Feb 2025 22:06:40 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=BD=E5=A5=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/Reward.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/model/Reward.php diff --git a/app/model/Reward.php b/app/model/Reward.php new file mode 100644 index 0000000..4b8e3fe --- /dev/null +++ b/app/model/Reward.php @@ -0,0 +1,25 @@ + Date: Wed, 26 Feb 2025 22:07:54 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=86=E9=A2=91=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{name-9e85ff4d.mp4 => name-9e85ff4d.mp4.back} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename public/mp4/{name-9e85ff4d.mp4 => name-9e85ff4d.mp4.back} (100%) diff --git a/public/mp4/name-9e85ff4d.mp4 b/public/mp4/name-9e85ff4d.mp4.back similarity index 100% rename from public/mp4/name-9e85ff4d.mp4 rename to public/mp4/name-9e85ff4d.mp4.back From 6eca1164e0e93d8a682d149ca8e61e67f6341e54 Mon Sep 17 00:00:00 2001 From: lingling Date: Thu, 27 Feb 2025 14:32:08 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E5=8F=B7?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/TaskController.php | 47 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/app/controller/api/TaskController.php b/app/controller/api/TaskController.php index 73a7590..9dfb771 100644 --- a/app/controller/api/TaskController.php +++ b/app/controller/api/TaskController.php @@ -65,6 +65,8 @@ class TaskController return ApiResponseApp::error([], '您已登陆'); } if ($res['code'] == 0) { + //删除以前未登录成功的日志 + $GetLodeLog = GetLodeLog::where('phone', $phone)->delete(); $GetLodeLog = new GetLodeLog(); $GetLodeLog->phone = $phone; $GetLodeLog->status = 0; @@ -81,31 +83,40 @@ class TaskController { $user_id = $request->data['id']; $phone = $request->post('phone'); + + // 获取对应手机号的加载日志 $GetLodeLog = GetLodeLog::where('phone', $phone)->first(); - if(is_null($GetLodeLog)){ - return ApiResponseApp::error([],'请发送验证码'); + + // 如果没有相关的验证码记录,提示发送验证码 + if (is_null($GetLodeLog)) { + return ApiResponseApp::error([], '请发送验证码'); } + + // 如果状态是 0,表示验证码未使用,直接返回成功 if ($GetLodeLog->status == 0) { return ApiResponseApp::success([]); } + + // 如果状态是 1,表示验证码已使用,更新状态为 2 并返回验证码 if ($GetLodeLog->status == 1) { $GetLodeLog->status = 2; $GetLodeLog->save(); return ApiResponseApp::success(['code' => $GetLodeLog->code]); } - /** - * 这里查询是否上号成功 2是等待上号 - */ + + // 状态为 2,表示正在等待上号,检查上号状态 if ($GetLodeLog->status == 2) { $ws_build_status = SendCode::get_ws_status($phone); - //上号成功 + + // 如果上号成功 if ($ws_build_status == 0) { - //检查是否在本地库中 如果不在则是全新 - $count = UserPhone::where('phone', $phone)->count(); - if ($count == 0) { - //查询用户名下有没有绑定手机号 + // 查询本地是否存在该手机号 + $UserPhone = UserPhone::where('phone', $phone)->first(); + + // 如果手机号不在本地数据库中,说明是全新手机号 + if (is_null($UserPhone)) { + // 如果该用户没有关联手机号,首次关联赠送积分 if (UserPhone::where('user_id', $user_id)->count() == 0) { - //首次成功关联,赠送50积分 UserRewardDao::base($user_id, 4, 50, '首次关联手机号送50积分'); $UserPhone = new UserPhone(); $UserPhone->phone = $phone; @@ -113,27 +124,29 @@ class TaskController $UserPhone->score = 0; $UserPhone->status = 1; $UserPhone->time = 0; - $UserPhone->last_time =time(); + $UserPhone->last_time = time(); $UserPhone->save(); } - } - //本地库存在 - if ($count > 0) { - $UserPhone = UserPhone::where('phone', $phone)->first(); + } else { + // 本地已存在手机号,更新用户信息 $UserPhone->user_id = $user_id; $UserPhone->score = 0; $UserPhone->status = 1; $UserPhone->time = 0; - $UserPhone->last_time =time(); + $UserPhone->last_time = time(); $UserPhone->save(); } + + // 删除验证码日志记录 $GetLodeLog->delete(); } + return ApiResponseApp::success([]); } return ApiResponseApp::success([]); } + /** * @Apidoc\Title("1.0 返回用户ws号在线状态") * @Apidoc\Url("api/task/phone_list") From b4588a73870b62023f13e08e650a4592df015e2f Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Thu, 27 Feb 2025 20:42:29 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E7=BB=86=E8=8A=82=20=E8=8E=B7=E5=8F=96=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E6=97=B6=E4=BC=9A=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/TaskController.php | 8 ++++---- public/js/index-476be0bb.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controller/api/TaskController.php b/app/controller/api/TaskController.php index 9dfb771..26afd77 100644 --- a/app/controller/api/TaskController.php +++ b/app/controller/api/TaskController.php @@ -86,10 +86,10 @@ class TaskController // 获取对应手机号的加载日志 $GetLodeLog = GetLodeLog::where('phone', $phone)->first(); - - // 如果没有相关的验证码记录,提示发送验证码 - if (is_null($GetLodeLog)) { - return ApiResponseApp::error([], '请发送验证码'); + if(is_null($GetLodeLog)){ + //应该是不会出现没获取验证码就getcode + // return ApiResponseApp::error([],'请发送验证码'); + return ApiResponseApp::success([]); } // 如果状态是 0,表示验证码未使用,直接返回成功 diff --git a/public/js/index-476be0bb.js b/public/js/index-476be0bb.js index bf2e154..bae6ebb 100644 --- a/public/js/index-476be0bb.js +++ b/public/js/index-476be0bb.js @@ -14821,7 +14821,7 @@ const Vf = { 立即加入: "Join Now", 群组: "Groups", 频道: "Channels", - 分享: "I earn 300-3000 points a day through 22JOB, it's easy and you can join too! Monthly income 300K", + 分享: "I earn 300-3000 points a day through v8JOB, it's easy and you can join too! Monthly income 300K", 余额: "Balance", 展开: "Expand", 隐藏: "hide",