这篇文章主要介绍PHP如何实现商品成交时发送短信功能,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
核心代码如下所示:
/* * ------------------------------------------------- * 修改状态 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); //发短信 return $result; } }
以上是“PHP如何实现商品成交时发送短信功能”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。