From de1feb8f1ef9f07d979cbcd09dad71fcc6932012 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Sun, 12 Mar 2023 19:10:46 +0800 Subject: [PATCH] test --- .../Controller/TimingController.class.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 0bc388b..b585470 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -11,6 +11,8 @@ namespace Admin\Controller; use User\Api\UserApi as UserApi; use function GuzzleHttp\Psr7\str; use Base\Factory\BaseFactory; +use Base\Service\MendService; +use Base\Tool\Log; /** * 后台首页控制器 @@ -1347,4 +1349,56 @@ class TimingController extends AdminController { } + public function shiftPlayers() { + $items = [ + 'lingtouyang' => 'cmyibu', + // 'lingtouyan' => 'cmbabu', + // '18054742361' => 'yibuqizu', + // '17828125172' => 'yibubazu', + // '19511891774' => 'yibuyizu', + // '15181732144' => 'yibuerzu', + // '15202815645' => 'yibusanzu', + // '17606977448' => 'yibuwuzu', + // 'lingtouyan1' => 'babubazu', + // 'dongling' => 'dongling1', + // '13272727572' => 'jiangshibo01', + // 'hdfzxyz' => 'hdfzxyz01', + ]; + foreach ($items as $fromPromoteAccount => $toPromoteAccount) { + $users = M("user","tab_")->where("promote_account='" . $fromPromoteAccount . "'")->select(); + foreach ($users as $user) { + $params = [ + 'promote_id_to' => $toPromoteAccount, + 'promote_id' => $toPromoteAccount, + 'order_time' => '2022-08-01 00:00:00', + 'allow_over_week' => 1, + 'remark' => '后台迁移', + 'user_id' => $user['id'], + 'account' => $user['account'], + ]; + var_dump($params); + // $this->shiftPlayer($params); + } + } + } + + private function shiftPlayer($params) { + $service = new MendService(); + try { + $service->addMendTask($params); + + $userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find(); + $promoteToData = M('promote','tab_')->field('account')->where(['id'=> $params['prmoote_id_to']])->find(); + addOperationLog([ + 'op_type' => 1, + 'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'], + 'op_name' => '编辑推广补链', + 'url' => U('Mend/edit', ['id' => $userData['id']]), + 'menu' => '推广员-推广员管理-推广补链-编辑推广补链', + 'content' => json_encode($params) + ]); + } catch (\Exception $e) { + Log::error($e->getMessage(), 'shift_players'); + } + } }