作者 刘朕
1 个管道 的构建 通过 耗费 2 秒

数据导出调试

... ... @@ -15,7 +15,8 @@ use think\Db;
class TestController extends HomeBaseController
{
protected $uid = 309; //451
protected $uid = 83; //451
protected $complete = [83];
public function prob()
{
... ... @@ -24,8 +25,6 @@ class TestController extends HomeBaseController
$uid = $this->uid;
$user = Db::name('user')->where('id',$uid)->find();
$user['my_user_id'] = Db::name('my_user')->where('uid',$uid)->value('id');
$indent = Db::name('indent')->where('salesman_uid',$uid)->order('create_time','desc')->select();
$arr = collection($indent)->toArray();
$data = [];
$state_arr = [
4 => '待付款',
... ... @@ -34,7 +33,9 @@ class TestController extends HomeBaseController
5 => '已发货',
6 => '待取货'
];
foreach ($arr as &$v) {
$indent_ids = Db::name('money_income')->where('uid',$uid)->group('indent_id')->column('indent_id');
foreach ($indent_ids as &$id) {
$v = Db::name('indent')->where('id',$id)->order('create_time','desc')->select();
if($v['state'] == 3 || $v['state'] == 5) {
$money = Db::name('money_income')->where('uid',$uid)->where('indent_id',$v['id'])->value('money');
$fact_money = Db::name('money_income')->where('uid',$uid)->where('indent_id',$v['id'])->sum('money');
... ... @@ -58,6 +59,32 @@ class TestController extends HomeBaseController
];
}
}
// $indent = Db::name('indent')->where('salesman_uid',$uid)->order('create_time','desc')->select();
// $arr = collection($indent)->toArray();
// foreach ($arr as &$v) {
// if($v['state'] == 3 || $v['state'] == 5) {
// $money = Db::name('money_income')->where('uid',$uid)->where('indent_id',$v['id'])->value('money');
// $fact_money = Db::name('money_income')->where('uid',$uid)->where('indent_id',$v['id'])->sum('money');
//// $income = Db::name('money_income')->where('uid',$uid)->where('indent_id',$v['id'])->select();
//// $v['income'] = collection($income)->toArray();
// $data[] = [
// $v['id'],
// $money,
// $v['book_num'],
// $v['name'],
// $v['phone'],
// $v['school'].'-'.$v['grade'].$v['class'],
// $state_arr[$v['state']],
// date('Y-m-d H:i:s',$v['create_time']),
// date('Y-m-d H:i:s',$v['pay_time']),
// $v['region'],
// $v['beiyong_address'],
// $money,
// $fact_money,
// $fact_money != $money ? '是' : '否'
// ];
// }
// }
// 查询平台书籍收入金额
$this->excel($user,$data);
print_r($arr);exit;
... ...