My Order

get_row( $wpdb->prepare( "SELECT count(0) as num FROM guess_order WHERE user_id = %s LIMIT 1", $user_id ) ); $count = $row->num; $guessList = $wpdb->get_results("select * from guess_order where user_id = ". (int) $user_id .' order by id desc limit '. (($page - 1) * $page_size) . "," . $page_size);//查多条数据 foreach ($guessList as &$row){ $digit_1_money = $digit_2_money = $digit_3_money = $digit_box_money =0; $a = $b = $c = $ab = $ac = $bc = $abc = $box = []; if(!empty($row)){ if(empty($row->order_sn)){ $response = json_decode($row->response, 1); $row->order_sn = $response['bizData']['order_sn']; } $guess_content = json_decode($row->guess_content, 1); $digit_1_txt = $digit_2_txt = $digit_3_txt = $digit_box_txt = ''; foreach ($guess_content['lottery_numbers'] as $item){ if($item['digits_type'] == 1){ $arr = []; foreach ($item['digits_data'] as $k => $chid){ $str = $k . ':'; $temp =[]; foreach ($chid as $citem){ $digit_1_money+= $citem['number']; $temp[] = $citem['digits'] . '(' . $citem['number'] .')'; switch($k){ case 'A': $a[] = $citem['digits']; break; case 'B': $b[] = $citem['digits']; break; case 'C': $c[] = $citem['digits']; break; } } $str .= implode(',',$temp); $arr[] = $str; } $digit_1_txt = implode('; ',$arr); } if($item['digits_type'] == 2){ $arr = []; foreach ($item['digits_data'] as $k => $chid){ $str = $k . ':'; $temp =[]; foreach ($chid as $citem){ $digit_2_money+= $citem['number']; $temp[] = $citem['digits'] . '(' . $citem['number'] .')'; switch($k){ case 'AB': $ab[] = $citem['digits']; break; case 'BC': $bc[] = $citem['digits']; break; case 'AC': $ac[] = $citem['digits']; break; } } $str .= implode(',',$temp); $arr[] = $str; } $digit_2_txt = implode('; ',$arr); } if($item['digits_type'] == 3){ $arr = []; foreach ($item['digits_data'] as $chid){ $digit_3_money+= $chid['number']; $arr[] = $chid['digits'] . '(' . $chid['number'] .')'; $abc[] = $citem['digits']; } $digit_3_txt ='ABC:'. implode(', ',$arr); } if($item['digits_type'] == 4){ $arr = []; foreach ($item['digits_data'] as $chid){ $digit_box_money+= $chid['number']; $arr[] = $chid['digits'] . '(' . $chid['number'] .')'; $box[] = $chid['digits']; } $digit_box_txt = 'Box :'. implode(', ',$arr); } } } $row->digit_1_txt = $digit_1_txt; $row->digit_2_txt = $digit_2_txt; $row->digit_3_txt = $digit_3_txt; $row->digit_box_txt = $digit_box_txt; unset($row->guess_content); } } ?> My bet