one-day-Study notes-send SMS when goods are sold

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.