| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 | <?php// +----------------------------------------------------------------------// | A3Mall// +----------------------------------------------------------------------// | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.// +----------------------------------------------------------------------// | Author: xzncit <158373108@qq.com>// +----------------------------------------------------------------------namespace app\api\controller;use app\common\exception\BaseException;use think\facade\Request;use app\api\service\Ucenter as UcenterService;use app\api\service\Address as AddressService;use app\api\service\PaymentOrder as PaymentOrderService;class Ucenter extends Base {    /**     * 收藏列表     * @return \think\response\Json     */    public function favorite(){        try{            return $this->returnAjax("ok",1,UcenterService::getFavoriteList(Request::param()));        }catch (BaseException $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());        }    }    /**     * 删除收藏     * @return \think\response\Json     */    public function favorite_delete(){        try{            UcenterService::favoriteDelete(Request::param("id",""));            return $this->returnAjax("ok",1);        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),0);        }    }    /**     * 优惠劵     * @return \think\response\Json     */    public function coupon(){        try{            return $this->returnAjax("ok",1,UcenterService::getCouponList(Request::param()));        }catch (BaseException $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());        }    }    /**     * 积分列表     * @return \think\response\Json     */    public function point(){        try{            return $this->returnAjax("ok",1,UcenterService::getPointList(Request::param()));        }catch (BaseException $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());        }    }    /**     * 获取会员信息     * @return \think\response\Json     * @throws \Exception     */    public function info(){        return $this->returnAjax("ok",1,UcenterService::getUsersInfo());    }    /**     * 我的钱包     * @return \think\response\Json     */    public function wallet(){        return $this->returnAjax("ok",1,UcenterService::wallet());    }    /**     * 获取会员资料     * @return \think\response\Json     */    public function get_setting(){        return $this->returnAjax("ok",1,UcenterService::getSetting());    }    /**     * 保存会员设置     * @return \think\response\Json     */    public function setting(){        try{            UcenterService::settingSave(Request::param());            return $this->returnAjax("会员资料更新成功");        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),0);        }    }    /**     * 地址详细信息     * @return \think\response\Json     */    public function address(){        try{            return $this->returnAjax("ok",1,AddressService::detail(Request::param("id","","intval")));        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode());        }    }    /**     * 获取地址列表     * @return \think\response\Json     */    public function address_list(){        return $this->returnAjax("ok",1,AddressService::getList());    }    /**     * 删除地址     * @return \think\response\Json     */    public function address_delete(){        AddressService::delete(Request::param("id","","intval"));        return $this->returnAjax("ok");    }    /**     * 编辑地址     * @return \think\response\Json     */    public function address_editor(){        try{            return $this->returnAjax("操作成功",1,AddressService::editor(Request::param()));        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode());        }    }    /**     * 设置默认地址     * @return \think\response\Json     */    public function set_default_address(){        AddressService::setDefaultAddress(Request::param("id","0","intval"));        return $this->returnAjax("ok",1);    }    /**     * 获取帮助内容     * @return \think\response\Json     * @throws \think\db\exception\DataNotFoundException     * @throws \think\db\exception\DbException     * @throws \think\db\exception\ModelNotFoundException     */    public function help(){        return $this->returnAjax("ok",1, UcenterService::getHelpList());    }    /**     * 资金明细     * @return \think\response\Json     * @throws \think\db\exception\DataNotFoundException     * @throws \think\db\exception\DbException     * @throws \think\db\exception\ModelNotFoundException     */    public function fund(){        try{            return $this->returnAjax("ok",1,UcenterService::getFundList(Request::param()));        }catch (BaseException $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());        }    }    /**     * 提现记录     * @return \think\response\Json     * @throws \think\db\exception\DataNotFoundException     * @throws \think\db\exception\DbException     * @throws \think\db\exception\ModelNotFoundException     */    public function cashlist(){        try{            return $this->returnAjax("ok",1,UcenterService::getCashList(Request::param()));        }catch (BaseException $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());        }    }    /**     * 充值     * @return \think\response\Json     */    public function rechange(){        try{            return $this->returnAjax("ok",1,PaymentOrderService::recharge(Request::param()));        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode());        }    }    /**     * 获取充值金额     * @return \think\response\Json     */    public function rechange_price(){        return $this->returnAjax('ok',1,UcenterService::rechangePrice());    }    /**     * 申请提现     * @return \think\response\Json     */    public function settlement(){        return $this->returnAjax("ok",1,UcenterService::settlement());    }    /**     * 提交提现申请     * @return \think\response\Json     */    public function settlement_save(){        try{            UcenterService::settlementSave(Request::post());            return $this->returnAjax("申请提现成功,请等待管理员审核");        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),0);        }    }    /**     * 上传头像     * @return \think\response\Json     */    public function avatar() {        try{            return $this->returnAjax("ok",1,UcenterService::upload());        }catch (\Exception $ex){            return $this->returnAjax($ex->getMessage(),$ex->getCode());        }    }}
 |