master
elf 2 years ago
parent 526e76079b
commit de1feb8f1e

@ -11,6 +11,8 @@ namespace Admin\Controller;
use User\Api\UserApi as UserApi; use User\Api\UserApi as UserApi;
use function GuzzleHttp\Psr7\str; use function GuzzleHttp\Psr7\str;
use Base\Factory\BaseFactory; 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');
}
}
} }

Loading…
Cancel
Save