/** * 添加多个评分 * @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); } }
/** * 广告分页查询 * 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("没有相关数据!"); } }
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')); } }
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()); } } }
/** * 流量购回调地址 */ 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"; } }
/** * 交易首页 */ 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(); }
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']); } } }
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']); } }
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')); } }
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; }
function getUsers() { $method = "GET"; $url = "192.168.0.101/users"; $data = array(); $result = apiCall($method, $url, $data); return $result; }
public function delete() { $id = array('id' => I('id', 0)); $result = apiCall(GoldcoinApi::DELETE, array($id)); if ($result['status']) { $this->success('删除成功', U('Admin/Game/openbox')); } }
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); }
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'); } }
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')); }
public function delete() { $id = I('id', 0); $result = apiCall("Admin/Post/delete", array(array("id" => $id))); if (!$result['status']) { $this->error($result['info']); } $this->success("删除成功!"); }
public function testGetInfo() { if (IS_POST) { $id = I('post.id', 0); $userinfo = apiCall(AccountApi::GET_INFO, array($id)); dump($userinfo); } else { $this->display(); } }
public function getArea() { $cityid = I('post.cityid', ''); $result = apiCall(AreaApi::GET_LIST_BY_CITY_ID, array($cityid)); if ($result['status']) { $this->success($result['info']); } else { $this->error($result['info']); } }
/** * 查看行为日志 */ public function view($id = 0) { empty($id) && $this->error('参数错误!'); $map = array('id' => $id); $result = apiCall("Admin/ActionLog/getInfo", array($map)); $this->exitIfError($result); $this->assign('info', $result['info']); $this->meta_title = '查看行为日志'; $this->display(); }
public function delete() { $m_id = I('get.mid', 0); $map = array('member_uid' => $m_id, 'organization_id' => $this->orgid); $result = apiCall("Admin/OrgMember/delete", array($map)); if (!$result['status']) { $this->error($result['info']); } $this->success("删除成功!"); }
/** * ���鷴�� */ public function feedback() { $map = array('name' => I("name"), 'text' => I("text")); $result = apiCall(SuggestApi::ADD, array($map)); if ($result['status']) { $this->apiReturnSuc("����ύ�ɹ���"); } else { $this->apiReturnErr("����ύʧ�ܣ�"); } }
public function index() { $map = null; $page = array('curpage' => I('get.p'), C('LIST_ROWS')); $result = apiCall("AdminApp/query", array($map, $page)); if ($result['status']) { $this->assign("list", $result['info']['list']); $this->assign("show", $result['info']['show']); $this->display(); } }
public function add() { $product_id = I('post.product_id', 0); $groups = I('post.groups', array()); if ($product_id == 0) { $this->error("参数错误!"); } $map = array('p_id' => $product_id); apiCall(ProductGroupApi::DELETE, array($map)); if (count($groups) > 0) { foreach ($groups as $groupid) { $entity = array('p_id' => $product_id, 'g_id' => $groupid); if ($groupid == 14) { $entity['start_time'] = strtotime(I('post.start_time_1')); $entity['end_time'] = strtotime(I('post.end_time_1')); } if ($groupid == 15) { $entity['start_time'] = strtotime(I('post.start_time_2')); $entity['end_time'] = strtotime(I('post.end_time_2')); } if ($groupid == 16) { $entity['start_time'] = strtotime(I('post.start_time_3')); $entity['end_time'] = strtotime(I('post.end_time_3')); } if ($groupid == 40) { $entity['start_time'] = strtotime(I('post.start_time_13')); $entity['end_time'] = strtotime(I('post.end_time_13')); $entity['price'] = (double) I('price') * 100; } $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']); } }
/** * @param $id_arr 订单ID集合 */ function add($id_arr) { //遍历订单ID集合 foreach ($id_arr as $id) { //dump($id); $map = array('id' => $id); //获取订单 $result = apiCall(OrdersApi::QUERY_NO_PAGING, array($map)); //获取下单用户ID $wxuser_id = $result['info'][0]['wxuser_id']; //获取订单价格 $price = $result['info'][0]['price']; $map = array('id' => $wxuser_id); //获取wxuser信息 $result = apiCall(WxuserApi::QUERY_NO_PAGING, array($map)); //获取uid $uid = $result['info'][0]['uid']; //获取下单用户昵称 $nickname = $result['info'][0]['nickname']; $map = array('uid' => $uid); $uids = array(); $family = apiCall(WxuserFamilyApi::QUERY_NO_PAGING, array($map)); if ($family['info'][0]['parent_1'] != 0) { $uids[] = $family['info'][0]['parent_1']; } if ($family['info'][0]['parent_2'] != 0) { $uids[] = $family['info'][0]['parent_2']; } if ($family['info'][0]['parent_3'] != 0) { $uids[] = $family['info'][0]['parent_3']; } if ($family['info'][0]['parent_4'] != 0) { $uids[] = $family['info'][0]['parent_4']; } //获取所有分销商信息 foreach ($uids as $u) { $map = array('uid' => $u); $wxuserInfo = apiCall(WxuserApi::QUERY_NO_PAGING, array($map)); //查出分销商等级 $map = array('wxuser_group_id' => $wxuserInfo['info'][0]['groupid']); $groupAccess = apiCall(GroupAccessApi::QUERY_NO_PAGING, array($map)); $commission = (double) $groupAccess['info'][0]['percent'] * (double) $price; //佣金提成比例*价格=佣金 $map = array('uid' => $u); $WalletInfo = apiCall(WalletApi::QUERY_NO_PAGING, array($map)); $result = apiCall(WalletApi::SETINC, array($map, 'account_balance', $commission)); //添加佣金 $percent = (double) $groupAccess['info'][0]['percent'] * 100; $map = array('uid' => $u, 'before_money' => $WalletInfo['info'][0]['account_balance'], 'plus' => $commission, 'minus' => 0, 'after_money' => (double) $WalletInfo['info'][0]['account_balance'] + (double) $commission, 'create_time' => time(), 'dtree_type' => getDatatree('COMMISSION_ORDER_FINISH'), 'reason' => '用户' . $nickname . '(ID:' . $wxuser_id . ')' . '下单(ID:' . $id . '),分销商' . $wxuserInfo['info'][0]['nickname'] . '(ID:' . $u . ')获得佣金' . $commission . '分(' . $percent . '%)'); $result = apiCall(WalletHisApi::ADD, array($map)); } } // TODO: 计算佣金,并记录到数据库中。 }
/** * 查看收货地址 */ public function queryNoPaging() { $notes = "应用" . $this->client_id . ",调用Address查询接口"; addLog("Address/add", $_GET, $_POST, $notes); $map = array('uid' => I('uid')); $result = apiCall(AddressApi::QUERY_NO_PAGING, array($map)); if ($result['status']) { $this->apiReturnSuc($result['info']); } else { $this->apiReturnErr("查询失败"); } }
/** * 配置部分内容 */ public function config_set($group) { $map = array('group' => $group); $result = apiCall('Ucenter/Config/queryNoPaging', array($map)); if ($result['status']) { $this->assign("list", $result['info']); echo $this->fetch("Widget/config_set"); } else { LogRecord($result['info'], "[INFO]:" . __FILE__ . " [LINE]" . __LINE__); echo L('ERR_SYSTEM_BUSY'); } }
public function shopcart() { $pros = cookie('shopcats'); for ($i = 0; $i < count($pros); $i++) { $map = array('id' => $pros[$i]); $results[] = apiCall(ProductApi::QUERY_NO_PAGING, array($map)); } $this->assign('products', $results); $user = session('user'); $this->assign('user', $user); $this->theme($this->themeType)->display(); }
public function app() { $notes = "客户端" . $this->client_id . ",调用APP配置查询接口"; addLog("Config/app", $_GET, $_POST, $notes); $group = 6; //6是接口参数 $result = apiCall(ConfigApi::QUERY_NO_PAGING, array(array('group' => $group))); if (!$result['status']) { $this->apiReturnErr($result['info']); } $this->apiReturnSuc($this->simpleResult($result['info'])); }
public function view() { if (IS_GET) { $id = I('get.id', 0); $log = apiCall("Admin/WeixinLog/getInfo", array(array("id" => $id))); if ($log['status']) { $this->assign("log", $log['info']); $this->display(); } else { $this->error($log['result']); } } }
/** * POST: 登录 * @internal param post.username * @internal param post.password */ public function login_post() { $username = I("post.username", ''); $password = I('post.password', ''); $result = apiCall(AccountApi::LOGIN, array($username, $password)); if ($result['status']) { $uid = $result['info']; $result = apiCall(AccountApi::GET_INFO, array($uid)); $this->apiReturnSuc($result['info'], "json"); } else { $this->apiReturnErr($result['info'], "json"); } }