ThirdPartyController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace api\modules\v1\controllers\user;
  3. use api\controllers\OnAuthController;
  4. use common\helpers\ApiCode;
  5. use common\models\common\UserThirdPartyAddress;
  6. use Yii;
  7. class ThirdPartyController extends OnAuthController
  8. {
  9. public $modelClass = '';
  10. /**
  11. * @Description: 存储第三提现地址
  12. * @Author: qi
  13. * @DateTime 2022-11-16 15:25:49
  14. * @return mixed
  15. */
  16. public function actionSaveAddress()
  17. {
  18. if (\Yii::$app->request->isPost) {
  19. $params = Yii::$app->request->post();
  20. $res = Yii::$app->services->validate->validate($params, [
  21. [['third_party_address'], 'required'],
  22. ]);
  23. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  24. $params['mall_id'] = $this->mall_id;
  25. $params['user_id'] = $this->user_id;
  26. $result = UserThirdPartyAddress::setData($params);
  27. if ($result === false) return $this->error(UserThirdPartyAddress::getStaticError());
  28. return $this->success('数据保存成功');
  29. }
  30. }
  31. }