Changeset 3302894
- Timestamp:
- 05/29/2025 10:57:09 AM (10 months ago)
- Location:
- sell-esim/trunk
- Files:
-
- 2 edited
-
src/ApiClient.php (modified) (2 diffs)
-
templates/esim-dataplan-list.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sell-esim/trunk/src/ApiClient.php
r3118903 r3302894 27 27 public function register() 28 28 { 29 add_action(" update_option_sellesim_settings", array($this, 'updatePlan'));29 add_action("sellesim_update_plan", array($this, 'updatePlan')); 30 30 add_action('woocommerce_payment_complete', array($this, 'orderHandle')); 31 31 } … … 92 92 $client = new self(); 93 93 $dataplan_list = $client->esim_dataplan_list(); 94 update_option('sellesim_dataplan_list', $dataplan_list); 94 if ($dataplan_list) { 95 update_option('sellesim_dataplan_list', $dataplan_list); 96 } 95 97 } 96 98 -
sell-esim/trunk/templates/esim-dataplan-list.php
r2832142 r3302894 3 3 <?php 4 4 settings_errors(); 5 $last_run_time = get_option('sellesim_update_plan_last_run_time', 0); 6 $current_time = time(); 7 // 若最近15分钟没执行过 8 if ($current_time - $last_run_time >= 900) { 9 // 更新套餐 10 do_action('sellesim_update_plan'); 11 // 更新最后执行时间 12 update_option('sellesim_update_plan_last_run_time', $current_time); 13 echo '<p>Updated: ' . date('Y-m-d H:i:s', $current_time) . '</p>'; 14 } else { 15 echo '<p>Last update time: ' . date('Y-m-d H:i:s', $last_run_time) . '</p>'; 16 } 5 17 $dataplan_list = get_option('sellesim_dataplan_list'); 6 18 ?> … … 9 21 <thead> 10 22 <tr> 23 <th><?php echo esc_html('ID'); ?></th> 11 24 <th><?php echo esc_html('SKU'); ?></th> 12 25 <th><?php echo esc_html('eSIM Dataplan name'); ?></th> … … 19 32 <?php 20 33 if($dataplan_list){ 21 foreach ($dataplan_list as $ dataplan) {34 foreach ($dataplan_list as $key => $dataplan) { 22 35 echo ' 23 36 <tr> 37 <td>' . esc_html($key+1) . '</td> 24 38 <td>' . esc_html($dataplan['channel_dataplan_id']) . '</td> 25 39 <td>' . esc_html($dataplan['channel_dataplan_name']) . '</td>
Note: See TracChangeset
for help on using the changeset viewer.