one-day-Study notes-send SMS when goods are sold, one-day-study notes
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 */7 8 Public functionchangestateaction () {9 $id=$_request[' ID '];Ten $result=$this->changeconfirmstate ($id); One if($result) { A $this->success ("Modified successfully"); -}Else { - $this->error ("Modify failed"); the } - } - - Private functionChangeconfirmstate ($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]]); at foreach($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; *}Else if(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; $ } -}
http://www.bkjia.com/PHPjc/1125061.html www.bkjia.com true http://www.bkjia.com/PHPjc/1125061.html techarticle one-day-Study notes-send SMS when goods are sold, one-day-study notes Individual learning notes (one) On demand: Send SMS HTML code omitted when goods are sold ..... Model code omitted ....