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}