html code omitted...
Model code omitted...
The core code is as follows:
/* * ------------------------------------------------- * Modify status public * Author: lzp Time:-- * ------------------------------------------------- */ public function changeStateAction() { $id = $_REQUEST['id']; $result = $this->changeConfirmState($id); if ($result) { $this->success("Modification was successful"); } else { $this->error("Modification failed"); } } private function changeConfirmState($id) { $reg = $this->priceModel->selectPrice(['id'=>['eq', $id]]); $rel = $this->demandModel->selectDemand(['id'=>['eq',$reg[]['demand_id']]]); $demand_id = $reg[]['demand_id']; $reg['demand'] = $this->priceModel->selectPrice(['demand_id'=>['eq',$demand_id]]); foreach ($reg['demand'] as $key => $value){ if($value['phone'] == $reg[]['phone']){ unset($reg['demand'][$key]); }else{ $new[] = $value['phone']; } } $new = [''=>'********']; if((time()-strtotime($rel[]['create_time']))> ){ echo "<script>alert('Timed out!');();</script>"; die; }else if(strtotime($rel[]['finish_time'])>){ echo "<script>alert('Trade completed!');();</script>"; die; }else{ $data_demand = [ 'is_available' => , 'finish_time' => date("Y-m-d H:i:s") ]; $result['Price'] = $this->priceModel->savePrice( ['id'=>['eq',$id]], ['state'=>] ); $result['Demadn'] = $this->demandModel->saveDemand(['id'=>['eq',$reg[]['demand_id']]] , $data_demand); $mobile = implode(",", $new); $content = "This demand has been sold, come again next time!"; smsApp($mobile,$content); //Send a text messagereturn $result; } }
The above code is the core code that the editor posted to you. The code is quite simple, so I didn’t write too many comments to you. If you encounter any problems during the reference process, please leave me a message. The editor will reply to you in time. Thank you very much for your support for my website!