pull/1/head
ztt 9 months ago
parent f536152b20
commit 815113a6a2
  1. 5
      app/api/controller/Active.php
  2. 20
      app/api/controller/User.php
  3. 12
      app/api/model/user/UserInvoice.php

@ -24,11 +24,14 @@ class Active extends Controller
$model = new ActiveMain();
$list = $model->with('col')
->where('status', '=', 1)
->where('id', $param['active_id'])->find();
->where('id', $param['active_id'])
->find();
if ($list) {
foreach ($list['col'] as $k => $row) {
$goodsModel = new GoodsModel();
$goods_list = $goodsModel->getListByIdsFromApi(explode(',', $row['col_goods_ids']));
// 隐藏冗余的属性
$goods_list->hidden(GoodsModel::getHidden(['content', 'goods_images', 'images']));
$list['col'][$k]['goods_list'] = $goods_list;
}
return $this->renderSuccess($list->toArray());

@ -34,6 +34,15 @@ use think\response\Json;
*/
class User extends Controller
{
/**
* 注销账号
* [delete description]
* @return [type] [description]
*/
public function delete(){
$user_id = UserService::getCurrentLoginUserId();
UserModel::where('user_id', $user_id)->update(['is_delete' => 1,'update_time' => time()]);
}
/**
* 当前用户详情
* @return Json
@ -212,6 +221,17 @@ class User extends Controller
return $this->renderSuccess('修改成功');
}
//发票抬头删除
public function delInvoicing(): Json
{
$service = new UserInvoice();
if(!$service->del($this->request->param())) {
return $this->renderSuccess($service->getError() ?: '操作失败');
}
return $this->renderSuccess('删除成功·');
}
//开票记录
public function invoicingLog(): Json
{

@ -86,4 +86,16 @@ class UserInvoice extends UserInvoiceModel
]) !== false;
}
public function del($data) {
if(empty($data['id'])) {
$this->error = '参数异常';
return false;
}
$userId = UserService::getCurrentLoginUserId();
$detail = self::get(['user_id' => $userId, 'id' => $data['id']]);
empty($detail) && throwError('未找到该抬头');
return $detail->delete();
}
}
Loading…
Cancel
Save