1 public function save(){ 2 $id = I(\'id\'); 3 $Goods = M(\'message\'); 4 $info = $Goods->find($id); 5 //就收数据 6 $data[\'content\'] = I(\'post.content\');//短信内容 7 $data[\'title\'] = I(\'post.title\');//分组 8 $data[\'add_time\'] = I(\'post.add_time\');//时间 9 $Brand = M(\'Brand b\'); 10 $title = I(\'post.title\'); 11 $brand_list1 = $Brand->where(array(\'c.title\' => $title))->join(\'inner join go_category c on b.group_id = c.id\')->field(\'b.number\')->select(); 12 13 foreach ($brand_list1 as $key => $value) { 14 $brand_list1[$key] = $value[\'number\']; 15 } 16 if (empty($brand_list1)) { 17 $this->ajaxReturn(array(\'status\' => \'0\', \'info\' => \'该分组没有号码,返回到列表!\')); 18 } 19 $phonestr = \'\'; 20 $phonestr = implode(\',\', $brand_list1);//以逗号分隔的号码串 21 22 header("Content-Type: text/html; charset=UTF-8"); 23 $flag = 0; 24 $params = \'\';//要post的数据 25 //以下信息自己填以下 26 $mobile = $phonestr;//手机号 27 $argv = array( 28 \'name\'=>\'\', //必填参数。用户账号 29 \'pwd\'=>\'\', //必填参数。(web平台:基本资料中的接口密码) 30 \'content\'=>I(\'post.content\'), //必填参数。发送内容(1-500 个汉字)UTF-8编码 31 \'mobile\'=>$mobile, //必填参数。手机号码。多个以英文逗号隔开 32 \'stime\'=>\'\', //可选参数。发送时间,填写时已填写的时间发送,不填时为当前时间发送 33 \'sign\'=>\'\', //必填参数。用户签名。 34 \'type\'=>\'pt\', //必填参数。固定值 pt 35 \'extno\'=>\'\' //可选参数,扩展码,用户定义扩展码,只能为数字 36 ); 37 foreach ($argv as $key=>$value) { 38 if ($flag!=0) { 39 $params .= "&"; 40 $flag = 1; 41 } 42 $params.= $key."="; $params.= urlencode($value);// urlencode($value); 43 $flag = 1; 44 } 45 $url = "http://web.duanxinwang.cc/asmx/smsservice.aspx?".$params; //提交的url地址 46 $con= file_get_contents($url); //获取信息发送后的状态 47 $datarr = explode(\',\', $con); 48 $data[\'result\'] = $datarr[0]; 49 $data[\'task\'] = $datarr[1]; 50 $phonestr = $mobile; 51 $str = explode(",", $phonestr); 52 for ($i = 0;$i < count($str);$i++) { 53 $data[\'phone\'] = $str[$i]; 54 $result1 = $Goods->add($data); 55 } 56 if($datarr[0] == \'0\'){ 57 $this->ajaxReturn(array(\'status\' => $datarr[0], \'info\' => $datarr[5])); 58 }else{ 59 $this->ajaxReturn(array(\'status\' => $datarr[0], \'info\' => $datarr[5])); 60 } 61 124 125 }