function sendDeviceUnicast() { $param = json_decode(file_get_contents('php://input', true)); $xtoken = $param['xtoken']; init_verify_token($xtoken); $uid = $param['uid']; if (empty($uid)) { err_ret(-205, 'lack of param', '缺少参数'); } $title = $param['title']; if ($title == '') { err_ret(-205, 'lack of param', '缺少参数'); } $text = $param['text']; if ($text == '') { err_ret(-205, 'lack of param', '缺少参数'); } sendDeviceUnicast(1369, '你中2亿元大奖啦', '快去领奖吧', '快去领奖吧,领奖记得要捐款啊'); }
function test() { echo 'Show/test'; die; $uid = $_GET['uid']; $coachid = $_GET['coachid']; $time = time(); //通知用户 $sql = "SELECT id, name,nicker FROM user_info WHERE id IN({$uid},{$coachid})"; echo $sql; die; $model = new Model(); $result = $model->query($sql); var_dump($result); foreach ($result as $value) { if ($value['id'] == $uid) { //用户 $userNicker = $value['nicker']; } else { if ($value['id'] == $coachid) { $coachName = $value['name']; } } } $strDate = timeToString($time); $strTicker = 'Hi,' . $userNicker . ' 你有新的计划啦,查看'; $strTitle = 'Hi,' . $userNicker . ' 你有新的计划啦,查看'; $strText = "Hi,{$userNicker} 你的教练{$coachName给你安排了}{$strDate的新的训练计划啦} 记得去查看哦"; //发通知 sendDeviceUnicast($uid, $strTicker, $strTitle, $strText); die; //xplan_images/action_f_coverimg //http://123.57.135.102/xplan_headers/ac_x001z.jpg //fcoverimg // $model = new Model('action'); // $result = $model->select(); // for ($i=0; $i < count($result); $i++) { // $filename = basename($result[$i]['coverimg']); // $fcoverimg = 'http://123.57.135.102/xplan_images/action_f_coverimg/'.$filename; // $data['fcoverimg'] = $fcoverimg; // $model->where('id='.$result[$i]['id'])->save($data); // } // $user = '******'; // $comment = 'd:/comment.xml'; // $xml = simplexml_load_file($comment); // $model_user_info = new Model('user_info'); // $model_comment = new Model('comment'); // $data = array(); // foreach($xml->children() as $child){ // $record_name = $child->getName(); // if($record_name == 'RECORD'){ // foreach ($child as $subchild) { // $key = $subchild->getName(); // if($key == 'coachid'){ // $data['coachid'] = (int)$subchild; // }else if($key == 'userid'){ // $data['userid'] = (int)$subchild + 1251; // }else if($key == 'content'){ // $data['content'] = (string)$subchild; // }else if($key == 'time'){ // $data['time'] = (int)$subchild; // } // } // $model_comment->add($data); // } // } // foreach($xml->children() as $child){ // $record_name = $child->getName(); // if($record_name == 'RECORD'){ // foreach ($child as $subchild) { // $key = $subchild->getName(); // if($key == 'username'){ // $data['username'] = (string)$subchild; // }else if($key == 'password'){ // $data['password'] = (string)$subchild; // }else if($key == 'name'){ // $data['name'] = (string)$subchild; // }else if($key == 'gender'){ // $data['gender'] = (string)$subchild; // }else if($key == 'header'){ // $data['header'] = (string)$subchild; // }else if($key == 'nicker'){ // $data['nicker'] = (string)$subchild; // }else if($key == 'height'){ // $data['height'] = (string)$subchild; // }else if($key == 'weight'){ // $data['weight'] = (string)$subchild; // }else if($key == 'type'){ // $data['type'] = (string)$subchild; // }else if($key == 'qq'){ // $data['qq'] = (string)$subchild; // }else if($key == 'weixin'){ // $data['weixin'] = (string)$subchild; // }else if($key == 'phone'){ // $data['phone'] = (string)$subchild; // }else if($key == 'weibo'){ // $data['weibo'] = (string)$subchild; // }else if($key == 'city'){ // $data['city'] = (string)$subchild; // }else if($key == 'birthday'){ // $data['birthday'] = (string)$subchild; // }else if($key == 'email'){ // $data['email'] = (string)$subchild; // }else if($key == 'regtime'){ // $data['regtime'] = (int)$subchild + 123; // } // } // $model_user_info->add($data); // unset($data); // } // } // echo "添加评论成功"; }