store_id = get_store_id(); $form->scenario = $form::USER_SEARCH; $form->attributes = get_params(); return $this->asJson($form->searchUser()); } /** * 用户列表 * @return \yii\web\Response * @author: hankaige * @Time: 2024/11/30 下午1:36 */ public function actionList(): \yii\web\Response { $form = new UserForm(); $form->store_id = get_store_id(); $form->scenario = $form::USER_LIST; $form->attributes = get_params(); return $this->asJson($form->getUserList()); } /** * 编辑修改用户信息 * @return \yii\web\Response * @author: hankaige * @Time: 2024/11/30 下午3:25 */ public function actionEditUser(): \yii\web\Response { $form = new UserForm(); $form->store_id = get_store_id(); $form->scenario = $form::USER_EDIT; $form->attributes = post_params(); return $this->asJson($form->editUser()); } /** * 新增用户 * @return \yii\web\Response * @author: hankaige * @Time: 2024/11/30 下午3:50 */ public function actionAddUser(): \yii\web\Response { $form = new UserForm(); $form->store_id = get_store_id(); $form->md_id = get_md_id(); $form->scenario = $form::USER_ADD; $form->attributes = post_params(); return $this->asJson($form->addUser()); } /** * 获取会员等级列表 * @return \yii\web\Response * @author: hankaige * @Time: 2024/11/30 下午3:51 */ public function actionGetLevelList(): \yii\web\Response { $form = new UserForm(); $form->store_id = get_store_id(); return $this->asJson($form->getLevelList()); } /** * 余额/积分充值 支付方式获取 * @return \Yii\web\Response * @author: hankaige * @Time: 2024/12/2 上午9:33 */ public function actionPayType(): \Yii\web\Response { $type = get_params('type'); if ($type == 'recharge') { // 返回余额充值相关设置 $name = [ 'recharge_wallet_status', 'recharge_custom_status', 'recharge_pic_url', 'recharge_ad_pic_url', 'recharge_page_url', 'recharge_p_pic_url', 'recharge_help', ]; $data = Option::get($name, get_store_id(), 'recharge'); $data = array_column($data, NULL, 'name'); $balance = [ 'status' => $data['recharge_wallet_status']['value'], 'pic_url' => $data['recharge_pic_url']['value'], 'ad_pic_url' => $data['recharge_ad_pic_url']['value'], 'page_url' => $data['recharge_page_url']['value'], 'p_pic_url' => $data['recharge_p_pic_url']['value'], 'help' => $data['recharge_help']['value'], 'type' => $data['recharge_custom_status']['value'],// 是否开启自定义充值金额 ]; $list = Recharge::find()->where(['store_id' => get_store_id(), 'is_delete' => 0]) ->orderBy(['pay_price' => SORT_DESC])->asArray()->all(); $levelType = Level::find()->where(['store_id' => get_store_id(), 'is_delete' => Level::NOT_DELETE])->asArray()->all(); foreach ($list as &$val) { foreach ($levelType as $type) { if ($val['level_up'] == $type['level']) { $val['level_up_name'] = $type['name']; break; } } } $data = [ 'list' => array_values($list), 'balance' => $balance, 'pay_type' => [ ['pay_type' => RechargeForm::WECHAT_PAY, 'pay_name' => '微信支付'], ['pay_type' => RechargeForm::CASH_PAY, 'pay_name' => '现金支付'] ] ]; } if ($type == 'integral') { $data = [ 'integral' => Option::get(OptionSetting::STORE_INTEGRAL,get_store_id(),'gift', Option::get(OptionSetting::STORE_INTEGRAL,get_store_id(),'store',100)['value'])['value'], 'pay_type' => [ ['pay_type' => IntegralForm::WECHAT_PAY, 'pay_name' => '微信支付'], ['pay_type' => IntegralForm::CASH_PAY, 'pay_name' => '现金支付'] ] ]; } return $this->asJson(['code' => 0, 'msg' => 'success', 'data' => $data]); } /** * 余额充值订单创建 * @return \Yii\web\Response * @author: hankaige * @Time: 2024/12/2 上午9:33 */ public function actionRechargeOrderSubmit(): \Yii\web\Response { $form = new RechargeForm(); $form->store_id = get_store_id(); $form->scenario = $form::SUBMIT_ORDER; $form->attributes = post_params(); return $this->asJson($form->recharge()); } /** * 充值订单支付 * @return \Yii\web\Response * @author: hankaige * @Time: 2024/12/2 上午11:19 */ public function actionRechargeOrderPay(): \Yii\web\Response { $form = new RechargeForm(); $form->store_id = get_store_id(); $form->scenario = $form::PAY_ORDER; $form->attributes = post_params(); return $this->asJson($form->pay()); } /** * 积分充值订单提交 * @return \Yii\web\Response * @author: hankaige * @Time: 2024/12/3 上午10:25 */ public function actionIntegralOrderSubmit(): \Yii\web\Response { $form = new IntegralForm(); $form->store_id = get_store_id(); $form->scenario = $form::INTEGRAL_SUBMIT; $form->attributes = post_params(); return $this->asJson($form->submitIntegral()); } public function actionIntegralOrderPay():\Yii\web\Response { $form = new IntegralForm(); $form->store_id = get_store_id(); $form->scenario = $form::INTEGRAL_PAY; $form->attributes = post_params(); return $this->asJson($form->pay()); } }