data(UserAddressLogic::getLists($this->userId)); } /** * @notes 详情 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:41 */ public function detail() { $params = (new UserAddressValidate())->goCheck('detail', ['user_id' => $this->userId]); $result = UserAddressLogic::getDetail($params['id'], $this->userId); return $this->data($result); } /** * @notes 获取默认地址 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:41 */ public function getDefault() { $result = UserAddressLogic::getDefault($this->userId); return $this->data($result); } /** * @notes 设置默认地址 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:41 */ public function setDefault() { $params = (new UserAddressValidate())->post()->goCheck('set', ['user_id' => $this->userId]); UserAddressLogic::setDefault($params, $this->userId); return $this->success('设置成功',[],1,1); } /** * @notes 添加收货地址 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:42 */ public function add() { $params = (new UserAddressValidate())->post()->goCheck('add'); UserAddressLogic::addAddress($params, $this->userId); return $this->success(); } /** * @notes 编辑收货地址 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:42 */ public function edit() { $params = (new UserAddressValidate())->post()->goCheck('', ['user_id' => $this->userId]); UserAddressLogic::editAddress($params); return $this->success(); } /** * @notes 删除 * @return \think\response\Json * @author 段誉 * @date 2021/7/22 11:42 */ public function del() { $params = (new UserAddressValidate())->post()->goCheck('del', ['user_id' => $this->userId]); UserAddressLogic::del($params); return $this->success(); } /** * @notes 将省市区名称转为id * @return \think\response\Json * @author Tab * @date 2021/8/12 16:02 */ public function handleRegion() { $params = (new UserAddressValidate())->goCheck('handleRegion'); $result = UserAddressLogic::handleRegion($params); return $this->data($result); } /** * @notes 获取省市区 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author cjhao * @date 2022/11/8 6:43 下午 */ public function getRegion() { $id = $this->request->get('id',0); $lists = UserAddressLogic::getRegion($id); return $this->data($lists); } /** * 获取特定地区列表信息 * * */ public function getSpecialAreaList(){ return $this->data(UserAddressLogic::getSpecialAreaLists()); } /** * 获取指定地区配送费信息 * * */ public function getSpecialAreaShipFeeInfo(){ $id = $this->request->get('district_id',0); if($id == 0) return $this->fail('请传入区iD'); $lists = UserAddressLogic::getSpecialAreaInfo($id); return $this->data($lists); } }