消息数据转换

This commit is contained in:
devil
2020-07-31 18:55:47 +08:00
parent 9e7037d05c
commit 29aff1aca4
12 changed files with 115 additions and 40 deletions

View File

@ -396,5 +396,54 @@ class Devtest extends Common
}
echo 'count:'.count($data).', success:'.$success.', fail:'.$fail;
}
/**
* 消息数据处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-07-26
* @desc description
*/
public function MessageHandle()
{
if(input('pwd') != 'shopxo520')
{
die('非法访问');
}
// 状态
$success = 0;
$fail = 0;
// 获取日志
$data = Db::name('Message')->where(['is_handle'=>0])->limit(0, 500)->select();
if(!empty($data))
{
$business_type_list = [
0 => '默认',
1 => '订单',
2 => '充值',
3 => '提现',
];
foreach($data as $v)
{
$upd_data = [
'is_handle' => 1,
'business_type' => isset($business_type_list[$v['business_type']]) ? $business_type_list[$v['business_type']] : $v['business_type'],
];
// 更新操作
if(Db::name('Message')->where(['is_handle'=>0, 'id'=>$v['id']])->update($upd_data))
{
$success++;
} else {
$fail++;
}
}
}
echo 'count:'.count($data).', success:'.$success.', fail:'.$fail;
}
}
?>