/** * 处理提交保存 */ private function handle_form($params) { apf_require_class('Bll_App_Appparams'); $config_sercet = $this->get_config('sercet', 'app'); $flag = false; $message = ''; $return_url = 'http://' . $_SERVER['HTTP_HOST'] . '/user/appsetting/add'; $data = array(); if ($config_sercet != $params['sercet']) { $message = '口令不正确!请核对'; } else { if (empty($params['cache_k']) || empty($params['note']) || !in_array($params['app'], array(1, 2, 3))) { $message = '输入参数不完整'; } else { $cache_k = $params['cache_k']; $result = Bll_App_Appparams::get_instance()->getCount("cache_k = '" . $cache_k . "'"); if ($result) { $message = '已经存在该设置项'; } else { if (preg_match("/^\\w+\$/", $params['cache_k'])) { $flag = true; $data['cache_k'] = $params['cache_k']; $data['display_order'] = $params['display_order']; $data['cache_v'] = $params['cache_v']; $data['app'] = (int) $params['app']; $data['note'] = $params['note']; } else { $message = '数据格式错误'; } } } } if ($flag) { //$id = Bll_App_Appparams::get_instance()->add($data); $url = 'http://' . $_SERVER['HTTP_HOST'] . '/user/appsetting/list'; apf_require_class('Tools_Curl'); $curl = new Tools_Curl(); $save_setting_url = $this->get_config('save_setting_url', 'app'); $post_data = array('cache_k' => $data['cache_k'], 'cache_v' => $data['cache_v'], 'app' => $data['app'], 'note' => $data['note'], 'display_order' => $data['display_order']); $curl_result = $curl->post($save_setting_url, $post_data); $response_data = json_decode($curl_result, true); if (isset($response_data['status']) && $response_data['status'] == 'ok') { $this->response->redirect($url); exit; } else { echo '远程API接口无法响应,添加失败<br>'; echo '<a href="' . $return_url . '">点击返回</a>'; exit; } } else { echo $message; echo '<br>'; echo '<a href="' . $return_url . '">返回</a>'; exit; } }
public function issuetopic() { $pams = $this->request->get_parameters(); $issuetopicapiurl = APF::get_instance()->get_config('cmsissuetopic'); if ((int) $pams['ac'] == 1) { $data = $_POST; //user_id 目前是写死的。因为目前只规定几个人可以通过cms发话题 $user_id = "1"; $cityid = $pams['cityid']; $communityid = $pams['communityid']; $issuetopiccontent['user_id'] = $user_id; $issuetopiccontent['group_id'] = $pams['group_id']; $issuetopiccontent['topic_title'] = $data['topic_title']; $issuetopiccontent['topic_content'] = $data['topic_content']; $imageinfo = $data['imageinfo']; $issuetopiccontent['topic_images'] = $data['topic_images']; $issuetopic = json_encode($issuetopiccontent); var_dump($issuetopic); exit; $curl = new Tools_Curl(); $re = $curl->post($issuetopicapiurl, $issuetopic); echo $re; } /*$topic_images=array( array( 'host' => 1, 'id' => '31b041fe76685f60f8cbb4719a76e021', 'width' => 240, 'height' => 240, 'size' => 8633, 'hash' => '31b041fe76685f60f8cbb4719a76e021', 'format' => 'PNG', 'exists' => 1, ), array( 'host' => 1, 'id' => '41cce1b12aa5ae2a4b4116347c5b722e', 'width' => 240, 'height' => 240, 'size' => 7946, 'hash' => '41cce1b12aa5ae2a4b4116347c5b722e', 'format' => 'PNG', 'exists' => 1, ));*/ //插入issued topic api //curl -d '{"user_id":"1","group_id":"1","topic_title":"有title link 测试","topic_content":"这是一个topic content测试","topic_images":[{"host":1,"id":"31b041fe76685f60f8cbb4719a76e021","width":240,"height":240,"size":8633,"hash":"31b041fe76685f60f8cbb4719a76e021","format":"PNG","exists":1},{"host":1,"id":"41cce1b12aa5ae2a4b4116347c5b722e","width":240,"height":240,"size":7946,"hash":"41cce1b12aa5ae2a4b4116347c5b722e","format":"PNG","exists":1}]}' http://anlife.mingyongwang.dev.anjuke.com:8887/support/cmsissuetopic?nosig=1 return 'Group_Issuetopic'; }
public function auditing($group_ids, $type) { $params = array('group_ids' => json_encode($group_ids), 'operate' => $type); $options = array(); $custom_cookie = APF::get_instance()->get_config('custom_cookie', 'common'); if (isset($custom_cookie['use_cookie']) && $custom_cookie['use_cookie']) { $options['custom_cookie'] = $custom_cookie['cookie']; } $curl = new Tools_Curl($options); $url = APF::get_instance()->get_config('group_auditing_url', 'common'); $res = $curl->post($url, $params); $result = json_decode($res, true); if (!is_array($result)) { return false; } return $result; }
public function audfail() { $url = APF::get_instance()->get_config('handle_appeal'); $curl = new Tools_Curl(); foreach ($_POST['data'] as $key => $v) { $p[] = array('id' => $v['id'], 'type_id' => $v['type_id']); } $params = array('type' => 2, 'operate' => 0, 'data' => json_encode($p)); $res = $curl->post($url, $params); $res = json_decode($res, true); $output = array(); if (is_array($res) && @$res['datas'] == 1) { $output['code'] = 0; $output['msg'] = 'SUCCESS'; } elseif (is_array($res) && isset($res['error_code'])) { $output['code'] = $res['error_code']; $output['msg'] = $res['error_msg']; } else { $output['code'] = 1; $output['msg'] = 'FAIL'; } echo json_encode($output); }