AddressController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\admin\classes\AddressClass;
  4. use Yii;
  5. use common\components\util;
  6. class AddressController extends BaseController
  7. {
  8. //地址列表 ssh 20221003
  9. public function actionList()
  10. {
  11. //$get = Yii::$app->request->get();
  12. $where = ['adminId' => $this->adminId];
  13. $list = AddressClass::getAddressList($where);
  14. util::success($list);
  15. }
  16. //地址列表 ssh 20221003
  17. public function actionAdd()
  18. {
  19. $post = Yii::$app->request->post();
  20. $post['sjId'] = $this->sjId;
  21. $post['mainId'] = $this->mainId;
  22. $post['shopId'] = $this->shopId;
  23. $post['adminId'] = $this->adminId;
  24. AddressClass::addData($post);
  25. util::complete();
  26. }
  27. //修改地址 ssh 20221003
  28. public function actionUpdate()
  29. {
  30. $post = Yii::$app->request->post();
  31. $id = $post['id'] ?? 0;
  32. unset($post['id']);
  33. $address = AddressClass::getById($id, true);
  34. if ($address->mainId != $this->mainId) {
  35. util::fail('没有权限修改');
  36. }
  37. AddressClass::updateById($id, $post);
  38. util::complete();
  39. }
  40. }