One-day-Study Notes-send text messages when goods are sold, one-day-Study Notes

Source: Internet
Author: User

One-day-Study Notes-send text messages when goods are sold, one-day-Study Notes
Personal Study Notes (one)

 

Send SMS when goods are sold as required

Html code omitted .....

Model Code omitted .....

1/* 2 * modify 3 * State public 4 * Author: lzp Time: 2016-05-27 5 * --------------------------------------------------- 6 */7 8 public function changeStateAction () {9 $ id = $ _ REQUEST ['id']; 10 $ result = $ this-> changeConfirmState ($ id); 11 if ($ result) {12 $ this-> success ("modified successfully"); 13} else {14 $ this-> error ("failed to modify"); 15} 16} 17 18 private function changeConfirmSta Te ($ id) {19 $ reg = $ this-> priceModel-> selectPrice (['id' => ['eq ', $ id]); 20 $ rel = $ this-> demandModel-> selectDemand (['id' => ['eq ', $ reg [0] ['demand _ id']); 21 $ demand_id = $ reg [0] ['demand _ id']; 22 $ reg ['demand'] = $ this-> priceModel-> selectPrice (['demand _ id' => ['eq ', $ demand_id]); 23 foreach ($ reg ['demand'] as $ key => $ value) {24 if ($ value ['phone'] = $ reg [0] ['phone']) {25 unset ($ reg ['demand'] [$ key]); 26} els E {27 $ new [] = $ value ['phone']; 28} 29} 31 $ new = ['0' => '2017 ********** ']; 32 if (time () -strtotime ($ rel [0] ['create _ time'])> 86400) {33 echo "<script> alert ('timeout! '); History. back (); </script> "; 34 die; 35} else if (strtotime ($ rel [0] ['finish _ time'])> 0) {36 echo "<script> alert ('closed! '); History. back (); </script> "; 37 die; 38} else {39 $ data_demand = ['is _ available '=> 2, 'finish _ time' => date ("Y-m-d H: I: s")]; 40 $ result ['price'] = $ this-> priceModel-> savePrice (['id' => ['eq ', $ id], ['state' => 2]); 41 $ result ['madn'] = $ this-> demandModel-> saveDemand (['id' => ['eq ', $ reg [0] ['demand _ id'], $ data_demand); 42 $ mobile = implode (",", $ new ); 43 $ content = "this requirement has been closed. Come back next time! "; 44 smsApp ($ mobile, $ content); // send a message 45 return $ result; 46} 47}

 

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.