《基于php实现商品成交时发送短信功能.doc》由会员分享,可在线阅读,更多相关《基于php实现商品成交时发送短信功能.doc(3页珍藏版)》请在金锄头文库上搜索。
1、基于PHP实现商品成交时发送短信功能最近做了一个项目,其中有需求,要求我们实现此功能:商品成交时发送短信,下面贴出核心代码,方面大家以后学习。html代码省略.Model代码省略.核心代码如下所示:/* -* 修改状态 public* Author: lzp Time:-* -*/public function changeStateAction $id = $_REQUESTid;$result = $this-changeConfirmState($id);if ($result) $this-success(修改成功); else $this-error(修改失败);private fu
2、nction changeConfirmState($id) $reg = $this-priceModel-selectPrice(id=eq, $id);$rel = $this-demandModel-selectDemand(id=eq,$regdemand_id);$demand_id = $regdemand_id;$regdemand = $this-priceModel-selectPrice(demand_id=eq,$demand_id);foreach ($regdemand as $key = $value)if($valuephone = $regphone)unse
3、t($regdemand$key);else$new = $valuephone;$new = =*;if(time -strtotime($relcreate_time) )echo alert(已超时!);history.back ;die;else if(strtotime($relfinish_time)echo alert(已成交!);history.back ;die;else$data_demand = is_available = , finish_time = date(Y-m-d H:i:s) ;$resultPrice = $this-priceModel-savePrice( id=eq,$id, state= );$resultDemadn = $this-demandModel-saveDemand(id=eq,$regdemand_id , $data_demand);$mobile = implode(, $new);$content = 此条需求已成交,下次再来哟!;smsApp($mobile,$content); /发短信return $result;以上代码是给大家贴的核心的代码,代码还算简单,所以没给大家写太多的注释