New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 获取用户数据相关 Api |
| | | * 王腾宇 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('./init_db.php'); |
| | | require('./common/interface.func.php'); |
| | | |
| | | |
| | | if($_SERVER['REQUEST_METHOD'] != 'POST'){ |
| | | http_response_code(405); |
| | | } else { |
| | | $retData=checkParam($_GET); |
| | | switch ($retData["rspCode"]){ |
| | | case "e00000": |
| | | $userApi = new UserApi(); |
| | | switch (getUrl($_SERVER['REQUEST_URI'])) |
| | | { |
| | | case "getUserList": |
| | | $retData["rspData"] = $userApi->getUserList($retData["repData"]); |
| | | break; |
| | | case "getUserOrderList": |
| | | $retData["rspData"] = $userApi->getUserOrderList($retData["repData"]); |
| | | break; |
| | | default: http_response_code(404); |
| | | } |
| | | break; |
| | | case "e00001": |
| | | $retData["rspMsg"]="接入平台不存在"; |
| | | break; |
| | | case "e00002": |
| | | $retData["rspMsg"]="鉴权失败"; |
| | | break; |
| | | } |
| | | exit(json_encode($retData,JSON_UNESCAPED_UNICODE)); |
| | | } |
| | | |
| | | |
| | | class UserApi |
| | | { |
| | | function _initialize() |
| | | {} |
| | | |
| | | public function getUserList($param) |
| | | { |
| | | global $db; |
| | | return $db->getAll("SELECT * from ecs_users where invitation_code="."'".$param["invitationCode"]."'"); |
| | | } |
| | | |
| | | public function getUserOrderList($param) |
| | | { |
| | | global $db; |
| | | return $db->getAll("select *,(select user_name from ecs_users where i.user_id = user_id) as user_name from ecs_order_info i left join ecs_order_goods g on i.order_id = g.order_id where i.user_id in (select ecs_users.user_id from ecs_users where invitation_code="."'".$param["invitationCode"]."')"); |
| | | } |
| | | } |