您好,登錄后才能下訂單哦!
這篇文章主要介紹PHP如何實現(xiàn)商品成交時發(fā)送短信功能,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
核心代碼如下所示:
/* * ------------------------------------------------- * 修改狀態(tài) public * Author: lzp Time:-- * ------------------------------------------------- */ public function changeStateAction() { $id = $_REQUEST['id']; $result = $this->changeConfirmState($id); if ($result) { $this->success("修改成功"); } else { $this->error("修改失敗"); } } 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('已超時!');history.back();</script>"; die; }else if(strtotime($rel[]['finish_time'])>){ echo "<script>alert('已成交!');history.back();</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 = "此條需求已成交,下次再來喲!"; smsApp($mobile,$content); //發(fā)短信 return $result; } }
以上是“PHP如何實現(xiàn)商品成交時發(fā)送短信功能”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業(yè)資訊頻道!
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。