AddressController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. AddressClass::addData($post);
  24. util::complete();
  25. }
  26. //修改地址 ssh 20221003
  27. public function actionUpdate()
  28. {
  29. $post = Yii::$app->request->post();
  30. $id = $post['id'] ?? 0;
  31. unset($post['id']);
  32. $address = AddressClass::getById($id, true);
  33. if ($address->mainId != $this->mainId) {
  34. util::fail('没有权限修改');
  35. }
  36. AddressClass::updateById($id, $post);
  37. util::complete();
  38. }
  39. }