本文整理汇总了PHP中apiCall函数的典型用法代码示例。如果您正苦于以下问题:PHP apiCall函数的具体用法?PHP apiCall怎么用?PHP apiCall使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apiCall函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addArray
/**
* 添加多个评分
* @param $orders_id 订单ID
* @param $uid 用户ID
* @param $pid_arr 产品数组-评分
* @param $score_arr 评分数组
* @param $text_arr 评价内容
* @return array
*/
public function addArray($orders_id, $uid, $pid_arr, $score_arr, $logistics_service_arr, $delivery_speed_arr, $service_attitude_arr, $text_arr)
{
$this->model->startTrans();
$flag = true;
$error = "";
$insert_ids = array();
$nowtime = time();
foreach ($pid_arr as $key => $id) {
$entity = array('product_id' => $id, 'orders_id' => $orders_id, 'score' => $score_arr[$key], 'logistics_service' => $logistics_service_arr[$key], 'delivery_speed' => $delivery_speed_arr[$key], 'service_attitude' => $service_attitude_arr[$key], 'comment' => $text_arr[$key], 'user_id' => $uid, 'createtime' => $nowtime);
if ($this->model->create($entity, 1)) {
$result = $this->model->add($entity);
if ($result === false) {
$flag = false;
$error = $this->model->getDbError();
} else {
apiCall(OrdersApi::SAVE_BY_ID, array($orders_id, array('comment_status' => 1)));
array_push($insert_ids, $result);
}
} else {
$flag = false;
$error = $this->model->getError();
}
}
if ($flag) {
$this->model->commit();
return $this->apiReturnSuc($insert_ids);
} else {
$this->model->rollback();
return $this->apiReturnErr($error);
}
}
示例2: query
/**
* 广告分页查询
* position广告位置
* pageNo页码
* pageSize 显示个数
*/
public function query()
{
$notes = "应用" . $this->client_id . ",调用Banners分页查询接口";
addLog("Banners/query", $_GET, $_POST, $notes);
$arr = array('app_index' => 6007, 'app_finance' => 6008, 'app_carousel' => 6009, 'app_life' => 6010);
$position = $this->_post('position', '', "位置参数必须");
if (!isset($arr[$position])) {
$this->apiReturnErr("不支持的位置参数!");
}
$position = $arr[$position];
$curpage = $this->_post('curpage', 0);
$pagesize = $this->_post('pagesize', 10);
$map = array('position' => $position);
$order = " sort asc ";
$page = array('curpage' => $curpage, 'size' => $pagesize);
//分页
$result = apiCall(BannersApi::QUERY, array($map, $page, $order));
if ($result['status']) {
$list = $result['info']['list'];
$list = $this->convertImgUrl($list);
$this->apiReturnSuc($list);
} else {
$this->apiReturnErr("没有相关数据!");
}
}
示例3: edit
public function edit()
{
$id = I('id', 0);
if (IS_GET) {
$result = apiCall(BannersApi::GET_INFO, array(array('id' => $id)));
if (!$result['status']) {
$this->error($result['info']);
}
$this->assign("vo", $result['info']);
$this->display();
} else {
$title = I('post.title', '');
// $url =
$notes = I('post.notes', '');
$position = I('post.position', 18);
if (empty($position)) {
$this->error("配置错误!");
}
$entity = array('position' => $position, 'title' => $title, 'notes' => $notes, 'img' => I('post.img', ''), 'url' => I('post.url', ''));
$result = apiCall(BannersApi::SAVE_BY_ID, array($id, $entity));
if (!$result['status']) {
$this->error($result['info']);
}
$this->success("保存成功!", U('Admin/Banners/index'));
}
}
示例4: upload
public function upload()
{
if (IS_POST) {
$uid = $this->_post('uid', 0);
$type = $this->_post('type', '');
if (!in_array($type, $this->Accept_Type)) {
$this->apiReturnErr("文件类型不支持!");
}
if ($uid <= 0) {
$this->apiReturnErr("用户ID非法!");
}
$result = apiCall(UserApi::GET_INFO, array($uid));
if (!$result['status']) {
$this->apiReturnErr("用户ID不存在!");
}
if (!isset($_FILES['image'])) {
$this->apiReturnErr("文件对象必须为image!");
}
$result['info'] = "";
//2.再上传到自己的服务器,
//TODO:也可以上传到QINIU上
/* 返回标准数据 */
/* 调用文件上传组件上传文件 */
$Picture = D('UserPicture');
$extInfo = array('uid' => $uid, 'imgurl' => C('SITE_URL'), 'type' => $type);
$info = $Picture->upload($_FILES, C('USER_PICTURE_UPLOAD'), $extInfo);
/* 记录图片信息 */
if ($info) {
$info['image']['imgurl'] = C('SITE_URL') . $info['image']['path'];
$this->apiReturnSuc($info['image']);
} else {
$this->apiReturnErr($Picture->getError());
}
}
}
示例5: index
/**
* 流量购回调地址
*/
public function index()
{
/*
* {"channelOrderNo":"158581990641014538769441118","extraData":"",
* "orderNo":"1453876701223039",
* "orderStatus":"4","providerResultCode":"1",
* "providerResultReason":"\u8ba2\u8d2d\u6210\u529f",
* "resultCode":"1000","resultMessage":"\u6210\u529f",
* "sign":"8194b64649a34e8619a74c76c5ef436e"}*/
addLog("Santi/callback", $_GET, $_POST, '[调试]三体回调地址');
// exit;
$order_no = $this->_get('orderNo', '', '缺失orderNo参数');
$order_status = $this->_get('orderStatus', '');
$channel_order_no = $this->_get('channelOrderNo', '');
$result_code = $this->_get('resultCode', '');
$result_message = $this->_get('resultMessage', '');
$provider_result_code = $this->_get('providerResultCode', '');
$provider_result_reason = $this->_get('providerResultReason', '');
$extraData = $this->_get('extraData', '');
$sign = $this->_get('sign', '', '缺失sign参数');
$entity = array('order_no' => $order_no, 'order_status' => $order_status, 'channel_order_no' => $channel_order_no, 'result_code' => $result_code, 'result_message' => $result_message, 'provider_result_code' => $provider_result_code, 'provider_result_reason' => $provider_result_reason, 'extra_data' => $extraData, 'sign' => $sign, 'create_time' => time());
$update_entity = array('order_status' => $order_status);
$result = apiCall(SantiCallbackApi::ADD, array($entity));
$result = apiCall(SantiOrderApi::SAVE, array(array('order_no' => $order_no), $update_entity));
if ($result['status']) {
echo "SUCCESS";
} else {
echo "FAIL";
}
}
示例6: tradeIndex
/**
* 交易首页
*/
public function tradeIndex()
{
$map = array('status' => 2, 'dtree_type' => 3);
$result = apiCall(FinAccountBalanceHisApi::QUERY_NO_PAGING, array($map));
$this->assign('count', count($result['info']));
$this->display();
}
示例7: picturelist
public function picturelist()
{
if (IS_AJAX) {
$q = I('post.q', '');
$time = I('post.time', '');
$cur = I('post.p', 0);
$size = I('post.size', 10);
$map = array('uid' => UID);
$page = array('curpage' => $cur, 'size' => $size);
$order = 'create_time desc';
$params = array('p' => $cur, 'size' => $size);
if (!empty($q)) {
$params['q'] = $q;
$map['ori_name'] = array("like", '%' . $q . '%');
}
if (!empty($time)) {
$time = strtotime($time);
// dump($time);
$map['create_time'] = array(array('lt', $time + 24 * 3600), array('gt', $time - 1), 'and');
}
$fields = 'id,create_time,status,path,url,md5,imgurl,ori_name,savename,size';
$result = apiCall(UserPictureApi::QUERY, array($map, $page, $order, $params, $fields));
if ($result['status']) {
$this->success($result['info']);
} else {
$this->error($result['info']);
}
}
}
示例8: add
public function add()
{
$product_id = I('post.product_id', 0);
$groups = I('post.groups', array());
if ($product_id == 0) {
$this->error("参数错误!");
}
if (count($groups) > 0) {
foreach ($groups as $groupid) {
$entity = array('p_id' => $product_id, 'g_id' => $groupid);
$result = apiCall(ProductGroupApi::GET_INFO, array($entity));
if (!$result['status']) {
$this->error($result['info']);
}
if (is_null($result['info'])) {
$result = apiCall(ProductGroupApi::ADD, array($entity));
if (!$result['status']) {
$this->error($result['info']);
}
}
}
array_push($groups, "-1");
$map = array('g_id' => array('not in', $groups));
$map['p_id'] = $product_id;
$result = apiCall(ProductGroupApi::DELETE, array($map));
} else {
$result = array('status' => true);
$result = apiCall(ProductGroupApi::DELETE, array(array('p_id' => $product_id)));
}
if ($result['status']) {
$this->success("操作成功!");
} else {
$this->error($result['info']);
}
}
示例9: index
public function index()
{
//get.startdatetime
$startdatetime = I('startdatetime', date('Y/m/d H:i', time() - 24 * 3600), 'urldecode');
$enddatetime = I('enddatetime', date('Y/m/d H:i', time()), 'urldecode');
//分页时带参数get参数
$params = array('startdatetime' => $startdatetime, 'enddatetime' => $enddatetime);
$startdatetime = strtotime($startdatetime);
$enddatetime = strtotime($enddatetime);
if ($startdatetime === FALSE || $enddatetime === FALSE) {
LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
$this->error(L('ERR_DATE_INVALID'));
}
$map = array();
$map['timestamp'] = array(array('EGT', $startdatetime), array('elt', $enddatetime), 'and');
$page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
$order = " timestamp desc ";
//
$result = apiCall('Admin/Log/query', array($map, $page, $order, $params));
//
if ($result['status']) {
$this->assign('startdatetime', $startdatetime);
$this->assign('enddatetime', $enddatetime);
$this->assign('show', $result['info']['show']);
$this->assign('list', $result['info']['list']);
$this->display();
} else {
LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
$this->error(L('UNKNOWN_ERR'));
}
}
示例10: fetchQuestion
function fetchQuestion($qid, $db)
{
$filter = "!)rcjzniPuafk4WNG65yr";
$data = apiCall("questions/{$qid}?order=desc&sort=activity", 'codereview', $filter);
$json = json_decode($data, true);
$items = $json['items'];
if (count($items) == 0) {
return showError('Question ' . $qid . ' not found');
}
$question = $json['items'][0];
$dbfields = array("is_answered", "view_count", "favorite_count", "answer_count", "score", "accepted_answer_id");
$sql = 'INSERT INTO cr_badge (question_id, is_answered, favorite_count, answer_count, view_count, score, fetch_time, accepted_answer_id) ' . 'VALUES (:qid, :is_answered, :favorite_count, :answer_count, :view_count, :score, :time, :accepted_answer_id) ON DUPLICATE KEY UPDATE ' . 'is_answered = :is_answered, favorite_count = :favorite_count, answer_count = :answer_count, view_count = :view_count, score = :score, fetch_time = :time, accepted_answer_id = :accepted_answer_id ;';
$stmt = $db->prepare($sql);
$sql_params = array();
foreach ($dbfields as $field_name) {
if (isset($question[$field_name])) {
$sql_params[':' . $field_name] = $question[$field_name];
} else {
$sql_params[':' . $field_name] = 0;
}
}
$sql_params[':qid'] = $qid;
$sql_params[':time'] = time();
$result = $stmt->execute($sql_params);
if ($result) {
useData($question);
} else {
die($stmt->errorInfo());
}
return $json;
}
示例11: getUsers
function getUsers()
{
$method = "GET";
$url = "192.168.0.101/users";
$data = array();
$result = apiCall($method, $url, $data);
return $result;
}
示例12: delete
public function delete()
{
$id = array('id' => I('id', 0));
$result = apiCall(GoldcoinApi::DELETE, array($id));
if ($result['status']) {
$this->success('删除成功', U('Admin/Game/openbox'));
}
}
示例13: index
public function index()
{
//$id_arr=array(4,6);
//apiCall(CommissionCountApi::ADD,array($id_arr));
$map = array('name' => 'REFERRER_NUM');
$rNresult = apiCall(ConfigApi::QUERY_NO_PAGING, array($map));
dump($rNresult);
}
示例14: add
public function add()
{
if (IS_GET) {
cookie("__forward__", $_SERVER['HTTP_REFERER']);
$map = array();
$map['wxuserid'] = $this->userinfo['id'];
$map['default'] = 1;
$result = apiCall(AddressApi::GET_INFO, array($map));
if (!$result['status']) {
$this->error($result['info']);
}
if (is_array($result['info'])) {
//获取城市,区域信息
$city = apiCall(CityApi::GET_LIST_BY_PROVINCE_ID, array($result['info']['province']));
if (!$city['status']) {
LogRecord($city['info'], __FILE__ . __LINE__);
}
$this->assign("city", $city['info']);
$area = apiCall(AreaApi::GET_LIST_BY_CITY_ID, array($result['info']['city']));
if (!$area['status']) {
LogRecord($city['info'], __FILE__ . __LINE__);
}
$this->assign("area", $area['info']);
}
//dump($result['info']);
$this->assign("address", $result['info']);
$result = apiCall(ProvinceApi::QUERY_NO_PAGING, array());
if (!$result['status']) {
$this->error($result['info']);
}
$this->assign("provinces", $result['info']);
$this->assign("back_url", cookie("__forward__"));
$this->theme($this->themeType)->display();
} else {
$id = I('post.id', 0, 'intval');
$province = I('post.province', '');
$city = I('post.city', '');
$area = I('post.area', '');
$detail = I('post.detail', '');
$mobile = I('post.mobile', '');
$postcode = I('post.postcode', '');
$contactname = I('post.name', '');
$entity = array('wxno' => '', 'country' => '中国', 'province' => $province, 'city' => $city, 'area' => $area, 'detailinfo' => $detail, 'mobile' => $mobile, 'default' => 1, 'contactname' => $contactname, 'zip_code' => $postcode);
if (empty($id)) {
//新增
$entity['wxuserid'] = $this->userinfo['id'];
$result = apiCall(AddressApi::ADD, array($entity));
} else {
//保存
$result = apiCall(AddressApi::SAVE_BY_ID, array($id, $entity));
}
if (!$result['status']) {
$this->error($result['info']);
}
$this->success("操作成功!~", cookie("__forward__") . '?fromsession=1');
}
}
示例15: delete
public function delete()
{
$client_id = I('get.client_id', 0);
$result = apiCall(ClientsApi::DELETE, array(array('client_id' => $client_id)));
if (!$result['status']) {
$this->error($result['info']);
}
$this->success("删除成功!", U('Admin/Clients/index'));
}