check_login(); $userinfo = Users::getUserInfo($user_id); $this->success('成功',$userinfo); } /** * @title 收货地址列表 * @desc 我的收货地址 * @url /api/User/my_address * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: */ public function my_address(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $result = Users::MyAddress($user_id,$Nowpage,$limits); $this->success('成功',$result['data']); } /** * @title 添加、修改收货地址 * @desc 添加、修改收货地址 * @url /api/User/add_edit_address * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:name type:string require:1 default: desc:收货人姓名 * @param name:phone type:string require:1 default: desc:手机号 * @param name:province type:string require:1 default: desc:省 * @param name:city type:string require:1 default: desc:市 * @param name:area type:string require:1 default: desc:区 * @param name:address type:string require:1 default: desc:具体地址 * @param name:is_default type:int require:0 default:0 desc:默认地址1:默认0:否 * @param name:jd type:string require:0 default:0 desc:经度 * @param name:wd type:string require:0 default:0 desc:纬度 * @param name:address_id type:int require:0 default:0 desc:收货地址ID,有则修改,无则添加 */ public function add_edit_address(){ $user_id = $this->check_login(); $data['name'] = input('name'); //收货人姓名 $data['phone'] = input('phone'); //手机号 $data['province'] = input('province'); //省 $data['city'] = input('city'); //市 $data['area'] = input('area'); //区 $data['address'] = input('address'); //具体地址 $data['is_default'] = input('is_default',0); //默认地址 1:默认 $data['jd'] = input('jd'); //经度 $data['wd'] = input('wd'); //纬度 $address_id = intval(input('address_id')); //收货地址ID 有则修改,无则添加 if (!$data['name'] || !$data['phone'] || !$data['province'] || !$data['city'] || !$data['area'] || !$data['address']) $this->error('参数错误'); if (!Validate::regex($data['phone'], "^1\d{10}$")) $this->error('手机号格式错误'); $result = Users::AddEditAddress($user_id,$data,$address_id); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 设为默认地址 * @desc 设为默认地址 * @url /api/User/set_address_default * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:address_id type:int require:1 default:1 desc:地址ID */ public function set_address_default(){ $user_id = $this->check_login(); $address_id = intval(input('address_id')); //地址ID if (!$address_id) $this->error('地址ID为空'); $result = Users::SetAddressDefault($user_id,$address_id); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 删除地址 * @desc 删除地址 * @url /api/User/del_address * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:address_id type:int require:1 default:1 desc:地址ID */ public function del_address(){ $user_id = $this->check_login(); $address_id = intval(input('address_id')); //地址ID if (!$address_id) $this->error('地址ID为空'); $result = Users::DelAddress($user_id,$address_id); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 修改个人资料 * @desc 修改个人资料 * @url /api/User/edit_user_info * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:headimg type:string require:0 default:1 desc:头像 * @param name:nickname type:string require:0 default:1 desc:昵称 */ public function edit_user_info(){ $user_id = $this->check_login(); $data = input(); $result = Users::EditUserInfo($user_id,$data); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 修改密码 * @desc 修改密码 * @url /api/User/change_password * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:password type:string require:0 desc:密码 * @param name:confirm_password type:string require:0 desc:确认密码 * @param name:ver_code type:string require:0 desc:验证码 */ public function change_password(){ $user_id = $this->check_login(); $password = input('password'); //密码 $confirm_password = input('confirm_password'); //确认密码 $ver_code = input('ver_code'); //验证码 if (!$password || !$ver_code || !$confirm_password){ $this->error('参数错误'); } if ($password!=$confirm_password){ $this->error('密码与确认密码不一致'); } $result = Users::changePassword($user_id,$password,$ver_code); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 申请成为设计师 * @desc 申请成为设计师 * @url /api/User/apply_designer * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:name type:string require:1 desc:姓名 * @param name:design_classifi type:string require:1 desc:设计分类 * @param name:skills_label type:string require:1 desc:技能标签 * @param name:good_type type:string require:1 desc:擅长类型 * @param name:good_style type:string require:1 desc:擅长风格 * @param name:province type:string require:1 desc:省 * @param name:city type:string require:1 desc:市 * @param name:area type:string require:1 desc:区 * @param name:work_experience type:string require:1 desc:工作经历 * @param name:work_year type:string require:1 desc:工作年限 * @param name:identity_card_zheng type:string require:1 desc:身份证正面 * @param name:identity_card_fan type:string require:1 desc:身份证反面 * @param name:related_certificate type:string require:1 desc:相关证书,数组 * @param name:works type:string require:1 desc:作品,数组 * @param name:wd type:string require:1 desc:当前位置纬度 * @param name:jd type:string require:1 desc:当前位置经度 */ public function apply_designer(){ $user_id = $this->check_login(); $data['name'] = input('name'); //姓名 $data['design_classifi'] = input('design_classifi'); //设计分类 $data['skills_label'] = input('skills_label'); //技能标签 $data['good_type'] = input('good_type'); //擅长类型 // $data['good_style'] = input('good_style'); //擅长风格 $data['province'] = input('province'); //省 $data['city'] = input('city'); //市 $data['area'] = input('area'); //区 // $data['work_experience'] = input('work_experience'); //工作经历 $data['work_year'] = input('work_year'); //工作年限 $data['identity_card_zheng'] = input('identity_card_zheng'); //身份证正面 $data['identity_card_fan'] = input('identity_card_fan'); //身份证反面 $data['related_certificate'] = input('related_certificate'); //相关证书 $data['works'] = input('works'); //作品 $data['wd'] = input('wd'); //当前位置纬度 $data['jd'] = input('jd'); //当前位置经度 if (!$data['name'] || !$data['design_classifi'] || !$data['design_classifi'] || !$data['skills_label'] || !$data['good_type'] || !$data['identity_card_zheng'] || !$data['identity_card_fan'] || !$data['province'] || !$data['city'] || !$data['area'] || !$data['work_year'] || !$data['works']){ $this->error('参数错误'); } $data['related_certificate'] = implode(',',$data['related_certificate']); $data['works'] = implode(',',$data['works']); $data['skills_label'] = implode(',',$data['skills_label']); $data['good_type'] = implode(',',$data['good_type']); $result = Users::applyDesigner($user_id,$data); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 投诉提交 * @desc 投诉提交 * @url /api/User/message * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:content type:string require:0 desc:内容 */ public function message(){ $user_id = $this->check_login(); $content = input('content'); //内容 if (!$content) $this->error('参数错误'); $result = Users::Message($user_id,$content); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 时间管理列表 * @desc 时间管理列表 * @url /api/User/time_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * * @return name:switch type:int desc:1:开启2:关闭 * @return name:date type:int desc:日期 * @return name:price type:int desc:价格 */ public function time_list(){ $user_id = $this->check_login(); $result = Users::timeList($user_id); $this->success('成功',$result['data']); } /** * @title 时间设置开关 * @desc 时间设置开关 * @url /api/User/time_switch * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:json type:json require:1 desc:json */ public function time_switch(){ $user_id = $this->check_login(); $json = input('json'); // $date = input('date'); //日期 // $switch = input('switch'); //1:开 2:关 // $price = input('price'); //价格 // if (!$date || !$switch || !$price || $price<=0) $this->error('参数错误'); if (!$json) $this->error('参数错误'); // $result = Users::timeSwitch($user_id,$date,$switch,$price); $json = json_decode($json,true); $result = Users::timeSwitch($user_id,$json); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 设计师端余额提现 * @desc 设计师端余额提现 * @url /api/User/user_withdraw * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:money type:string require:0 desc:金额 * @param name:withdraw_type type:string require:0 desc:提现方式weixin:微信zfb:支付宝 */ public function user_withdraw(){ $user_id = $this->check_login(); $money = input('money'); //提现金额 $withdraw_type = input('withdraw_type'); //提现方式 if (!in_array($withdraw_type,array('weixin','zfb'))) $this->error('提现方式错误'); if (!$money || $money<=0) $this->error('金额错误'); $result = Users::userWithdraw($user_id,$money,$withdraw_type); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 设计师端消费明细 * @desc 设计师端消费明细 * @url /api/User/money_record * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: * * * * @return name:paid type:int desc:是否完成0:审核中1:成功2:拒绝 * @return name:withdraw_type type:string desc:方式(weixin:微信,zfb:支付宝,sy:订单收益) * @return name:create_at type:string desc:时间 * @return name:price type:string desc:金额 * */ public function money_record(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $result = Users::moneyRecord($user_id,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } /** * @title 用户端订单列表 * @desc 用户端订单列表 * @url /api/User/user_order_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: * @param name:keywords type:int require:0 default:10 desc:关键词 * @param name:status type:int require:0 default:10 desc:订单状态(-1:申请退款中-2:退款成功-3:退款失败0:待付款1:待服务;2:进行中;3:已完成,待评价;4:已评价5:取消订单all:全部订单) * * */ public function user_order_list(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $status = input("status",'all'); $keywords = input('keywords'); //搜索关键词 $result = Users::userOrderList($user_id,$status,$keywords,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } /** * @title 订单支付 * @desc 订单支付 * @url /api/User/pay_order * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * */ public function pay_order(){ $user_id = $this->check_login(); $order_no = input('order_no'); //订单号 if (!$order_no) $this->error('订单号为空'); $result = Users::payOrder($user_id,$order_no); if ($result['code']){ $this->success($result['msg'],$result['data']); }else{ $this->error($result['msg']); } } /** * @title 订单支付加班费 * @desc 订单支付加班费 * @url /api/User/overtime_pay_order * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * @param name:pay_type type:string require:0 default: desc:支付方式(weixin:微信,zfb:支付宝) * */ public function overtime_pay_order(){ $user_id = $this->check_login(); $order_no = input('order_no'); //订单号 if (!$order_no) $this->error('订单号为空'); $pay_type = input("pay_type",'weixin'); if (!in_array($pay_type,array('weixin','zfb'))) $this->error('支付方式错误'); $result = Users::overtimePayOrder($user_id,$order_no,$pay_type); if ($result['code']){ $this->success($result['msg'],$result['data']); }else{ $this->error($result['msg']); } } /** * @title 订单详情 * @desc 订单详情 * @url /api/User/order_detail * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * * */ public function order_detail(){ $this->check_login(); $order_no= input('order_no'); //订单号 $result = Users::orderDetail($order_no); if ($result['code']){ $this->success($result['msg'],$result['data']); }else{ $this->error($result['msg']); } } /** * @title 取消订单 * @desc 取消订单 * @url /api/User/cancel_order * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * * */ public function cancel_order(){ $user_id = $this->check_login(); $order_no= input('order_no'); $result = Users::cancelOrder($user_id,$order_no); if ($result['code']){ $this->success($result['msg'],$result['data']); }else{ $this->error($result['msg']); } } /** * @title 删除订单 * @desc 删除订单 * @url /api/User/del_order * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * * */ public function del_order(){ $user_id = $this->check_login(); $order_no= input('order_no'); $result = Users::delOrder($user_id,$order_no); if ($result['code']){ $this->success($result['msg'],$result['data']); }else{ $this->error($result['msg']); } } /** * @title 订单评价 * @desc 订单评价 * @url /api/User/evaluation_order * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:order_no type:string require:0 default: desc:订单号 * @param name:evaluation type:int require:0 default: desc:几颗星 * @param name:evaluation_content type:string require:0 default: desc:评价内容 * */ public function evaluation_order(){ $user_id = $this->check_login(); $order_no= input('order_no'); //订单号 $evaluation = intval(input('evaluation')); //几颗星 $evaluation_content = input('evaluation_content'); //评价内容 if (!$evaluation) $this->error('请评分'); if ($evaluation<1 || $evaluation>5) $this->error('评分1-5'); if (!$evaluation_content) $this->error('请输入评价内容'); $result = Users::evaluationOrder($user_id,$order_no,$evaluation,$evaluation_content); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 用户端我的评价 * @desc 用户端我的评价 * @url /api/User/user_evaluation_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: * * @return name:order_no type:string desc:订单号 * @return name:evaluation type:string desc:几颗星 * @return name:evaluation_time type:string desc:时间 * @return name:evaluation_content type:string desc:评价内容 * @return name:name type:string desc:用户姓名 * @return name:nickname type:string desc:用户昵称 * @return name:headimg type:string desc:头像 * @return name:designer_name type:string desc:设计师姓名 */ public function user_evaluation_list(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $result = Users::userEvaluationList($user_id,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } /** * @title 设计师端我的评价 * @desc 设计师端我的评价 * @url /api/User/designer_evaluation_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: * * @return name:order_no type:string desc:订单号 * @return name:evaluation type:string desc:几颗星 * @return name:evaluation_time type:string desc:时间 * @return name:evaluation_content type:string desc:评价内容 * @return name:name type:string desc:用户姓名 * @return name:nickname type:string desc:用户昵称 * @return name:headimg type:string desc:头像 */ public function designer_evaluation_list(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $result = Users::designerEvaluationList($user_id,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } /** * @title 设计师端添加作品 * @desc 设计师端添加作品 * @url /api/User/add_works * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:imgs type:array require:1 default: desc:作品图片,数组 * */ public function add_works(){ $user_id = $this->check_login(); $imgs = input('imgs'); //图片 if (!$imgs) $this->error('请上传图片'); $result = Users::addWorks($user_id,$imgs); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 设计师端作品列表 * @desc 设计师端作品列表 * @url /api/User/work_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @return name:date type:string desc:日期 * @return name:imgs@id type:string desc:主键ID * @return name:imgs@img type:string desc:图片地址 */ public function work_list(){ $user_id = $this->check_login(); $result = Users::workList($user_id); $this->success($result['msg'],$result['data']); } /** * @title 设计师端删除作品 * @desc 设计师端删除作品 * @url /api/User/del_works * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * @param name:ids type:string require:1 default: desc:作品id,多个以逗号隔开 * */ public function del_works(){ $user_id = $this->check_login(); $ids = input('ids'); //作品id if (!$ids) $this->error('作品id为空'); $result = Users::delWorks($user_id,$ids); if ($result['code']){ $this->success($result['msg']); }else{ $this->error($result['msg']); } } /** * @title 设计师端订单列表 * @desc 设计师端订单列表 * @url /api/User/designer_order_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: * @param name:keywords type:int require:0 default:10 desc:关键词 * @param name:status type:int require:0 default:10 desc:订单状态(1:已接单;2:待完成;3:已完成;all:全部订单) */ public function designer_order_list(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $status = input("status",'all'); $keywords = input('keywords'); //搜索关键词 $result = Users::designerOrderList($user_id,$status,$keywords,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } /** * @title 设计师开始工作打卡 * @desc 设计师开始工作打卡 * @url /api/User/clock_in_start * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:order_no type:string require:1 default: desc:订单号 * @param name:start_address type:string require:0 default:10 desc:打卡地址 */ public function clock_in_start(){ $user_id = $this->check_login(); $order_no = input('order_no'); $start_address = input('start_address'); if (!$order_no || !$start_address) $this->error('参数错误'); $result = Users::clockInStart($user_id,$order_no,$start_address); $this->success($result['msg'],$result['data']); } /** * @title 设计师结束工作打卡 * @desc 设计师结束工作打卡 * @url /api/User/clock_in_end * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:order_no type:string require:1 default: desc:订单号 * @param name:end_address type:string require:0 default:10 desc:打卡地址 */ public function clock_in_end(){ $user_id = $this->check_login(); $order_no = input('order_no'); $end_address = input('end_address'); if (!$order_no || !$end_address) $this->error('参数错误'); $result = Users::clockInEnd($user_id,$order_no,$end_address); $this->success($result['msg'],$result['data']); } /** * @title 设计师结束工作上传作品 * @desc 设计师结束工作上传作品 * @url /api/User/order_uploading * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:order_no type:string require:1 default: desc:订单号 * @param name:works type:string require:0 default:10 desc:上传作品,数组 */ public function order_uploading(){ $user_id = $this->check_login(); $order_no = input('order_no'); $works = input('works'); if (!$order_no || !$works) $this->error('参数错误'); $result = Users::orderUploading($user_id,$order_no,$works); $this->success($result['msg'],$result['data']); } /** * @title 用户优惠券列表 * @desc 用户优惠券列表 * @url /api/User/coupon_list * @method POST * @tag 基础 * @header name:Authorization require:1 default: desc:验证token * * @param name:page type:int require:0 default:1 desc: * @param name:limit type:int require:0 default:10 desc: */ public function coupon_list(){ $user_id = $this->check_login(); $Nowpage = input('page',1); $limits = input("limit",10); $result = Users::couponList($user_id,$Nowpage,$limits); $this->success($result['msg'],$result['data']); } }