Individual Learning Notes (one)
On demand: Send SMS when goods are sold
HTML code omitted .....
Model code omitted .....
1/*2 * -------------------------------------------------3* Modify State Public4* AUTHOR:LZP time:2016-05-275 * -------------------------------------------------6*/78 Publicfunctionchangestateaction () {9$id=$_request[' ID '];Ten$result=$this->changeconfirmstate ($id); Oneif($result) { A$this->success ("Modified successfully"); -}Else { -$this->error ("Modify failed"); the } - } - -PrivatefunctionChangeconfirmstate ($id) { +$reg=$this->pricemodel->selectprice ([' id ' =>[' eq ',$id]]); -$rel=$this->demandmodel->selectdemand ([' id ' =>[' eq ',$reg[0] [' demand_id ']]]); +$demand _id=$reg[0] [' demand_id ']; A$reg[' demand '] =$this->pricemodel->selectprice ([' demand_id ' =>[' eq ',$demand _id]]); atforeach($reg[' demand '] as$key=$value){ -if($value[' phone '] = =$reg[0] [' Phone ']){ -unset($reg[' demand '] [$key]); -}Else{ -$new[] =$value[' Phone ']; - } in } to$new= [' 0 ' = ' 136******** ']; +if(( Time()-Strtotime($rel[0] [' Create_time '])) > 86400){ -Echo""; the die; *}Elseif(Strtotime($rel[0] [' Finish_time ']) >0){ $Echo"";Panax Notoginseng die; -}Else{ the$data _demand= [' is_available ' = = 2, ' finish_time ' =Date("Y-m-d h:i:s") ]; +$result[' price '] =$this->pricemodel->saveprice ([' id ' =>[' eq ',$id]], [' State ' =>2] ); A$result[' demadn '] =$this->demandmodel->savedemand ([' id ' =>[' eq ',$reg[0] [' demand_id ']] ,$data _demand); the$mobile=implode(",",$new); +$content= "This demand has been sold, next time come yo!"; -Smsapp ($mobile,$content); Send SMS $return$result; $ } -}
The above describes the one-day-study notes-the merchandise deal when sending text messages, including the sending of text messages, one aspect of the content, I hope that the PHP tutorial interested in a friend helpful.