淘宝退款优化
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
* @Author: kangkang
|
* @Author: kangkang
|
||||||
* @Date: 2020-10-13 19:52:37
|
* @Date: 2020-10-13 19:52:37
|
||||||
* @LastEditors: kangkang
|
* @LastEditors: kangkang
|
||||||
* @LastEditTime: 2020-10-22 09:48:36
|
* @LastEditTime: 2020-10-22 17:31:20
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace app\order\controller;
|
namespace app\order\controller;
|
||||||
@@ -22,7 +22,7 @@ class TbRefund extends Controller
|
|||||||
{
|
{
|
||||||
$refund = new RefundMOdel;
|
$refund = new RefundMOdel;
|
||||||
$userModel = new UserModel;
|
$userModel = new UserModel;
|
||||||
$get_list = $refund->getListPage();
|
$get_list = $refund->getListPage([],'*','Modified desc');
|
||||||
$user_phone = [];
|
$user_phone = [];
|
||||||
$lists = [];
|
$lists = [];
|
||||||
$list = [];
|
$list = [];
|
||||||
@@ -33,13 +33,14 @@ class TbRefund extends Controller
|
|||||||
}
|
}
|
||||||
$lists[] = $v;
|
$lists[] = $v;
|
||||||
}
|
}
|
||||||
$user_test = $userModel->getListPage('LoginCode in('. implode(',', $user_phone) .')','RestAmount,LoginCode');
|
$user_test = $userModel->getListPage('LoginCode in('. implode(',', $user_phone) .') OR Phone in('. implode(',', $user_phone) .')','RestAmount,LoginCode,Phone');
|
||||||
foreach ($user_test as $k=>$v){
|
|
||||||
foreach ($lists as $key=>$val){
|
foreach ($lists as $key=>$val){
|
||||||
if($val['Phone'] == $v['LoginCode']){
|
foreach ($user_test as $k=>$v){
|
||||||
|
if($val['Phone'] == $v['LoginCode'] || $val['Phone'] == $v['Phone']){
|
||||||
$val['account'] = $v['RestAmount'];
|
$val['account'] = $v['RestAmount'];
|
||||||
$list[] = $val;
|
$list[] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$count = $refund->getCount();
|
$count = $refund->getCount();
|
||||||
@@ -58,7 +59,7 @@ class TbRefund extends Controller
|
|||||||
}
|
}
|
||||||
$refund = new RefundMOdel;
|
$refund = new RefundMOdel;
|
||||||
$userModel = new UserModel;
|
$userModel = new UserModel;
|
||||||
$get_list = $refund->getListPage();
|
$get_list = $refund->getListPage([],'*','Modified desc');
|
||||||
$user_phone = [];
|
$user_phone = [];
|
||||||
$lists = [];
|
$lists = [];
|
||||||
$list = [];
|
$list = [];
|
||||||
@@ -69,13 +70,14 @@ class TbRefund extends Controller
|
|||||||
}
|
}
|
||||||
$lists[] = $v;
|
$lists[] = $v;
|
||||||
}
|
}
|
||||||
$user_test = $userModel->getListPage('LoginCode in('. implode(',', $user_phone) .')','RestAmount,LoginCode');
|
$user_test = $userModel->getListPage('LoginCode in('. implode(',', $user_phone) .') OR Phone in('. implode(',', $user_phone) .')','RestAmount,LoginCode,Phone');
|
||||||
foreach ($user_test as $k=>$v){
|
|
||||||
foreach ($lists as $key=>$val){
|
foreach ($lists as $key=>$val){
|
||||||
if($val['Phone'] == $v['LoginCode']){
|
foreach ($user_test as $k=>$v){
|
||||||
|
if($val['Phone'] == $v['LoginCode'] || $val['Phone'] == $v['Phone']){
|
||||||
$val['account'] = $v['RestAmount'];
|
$val['account'] = $v['RestAmount'];
|
||||||
$list[] = $val;
|
$list[] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
115
script/test.php
115
script/test.php
@@ -1,115 +0,0 @@
|
|||||||
<?php
|
|
||||||
$is_script = 1;
|
|
||||||
include '../index.php';
|
|
||||||
|
|
||||||
use app\api\model\Logs;
|
|
||||||
use app\api\model\User;
|
|
||||||
|
|
||||||
$test = new Logs();
|
|
||||||
$list = $test->fetchAll();
|
|
||||||
|
|
||||||
//不应该存在的时间点
|
|
||||||
$not_exit_time = ['23','00','01','02','03','04','05','06','07'];
|
|
||||||
|
|
||||||
$user_manager = [];
|
|
||||||
$user_product = [];
|
|
||||||
$user_vip_price = [];
|
|
||||||
$user_contact = [];
|
|
||||||
$export_info = [];
|
|
||||||
foreach ($list as $info) {
|
|
||||||
switch ($info['operation']) {
|
|
||||||
case '点击客户管理':
|
|
||||||
$user_manager[] = $info;
|
|
||||||
break;
|
|
||||||
case '点击客户信息产品账号':
|
|
||||||
$user_product[] = $info;
|
|
||||||
break;
|
|
||||||
case '点击客户信息会员价':
|
|
||||||
$user_vip_price[] = $info;
|
|
||||||
break;
|
|
||||||
case '点击客户更多联系方式':
|
|
||||||
$user_contact[] = $info;
|
|
||||||
break;
|
|
||||||
case '点击导出所有客户信息':
|
|
||||||
$export_info[] = $info;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$recore_num = 1;
|
|
||||||
|
|
||||||
$start_time = "2020-5-13 15:42:27";
|
|
||||||
$user_click_time = [];
|
|
||||||
//点击用户管理
|
|
||||||
foreach ($user_manager as $v) {
|
|
||||||
// $userlist = $user->field('`LoginCode`')->where(['CreateTime'=>['<',$start_time]])->order('id')->limit('50')->fetchAll();
|
|
||||||
// $user_click_time[] = $start_time;
|
|
||||||
// $data['info'] = json_encode($userlist);
|
|
||||||
$data['create_time'] = $start_time;
|
|
||||||
$test->where(['id' => $v['id']])->update($data);
|
|
||||||
$start_time = formatTime($start_time,10000,30000);
|
|
||||||
echo '更新第'.$recore_num++.'条数据'."\r";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点击导出所有客户信息
|
|
||||||
$start_time = "2020-5-13 15:45:37";
|
|
||||||
foreach($export_info as $v){
|
|
||||||
// $data['info'] = '本次点击时间之前所有客户数据';
|
|
||||||
$data['create_time'] = $start_time;
|
|
||||||
$test->where(['id' => $v['id']])->update($data);
|
|
||||||
$start_time = formatTime($start_time,20000,43200);
|
|
||||||
echo '更新第'.$recore_num++.'条数据'."\r";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//点击客户信息产品账号
|
|
||||||
$k = 0;
|
|
||||||
$start_time = "2020-5-13 15:42:35";
|
|
||||||
//给出客户信息列表
|
|
||||||
|
|
||||||
foreach ($user_product as $v) {
|
|
||||||
// $data['info'] = $user_click_list[$k++]['LoginCode'];
|
|
||||||
$data['create_time'] = $start_time;
|
|
||||||
$test->where(['id' => $v['id']])->update($data);
|
|
||||||
$start_time = formatTime($start_time,100,180);
|
|
||||||
echo '更新第'.$recore_num++.'条数据'."\r";
|
|
||||||
}
|
|
||||||
|
|
||||||
//点击客户信息会员价
|
|
||||||
$k = 0;
|
|
||||||
$start_time = "2020-5-13 15:42:57";
|
|
||||||
foreach ($user_vip_price as $v) {
|
|
||||||
// $data['info'] = $user_click_list[$k++]['LoginCode'];
|
|
||||||
$data['create_time'] = $start_time;
|
|
||||||
$test->where(['id' => $v['id']])->update($data);
|
|
||||||
$start_time = formatTime($start_time,100,180);
|
|
||||||
echo '更新第'.$recore_num++.'条数据'."\r";
|
|
||||||
}
|
|
||||||
|
|
||||||
//点击客户更多联系方式
|
|
||||||
$k = 0;
|
|
||||||
$start_time = "2020-5-13 15:43:08";
|
|
||||||
foreach ($user_contact as $v) {
|
|
||||||
// $data['info'] = $user_click_list[$k++]['LoginCode'];
|
|
||||||
$data['create_time'] = $start_time;
|
|
||||||
$test->where(['id' => $v['id']])->update($data);
|
|
||||||
$start_time = formatTime($start_time,100,180);
|
|
||||||
echo '更新第'.$recore_num++.'条数据'."\r";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function formatTime($time,$rand1,$rand2)
|
|
||||||
{
|
|
||||||
global $not_exit_time;
|
|
||||||
|
|
||||||
$c_time = date('Y-m-d H:i:s',strtotime($time) + rand($rand1,$rand2));
|
|
||||||
$start_time = explode(':',explode(' ',$c_time)[1])[0];
|
|
||||||
if(!in_array($start_time,$not_exit_time)){
|
|
||||||
|
|
||||||
return $c_time;
|
|
||||||
} else {
|
|
||||||
return formatTime($c_time,$rand1,$rand2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user